Page 1 of 1
Does MBR sends to VBR partiton information?
Posted: Sun Dec 13, 2020 2:26 am
by Bonfra
When the MBR loads the VBR in memory from a specific partition, the VBR runs as a normal bootloader but if it need to interact with the disk it should be aware of the fact that is not at the start of the disk but there is some bias.
For example the first bootable partition is at LBA = 2048 and when its bootloader is loaded it reads the file system starting from LBA = 2048 instead of the start of the disk. Is this something hardcoded or the MBR should send the information like the boot drive?
I know I can do it my self but I wanted to know if some sort of convention exists.
Re: Does MBR sends to VBR partiton information?
Posted: Sun Dec 13, 2020 3:32 am
by nullplan
Wikipedia claims that DS:SI will point to the partition table entry for the active partition. I don't know how reliable that is, though. Other members here have counselled against trusting that, only trusting that DL is the BIOS drive number.
Re: Does MBR sends to VBR partiton information?
Posted: Sun Dec 13, 2020 4:47 am
by PeterX
There's not "the MBR" as a kind of standard. What comes close to being a standard are the MBR from Windows and from Grub2.
And, no, you can't expect an MBR to hand over that information. What you can do is writing your own MBR and VBR and let the MBR hand over:
(a) some "magic" to recognize whether the VBR is loaded by your MBR or some other MBR. The VBR would check for that and fail with a short error message if the wrong MBR is used. For example you could set eax = 0x1234ABCD.
(b) the info you want to pass.
Disadvantage: With this solution booting fails if the MBR is overwritten. But perhaps that's ok.
Greetings
Peter
Re: Does MBR sends to VBR partiton information?
Posted: Sun Dec 13, 2020 3:44 pm
by Octocontrabass
nullplan wrote:Wikipedia claims that DS:SI will point to the partition table entry for the active partition. I don't know how reliable that is, though.
It doesn't work with the MBR written by Windows Vista or newer.