[syslinux:master] memdisk/dskprobe.c: Additional checks in INT13h AH08h and AH41h

syslinux-bot for Shao Miller shao.miller at yrdsb.edu.on.ca
Fri Apr 1 15:54:32 PDT 2011


Commit-ID:  61df6e617c2d755ef8cac91c8c4b9bc2710b2bee
Gitweb:     http://syslinux.zytor.com/commit/61df6e617c2d755ef8cac91c8c4b9bc2710b2bee
Author:     Shao Miller <shao.miller at yrdsb.edu.on.ca>
AuthorDate: Wed, 26 Jan 2011 20:10:24 -0500
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Wed, 26 Jan 2011 20:40:41 -0500

memdisk/dskprobe.c: Additional checks in INT13h AH08h and AH41h

Some BIOSs lie and don't set CF when they should.

Additional comments from Shao:

Fix INT 0x13, AH==0x08 disk drive probe.

This function might return CF==0 ("success"), but could return a
standard response no matter which drive number is passed in DL, but
based only on DL's bit 7.  Fortunately, AH should be 0 for an existent
drive and 01h for a non-existent drive.  Now we check AH.

Fix INT 0x13, AH==0x41 disk drive probe

This function might return CF==0 ("success"), but could also include BX
left unchanged.  If extensions are present, BX should be returned with
0xAA55.  So we now check for this special value in our determination of
a drive's presence.

Signed-off-by: Gene Cumm <gene.cumm at gmail.com>


---
 memdisk/dskprobe.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/memdisk/dskprobe.c b/memdisk/dskprobe.c
index 84400a8..ee7be12 100644
--- a/memdisk/dskprobe.c
+++ b/memdisk/dskprobe.c
@@ -57,7 +57,7 @@ static int probe_int13h_08h(uint8_t drive, com32sys_t * regs)
 
     memset(regs, 0, sizeof *regs);
     probe_any(0x08, drive, regs);
-    present = !(regs->eflags.l & 1);
+    present = !(regs->eflags.l & 1) && !regs->eax.b[1];
     dskprobe_printf("  AH08: CF%d BL%02x DL%02x\n", regs->eflags.l & 1,
 		    regs->ebx.b[0], regs->edx.b[0]);
     return present;
@@ -88,7 +88,7 @@ static int probe_int13h_41h(uint8_t drive, com32sys_t * regs)
     memset(regs, 0, sizeof *regs);
     regs->ebx.w[0] = 0x55AA;	/* BX == 0x55AA */
     probe_any(0x41, drive, regs);
-    present = !(regs->eflags.l & 1);
+    present = !(regs->eflags.l & 1) && (regs->ebx.w[0] == 0xAA55);
     dskprobe_printf("  AH41: CF%d BX%04x AH%02x DH%02x\n", regs->eflags.l & 1,
 		    regs->ebx.w[0], regs->eax.b[1], regs->edx.b[1]);
     return present;



More information about the Syslinux-commits mailing list