Skip to contentSkip to conversation

[5963] target-i386: Fix jmp im on x86_64 when executing 32-bit code

Qemu-devel Aurelien Jarno 1 participant 1 message Dec 10, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5963

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5963
Author:   aurel32
Date:     2008-12-10 15:02:16 +0000 (Wed, 10 Dec 2008)

Log Message:
-----------
target-i386: Fix jmp im on x86_64 when executing 32-bit code

When running grub-install (32-bit) on an x86_64 Linux system in qemu, it hangs on a pagefault forever, because an integer overflow occurs on the IP on "jmp im". This patch masks overflows for 32 bit IPs on a 64 bit system, just like it is done for 16 bit IPs already.

Using this patch, x86_64 openSUSE installation works again.

Modified Paths:
--------------
trunk/target-i386/translate.c

Modified: trunk/target-i386/translate.c
===================================================================

target-i386/translate.c +2 -0
@@ -6165,6 +6165,8 @@
         tval += s->pc - s->cs_base;
         if (s->dflag == 0)
             tval &= 0xffff;
+        else if(!CODE64(s))
+            tval &= 0xffffffff;
         gen_jmp(s, tval);
         break;
     case 0xea: /* ljmp im */