qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-8.2] target/sparc: Fix RETURN
@ 2023-11-08 20:47 Richard Henderson
  2023-11-08 21:18 ` Philippe Mathieu-Daudé
  2023-11-09 18:49 ` Mark Cave-Ayland
  0 siblings, 2 replies; 3+ messages in thread
From: Richard Henderson @ 2023-11-08 20:47 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark Cave-Ayland

Perform window restore before pc update. Required in order
to recognize any window underflow trap with the current pc.

Fixes: 86b82fe021f4 ("target/sparc: Move JMPL, RETT, RETURN to decodetree")
Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/sparc/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/sparc/translate.c b/target/sparc/translate.c
index 6fc333a6b8..9387299559 100644
--- a/target/sparc/translate.c
+++ b/target/sparc/translate.c
@@ -4096,12 +4096,12 @@ TRANS(RETT, 32, do_add_special, a, do_rett)
 static bool do_return(DisasContext *dc, int rd, TCGv src)
 {
     gen_check_align(dc, src, 3);
+    gen_helper_restore(tcg_env);
 
     gen_mov_pc_npc(dc);
     tcg_gen_mov_tl(cpu_npc, src);
     gen_address_mask(dc, cpu_npc);
 
-    gen_helper_restore(tcg_env);
     dc->npc = DYNAMIC_PC_LOOKUP;
     return true;
 }
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH for-8.2] target/sparc: Fix RETURN
  2023-11-08 20:47 [PATCH for-8.2] target/sparc: Fix RETURN Richard Henderson
@ 2023-11-08 21:18 ` Philippe Mathieu-Daudé
  2023-11-09 18:49 ` Mark Cave-Ayland
  1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-11-08 21:18 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel; +Cc: Mark Cave-Ayland

On 8/11/23 21:47, Richard Henderson wrote:
> Perform window restore before pc update. Required in order
> to recognize any window underflow trap with the current pc.
> 
> Fixes: 86b82fe021f4 ("target/sparc: Move JMPL, RETT, RETURN to decodetree")
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/sparc/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index 6fc333a6b8..9387299559 100644
> --- a/target/sparc/translate.c
> +++ b/target/sparc/translate.c
> @@ -4096,12 +4096,12 @@ TRANS(RETT, 32, do_add_special, a, do_rett)
>   static bool do_return(DisasContext *dc, int rd, TCGv src)
>   {
>       gen_check_align(dc, src, 3);
> +    gen_helper_restore(tcg_env);
>   
>       gen_mov_pc_npc(dc);
>       tcg_gen_mov_tl(cpu_npc, src);
>       gen_address_mask(dc, cpu_npc);
>   
> -    gen_helper_restore(tcg_env);

Ahah! I noticed that earlier in a late review, wondered why you moved
that gen_helper_restore() call after updating $nPC, but my SPARC is now
rusty so I was sure I was missing something. Too shy to ask :/

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

>       dc->npc = DYNAMIC_PC_LOOKUP;
>       return true;
>   }



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH for-8.2] target/sparc: Fix RETURN
  2023-11-08 20:47 [PATCH for-8.2] target/sparc: Fix RETURN Richard Henderson
  2023-11-08 21:18 ` Philippe Mathieu-Daudé
@ 2023-11-09 18:49 ` Mark Cave-Ayland
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Cave-Ayland @ 2023-11-09 18:49 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

On 08/11/2023 20:47, Richard Henderson wrote:

> Perform window restore before pc update. Required in order
> to recognize any window underflow trap with the current pc.
> 
> Fixes: 86b82fe021f4 ("target/sparc: Move JMPL, RETT, RETURN to decodetree")
> Reported-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/sparc/translate.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/sparc/translate.c b/target/sparc/translate.c
> index 6fc333a6b8..9387299559 100644
> --- a/target/sparc/translate.c
> +++ b/target/sparc/translate.c
> @@ -4096,12 +4096,12 @@ TRANS(RETT, 32, do_add_special, a, do_rett)
>   static bool do_return(DisasContext *dc, int rd, TCGv src)
>   {
>       gen_check_align(dc, src, 3);
> +    gen_helper_restore(tcg_env);
>   
>       gen_mov_pc_npc(dc);
>       tcg_gen_mov_tl(cpu_npc, src);
>       gen_address_mask(dc, cpu_npc);
>   
> -    gen_helper_restore(tcg_env);
>       dc->npc = DYNAMIC_PC_LOOKUP;
>       return true;
>   }

Thanks Richard! I've tried booting the FreeBSD ISO several times with this patch 
applied, and haven't seen a single failure so:

Tested-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-09 18:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 20:47 [PATCH for-8.2] target/sparc: Fix RETURN Richard Henderson
2023-11-08 21:18 ` Philippe Mathieu-Daudé
2023-11-09 18:49 ` Mark Cave-Ayland

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).