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.
int 0x13, ah=42
Re: int 0x13, ah=42
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
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
-
- Member
- Posts: 5575
- Joined: Mon Mar 25, 2013 7:01 pm
Re: int 0x13, ah=42
Bochs is most likely playing with the segment registers to address more than 64kB at a time.8infy wrote:If its the latter, how can Bochs allow to read over 65536 bytes in 16 bit addressing?
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.)8infy wrote:And why is that field even 2 bytes in size if you can't read more than 128 blocks at a time?
Re: int 0x13, ah=42
Interesting, on wikipedia it says 2 bytes. 1 byte makes more sense, thanks.Octocontrabass wrote:Bochs is most likely playing with the segment registers to address more than 64kB at a time.8infy wrote:If its the latter, how can Bochs allow to read over 65536 bytes in 16 bit addressing?
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.)8infy wrote:And why is that field even 2 bytes in size if you can't read more than 128 blocks at a time?
Re: int 0x13, ah=42
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.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