summaryrefslogtreecommitdiff
path: root/pc-bios
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2010-02-18 17:13:25 +0100
committerAvi Kivity <avi@redhat.com>2010-02-22 11:34:09 +0200
commit943bbe20a5fa9d2c7b0201a6fa7227fd483050dd (patch)
treee705102a550f00e8e2203e63f777a12ae3261c85 /pc-bios
parentfaa06228ac5282902522935a13585db1a02c12f2 (diff)
extboot: Keep variables in RAM
Instead of saving the old INT 0x13 and 0x19 handlers in ROM which fails under QEMU as it enforces protection, keep them in spare vectors of the interrupt table, namely INT 0x80 and 0x81. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'pc-bios')
-rw-r--r--pc-bios/optionrom/extboot.S41
1 files changed, 30 insertions, 11 deletions
diff --git a/pc-bios/optionrom/extboot.S b/pc-bios/optionrom/extboot.S
index 1e60f6878..1eeb17238 100644
--- a/pc-bios/optionrom/extboot.S
+++ b/pc-bios/optionrom/extboot.S
@@ -19,6 +19,9 @@
* Authors: Anthony Liguori <aliguori@us.ibm.com>
*/
+#define OLD_INT19 (0x80 * 4) /* re-use INT 0x80 BASIC vector */
+#define OLD_INT13 (0x81 * 4) /* re-use INT 0x81 BASIC vector */
+
.code16
.text
.global _start
@@ -37,7 +40,7 @@ _start:
/* save old int 19 */
mov (0x19*4), %eax
- mov %eax, %cs:old_int19
+ mov %eax, (OLD_INT19)
/* install out int 19 handler */
movw $int19_handler, (0x19*4)
@@ -48,6 +51,7 @@ _start:
lret
int19_handler:
+ push %eax /* reserve space for lret */
push %eax
push %bx
push %cx
@@ -69,7 +73,7 @@ int19_handler:
1: /* hook int13: intb(0x404) == 1 */
/* save old int 13 to int 2c */
mov (0x13*4), %eax
- mov %eax, %cs:old_int13
+ mov %eax, (OLD_INT13)
/* install our int 13 handler */
movw $int13_handler, (0x13*4)
@@ -90,15 +94,21 @@ int19_handler:
3: /* fall through: inb(0x404) == 0 */
/* restore previous int $0x19 handler */
- mov %cs:old_int19,%eax
+ mov (OLD_INT19),%eax
mov %eax,(0x19*4)
-
+
+ /* write old handler as return address onto stack */
+ push %bp
+ mov %sp, %bp
+ mov %eax, 14(%bp)
+ pop %bp
+
pop %ds
pop %dx
pop %cx
pop %bx
pop %eax
- ljmpw *%cs:old_int19
+ lret
#define FLAGS_CF 0x01
@@ -626,7 +636,21 @@ terminate_disk_emulation:
int13_handler:
cmp $0x80, %dl
je 1f
- ljmpw *%cs:old_int13
+
+ /* write old handler as return address onto stack */
+ push %eax
+ push %eax
+ push %ds
+ push %bp
+ mov %sp, %bp
+ xor %ax, %ax
+ mov %ax, %ds
+ mov (OLD_INT13), %eax
+ mov %eax, 8(%bp)
+ pop %bp
+ pop %ds
+ pop %eax
+ lret
1:
cmp $0x0, %ah
jne 1f
@@ -686,10 +710,5 @@ int13_handler:
int $0x18 /* boot failed */
iret
-/* Variables */
-.align 4, 0
-old_int13: .long 0
-old_int19: .long 0
-
.align 512, 0
_end: