* [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode
@ 2020-06-25 9:12 Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 1/2] target/sparc: " Laurent Vivier
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-06-25 9:12 UTC (permalink / raw)
To: qemu-devel
Cc: Giuseppe Musacchio, Mark Cave-Ayland, Riku Voipio,
Richard Henderson, Philippe Mathieu-Daudé, Laurent Vivier,
Artyom Tarasenko
I send a modified version according to Richard's comments of the original
series sent by Giuseppe Musacchio <thatlemon@gmail.com> (aka LemonBoy).
v2: split patch in two patches
update comment style
I didn't really test the new patches (except a build and "make check").
But there is no code modification so I don't think I can introduce bugs in
this process. Any "Tested-by:" is welcome.
LemonBoy (2):
target/sparc: Translate flushw opcode
linux-user/sparc64: Fix the handling of window spill trap
bsd-user/main.c | 6 +++++-
linux-user/sparc/cpu_loop.c | 6 +++++-
target/sparc/translate.c | 2 ++
3 files changed, 12 insertions(+), 2 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] target/sparc: Translate flushw opcode
2020-06-25 9:12 [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Laurent Vivier
@ 2020-06-25 9:12 ` Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 2/2] linux-user/sparc64: Fix the handling of window spill trap Laurent Vivier
2020-06-26 21:23 ` [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Richard Henderson
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-06-25 9:12 UTC (permalink / raw)
To: qemu-devel
Cc: Giuseppe Musacchio, Mark Cave-Ayland, Riku Voipio,
Richard Henderson, Philippe Mathieu-Daudé, Laurent Vivier,
Artyom Tarasenko
From: LemonBoy <thatlemon@gmail.com>
The ifdef logic should unconditionally compile in the `xop == 0x2b` case
when targeting sparc64.
Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
target/sparc/translate.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 9416a551cf46..1a4efd4ed665 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -3663,6 +3663,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
#endif
gen_store_gpr(dc, rd, cpu_tmp0);
break;
+#endif
+#if defined(TARGET_SPARC64) || !defined(CONFIG_USER_ONLY)
} else if (xop == 0x2b) { /* rdtbr / V9 flushw */
#ifdef TARGET_SPARC64
gen_helper_flushw(cpu_env);
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] linux-user/sparc64: Fix the handling of window spill trap
2020-06-25 9:12 [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 1/2] target/sparc: " Laurent Vivier
@ 2020-06-25 9:12 ` Laurent Vivier
2020-06-26 21:23 ` [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Richard Henderson
2 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-06-25 9:12 UTC (permalink / raw)
To: qemu-devel
Cc: Giuseppe Musacchio, Mark Cave-Ayland, Riku Voipio,
Richard Henderson, Philippe Mathieu-Daudé, Laurent Vivier,
Artyom Tarasenko
From: LemonBoy <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>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode
2020-06-25 9:12 [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 1/2] target/sparc: " Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 2/2] linux-user/sparc64: Fix the handling of window spill trap Laurent Vivier
@ 2020-06-26 21:23 ` Richard Henderson
2020-06-29 11:01 ` Laurent Vivier
2 siblings, 1 reply; 5+ messages in thread
From: Richard Henderson @ 2020-06-26 21:23 UTC (permalink / raw)
To: Laurent Vivier, qemu-devel
Cc: Giuseppe Musacchio, Riku Voipio, Mark Cave-Ayland,
Philippe Mathieu-Daudé, Artyom Tarasenko
On 6/25/20 2:12 AM, Laurent Vivier wrote:
> I send a modified version according to Richard's comments of the original
> series sent by Giuseppe Musacchio <thatlemon@gmail.com> (aka LemonBoy).
>
> v2: split patch in two patches
> update comment style
>
> I didn't really test the new patches (except a build and "make check").
> But there is no code modification so I don't think I can introduce bugs in
> this process. Any "Tested-by:" is welcome.
>
> LemonBoy (2):
> target/sparc: Translate flushw opcode
> linux-user/sparc64: Fix the handling of window spill trap
>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
You might want to reset the Author to match the Signed-off-by.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode
2020-06-26 21:23 ` [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Richard Henderson
@ 2020-06-29 11:01 ` Laurent Vivier
0 siblings, 0 replies; 5+ messages in thread
From: Laurent Vivier @ 2020-06-29 11:01 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: Giuseppe Musacchio, Riku Voipio, Mark Cave-Ayland,
Philippe Mathieu-Daudé, Artyom Tarasenko
Le 26/06/2020 à 23:23, Richard Henderson a écrit :
> On 6/25/20 2:12 AM, Laurent Vivier wrote:
>> I send a modified version according to Richard's comments of the original
>> series sent by Giuseppe Musacchio <thatlemon@gmail.com> (aka LemonBoy).
>>
>> v2: split patch in two patches
>> update comment style
>>
>> I didn't really test the new patches (except a build and "make check").
>> But there is no code modification so I don't think I can introduce bugs in
>> this process. Any "Tested-by:" is welcome.
>>
>> LemonBoy (2):
>> target/sparc: Translate flushw opcode
>> linux-user/sparc64: Fix the handling of window spill trap
>>
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> You might want to reset the Author to match the Signed-off-by.
Applied to my branch linux-user-for-5.1 with updated author to "Giuseppe
Musacchio <thatlemon@gmail.com>"
Thanks,
Laurent
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-29 11:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-25 9:12 [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 1/2] target/sparc: " Laurent Vivier
2020-06-25 9:12 ` [PATCH v2 2/2] linux-user/sparc64: Fix the handling of window spill trap Laurent Vivier
2020-06-26 21:23 ` [PATCH v2 0/2] linux-user/sparc64: Translate flushw opcode Richard Henderson
2020-06-29 11:01 ` Laurent Vivier
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).