Skip to content

Commit

Permalink
linux-user/sparc64: Fix the handling of window spill trap
Browse files Browse the repository at this point in the history
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: <[email protected]>
  • Loading branch information
LemonBoy authored and vivier committed Jun 29, 2020
1 parent aa04c9d commit d43624c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion bsd-user/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion linux-user/sparc/cpu_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d43624c

Please sign in to comment.