qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5091] Fix Sparc64 window handling problems detected by Vince Weaver
Date: Wed, 27 Aug 2008 19:19:45 +0000	[thread overview]
Message-ID: <E1KYQYS-0005k7-VH@cvs.savannah.gnu.org> (raw)

Revision: 5091
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5091
Author:   blueswir1
Date:     2008-08-27 19:19:44 +0000 (Wed, 27 Aug 2008)

Log Message:
-----------
Fix Sparc64 window handling problems detected by Vince Weaver

Modified Paths:
--------------
    trunk/linux-user/main.c

Modified: trunk/linux-user/main.c
===================================================================
--- trunk/linux-user/main.c	2008-08-27 18:43:53 UTC (rev 5090)
+++ trunk/linux-user/main.c	2008-08-27 19:19:44 UTC (rev 5091)
@@ -808,11 +808,16 @@
 
 static void restore_window(CPUSPARCState *env)
 {
-    unsigned int new_wim, i, cwp1;
+#ifndef TARGET_SPARC64
+    unsigned int new_wim;
+#endif
+    unsigned int i, cwp1;
     abi_ulong sp_ptr;
 
+#ifndef TARGET_SPARC64
     new_wim = ((env->wim << 1) | (env->wim >> (env->nwindows - 1))) &
         ((1LL << env->nwindows) - 1);
+#endif
 
     /* restore the invalid window */
     cwp1 = cpu_cwp_inc(env, env->cwp + 1);
@@ -826,12 +831,13 @@
         get_user_ual(env->regbase[get_reg_index(env, cwp1, 8 + i)], sp_ptr);
         sp_ptr += sizeof(abi_ulong);
     }
-    env->wim = new_wim;
 #ifdef TARGET_SPARC64
     env->canrestore++;
     if (env->cleanwin < env->nwindows - 1)
         env->cleanwin++;
     env->cansave--;
+#else
+    env->wim = new_wim;
 #endif
 }
 
@@ -843,14 +849,23 @@
     for(;;) {
         /* if restore would invoke restore_window(), then we can stop */
         cwp1 = cpu_cwp_inc(env, env->cwp + offset);
+#ifndef TARGET_SPARC64
         if (env->wim & (1 << cwp1))
             break;
+#else
+        if (env->canrestore == 0)
+            break;
+        env->cansave++;
+        env->canrestore--;
+#endif
         save_window_offset(env, cwp1);
         offset++;
     }
+    cwp1 = cpu_cwp_inc(env, env->cwp + 1);
+#ifndef TARGET_SPARC64
     /* set wim so that restore will reload the registers */
-    cwp1 = cpu_cwp_inc(env, env->cwp + 1);
     env->wim = 1 << cwp1;
+#endif
 #if defined(DEBUG_WIN)
     printf("flush_windows: nb=%d\n", offset - 1);
 #endif

                 reply	other threads:[~2008-08-27 19:19 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=E1KYQYS-0005k7-VH@cvs.savannah.gnu.org \
    --to=blauwirbel@gmail.com \
    --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).