qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/rx: Use target_ulong for address in LI
@ 2024-07-24  4:56 Richard Henderson
  2024-07-24  6:15 ` Thomas Huth
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Henderson @ 2024-07-24  4:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: thuth

Using int32_t meant that the address was sign-extended to uint64_t
when passing to translator_ld*, triggering an assert.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2453
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/rx/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/target/rx/translate.c b/target/rx/translate.c
index 9b81cf20b3..9aade2b6e5 100644
--- a/target/rx/translate.c
+++ b/target/rx/translate.c
@@ -85,7 +85,8 @@ static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn,
 
 static uint32_t li(DisasContext *ctx, int sz)
 {
-    int32_t tmp, addr;
+    target_ulong addr;
+    uint32_t tmp;
     CPURXState *env = ctx->env;
     addr = ctx->base.pc_next;
 
-- 
2.43.0



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

* Re: [PATCH] target/rx: Use target_ulong for address in LI
  2024-07-24  4:56 [PATCH] target/rx: Use target_ulong for address in LI Richard Henderson
@ 2024-07-24  6:15 ` Thomas Huth
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Huth @ 2024-07-24  6:15 UTC (permalink / raw)
  To: Richard Henderson, qemu-devel

On 24/07/2024 06.56, Richard Henderson wrote:
> Using int32_t meant that the address was sign-extended to uint64_t
> when passing to translator_ld*, triggering an assert.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2453
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/rx/translate.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target/rx/translate.c b/target/rx/translate.c
> index 9b81cf20b3..9aade2b6e5 100644
> --- a/target/rx/translate.c
> +++ b/target/rx/translate.c
> @@ -85,7 +85,8 @@ static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn,
>   
>   static uint32_t li(DisasContext *ctx, int sz)
>   {
> -    int32_t tmp, addr;
> +    target_ulong addr;
> +    uint32_t tmp;
>       CPURXState *env = ctx->env;
>       addr = ctx->base.pc_next;
>   

Thank you very much! This fixes the problem for me.

Tested-by: Thomas Huth <thuth@redhat.com>



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

end of thread, other threads:[~2024-07-24  6:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-24  4:56 [PATCH] target/rx: Use target_ulong for address in LI Richard Henderson
2024-07-24  6:15 ` Thomas Huth

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