Fix jmp im on x86_64 when executing 32-bit code
PATCH 1/1 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.
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 */
Quoted 11 lines · Alexander Graf
When running grub-install (32-bit) on an
x86_64Linux 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_64openSUSE installation works again.Signed-off-by Alexander Graf <[email protected]>Signed-off-by Kevin Wolf <[email protected]>
Thanks for your great work, it is something broken for a long time, and it is nice to see that fixed. I have applied the patch to the SVN.
Quoted 13 lines
Index:
target-i386/translate.c
===================================================================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 */
Signature · 4 lines
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' [email protected] | [email protected] `- people.debian.org/~aurel32 | www.aurel32.net