From 7416092b83d73da5e46628355f424a0a449e29d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 14 Oct 2005 09:25:45 +0000 Subject: [PATCH] Marcus spotted an error in the cylinder calculation in get_drive_parameters() - didn't have an effect on floppies or CD-ROMs, but would have on real hard drives that require CHS access. Changed the cylinder-to-regs conversion in BIOSDrive::ReadAt() (that one was actually correct) to make it look similar to the conversion in the opposite direction in get_drive_parameters(). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14377 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/boot/platform/bios_ia32/devices.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/boot/platform/bios_ia32/devices.cpp b/src/system/boot/platform/bios_ia32/devices.cpp index 2713cd47a3..9719f49186 100644 --- a/src/system/boot/platform/bios_ia32/devices.cpp +++ b/src/system/boot/platform/bios_ia32/devices.cpp @@ -176,7 +176,7 @@ get_drive_parameters(uint8 drive, drive_parameters *parameters) // fill drive_parameters structure with useful values parameters->parameters_size = kParametersSizeVersion1; parameters->flags = 0; - parameters->cylinders = (((regs.ecx << 8) & 0xc000) | ((regs.ecx >> 8) & 0xff)) + 1; + parameters->cylinders = (((regs.ecx & 0xc0) << 2) | ((regs.ecx >> 8) & 0xff)) + 1; parameters->heads = ((regs.edx >> 8) & 0xff) + 1; // heads and cylinders start counting from 0 parameters->sectors_per_track = regs.ecx & 0x3f; @@ -433,7 +433,7 @@ BIOSDrive::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) struct bios_regs regs; regs.eax = BIOS_READ | blocksRead; regs.edx = fDriveID | (head << 8); - regs.ecx = sector | ((cylinder >> 8) << 6) | ((cylinder & 0xff) << 8); + regs.ecx = sector | ((cylinder >> 2) & 0xc0) | ((cylinder & 0xff) << 8); regs.es = 0; regs.ebx = kExtraSegmentScratch; call_bios(0x13, ®s);