[syslinux:master] chain.c32: fix conversion from LBA to CHS

syslinux-bot for H. Peter Anvin hpa at zytor.com
Tue Oct 12 22:33:13 PDT 2010


Commit-ID:  904fea3db31bda2360a9d3b6fe1cd0ce17c9c0ee
Gitweb:     http://syslinux.zytor.com/commit/904fea3db31bda2360a9d3b6fe1cd0ce17c9c0ee
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Tue, 12 Oct 2010 22:31:09 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Tue, 12 Oct 2010 22:31:09 -0700

chain.c32: fix conversion from LBA to CHS

Bits [9:8] of the cylinder goes into the top bits of the sector
register, not the bottom (and the math for that was wrong, anyway.)

Reported-by: Michal Soltys <soltys at ziu.info>
Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 com32/modules/chain.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/com32/modules/chain.c b/com32/modules/chain.c
index 6a5b115..13878c7 100644
--- a/com32/modules/chain.c
+++ b/com32/modules/chain.c
@@ -282,7 +282,7 @@ static void *read_sectors(uint64_t lba, uint8_t count)
 	inreg.eax.b[0] = count;
 	inreg.eax.b[1] = 0x02;	/* Read */
 	inreg.ecx.b[1] = c & 0xff;
-	inreg.ecx.b[0] = s + (c >> 6);
+	inreg.ecx.b[0] = ((c >> 2) & 0xc0) + s;
 	inreg.edx.b[1] = h;
 	inreg.edx.b[0] = disk_info.disk;
 	inreg.ebx.w[0] = OFFS(buf);



More information about the Syslinux-commits mailing list