Skip to contentSkip to conversation

target/rx: Use target_ulong for address in LI

PATCH In review Richard Henderson 2 participants 2 messages Jul 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/rx: Use target_ulong for address in LI

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

---
 target/rx/translate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
target/rx/translate.c +2 -1
index 9b81cf20b3..9aade2b6e5 100644
@@ -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;
 
Signature · 1 line
2.43.0
Tested-by on v1 1/1
#1 lore raw
Quoted 14 lines · Richard Henderson

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

---
  target/rx/translate.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
target/rx/translate.c +0 -0
index 9b81cf20b3..9aade2b6e5 100644

target/rx/translate.c static uint32_t decode_load_bytes(DisasContext *ctx, uint32_t insn, · line 92

Quoted 9 lines
target/rx/translate.c +2 -1
@@ -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.