flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Is Fn 8 Int 13h reliable nowadays?

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 04 Mar 2015, 23:03
Hi guys,

Boot code loads from USB flash drive. What I want is to add MBR partition table entries validation before trying to load bootsector. In order to check if CHS start/end is within the valid range, I need to get boot drive geometry. EDD Specification suggests Fn 8 Int 13h. I checked what it returns on three PCs and all give me different CHS values. From Ralph Brown's this function seems to be a very unreliable on legacy platforms. But what about now? What is a better (appropriate) way to check USB goot drive CHS geometry? Or this function is OK and different values I get are only because of different versions of BIOS?

Thanks in advance
Post 04 Mar 2015, 23:03
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 05 Mar 2015, 03:17
Try INT 13h ah=48h, see attached specification.

I have used these extended functions for boot loading from CD. I will soon be developing a USB Flash drive boot, likely similar to what you are doing and I planned on using those BIOS calls.


Description:
Download
Filename: specsedd30 (1).pdf
Filesize: 113.08 KB
Downloaded: 723 Time(s)

Post 05 Mar 2015, 03:17
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 05 Mar 2015, 10:20
Right, but the same spec, describing the Device Parameters Block (pg. 33), refers back to function 8 for logical chs:
Code:
Offset  Type      Description
...     ...       ...
4       DWord     Number of default cylinders.
                  The content of this field shall be one greater than the maximum cylinder number.
                  INT 13h FN 08h shall be used to find the logical number of cylinders.
8       DWord     Number of default heads.
                  The content of this field shall be one greater than the maximum head number.
                  INT 13h FN 08h shall be used to find the logical number of heads.
12      DWord     Number of default sectors per track.
                  The content of this field shall be the same as the maximum sector number
                  because sector addresses are 1 based. INT 13h FN 08h shall be used to find the
                  logical number of sectors per track.
...     ...       ...    

I assume this relates to usb drives, cause they emulate chs.
probably I'll need to do some testing with invalid paramenters to different devices and see what comes out...
Post 05 Mar 2015, 10:20
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 05 Mar 2015, 10:56
You should be able to use Logical Block Addresses instead of CHS.
Post 05 Mar 2015, 10:56
View user's profile Send private message Reply with quote
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 05 Mar 2015, 11:36
Probably you're right. No need in overcomplicating things since if bios can boot from usb, then it will definitely support edd, and checking partition table for valid start_lba/size would be enough on this stage. all enhanced checks with chs translations and the rest could be done later on demand. thanks
Post 05 Mar 2015, 11:36
View user's profile Send private message Reply with quote
smiddy



Joined: 31 Oct 2004
Posts: 557
smiddy 06 Mar 2015, 00:44
No sweat! I don't know when I'll get to mine, should be within the month. I'll post it here once I do.
Post 06 Mar 2015, 00:44
View user's profile Send private message Reply with quote
Coty



Joined: 17 May 2010
Posts: 553
Location: ␀
Coty 12 Mar 2015, 15:04
The reliability of utilizing BIOS ints is debatable, modern PCs are losing compatibility with anything that doesn't utilize secure boot and not all UEFI properly emulate BIOS even when in legacy mode.

All this is the cost of making PCs somehow "better".
Post 12 Mar 2015, 15:04
View user's profile Send private message Send e-mail Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.