[syslinux:master] memdisk/dskprobe: Show the status of the last command when debugging

syslinux-bot for Gene Cumm gene.cumm at gmail.com
Fri Apr 1 15:54:34 PDT 2011


Commit-ID:  a557d22c12b6e1353f97d5aacc50d511b6843ce4
Gitweb:     http://syslinux.zytor.com/commit/a557d22c12b6e1353f97d5aacc50d511b6843ce4
Author:     Gene Cumm <gene.cumm at gmail.com>
AuthorDate: Wed, 26 Jan 2011 21:07:33 -0500
Committer:  Gene Cumm <gene.cumm at gmail.com>
CommitDate: Wed, 26 Jan 2011 21:07:33 -0500

memdisk/dskprobe: Show the status of the last command when debugging

INT13h AH01h is supposed to show the status of the last command.  Show
its status and determine if it's a known failure.

This does not affect the "present" variable at this time.


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

diff --git a/memdisk/dskprobe.c b/memdisk/dskprobe.c
index 9071fb0..e554f57 100644
--- a/memdisk/dskprobe.c
+++ b/memdisk/dskprobe.c
@@ -49,6 +49,38 @@ static void probe_any(uint8_t func, uint8_t drive, com32sys_t * regs)
 }
 
 /**
+ * Determine if the return from probe_int13h_01h indicates a failure; a
+ * return of zero indicates no known failure.
+ */
+static int probe_int13h_01h_fail(int istatus)
+{
+    int status = 0;
+
+    if (istatus >= 256)
+	status = istatus;
+    else
+	switch (istatus) {
+	case 1: status = istatus;
+	}
+    return status;
+}
+
+/**
+ * INT 0x13, AH == 0x01: Get status of last command.
+ */
+static int probe_int13h_01h(uint8_t drive)
+{
+    int status;
+    com32sys_t regs;
+
+    memset((void *)(&regs), 0, sizeof regs);
+    probe_any(0x01, drive, &regs);
+    status = (regs.eflags.l & 1) * 256 + regs.eax.b[1];
+    dskprobe_printf("    AH01: CF%d AH%02x\n", regs.eflags.l & 1, regs.eax.b[1]);
+    return status;
+}
+
+/**
  * INT 0x13, AH == 0x08: Get drive parameters.
  */
 static int probe_int13h_08h(uint8_t drive, com32sys_t * regs)
@@ -70,10 +102,13 @@ static int probe_int13h_08h(uint8_t drive, com32sys_t * regs)
 static int probe_int13h_15h(uint8_t drive, com32sys_t * regs)
 {
     int present;
+    int status;
 
     memset(regs, 0, sizeof *regs);
     probe_any(0x15, drive, regs);
     present = !(regs->eflags.l & 1) && regs->eax.b[1];
+    status = probe_int13h_01h(drive);
+    probe_int13h_01h_fail(status);
     dskprobe_printf("  AH15: P%d CF%d AH%02x AL%02x CX%04x DX%04x\n", present,
 		    regs->eflags.l & 1, regs->eax.b[1], regs->eax.b[0],
 		    regs->ecx.w[0], regs->edx.w[0]);



More information about the Syslinux-commits mailing list