OSDev.org
https://forum.osdev.org/

Disk sector; buffer cache;is my thinking process good at all
https://forum.osdev.org/viewtopic.php?f=13&t=56282
Page 1 of 1

Author:  mtbro [ Mon May 16, 2022 7:54 am ]
Post subject:  Disk sector; buffer cache;is my thinking process good at all

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?

Author:  Octocontrabass [ Mon May 16, 2022 10:28 am ]
Post subject:  Re: Disk sector; buffer cache; s my thinking process good at

INT 0x13 only supports hard disks with 512-byte sectors.

Author:  BigBuda [ Mon May 16, 2022 11:33 am ]
Post subject:  Re: Disk sector; buffer cache; s my thinking process good at

Octocontrabass wrote:
INT 0x13 only supports hard disks with 512-byte sectors.


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?

Author:  mtbro [ Mon May 16, 2022 12:35 pm ]
Post subject:  Re: Disk sector; buffer cache; s my thinking process good at

Octocontrabass wrote:
INT 0x13 only supports hard disks with 512-byte sectors.

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?

Author:  BigBuda [ Mon May 16, 2022 12:41 pm ]
Post subject:  Re: Disk sector; buffer cache; s my thinking process good at

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?


I do remember reading documentation stating that only non-extended Int 0x13 functions assumed 512byte-sectors.

Author:  Octocontrabass [ Mon May 16, 2022 1:08 pm ]
Post subject:  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.

Author:  mtbro [ Mon May 16, 2022 2:51 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/