Skip to contentSkip to conversation

target/xtensa: Remove all uses of target_ulong type

PATCH In review Philippe Mathieu-Daudé 2 participants 6 messages Oct 8, 2025 – Oct 15, 2025

lore
Share & tools
lore
#0 lore raw

cover target/xtensa: Remove all uses of target_ulong type

Remove the left over target_ulong uses in Xtensa frontend.

Philippe Mathieu-Daudé (2):
target/xtensa: Remove target_ulong use in xtensa_tr_translate_insn() target/xtensa: Remove target_ulong use in xtensa_get_tb_cpu_state()

 target/xtensa/cpu.c       | 6 +++---
 target/xtensa/translate.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.51.0
#1 lore raw

PATCH 1/2 target/xtensa: Remove target_ulong use in xtensa_tr_translate_insn()

Since commit 85c19af63e7 ("include/exec: Use vaddr in DisasContextBase for virtual addresses") the DisasContextBase::pc_first field is a vaddr type.

---
 target/xtensa/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/xtensa/translate.c +1 -1
index 34ae2f4e162..bb8d2ed86cf 100644
@@ -1166,7 +1166,7 @@ static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
 {
     DisasContext *dc = container_of(dcbase, DisasContext, base);
     CPUXtensaState *env = cpu_env(cpu);
-    target_ulong page_start;
+    vaddr page_start;
 
     /* These two conditions only apply to the first insn in the TB,
        but this is the first TranslateOps hook that allows exiting.  */
Signature · 1 line
2.51.0
Reviewed-by Anton Johansson on v1 1/2
#2 lore raw

Re: [PATCH 1/2] target/xtensa: Remove target_ulong use in xtensa_tr_translate_insn()

Quoted 25 lines · Philippe Mathieu-Daudé

Since commit 85c19af63e7 ("include/exec: Use vaddr in DisasContextBase for virtual addresses") the DisasContextBase::pc_first field is a vaddr type.

---
 target/xtensa/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target/xtensa/translate.c +1 -1
index 34ae2f4e162..bb8d2ed86cf 100644
@@ -1166,7 +1166,7 @@ static void xtensa_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu)
 {
     DisasContext *dc = container_of(dcbase, DisasContext, base);
     CPUXtensaState *env = cpu_env(cpu);
-    target_ulong page_start;
+    vaddr page_start;
 
     /* These two conditions only apply to the first insn in the TB,
        but this is the first TranslateOps hook that allows exiting.  */
Signature · 1 line
2.51.0
#3 lore raw

PATCH 2/2 target/xtensa: Remove target_ulong use in xtensa_get_tb_cpu_state()

In reply to Philippe Mathieu-Daudé

Since commit bb5de52524c ("target: Widen pc/cs_base in cpu_get_tb_cpu_state"), cpu_get_tb_cpu_state() expects a uint64_t type for cs_base.

---
 target/xtensa/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
target/xtensa/cpu.c +3 -3
index ea9b6df3aa2..1eeed44e336 100644
@@ -59,13 +59,13 @@ static TCGTBCPUState xtensa_get_tb_cpu_state(CPUState *cs)
 {
     CPUXtensaState *env = cpu_env(cs);
     uint32_t flags = 0;
-    target_ulong cs_base = 0;
+    uint64_t cs_base = 0;
 
     flags |= xtensa_get_ring(env);
     if (env->sregs[PS] & PS_EXCM) {
         flags |= XTENSA_TBFLAG_EXCM;
     } else if (xtensa_option_enabled(env->config, XTENSA_OPTION_LOOP)) {
-        target_ulong lend_dist =
+        uint64_t lend_dist =
             env->sregs[LEND] - (env->pc & -(1u << TARGET_PAGE_BITS));
 
         /*
@@ -83,7 +83,7 @@ static TCGTBCPUState xtensa_get_tb_cpu_state(CPUState *cs)
          * for the TB that contains this instruction.
          */
         if (lend_dist < (1u << TARGET_PAGE_BITS) + env->config->max_insn_size) {
-            target_ulong lbeg_off = env->sregs[LEND] - env->sregs[LBEG];
+            uint64_t lbeg_off = env->sregs[LEND] - env->sregs[LBEG];
 
             cs_base = lend_dist;
             if (lbeg_off < 256) {
Signature · 1 line
2.51.0
Reviewed-by Anton Johansson on v1 2/2
#4 lore raw

Re: [PATCH 2/2] target/xtensa: Remove target_ulong use in xtensa_get_tb_cpu_state()

Quoted 8 lines · Philippe Mathieu-Daudé

Since commit bb5de52524c ("target: Widen pc/cs_base in cpu_get_tb_cpu_state"), cpu_get_tb_cpu_state() expects a uint64_t type for cs_base.

---
 target/xtensa/cpu.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Remove the left over target_ulong uses in Xtensa frontend.

Philippe Mathieu-Daudé (2):
target/xtensa: Remove target_ulong use in xtensa_tr_translate_insn() target/xtensa: Remove target_ulong use in xtensa_get_tb_cpu_state()

Series queued, thanks.