CHS or LBA translation
CHS or LBA translation
I only have the MBR of my Hard Disk now I need to know in what sector is the boot sector to read this but I don't know how to find with the CHS. How to find the boot sector through LBA?
Re: CHS or LBA translation
Read an article about MBR structure. http://wiki.osdev.org/MBR
There you'll find details on how to find the boot sector of active partition.
There you'll find details on how to find the boot sector of active partition.
Re: CHS or LBA translation
I already read this article but it dont explain how to find the boot sector of a partition with the logigal block address or with the cylinder head sector. This is my doubt. I only want to know what I do with the LBA address or with the CHS address because my hard disk have more than 1023 cylinders.
Re: CHS or LBA translation
Try this.
if "EDD installation check" function is OK:
- use "Extended read" function (42h) with LBA value;
else:
- use "Get disk params" function (8) to get SPT and Heads params;
- translate LBA to CHS using formulas: s = LBA mod SPT + 1, t = LBA div SPT, h = t mod Heads, c = t div Heads;
- check c value (<=1023?);
- use "Legacy read" function (2) with c, h, s values.
if "EDD installation check" function is OK:
- use "Extended read" function (42h) with LBA value;
else:
- use "Get disk params" function (8) to get SPT and Heads params;
- translate LBA to CHS using formulas: s = LBA mod SPT + 1, t = LBA div SPT, h = t mod Heads, c = t div Heads;
- check c value (<=1023?);
- use "Legacy read" function (2) with c, h, s values.
If you have seen bad English in my words, tell me what's wrong, please.
-
- Member
- Posts: 141
- Joined: Thu Jun 17, 2010 2:36 am
Re: CHS or LBA translation
CHS fields in the MBR are unreliable. Microsoft decided to dump them (rightfully so) when they switched to NTFS, and are using the fields to store something else.
IMO, you shouldn't mess around with CHS at all with HDD's. If the HDD\BIOS doesn't support, sucks for whoever has that 15+ year old machine. Any effort to support CHS will likely be wasted, and could just end up making things worse\introducing bugs. Just my .02 though.
IMO, you shouldn't mess around with CHS at all with HDD's. If the HDD\BIOS doesn't support, sucks for whoever has that 15+ year old machine. Any effort to support CHS will likely be wasted, and could just end up making things worse\introducing bugs. Just my .02 though.
Re: CHS or LBA translation
MBR does explains it all.0x3B0 wrote:I already read this article but it dont explain how to find the boot sector of a partition with the logigal block address or with the cylinder head sector. This is my doubt. I only want to know what I do with the LBA address or with the CHS address because my hard disk have more than 1023 cylinders.
Follow the link Partition_Table and it explains each field including CHS and LBA of a partiton.See the Partition Table article for the format of each partition table entry field.
Re: CHS or LBA translation
Forget about CHS access for any drive larger than 8GiB. Only LBA access will allow you address the whole drive.0x3B0 wrote:I do with the LBA address or with the CHS address because my hard disk have more than 1023 cylinders.