]> Git Repo - qemu.git/commitdiff
linux-user/sparc64: Fix the handling of window spill trap
authorGiuseppe Musacchio <[email protected]>
Thu, 25 Jun 2020 09:12:04 +0000 (11:12 +0200)
committerLaurent Vivier <[email protected]>
Mon, 29 Jun 2020 11:00:23 +0000 (13:00 +0200)
Fix the handling of window spill traps by keeping cansave into account
when calculating the new CWP.

Signed-off-by: Giuseppe Musacchio <[email protected]>
Signed-off-by: Laurent Vivier <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20200625091204.3186186[email protected]>

bsd-user/main.c
linux-user/sparc/cpu_loop.c

index 0bfe46cff93e723fd1f135528eb65bb35a3c8a91..ac40d79bfaacb4545dfdb94e479f0fe34df6d192 100644 (file)
@@ -413,7 +413,11 @@ static void save_window(CPUSPARCState *env)
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     env->wim = new_wim;
 #else
-    save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
+    /*
+     * cansave is zero if the spill trap handler is triggered by `save` and
+     * nonzero if triggered by a `flushw`
+     */
+    save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
     env->cansave++;
     env->canrestore--;
 #endif
index 7645cc04ca7322e00ed8557079679c834bfdd006..02532f198df83c5cd83b9f0bc7bea63e82c03c8c 100644 (file)
@@ -69,7 +69,11 @@ static void save_window(CPUSPARCState *env)
     save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
     env->wim = new_wim;
 #else
-    save_window_offset(env, cpu_cwp_dec(env, env->cwp - 2));
+    /*
+     * cansave is zero if the spill trap handler is triggered by `save` and
+     * nonzero if triggered by a `flushw`
+     */
+    save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
     env->cansave++;
     env->canrestore--;
 #endif
This page took 0.027835 seconds and 4 git commands to generate.