* [PATCH] linux-user/sparc64: Translate flushw opcode
@ 2020-04-10 21:14 LemonBoy
2020-04-17 11:06 ` LemonBoy
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: LemonBoy @ 2020-04-10 21:14 UTC (permalink / raw)
To: qemu-devel, laurent, richard.henderson
From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
From: LemonBoy <thatlemon@gmail.com>
Date: Fri, 10 Apr 2020 22:55:26 +0200
Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
The ifdef logic should unconditionally compile in the `xop == 0x2b` case
when targeting sparc64.
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>
---
bsd-user/main.c | 4 +++-
linux-user/sparc/cpu_loop.c | 4 +++-
target/sparc/translate.c | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 770c2b267a..d6b1c997e3 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
--- a/linux-user/sparc/cpu_loop.c
+++ b/linux-user/sparc/cpu_loop.c
@@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
index 9416a551cf..1a4efd4ed6 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.20.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-04-10 21:14 [PATCH] linux-user/sparc64: Translate flushw opcode LemonBoy
@ 2020-04-17 11:06 ` LemonBoy
2020-05-07 14:17 ` Laurent Vivier
2020-05-07 18:33 ` Richard Henderson
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: LemonBoy @ 2020-04-17 11:06 UTC (permalink / raw)
To: qemu-devel, laurent, mark.cave-ayland, atar4qemu
Ping, I forgot to CC the SPARC mantainers in the previous mail.
On 10/04/20 23:14, LemonBoy wrote:
> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
> From: LemonBoy <thatlemon@gmail.com>
> Date: Fri, 10 Apr 2020 22:55:26 +0200
> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
>
> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
> when targeting sparc64.
>
> 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>
> ---
> bsd-user/main.c | 4 +++-
> linux-user/sparc/cpu_loop.c | 4 +++-
> target/sparc/translate.c | 2 ++
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 770c2b267a..d6b1c997e3 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
> --- a/linux-user/sparc/cpu_loop.c
> +++ b/linux-user/sparc/cpu_loop.c
> @@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
> index 9416a551cf..1a4efd4ed6 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);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-04-17 11:06 ` LemonBoy
@ 2020-05-07 14:17 ` Laurent Vivier
2020-05-07 15:29 ` Artyom Tarasenko
0 siblings, 1 reply; 7+ messages in thread
From: Laurent Vivier @ 2020-05-07 14:17 UTC (permalink / raw)
To: LemonBoy, qemu-devel, mark.cave-ayland, atar4qemu; +Cc: Richard Henderson
Hi,
could someone with SPARC knowledge review this patch?
I'd like to add it to linux-user queue.
Thanks,
Laurent
Le 17/04/2020 à 13:06, LemonBoy a écrit :
> Ping, I forgot to CC the SPARC mantainers in the previous mail.
>
> On 10/04/20 23:14, LemonBoy wrote:
>> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
>> From: LemonBoy <thatlemon@gmail.com>
>> Date: Fri, 10 Apr 2020 22:55:26 +0200
>> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
>>
>> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
>> when targeting sparc64.
>>
>> 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>
>> ---
>> bsd-user/main.c | 4 +++-
>> linux-user/sparc/cpu_loop.c | 4 +++-
>> target/sparc/translate.c | 2 ++
>> 3 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/bsd-user/main.c b/bsd-user/main.c
>> index 770c2b267a..d6b1c997e3 100644
>> --- a/bsd-user/main.c
>> +++ b/bsd-user/main.c
>> @@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
>> --- a/linux-user/sparc/cpu_loop.c
>> +++ b/linux-user/sparc/cpu_loop.c
>> @@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
>> index 9416a551cf..1a4efd4ed6 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);
>>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-05-07 14:17 ` Laurent Vivier
@ 2020-05-07 15:29 ` Artyom Tarasenko
0 siblings, 0 replies; 7+ messages in thread
From: Artyom Tarasenko @ 2020-05-07 15:29 UTC (permalink / raw)
To: Laurent Vivier; +Cc: LemonBoy, Richard Henderson, Mark Cave-Ayland, qemu-devel
On Thu, May 7, 2020 at 4:17 PM Laurent Vivier <laurent@vivier.eu> wrote:
>
> Hi,
>
> could someone with SPARC knowledge review this patch?
> I'd like to add it to linux-user queue.
>
Since it's TCG, I'd really preferred a review from Richard.
Regards,
Artyom
>
> Le 17/04/2020 à 13:06, LemonBoy a écrit :
> > Ping, I forgot to CC the SPARC mantainers in the previous mail.
> >
> > On 10/04/20 23:14, LemonBoy wrote:
> >> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
> >> From: LemonBoy <thatlemon@gmail.com>
> >> Date: Fri, 10 Apr 2020 22:55:26 +0200
> >> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
> >>
> >> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
> >> when targeting sparc64.
> >>
> >> 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>
> >> ---
> >> bsd-user/main.c | 4 +++-
> >> linux-user/sparc/cpu_loop.c | 4 +++-
> >> target/sparc/translate.c | 2 ++
> >> 3 files changed, 8 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/bsd-user/main.c b/bsd-user/main.c
> >> index 770c2b267a..d6b1c997e3 100644
> >> --- a/bsd-user/main.c
> >> +++ b/bsd-user/main.c
> >> @@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
> >> --- a/linux-user/sparc/cpu_loop.c
> >> +++ b/linux-user/sparc/cpu_loop.c
> >> @@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
> >> index 9416a551cf..1a4efd4ed6 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);
> >>
> >
>
--
Regards,
Artyom Tarasenko
SPARC and PPC PReP under qemu blog: http://tyom.blogspot.com/search/label/qemu
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-04-10 21:14 [PATCH] linux-user/sparc64: Translate flushw opcode LemonBoy
2020-04-17 11:06 ` LemonBoy
@ 2020-05-07 18:33 ` Richard Henderson
2020-05-28 17:13 ` Laurent Vivier
2020-06-08 17:29 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 7+ messages in thread
From: Richard Henderson @ 2020-05-07 18:33 UTC (permalink / raw)
To: LemonBoy, qemu-devel, laurent
On 4/10/20 2:14 PM, LemonBoy wrote:
> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
> From: LemonBoy <thatlemon@gmail.com>
> Date: Fri, 10 Apr 2020 22:55:26 +0200
> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
>
> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
> when targeting sparc64.
>
> Fix the handling of window spill traps by keeping cansave into account
> when calculating the new CWP.
This is two separate fixes and should be two separate patches.
> bsd-user/main.c | 4 +++-
> linux-user/sparc/cpu_loop.c | 4 +++-
First patch,
> target/sparc/translate.c | 2 ++
> 3 files changed, 8 insertions(+), 2 deletions(-)
Second patch.
> + /* cansave is zero if the spill trap handler is triggered by `save` and */
> + /* nonzero if triggered by a `flushw` */
Format the comment like so:
/*
* cansave is zero...
* nonzero if ...
*/
> + save_window_offset(env, cpu_cwp_dec(env, env->cwp - env->cansave - 2));
But this does match the implementation in sparc_cpu_do_interrupt, so the change
is good.
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index 9416a551cf..1a4efd4ed6 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);
Look ok here too.
r~
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-04-10 21:14 [PATCH] linux-user/sparc64: Translate flushw opcode LemonBoy
2020-04-17 11:06 ` LemonBoy
2020-05-07 18:33 ` Richard Henderson
@ 2020-05-28 17:13 ` Laurent Vivier
2020-06-08 17:29 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 7+ messages in thread
From: Laurent Vivier @ 2020-05-28 17:13 UTC (permalink / raw)
To: LemonBoy; +Cc: richard.henderson, qemu-devel
LemonBoy,
could you resend a series of two patches modified as said by Richard?
Changes should be only cosmetic.
Thanks,
Laurent
Le 10/04/2020 à 23:14, LemonBoy a écrit :
> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
> From: LemonBoy <thatlemon@gmail.com>
> Date: Fri, 10 Apr 2020 22:55:26 +0200
> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
>
> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
> when targeting sparc64.
>
> 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>
> ---
> bsd-user/main.c | 4 +++-
> linux-user/sparc/cpu_loop.c | 4 +++-
> target/sparc/translate.c | 2 ++
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 770c2b267a..d6b1c997e3 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
> --- a/linux-user/sparc/cpu_loop.c
> +++ b/linux-user/sparc/cpu_loop.c
> @@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
> index 9416a551cf..1a4efd4ed6 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);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] linux-user/sparc64: Translate flushw opcode
2020-04-10 21:14 [PATCH] linux-user/sparc64: Translate flushw opcode LemonBoy
` (2 preceding siblings ...)
2020-05-28 17:13 ` Laurent Vivier
@ 2020-06-08 17:29 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-06-08 17:29 UTC (permalink / raw)
To: LemonBoy, qemu-devel, laurent, richard.henderson
Hello Giuseppe,
On 4/10/20 11:14 PM, LemonBoy wrote:
> From 11d0cfe58d12e0f191b435ade88622cfceb2098a Mon Sep 17 00:00:00 2001
> From: LemonBoy <thatlemon@gmail.com>
> Date: Fri, 10 Apr 2020 22:55:26 +0200
> Subject: [PATCH] linux-user/sparc64: Translate flushw opcode
>
> The ifdef logic should unconditionally compile in the `xop == 0x2b` case
> when targeting sparc64.
>
> Fix the handling of window spill traps by keeping cansave into account
> when calculating the new CWP.
Thanks for the fix.
Do you mind addressing the comment Richard suggested?
Thanks!
Phil.
>
> Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
> ---
> bsd-user/main.c | 4 +++-
> linux-user/sparc/cpu_loop.c | 4 +++-
> target/sparc/translate.c | 2 ++
> 3 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/bsd-user/main.c b/bsd-user/main.c
> index 770c2b267a..d6b1c997e3 100644
> --- a/bsd-user/main.c
> +++ b/bsd-user/main.c
> @@ -413,7 +413,9 @@ 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 7645cc04ca..20a7401126 100644
> --- a/linux-user/sparc/cpu_loop.c
> +++ b/linux-user/sparc/cpu_loop.c
> @@ -69,7 +69,9 @@ 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/target/sparc/translate.c b/target/sparc/translate.c
> index 9416a551cf..1a4efd4ed6 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);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-06-08 17:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 21:14 [PATCH] linux-user/sparc64: Translate flushw opcode LemonBoy
2020-04-17 11:06 ` LemonBoy
2020-05-07 14:17 ` Laurent Vivier
2020-05-07 15:29 ` Artyom Tarasenko
2020-05-07 18:33 ` Richard Henderson
2020-05-28 17:13 ` Laurent Vivier
2020-06-08 17:29 ` Philippe Mathieu-Daudé
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).