Replace 32 bit call instructions with 16 bit call instructions in the vgabios to workaround problems in old versions of x86emu. This change allows fc13 and fc14 to boot. (Other x86emu emulation bugs still prevent fc11 and fc12 from booting.)
Signed-off-by: Kevin O'Connor kevin@koconnor.net --- scripts/vgafixup.py | 2 ++ vgasrc/vgaentry.S | 23 ++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/scripts/vgafixup.py b/scripts/vgafixup.py index 52fb934..2493f35 100644 --- a/scripts/vgafixup.py +++ b/scripts/vgafixup.py @@ -28,6 +28,8 @@ def main(): out.append('retw $2\n') elif sline == 'leave': out.append('movl %ebp, %esp ; popl %ebp\n') + elif sline.startswith('call'): + out.append('pushw %ax ; callw' + sline[4:] + '\n') else: out.append(line) infile.close() diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S index d9fe05b..a65136d 100644 --- a/vgasrc/vgaentry.S +++ b/vgasrc/vgaentry.S @@ -44,17 +44,34 @@ _rom_header_signature: * Entry points ****************************************************************/
+ // This macro is the same as ENTRY_ARG except the "calll" + // instruction is avoided to work around known issues in the + // emulation of some versions of x86emu. + .macro ENTRY_ARG_VGA cfunc + cli + cld + PUSHBREGS + movw %ss, %ax // Move %ss to %ds + movw %ax, %ds + movl %esp, %ebx // Backup %esp, then zero high bits + movzwl %sp, %esp + movl %esp, %eax // First arg is pointer to struct bregs + pushw %ax ; callw \cfunc + movl %ebx, %esp // Restore %esp (including high bits) + POPBREGS + .endm + DECLFUNC entry_104f05 entry_104f05: - ENTRY_ARG vbe_104f05 + ENTRY_ARG_VGA vbe_104f05 lretw
DECLFUNC _optionrom_entry _optionrom_entry: - ENTRY_ARG vga_post + ENTRY_ARG_VGA vga_post lretw
DECLFUNC entry_10 entry_10: - ENTRY_ARG handle_10 + ENTRY_ARG_VGA handle_10 iretw