Commit 32938e127f50a40844a0fb9c5abb8691aeeccf7e

Authored by aurel32
1 parent 4efbe58f

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.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5963 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 2 additions and 0 deletions
target-i386/translate.c
... ... @@ -6165,6 +6165,8 @@ static target_ulong disas_insn(DisasContext *s, target_ulong pc_start)
6165 6165 tval += s->pc - s->cs_base;
6166 6166 if (s->dflag == 0)
6167 6167 tval &= 0xffff;
  6168 + else if(!CODE64(s))
  6169 + tval &= 0xffffffff;
6168 6170 gen_jmp(s, tval);
6169 6171 break;
6170 6172 case 0xea: /* ljmp im */
... ...