1
From: Kevin O'Connor <kevin@koconnor.net>
2
Date: Wed Feb 5 22:47:29 2014 -0500
3
Subject: vgabios: Attempt to detect old x86emu and force a fault.
4
Upstream-Commit: 8032b8a0fec550de5cb2f7d37aa031cebc2200c3
5
Bug-Debian: http://bugs.debian.org/737142
7
Check for cases where the leal instruction does not work. This
8
instruction is known to not be emulated properly on old versions of
9
x86emu. If a broken version of x86emu is found, force a fault that
10
x86emu will easily detect. This should help prevent soft failures
11
when running old software.
13
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
15
diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S
16
index 9854448..6e31c4e 100644
17
--- a/vgasrc/vgaentry.S
18
+++ b/vgasrc/vgaentry.S
19
@@ -45,9 +45,26 @@ _rom_header_signature:
21
****************************************************************/
23
- // This macro is the same as ENTRY_ARG except the "calll"
24
- // instruction is avoided to work around known issues in the
25
- // emulation of some versions of x86emu.
26
+ // Force a fault if found to be running on broken x86emu versions.
27
+ DECLFUNC x86emu_fault
32
+ // This macro implements a call while avoiding instructions
33
+ // that old versions of x86emu have problems with.
34
+ .macro VGA_CALLL cfunc
35
+ // Make sure leal instruction works.
37
+ leal (%ecx, %ecx, 1), %ecx
40
+ // Use callw instead of calll
45
+ // This macro is the same as ENTRY_ARG except VGA_CALLL is used.
46
.macro ENTRY_ARG_VGA cfunc
49
@@ -57,7 +74,7 @@ _rom_header_signature:
50
movl %esp, %ebx // Backup %esp, then zero high bits
52
movl %esp, %eax // First arg is pointer to struct bregs
53
- pushw %ax ; callw \cfunc
55
movl %ebx, %esp // Restore %esp (including high bits)
58
@@ -103,7 +120,7 @@ entry_10_extrastack:
59
movw %ds, %dx // Setup %ss/%esp and call function
62
- pushw %ax ; callw handle_10
65
movl %esp, %eax // Restore registers and return
66
movw BREGS_size+4(%eax), %ss