From: Kevin O'Connor <kevin@koconnor.net>
To: Michael Tokarev <mjt@tls.msk.ru>, Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniele Di Proietto <daniele.di.proietto@gmail.com>,
seabios <seabios@seabios.org>, qemu-devel <qemu-devel@nongnu.org>,
Julian Pidancet <julian.pidancet@gmail.com>
Subject: Re: [Qemu-devel] PC-BSD installer does not boot with 1.7.4 (bisected)
Date: Wed, 5 Feb 2014 23:04:42 -0500 [thread overview]
Message-ID: <20140206040442.GA5486@morn.localdomain> (raw)
In-Reply-To: <20140205174406.GA26098@morn.localdomain>
On Wed, Feb 05, 2014 at 12:44:06PM -0500, Kevin O'Connor wrote:
> On Tue, Feb 04, 2014 at 04:33:19PM +0400, Michael Tokarev wrote:
> > We have a bugreport in debian, http://bugs.debian.org/737142,
> > stating that PC-BSD does not work with seabios-1.7.4 anymore.
> >
> > I digged in, and found out that it fails only with -vga std
> > (cirrus works fine). So I bisected the issue - only changing
> > vgabios-stdvga.bin, and found this:
[...]
> This seems to be similar to the freebsd problem reported last year -
> see:
> http://lists.gnu.org/archive/html/qemu-stable/2013-03/msg00037.html
[...]
> (*) The best I can think of is to try and construct some hand crafted
> assembler that can catch buggy x86emu emulators and force a failure..
I have put together some assember to try and run-time test for known
broken versions of x86emu. This patch to SeaVGABIOS does seem to
catch the freebsd issue and in my tests it convinces freebsd to take a
different approach. The patch is a bit ugly though.
Comments welcome.
-Kevin
commit e3caa553e940efb6184b30a5637134c4aa9f8b65
Author: Kevin O'Connor <kevin@koconnor.net>
Date: Wed Feb 5 22:47:29 2014 -0500
vgabios: Attempt to detect old x86emu and force a fault.
Check for cases where the leal instruction does not work. This
instruction is known to not be emulated properly on old versions of
x86emu. If a broken version of x86emu is found, force a fault that
x86emu will easily detect. This should help prevent soft failures
when running old software.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/vgasrc/vgaentry.S b/vgasrc/vgaentry.S
index 9854448..e246e7c 100644
--- a/vgasrc/vgaentry.S
+++ b/vgasrc/vgaentry.S
@@ -45,9 +45,27 @@ _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.
+ // Force a fault if found to be running on broken x86emu versions.
+ DECLFUNC x86emu_fault
+x86emu_fault:
+ int $0x03
+1: hlt
+ jmp 1b
+
+ // This macro implements a call while avoiding instructions
+ // that old versions of x86emu have problems with.
+ .macro VGA_CALLL cfunc
+ // Make sure leal instruction works.
+ movl $0x8000, %ecx
+ leal (%ecx, %ecx, 1), %ecx
+ cmpl $0x10000, %ecx
+ jne x86emu_fault
+ // Use callw instead of calll
+ push %ax
+ callw \cfunc
+ .endm
+
+ // This macro is the same as ENTRY_ARG except VGA_CALLL is used.
.macro ENTRY_ARG_VGA cfunc
cli
cld
@@ -57,7 +75,7 @@ _rom_header_signature:
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
+ VGA_CALLL \cfunc
movl %ebx, %esp // Restore %esp (including high bits)
POPBREGS
.endm
@@ -103,7 +121,7 @@ entry_10_extrastack:
movw %ds, %dx // Setup %ss/%esp and call function
movw %dx, %ss
movl %eax, %esp
- pushw %ax ; callw handle_10
+ VGA_CALLL handle_10
movl %esp, %eax // Restore registers and return
movw BREGS_size+4(%eax), %ss
next prev parent reply other threads:[~2014-02-06 4:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 12:33 [Qemu-devel] PC-BSD installer does not boot with 1.7.4 (bisected) Michael Tokarev
2014-02-05 17:44 ` Kevin O'Connor
2014-02-06 4:04 ` Kevin O'Connor [this message]
2014-02-06 12:44 ` [Qemu-devel] *BSD kernel crash at boot in qemu with seabios " Michael Tokarev
2014-02-11 22:34 ` Xin Li
2014-02-10 15:41 ` [Qemu-devel] PC-BSD installer does not boot with " Kevin O'Connor
2014-02-17 17:35 ` Michael Tokarev
2014-02-17 19:07 ` Kevin O'Connor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140206040442.GA5486@morn.localdomain \
--to=kevin@koconnor.net \
--cc=daniele.di.proietto@gmail.com \
--cc=julian.pidancet@gmail.com \
--cc=kraxel@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=qemu-devel@nongnu.org \
--cc=seabios@seabios.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).