OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:12 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: int 0x13, ah=42
PostPosted: Sun May 10, 2020 11:45 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
Hey everyone, as the title says, im trying to use the extended read function in my VBR code, but i'm having a trouble understanding the sector count field of the DAP packet.
Every VM I've tried fails at different block counts,iirc VMWare fails at 128, VirtualBox fails at 129, QEMU fails at 129, Bochs fails at 255. My disk is 64mb in size,
and is ~130k sectors. I know I could just read like 127 blocks at once and do it multiple times, not that my kernel loader is that big anyways. I'm just trying to understand
whether i'm doing something wrong or maybe thats just the limit. If its the latter, how can Bochs allow to read over 65536 bytes in 16 bit addressing? And why is that
field even 2 bytes in size if you can't read more than 128 blocks at a time?

Thanks.


Top
 Profile  
 
 Post subject: Re: int 0x13, ah=42
PostPosted: Sun May 10, 2020 12:01 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 22, 2014 6:33 pm
Posts: 934
Location: USA
One of the major BIOS manufacturers had a limit of 0x7F (127d) sectors per transfer. Most other manufacturers followed suite.

To be 100% accurate, you need to do two things when using this function, not counting checking to see if it is available.

- Do not transfer more than 127 sectors at a time.
- Do not cross a 64k boundary with your buffer.

In other words, if you need to transfer more than 127 sectors, you need to call this function multiple times, as well as the buffer used must not have the read cross a 64k boundary.

Ben
- http://www.fysnet.net/osdesign_book_series.htm


Top
 Profile  
 
 Post subject: Re: int 0x13, ah=42
PostPosted: Sun May 10, 2020 12:26 pm 
Online
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
8infy wrote:
If its the latter, how can Bochs allow to read over 65536 bytes in 16 bit addressing?

Bochs is most likely playing with the segment registers to address more than 64kB at a time.

8infy wrote:
And why is that field even 2 bytes in size if you can't read more than 128 blocks at a time?

Who says it's two bytes? According to the specification, it's only one byte, and the maximum allowed value is 127 (0x7F). (A later version of the specification also allows 0xFF for extended functionality, but I don't think support for this version is very common.)


Top
 Profile  
 
 Post subject: Re: int 0x13, ah=42
PostPosted: Sun May 10, 2020 2:26 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
Octocontrabass wrote:
8infy wrote:
If its the latter, how can Bochs allow to read over 65536 bytes in 16 bit addressing?

Bochs is most likely playing with the segment registers to address more than 64kB at a time.

8infy wrote:
And why is that field even 2 bytes in size if you can't read more than 128 blocks at a time?

Who says it's two bytes? According to the specification, it's only one byte, and the maximum allowed value is 127 (0x7F). (A later version of the specification also allows 0xFF for extended functionality, but I don't think support for this version is very common.)


Interesting, on wikipedia it says 2 bytes. 1 byte makes more sense, thanks.


Top
 Profile  
 
 Post subject: Re: int 0x13, ah=42
PostPosted: Sun May 10, 2020 2:28 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 182
BenLunt wrote:
One of the major BIOS manufacturers had a limit of 0x7F (127d) sectors per transfer. Most other manufacturers followed suite.

To be 100% accurate, you need to do two things when using this function, not counting checking to see if it is available.

- Do not transfer more than 127 sectors at a time.
- Do not cross a 64k boundary with your buffer.

In other words, if you need to transfer more than 127 sectors, you need to call this function multiple times, as well as the buffer used must not have the read cross a 64k boundary.

Ben
- http://www.fysnet.net/osdesign_book_series.htm


Thanks! So to fill up an entire segment I would have to read 127, and then read 1 more? so that it's exactly 2^16 bytes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Octocontrabass and 98 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group