aboutsummaryrefslogtreecommitdiff
path: root/bsd-user
diff options
context:
space:
mode:
authorGiuseppe Musacchio <thatlemon@gmail.com>2020-06-25 11:12:04 +0200
committerLaurent Vivier <laurent@vivier.eu>2020-06-29 13:00:23 +0200
commitd43624c400597aec18dff917c1424b807bbb473d (patch)
tree29cc1a586b7d21ebc561a53201764eb56f40cf97 /bsd-user
parentaa04c9d9ef962d516af5ca89667de4282d1c22ef (diff)
linux-user/sparc64: Fix the handling of window spill trap
Fix the handling of window spill traps by keeping cansave into account when calculating the new CWP. Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200625091204.3186186-3-laurent@vivier.eu>
Diffstat (limited to 'bsd-user')
-rw-r--r--bsd-user/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0bfe46cff9..ac40d79bfa 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -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