home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,185 of 4,255   
   wolfgang kern to muta...@gmail.com   
   Re: sector size   
   24 Apr 22 13:58:57   
   
   From: nowhere@nevernet.at   
      
   On 24/04/2022 06:16, muta...@gmail.com wrote:   
   > On Sunday, April 24, 2022 at 11:49:58 AM UTC+10, wolfgang kern wrote:   
   >   
   >>> In that case - do you know what happens with a   
   >>> disk drive that has 4096-byte sectors and a BIOS?   
   >   
   >> it depends on the age of the BIOS, 4K HDs can be read   
   >> on 512 byte bounds anyway (just a bit slower then)   
   >   
   >>> If you do a BIOS INT 13H to read a sector using LBA,   
   >>> does it read 512 bytes or 4096 bytes?   
   >   
   >> 512 bytes, 4k aligned read/writes are recommended for   
   >> speed reasons only.   
      
   > Sorry, I don't understand. I'm not concerned about   
   > alignment.   
      
   It's recommended to write files starting at 4K bounds,   
   that is ie: LBA 0,8,16,24 and so on to avoid additional   
   cache reads and head moves, so fit HD-internal bounds.   
   Misaligned read/write may cost one full disk revolution,   
   that's usually 1/7200 Sec, means many thousand CPU cycles.   
      
   > If I have a buffer that is 512 bytes in size, and I do a BIOS   
   > call to read LBA sector 2:   
   > 1. Will the first 8192 bytes of the disk be skipped, because   
   > that is occupied by LBA 0 and LBA 1?   
      
   No, if it's a 4k HD then its internal cache will be loaded with   
   LBA 0..7 but the I/O-port is only fed with 512 bytes from LBA2.   
      
   > 2. Will my buffer get overrun, and 3584 bytes of my other   
   > code/data get trashed?   
      
   As long there is no weird UEFI/GPT assignment it wont overrun.   
   But if you like to be on the save side make your buffer 4K :)   
   __   
   wolfgang   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca