[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/12] linux-user/sparc64: Fix the handling of window spill trap
From: |
Laurent Vivier |
Subject: |
[PULL 02/12] linux-user/sparc64: Fix the handling of window spill trap |
Date: |
Sat, 4 Jul 2020 18:25:35 +0200 |
From: Giuseppe Musacchio <thatlemon@gmail.com>
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>
---
bsd-user/main.c | 6 +++++-
linux-user/sparc/cpu_loop.c | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0bfe46cff93e..ac40d79bfaac 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
diff --git a/linux-user/sparc/cpu_loop.c b/linux-user/sparc/cpu_loop.c
index 7645cc04ca73..02532f198df8 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -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
--
2.26.2
- [PULL 00/12] Linux user for 5.1 patches, Laurent Vivier, 2020/07/04
- [PULL 01/12] target/sparc: Translate flushw opcode, Laurent Vivier, 2020/07/04
- [PULL 02/12] linux-user/sparc64: Fix the handling of window spill trap,
Laurent Vivier <=
- [PULL 06/12] linux-user: Add strace support for printing argument of syscalls used for extended attributes, Laurent Vivier, 2020/07/04
- [PULL 04/12] linux-user: Extend strace support to enable argument printing after syscall execution, Laurent Vivier, 2020/07/04
- [PULL 07/12] linux-user: Add strace support for printing arguments of lseek(), Laurent Vivier, 2020/07/04
- [PULL 05/12] linux-user: Add strace support for a group of syscalls, Laurent Vivier, 2020/07/04
- [PULL 12/12] MAINTAINERS: update linux-user maintainer, Laurent Vivier, 2020/07/04
- [PULL 10/12] linux-user: Add thunk argument types for SIOCGSTAMP and SIOCGSTAMPNS, Laurent Vivier, 2020/07/04
- [PULL 11/12] linux-user: Add strace support for printing arguments of ioctl(), Laurent Vivier, 2020/07/04
- [PULL 08/12] linux-user: Add strace support for printing arguments of chown()/lchown(), Laurent Vivier, 2020/07/04