[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Qemu crashes on AAM 0

From: malc
Subject: Re: [Qemu-devel] Qemu crashes on AAM 0
Date: Sun, 29 Apr 2007 19:55:24 +0400 (MSD)

On Sat, 28 Apr 2007, Joris van Rantwijk wrote:

Qemu crashes with a floating point exception when emulating the "AAM 0"
instruction. By "crash", I mean that the whole qemu process actually
blows up (not just the program running inside Qemu).

A real i386 machine would trigger a divide exception on AAM 0.
This instruction form is undocumented of course, but blowing up the emulator
seems a bit drastic. I'm willing to write/test/provide a patch to fix this,
please let me know if that would be appreciated.

To trigger this bug, I run the qemu-0.9.0 binary distribution for
linux-i386 on Linux 2.6.21, without kqemu. I boot it with a FreeDOS
floppy image, start DEBUG, assemble the instruction AAM 0, execute it, boom.

By the way, Qemu is an amazing piece of work. I used it often and I'm quite
impressed by its overal quality and stability.

Following (given that real iron does indeed produce divide by zero
exception) should do the trick.

Index: op.c
RCS file: /cvsroot/qemu/qemu/target-i386/op.c,v
retrieving revision 1.47
diff -u -r1.47 op.c
--- op.c        1 Feb 2007 22:11:07 -0000       1.47
+++ op.c        29 Apr 2007 15:54:47 -0000
@@ -1004,6 +1004,9 @@
     int base = PARAM1;
     int al, ah;
+    if (!base) {
+        raise_exception(EXCP00_DIVZ);
+    }
     al = EAX & 0xff;
     ah = al / base;
     al = al % base;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]