I'm using int 0x13/AH=48h to get the sector size of the disk I'm reading. I've set a buffer in memory (4096 bytes) to cache data I've read. I didn't want to code around the fact it will be either 512 or 4096 and hence I did figure it out before reading any GPT structures. Now I'll face the same issue when reading ext2 structures. For those common (if not only) sector sizes it's easier to decide where and how should I cache my reads. But it does get more complicated with "wild", not common sector sizes.
My question is: am I maybe over-complicating things? Is this approach of trying to dynamically adjust to a possibly wild sector size common?
Disk sector; buffer cache;is my thinking process good at all
Disk sector; buffer cache;is my thinking process good at all
Last edited by mtbro on Tue May 17, 2022 1:39 am, edited 3 times in total.
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Disk sector; buffer cache; s my thinking process good at
INT 0x13 only supports hard disks with 512-byte sectors.
Re: Disk sector; buffer cache; s my thinking process good at
Documentation on Int 0x13 states that function 0x48 is able to provide a sector size (word starting at offset 0x18). So is it able to report but not use, or not even report and just pretends it does?Octocontrabass wrote:INT 0x13 only supports hard disks with 512-byte sectors.
Writing a bootloader in under 15 minutes: https://www.youtube.com/watch?v=0E0FKjvTA0M
Re: Disk sector; buffer cache; s my thinking process good at
That surprised me. I've the same logic as BigBuda, why does then 48h report sector size? Is this true for the whole int 0x13 services or only extended read (42h) ?Octocontrabass wrote:INT 0x13 only supports hard disks with 512-byte sectors.
If this is true then I guess the whole logic I created to make sure I'm reading just enough sectors is useless. Does this mean I can't BIOS services (or at least those from int 0x13) on 4Kn disk?
Re: Disk sector; buffer cache; s my thinking process good at
I do remember reading documentation stating that only non-extended Int 0x13 functions assumed 512byte-sectors.mtbro wrote:That surprised me. I've the same logic as BigBuda, why does then 48h report sector size? Is this true for the whole int 0x13 services or only extended read (42h) ?
If this is true then I guess the whole logic I created to make sure I'm reading just enough sectors is useless. Does this mean I can't BIOS services (or at least those from int 0x13) on 4Kn disk?
Writing a bootloader in under 15 minutes: https://www.youtube.com/watch?v=0E0FKjvTA0M
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Disk sector; buffer cache; s my thinking process good at
In theory, BIOS EDD functions can support different sector sizes.
In practice, the BIOS will either not assign a drive number or hang during POST because it assumes hard disks always have 512-byte sectors and can't handle any other sizes.
If you want to boot from a 4kN disk, use UEFI.
In practice, the BIOS will either not assign a drive number or hang during POST because it assumes hard disks always have 512-byte sectors and can't handle any other sizes.
If you want to boot from a 4kN disk, use UEFI.
Re: Disk sector; buffer cache; s my thinking process good at
That means I really over-complicated my approach.
For the time being legacy boot suffice, I'm at the beginning of a steep learning curve.
Thanks.
For the time being legacy boot suffice, I'm at the beginning of a steep learning curve.
Thanks.