qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabrice Bellard <fabrice@bellard.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [4520] fxsave/fxrstor 64 bit fix
Date: Thu, 22 May 2008 09:20:44 +0000	[thread overview]
Message-ID: <E1Jz6ya-0004uB-K6@cvs.savannah.gnu.org> (raw)

Revision: 4520
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4520
Author:   bellard
Date:     2008-05-22 09:20:43 +0000 (Thu, 22 May 2008)

Log Message:
-----------
fxsave/fxrstor 64 bit fix

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

Modified: trunk/target-i386/helper.c
===================================================================
--- trunk/target-i386/helper.c	2008-05-21 19:17:29 UTC (rev 4519)
+++ trunk/target-i386/helper.c	2008-05-22 09:20:43 UTC (rev 4520)
@@ -4248,6 +4248,18 @@
     stw(ptr, env->fpuc);
     stw(ptr + 2, fpus);
     stw(ptr + 4, fptag ^ 0xff);
+#ifdef TARGET_X86_64
+    if (data64) {
+        stq(ptr + 0x08, 0); /* rip */
+        stq(ptr + 0x10, 0); /* rdp */
+    } else 
+#endif
+    {
+        stl(ptr + 0x08, 0); /* eip */
+        stl(ptr + 0x0c, 0); /* sel  */
+        stl(ptr + 0x10, 0); /* dp */
+        stl(ptr + 0x14, 0); /* sel  */
+    }
 
     addr = ptr + 0x20;
     for(i = 0;i < 8; i++) {
@@ -4260,7 +4272,10 @@
         /* XXX: finish it */
         stl(ptr + 0x18, env->mxcsr); /* mxcsr */
         stl(ptr + 0x1c, 0x0000ffff); /* mxcsr_mask */
-        nb_xmm_regs = 8 << data64;
+        if (env->hflags & HF_CS64_MASK)
+            nb_xmm_regs = 16;
+        else
+            nb_xmm_regs = 8;
         addr = ptr + 0xa0;
         for(i = 0; i < nb_xmm_regs; i++) {
             stq(addr, env->xmm_regs[i].XMM_Q(0));
@@ -4297,7 +4312,10 @@
         /* XXX: finish it */
         env->mxcsr = ldl(ptr + 0x18);
         //ldl(ptr + 0x1c);
-        nb_xmm_regs = 8 << data64;
+        if (env->hflags & HF_CS64_MASK)
+            nb_xmm_regs = 16;
+        else
+            nb_xmm_regs = 8;
         addr = ptr + 0xa0;
         for(i = 0; i < nb_xmm_regs; i++) {
             env->xmm_regs[i].XMM_Q(0) = ldq(addr);

                 reply	other threads:[~2008-05-22  9:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1Jz6ya-0004uB-K6@cvs.savannah.gnu.org \
    --to=fabrice@bellard.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).