summaryrefslogtreecommitdiff
path: root/memdisk
diff options
context:
space:
mode:
authorGene Cumm <gene.cumm@gmail.com>2011-01-26 21:07:33 -0500
committerGene Cumm <gene.cumm@gmail.com>2011-01-26 21:07:33 -0500
commita557d22c12b6e1353f97d5aacc50d511b6843ce4 (patch)
treeb826325031a80c081a617ec8a9f970afe43a1709 /memdisk
parent91eae94265d72da0b6c57517f6d0dc05649e10cc (diff)
downloadsyslinux-a557d22c12b6e1353f97d5aacc50d511b6843ce4.tar.gz
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.
Diffstat (limited to 'memdisk')
-rw-r--r--memdisk/dskprobe.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/memdisk/dskprobe.c b/memdisk/dskprobe.c
index 9071fb0b..e554f57f 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]);