@samitouri / QOSamiQemu / commits / 596081113b

target/arm/tcg/translate.h: replace target_long with int64_t

target_long is used to represent a pc diff. Checked all call sites to make sure we were already passing signed values, so extending works as expected. Use vaddr for pc_curr and pc_save. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-id: 20260219040150.2098396-14-pierrick.bouvier@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Pierrick Bouvier committed Feb 18, 2026 at 20:01 UTC 596081113bdd947ac8d8c85ba4a491df439c4d0d
3 files changed +16 -16
target/arm/tcg/translate-a32.h
+1 -1
@@ -40,7 +40,7 @@ void write_neon_element64(TCGv_i64 src, int reg, int ele, MemOp memop);
40 TCGv_i32 add_reg_for_lit(DisasContext *s, int reg, int ofs);
41 void gen_set_cpsr(TCGv_i32 var, uint32_t mask);
42 void gen_set_condexec(DisasContext *s);
43 -void gen_update_pc(DisasContext *s, target_long diff);
43 +void gen_update_pc(DisasContext *s, int64_t diff);
44 void gen_lookup_tb(DisasContext *s);
45 long vfp_reg_offset(bool dp, unsigned reg);
46 long neon_full_reg_offset(unsigned reg);
target/arm/tcg/translate.c
+9 -9
@@ -253,12 +253,12 @@ static inline int get_a32_user_mem_index(DisasContext *s)
253 }
254
255 /* The pc_curr difference for an architectural jump. */
256 -static target_long jmp_diff(DisasContext *s, target_long diff)
256 +static int64_t jmp_diff(DisasContext *s, int64_t diff)
257 {
258 return diff + (s->thumb ? 4 : 8);
259 }
260
261 -static void gen_pc_plus_diff(DisasContext *s, TCGv_i32 var, target_long diff)
261 +static void gen_pc_plus_diff(DisasContext *s, TCGv_i32 var, int64_t diff)
262 {
263 assert(s->pc_save != -1);
264 if (tb_cflags(s->base.tb) & CF_PCREL) {
@@ -738,7 +738,7 @@ void gen_set_condexec(DisasContext *s)
738 }
739 }
740
741 -void gen_update_pc(DisasContext *s, target_long diff)
741 +void gen_update_pc(DisasContext *s, int64_t diff)
742 {
743 gen_pc_plus_diff(s, cpu_R[15], diff);
744 s->pc_save = s->pc_curr + diff;
@@ -1058,7 +1058,7 @@ static void gen_exception(int excp, uint32_t syndrome)
1058 tcg_constant_i32(syndrome));
1059 }
1060
1061 -static void gen_exception_insn_el_v(DisasContext *s, target_long pc_diff,
1061 +static void gen_exception_insn_el_v(DisasContext *s, int64_t pc_diff,
1062 int excp, uint32_t syn, TCGv_i32 tcg_el)
1063 {
1064 if (s->aarch64) {
@@ -1071,14 +1071,14 @@ static void gen_exception_insn_el_v(DisasContext *s, target_long pc_diff,
1071 s->base.is_jmp = DISAS_NORETURN;
1072 }
1073
1074 -void gen_exception_insn_el(DisasContext *s, target_long pc_diff, int excp,
1074 +void gen_exception_insn_el(DisasContext *s, int64_t pc_diff, int excp,
1075 uint32_t syn, uint32_t target_el)
1076 {
1077 gen_exception_insn_el_v(s, pc_diff, excp, syn,
1078 tcg_constant_i32(target_el));
1079 }
1080
1081 -void gen_exception_insn(DisasContext *s, target_long pc_diff,
1081 +void gen_exception_insn(DisasContext *s, int64_t pc_diff,
1082 int excp, uint32_t syn)
1083 {
1084 if (s->aarch64) {
@@ -1313,7 +1313,7 @@ static void gen_goto_ptr(void)
1313 * cpu_loop_exec. Any live exit_requests will be processed as we
1314 * enter the next TB.
1315 */
1316 -static void gen_goto_tb(DisasContext *s, unsigned tb_slot_idx, target_long diff)
1316 +static void gen_goto_tb(DisasContext *s, unsigned tb_slot_idx, int64_t diff)
1317 {
1318 if (translator_use_goto_tb(&s->base, s->pc_curr + diff)) {
1319 /*
@@ -1340,7 +1340,7 @@ static void gen_goto_tb(DisasContext *s, unsigned tb_slot_idx, target_long diff)
1340 }
1341
1342 /* Jump, specifying which TB number to use if we gen_goto_tb() */
1343 -static void gen_jmp_tb(DisasContext *s, target_long diff, int tbno)
1343 +static void gen_jmp_tb(DisasContext *s, int64_t diff, int tbno)
1344 {
1345 if (unlikely(s->ss_active)) {
1346 /* An indirect jump so that we still trigger the debug exception. */
@@ -1383,7 +1383,7 @@ static void gen_jmp_tb(DisasContext *s, target_long diff, int tbno)
1383 }
1384 }
1385
1386 -static inline void gen_jmp(DisasContext *s, target_long diff)
1386 +static inline void gen_jmp(DisasContext *s, int64_t diff)
1387 {
1388 gen_jmp_tb(s, diff, 0);
1389 }
target/arm/tcg/translate.h
+6 -6
@@ -27,8 +27,8 @@ typedef struct DisasLabel {
27 typedef struct DisasDelayException {
28 struct DisasDelayException *next;
29 TCGLabel *lab;
30 - target_long pc_curr;
31 - target_long pc_save;
30 + vaddr pc_curr;
31 + vaddr pc_save;
32 int condexec_mask;
33 int condexec_cond;
34 uint32_t excp;
@@ -359,14 +359,14 @@ static inline int curr_insn_len(DisasContext *s)
359
360 #ifdef TARGET_AARCH64
361 void a64_translate_init(void);
362 -void gen_a64_update_pc(DisasContext *s, target_long diff);
362 +void gen_a64_update_pc(DisasContext *s, int64_t diff);
363 extern const TranslatorOps aarch64_translator_ops;
364 #else
365 static inline void a64_translate_init(void)
366 {
367 }
368
369 -static inline void gen_a64_update_pc(DisasContext *s, target_long diff)
369 +static inline void gen_a64_update_pc(DisasContext *s, int64_t diff)
370 {
371 }
372 #endif
@@ -377,9 +377,9 @@ void arm_gen_test_cc(int cc, TCGLabel *label);
377 MemOp pow2_align(unsigned i);
378 void unallocated_encoding(DisasContext *s);
379 void gen_exception_internal(int excp);
380 -void gen_exception_insn_el(DisasContext *s, target_long pc_diff, int excp,
380 +void gen_exception_insn_el(DisasContext *s, int64_t pc_diff, int excp,
381 uint32_t syn, uint32_t target_el);
382 -void gen_exception_insn(DisasContext *s, target_long pc_diff,
382 +void gen_exception_insn(DisasContext *s, int64_t pc_diff,
383 int excp, uint32_t syn);
384 TCGLabel *delay_exception_el(DisasContext *s, int excp,
385 uint32_t syn, uint32_t target_el);