qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix jmp im on x86_64 when executing 32-bit code
@ 2008-12-09 13:14 Alexander Graf
  2008-12-10 15:02 ` Aurelien Jarno
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2008-12-09 13:14 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

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>



[-- Attachment #2: jmp-im.patch --]
[-- Type: text/x-patch, Size: 430 bytes --]

Index: target-i386/translate.c
===================================================================
--- target-i386/translate.c	(revision 5959)
+++ target-i386/translate.c	(working copy)
@@ -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 */

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Fix jmp im on x86_64 when executing 32-bit code
  2008-12-09 13:14 [Qemu-devel] [PATCH] Fix jmp im on x86_64 when executing 32-bit code Alexander Graf
@ 2008-12-10 15:02 ` Aurelien Jarno
  0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2008-12-10 15:02 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf

On Tue, Dec 09, 2008 at 02:14:19PM +0100, Alexander Graf wrote:
> 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>
> 
> 

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.

> Index: target-i386/translate.c
> ===================================================================
> --- target-i386/translate.c	(revision 5959)
> +++ target-i386/translate.c	(working copy)
> @@ -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 */


-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32@debian.org         | aurelien@aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-10 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-09 13:14 [Qemu-devel] [PATCH] Fix jmp im on x86_64 when executing 32-bit code Alexander Graf
2008-12-10 15:02 ` Aurelien Jarno

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).