summaryrefslogtreecommitdiffstats
path: root/src/arch/i386/interface/pcbios/int13.c
diff options
context:
space:
mode:
authorMichael Brown2007-07-09 21:37:39 +0200
committerMichael Brown2007-07-09 21:37:39 +0200
commitb90d321dfb1dfa7228f06ad834e484ee23c9a0c1 (patch)
tree26522a7c3cff12690f4fd0a4b5d553b9da45e096 /src/arch/i386/interface/pcbios/int13.c
parentProof of concept; works, but has several hard-coded hacks. (diff)
downloadipxe-b90d321dfb1dfa7228f06ad834e484ee23c9a0c1.tar.gz
ipxe-b90d321dfb1dfa7228f06ad834e484ee23c9a0c1.tar.xz
ipxe-b90d321dfb1dfa7228f06ad834e484ee23c9a0c1.zip
Change %dl fixup rules for INT13:
INT 13,08 : read number of drives from 40:75 INT 13,15 : do nothing all others : restore original value of %dl
Diffstat (limited to 'src/arch/i386/interface/pcbios/int13.c')
-rw-r--r--src/arch/i386/interface/pcbios/int13.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/arch/i386/interface/pcbios/int13.c b/src/arch/i386/interface/pcbios/int13.c
index a4563a05..23fdbf92 100644
--- a/src/arch/i386/interface/pcbios/int13.c
+++ b/src/arch/i386/interface/pcbios/int13.c
@@ -466,23 +466,28 @@ static void hook_int13 ( void ) {
/* Overwrite flags for iret */
"pushfw\n\t"
"popw 6(%%bp)\n\t"
- /* Restore %dl (except for %ah=0x08 or 0x15) */
- "cmpb $0x08, -1(%%bp)\n\t"
-
- "jne 7f\n\t"
- "movb $2, %%dl\n\t"
- "jmp 2f\n\t"
- "\n7:\n\t"
-
- "je 2f\n\t"
+ /* Fix up %dl:
+ *
+ * INT 13,15 : do nothing
+ * INT 13,08 : load with number of drives
+ * all others: restore original value
+ */
"cmpb $0x15, -1(%%bp)\n\t"
"je 2f\n\t"
"movb -4(%%bp), %%dl\n\t"
- "\n2:\n\t"
+ "cmpb $0x08, -1(%%bp)\n\t"
+ "jne 2f\n\t"
+ "pushw %%ds\n\t"
+ "pushw %1\n\t"
+ "popw %%ds\n\t"
+ "movb %c2, %%dl\n\t"
+ "popw %%ds\n\t"
/* Return */
+ "\n2:\n\t"
"movw %%bp, %%sp\n\t"
"popw %%bp\n\t"
- "iret\n\t" ) : : "i" ( int13 ) );
+ "iret\n\t" )
+ : : "i" ( int13 ), "i" ( BDA_SEG ), "i" ( BDA_NUM_DRIVES ) );
hook_bios_interrupt ( 0x13, ( unsigned int ) int13_wrapper,
&int13_vector );