accel/tcg: Widen TranslationBlock::flags to 64 bits
cover accel/tcg: Widen TranslationBlock::flags to 64 bits
Wanting to support another MIPS ISA I realized all the target flags are occupied. When that happen we use @cs_base as extra jocker, but then I remembered we aren't restricted to 32-bits anymore and can convert TranslationBlock::flags to uint64. Hence this series. Doing so I noticed RISCV MISA handling could be a bit simplified using full cs_base jocker card. Notes taken while auditing uses also committed.
Philippe Mathieu-Daudé (24):
target/arm: Widen CPUARMTBFlags::flags to 64 bits accel/tcg: Update stale TranslationBlock::jmp_lock comment accel/tcg: Widen TranslationBlock::flags to 64 bits target/arm: Update TB flags split comment for 64-bit tb->flags target/alpha: Use 64-bit TB flags
target/avr: Use 64-bit TB flags
target/hexagon: Use 64-bit TB flags
target/hppa: Use 64-bit TB flags
target/i386: Use 64-bit TB flags
target/loongarch: Use 64-bit TB flags
target/m68k: Use 64-bit TB flags
target/microblaze: Use 64-bit TB flags
target/mips: Use 64-bit TB flags
target/or1k: Use 64-bit TB flags
target/ppc: Use 64-bit TB flags
target/riscv: Use 64-bit TB flags
target/riscv: Partially revert use of tb->cs_base target/rx: Use 64-bit TB flags
target/s390x: Use 64-bit TB flags
target/sh4: Use 64-bit TB flags
target/sparc: Use 64-bit TB flags
target/tricore: Use 64-bit TB flags
target/xtensa: Use 64-bit TB flags
accel/tcg: Update TranslationBlock::cs_base description
accel/tcg/tb-hash.h | 5 +-- include/accel/tcg/tb-cpu-state.h | 2 +- include/exec/translation-block.h | 23 +++++++++---- target/arm/cpu.h | 17 +++++----- target/riscv/cpu.h | 8 ++--- target/sparc/cpu.h | 4 +-- accel/tcg/cpu-exec.c | 2 +- target/alpha/cpu.c | 2 +- target/alpha/translate.c | 2 +- target/arm/tcg/hflags.c | 4 +-- target/avr/cpu.c | 2 +- target/avr/translate.c | 2 +- target/hexagon/cpu.c | 16 ++++----- target/hexagon/translate.c | 14 ++++---- target/hppa/cpu.c | 2 +- target/hppa/translate.c | 2 +- target/i386/tcg/tcg-cpu.c | 3 +- target/i386/tcg/translate.c | 4 +-- target/loongarch/tcg/tcg_cpu.c | 2 +- target/m68k/cpu.c | 2 +- target/microblaze/translate.c | 6 ++-- target/mips/cpu.c | 2 +- target/mips/tcg/translate.c | 2 +- target/or1k/translate.c | 2 +- target/ppc/translate.c | 2 +- target/riscv/tcg/tcg-cpu.c | 58 +++++++++++++++----------------- target/riscv/tcg/translate.c | 49 +++++++++++++-------------- target/rx/cpu.c | 6 ++-- target/rx/translate.c | 16 ++++----- target/s390x/cpu.c | 2 +- target/sh4/cpu.c | 2 +- target/sh4/translate.c | 4 +-- target/sparc/cpu.c | 4 +-- target/tricore/cpu.c | 2 +- target/tricore/translate.c | 4 +-- target/xtensa/cpu.c | 2 +- target/xtensa/translate.c | 2 +- 37 files changed, 146 insertions(+), 137 deletions(-)
Signature · 1 line
2.55.0
PATCH 1/24 target/arm: Widen CPUARMTBFlags::flags to 64 bits
Use the 64-bit field accessors for TBFLAG_ANY and print the value with PRIx64. Prepare for TranslationBlock::flags becoming 64-bit.
--- target/arm/cpu.h | 12 ++++++------ target/arm/tcg/hflags.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-)
target/arm/cpu.h +6 -6
@@ -150,7 +150,7 @@ typedef struct ARMPACKey {/* See the commentary above the TBFLAG field definitions. */ typedef struct CPUARMTBFlags { -uint32_t flags; +uint64_t flags;uint64_t flags2; }CPUARMTBFlags ;
@@ -2614,12 +2614,12 @@ FIELD(TBFLAG_A64, MTE0_STORE_ONLY, 48, 1)FIELD (TBFLAG_A64 ,MTX ,49 ,2 )/* -* Helpers for using the above. Note that only the A64 accessors use -* FIELD_DP64() and FIELD_EX64(), because in the other cases the flags -* word either is or might be 32 bits only. +* Helpers for using the above. Note that only the ANY and A64 accessors +* use FIELD_DP64() and FIELD_EX64(), because the A32, M32 and AM32 +* fields all fit in 32 bits. */#define DP_TBFLAG_ANY (DST ,WHICH ,VAL ) \ - ((DST).flags = FIELD_DP32((DST).flags, TBFLAG_ANY, WHICH, VAL)) + ((DST).flags = FIELD_DP64((DST).flags, TBFLAG_ANY, WHICH, VAL))#define DP_TBFLAG_A64 (DST ,WHICH ,VAL ) \ ((DST).flags2 = FIELD_DP64((DST).flags2, TBFLAG_A64, WHICH, VAL))#define DP_TBFLAG_A32 (DST ,WHICH ,VAL ) \
@@ -2629,7 +2629,7 @@ FIELD(TBFLAG_A64, MTX, 49, 2)#define DP_TBFLAG_AM32 (DST ,WHICH ,VAL ) \ ((DST).flags2 = FIELD_DP32((DST).flags2, TBFLAG_AM32, WHICH, VAL)) -#define EX_TBFLAG_ANY (IN ,WHICH ) FIELD_EX32((IN).flags, TBFLAG_ANY, WHICH) +#define EX_TBFLAG_ANY (IN ,WHICH ) FIELD_EX64((IN).flags, TBFLAG_ANY, WHICH)#define EX_TBFLAG_A64 (IN ,WHICH ) FIELD_EX64((IN).flags2, TBFLAG_A64, WHICH)#define EX_TBFLAG_A32 (IN ,WHICH ) FIELD_EX32((IN).flags2, TBFLAG_A32, WHICH)#define EX_TBFLAG_M32 (IN ,WHICH ) FIELD_EX32((IN).flags2, TBFLAG_M32, WHICH)
target/arm/tcg/hflags.c +2 -2
@@ -753,8 +753,8 @@ static void assert_hflags_rebuild_correctly(CPUARMState *env)if (unlikely (c.flags != r.flags || c.flags2 != r.flags2)) {fprintf (stderr,"TCG hflags mismatch " -"(current:(0x%08x,0x%016" PRIx64")" -" rebuilt:(0x%08x,0x%016" PRIx64")\n" , +"(current:(0x%016" PRIx64",0x%016" PRIx64")" +" rebuilt:(0x%016" PRIx64",0x%016" PRIx64")\n" , c.flags, c.flags2, r.flags, r.flags2);abort (); }
Signature · 1 line
2.55.0
PATCH 3/24 accel/tcg: Widen TranslationBlock::flags to 64 bits
In reply to Philippe Mathieu-Daudé32-bit host support was removed in v11.0.0 (with commit 372ec46b9f "meson: Reject 32-bit hosts"), so there is no reason to keep the TB flags 32-bit. The wider field fills the 4-byte hole between icount and tc, leaving sizeof(TranslationBlock) unchanged. Widen TCGTBCPUState::flags too.
Feed the upper 32 bits into the TB hash, and adapt format string.
--- accel/tcg/tb-hash.h | 5 +++-- include/accel/tcg/tb-cpu-state.h | 2 +- include/exec/translation-block.h | 2 +- accel/tcg/cpu-exec.c | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-)
accel/tcg/tb-hash.h +3 -2
@@ -63,9 +63,10 @@ static inline unsigned int tb_jmp_cache_hash_func(vaddr pc)static inline uint32_t tb_hash_func (tb_page_addr_t phys_pc,vaddr pc, -uint32_t flags,uint64_t flags2,uint32_t cf_mask) +uint64_t flags,uint64_t flags2,uint32_t cf_mask) { -return qemu_xxhash8 (phys_pc, pc, flags2, flags, cf_mask); +/* Fold the upper flag bits into the cf_mask slot. */ +return qemu_xxhash8 (phys_pc, pc, flags2, flags, cf_mask ^ (flags >>32 )); }#endif
include/accel/tcg/tb-cpu-state.h +1 -1
@@ -14,7 +14,7 @@typedef struct TCGTBCPUState {vaddr pc; -uint32_t flags; +uint64_t flags;uint32_t cflags;uint64_t cs_base; }TCGTBCPUState ;
include/exec/translation-block.h +1 -1
@@ -69,7 +69,7 @@ struct TranslationBlock {*/ uint64_t cs_base; -uint32_t flags;/* flags defining in which context the code was generated */ +uint64_t flags;/* flags defining in which context the code was generated */ uint32_t cflags;/* compile flags */ /* Note that TCG_MAX_INSNS is 512; we validate this match elsewhere. */
accel/tcg/cpu-exec.c +1 -1
@@ -271,7 +271,7 @@ static void log_cpu_exec(vaddr pc, CPUState *cpu,if (qemu_log_in_addr_range (pc)) {qemu_log_mask (CPU_LOG_EXEC ,"Trace %d: %p [%08" PRIx64 -"/%016" VADDR_PRIx"/%08x/%08x] %s\n" , +"/%016" VADDR_PRIx"/%08" PRIx64"/%08x] %s\n" , cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags, tb->cflags,lookup_symbol (pc));
Signature · 1 line
2.55.0
PATCH 4/24 target/arm: Update TB flags split comment for 64-bit tb->flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags is now 64-bit, but AArch64 needs TBFLAG_ANY (15 bits) plus TBFLAG_A64 (51 bits), so the split with tb->cs_base is still required.
--- target/arm/cpu.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
target/arm/cpu.h +3 -2
@@ -2484,8 +2484,9 @@ static inline bool arm_sctlr_b(const CPUARMState *env)uint64_t arm_sctlr (CPUARMState *env,int el);/* -* We have more than 32-bits worth of state per TB, so we split the data -* between tb->flags and tb->cs_base, which is otherwise unused for ARM. +* We have more than 64-bits worth of state per TB (AArch64 needs +* TBFLAG_ANY (15 bits) plus TBFLAG_A64 (51 bits)), so we split the data +* between tb->flags and tb->cs_base. * We collect these two parts in CPUARMTBFlags where they are named * flags and flags2 respectively. *
Signature · 1 line
2.55.0
PATCH 7/24 target/hexagon: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/hexagon/cpu.c | 16 ++++++++-------- target/hexagon/translate.c | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-)
target/hexagon/cpu.c +8 -8
@@ -370,13 +370,13 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState *cs) {CPUHexagonState *env =cpu_env (cs);vaddr pc = env->gpr[HEX_REG_PC ]; -uint32_t hex_flags =0 ; +uint64_t hex_flags =0 ;#ifndef CONFIG_USER_ONLY HexagonCPU *cpu;#endif if (pc == env->gpr[HEX_REG_SA0 ]) { - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,IS_TIGHT_LOOP ,1 ); + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,IS_TIGHT_LOOP ,1 ); }if (pc &PCALIGN_MASK ) { env->cause_code =HEX_CAUSE_PC_NOT_ALIGNED ;
@@ -385,22 +385,22 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState *cs)#ifndef CONFIG_USER_ONLY cpu =env_archcpu (env); - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,MMU_INDEX , + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,MMU_INDEX ,cpu_mmu_index (env_cpu (env), false)); - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,HVX_COPROC_ENABLED , + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,HVX_COPROC_ENABLED , cpu->hvx_ctx[0 ] &&GET_SSR_FIELD (SSR_XE , env->t_sreg[HEX_SREG_SSR ])); - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,CPU_MODE , + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,CPU_MODE ,get_cpu_mode (env));/* Single-step applies only to user and guest mode packets */ - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,SS_ACTIVE , + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,SS_ACTIVE ,GET_SSR_FIELD (SSR_SS , env->t_sreg[HEX_SREG_SSR ]) &&get_cpu_mode (env) !=HEX_CPU_MODE_MONITOR ); - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,HMX_COPROC_ENABLED , + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,HMX_COPROC_ENABLED , cpu->hmx &&GET_SSR_FIELD (SSR_XE2 , env->t_sreg[HEX_SREG_SSR ]));#else - hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,MMU_INDEX ,MMU_USER_IDX ); + hex_flags =FIELD_DP64 (hex_flags,TB_FLAGS ,MMU_INDEX ,MMU_USER_IDX );#endif return (TCGTBCPUState ){ .pc = pc, .flags = hex_flags };
target/hexagon/translate.c +7 -7
@@ -1570,9 +1570,9 @@ static void hexagon_tr_init_disas_context(DisasContextBase *dcbase, {DisasContext *ctx =container_of (dcbase, DisasContext, base);HexagonCPU *hex_cpu =env_archcpu (cpu_env (cs)); -uint32_t hex_flags = dcbase->tb->flags; +uint64_t hex_flags = dcbase->tb->flags; - ctx->mem_idx =FIELD_EX32 (hex_flags,TB_FLAGS ,MMU_INDEX ); + ctx->mem_idx =FIELD_EX64 (hex_flags,TB_FLAGS ,MMU_INDEX ); ctx->num_packets =0 ; ctx->num_insns =0 ; ctx->num_hvx_insns =0 ;
@@ -1582,23 +1582,23 @@ static void hexagon_tr_init_disas_context(DisasContextBase *dcbase, ctx->hlx_check_emitted = false;#endif ctx->branch_cond =TCG_COND_NEVER ; - ctx->is_tight_loop =FIELD_EX32 (hex_flags,TB_FLAGS ,IS_TIGHT_LOOP ); + ctx->is_tight_loop =FIELD_EX64 (hex_flags,TB_FLAGS ,IS_TIGHT_LOOP ); ctx->short_circuit = hex_cpu->cfg.short_circuit; ctx->hex_def =HEXAGON_CPU_GET_CLASS (hex_cpu)->hex_def; ctx->ieee_fp_extension = hex_cpu->cfg.ieee_fp_extension;#ifndef CONFIG_USER_ONLY ctx->hvx_coproc_enabled = -FIELD_EX32 (hex_flags,TB_FLAGS ,HVX_COPROC_ENABLED ); +FIELD_EX64 (hex_flags,TB_FLAGS ,HVX_COPROC_ENABLED ); ctx->hvx_check_emitted = false; - ctx->cpu_mode =FIELD_EX32 (hex_flags,TB_FLAGS ,CPU_MODE ); - ctx->ss_active =FIELD_EX32 (hex_flags,TB_FLAGS ,SS_ACTIVE ); + ctx->cpu_mode =FIELD_EX64 (hex_flags,TB_FLAGS ,CPU_MODE ); + ctx->ss_active =FIELD_EX64 (hex_flags,TB_FLAGS ,SS_ACTIVE );if (ctx->ss_active) {/* Step one packet, and let endloop0 branch within the packet */ ctx->base.max_insns =1 ; ctx->is_tight_loop = false; } ctx->hmx_coproc_enabled = -FIELD_EX32 (hex_flags,TB_FLAGS ,HMX_COPROC_ENABLED ); +FIELD_EX64 (hex_flags,TB_FLAGS ,HMX_COPROC_ENABLED ); ctx->hmx_check_emitted = false;#endif }
Signature · 1 line
2.55.0
PATCH 6/24 target/avr: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/avr/cpu.c | 2 +- target/avr/translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/avr/cpu.c +1 -1
@@ -58,7 +58,7 @@ static int avr_cpu_mmu_index(CPUState *cs, bool ifetch)static TCGTBCPUState avr_get_tb_cpu_state (CPUState *cs) {CPUAVRState *env =cpu_env (cs); -uint32_t flags =0 ; +uint64_t flags =0 ;if (env->fullacc) { flags |=TB_FLAGS_FULL_ACCESS ;
target/avr/translate.c +1 -1
@@ -2660,7 +2660,7 @@ static bool canonicalize_skip(DisasContext *ctx)static void avr_tr_init_disas_context (DisasContextBase *dcbase,CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base); -uint32_t tb_flags = ctx->base.tb->flags; +uint64_t tb_flags = ctx->base.tb->flags; ctx->cs = cs; ctx->env =cpu_env (cs);
Signature · 1 line
2.55.0
PATCH 9/24 target/i386: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/i386/tcg/tcg-cpu.c | 3 ++- target/i386/tcg/translate.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
target/i386/tcg/tcg-cpu.c +2 -1
@@ -53,7 +53,8 @@ static void x86_cpu_exec_exit(CPUState *cs)static TCGTBCPUState x86_get_tb_cpu_state (CPUState *cs) {CPUX86State *env =cpu_env (cs); -uint32_t flags, cs_base; +uint64_t flags; +uint32_t cs_base;vaddr pc; flags = env->hflags |
target/i386/tcg/translate.c +2 -2
@@ -122,7 +122,7 @@ typedef struct DisasContext {CCOp cc_op;/* current CC operation */ int mem_index;/* select memory access functions */ -uint32_t flags;/* all execution flags */ +uint64_t flags;/* all execution flags */ int cpuid_features;int cpuid_ext_features;int cpuid_ext2_features;
@@ -3535,7 +3535,7 @@ static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) {DisasContext *dc =container_of (dcbase, DisasContext, base);CPUX86State *env =cpu_env (cpu); -uint32_t flags = dc->base.tb->flags; +uint64_t flags = dc->base.tb->flags;uint32_t cflags =tb_cflags (dc->base.tb);int cpl = (flags >>HF_CPL_SHIFT ) &3 ;int iopl = (flags >>IOPL_SHIFT ) &3 ;
Signature · 1 line
2.55.0
PATCH 5/24 target/alpha: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/alpha/cpu.c | 2 +- target/alpha/translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/alpha/cpu.c +1 -1
@@ -44,7 +44,7 @@ static vaddr alpha_cpu_get_pc(CPUState *cs)static TCGTBCPUState alpha_get_tb_cpu_state (CPUState *cs) {CPUAlphaState *env =cpu_env (cs); -uint32_t flags = env->flags &ENV_FLAG_TB_MASK ; +uint64_t flags = env->flags &ENV_FLAG_TB_MASK ;#ifdef CONFIG_USER_ONLY flags |=TB_FLAG_UNALIGN * !cs->prctl_unalign_sigbus;
target/alpha/translate.c +1 -1
@@ -48,7 +48,7 @@ struct DisasContext {#ifdef CONFIG_USER_ONLY MemOp unalign;#endif -uint32_t tbflags; +uint64_t tbflags;int mem_idx;/* True if generating pc-relative code. */
Signature · 1 line
2.55.0
PATCH 2/24 accel/tcg: Update stale TranslationBlock::jmp_lock comment
In reply to Philippe Mathieu-Daudéjmp_lock was placed to fill a 4-byte hole, but commit 9da6079b2695 ("tcg: Add TranslationBlock.jmp_insn_offset") added jmp_insn_offset[], so jmp_lock, jmp_reset_offset[] and jmp_insn_offset[] now take 12 bytes, leaving a 4-byte hole after jmp_insn_offset.
--- include/exec/translation-block.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/exec/translation-block.h +5 -1
@@ -113,7 +113,11 @@ struct TranslationBlock {tb_page_addr_t page_addr[2 ];#endif -/* jmp_lock placed here to fill a 4-byte hole. Its documentation is below */ +/* +* jmp_lock, jmp_reset_offset[] and jmp_insn_offset[] take 12 bytes, +* leaving a 4-byte hole before jmp_target_addr[]. +* jmp_lock documentation is below. +*/ QemuSpin jmp_lock;/* The following data are used to directly call another TB from
Signature · 1 line
2.55.0
PATCH 10/24 target/loongarch: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/loongarch/tcg/tcg_cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/loongarch/tcg/tcg_cpu.c +1 -1
@@ -236,7 +236,7 @@ static TCGTBCPUState loongarch_get_tb_cpu_state(CPUState *cs) {CPULoongArchState *env =cpu_env (cs);CPUSysState *sys =env_sys (env); -uint32_t flags; +uint64_t flags; flags = sys->CSR_CRMD & (R_CSR_CRMD_PLV_MASK |R_CSR_CRMD_PG_MASK ); flags |=FIELD_EX64 (sys->CSR_EUEN,CSR_EUEN ,FPE ) *HW_FLAGS_EUEN_FPE ;
Signature · 1 line
2.55.0
PATCH 11/24 target/m68k: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/m68k/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/m68k/cpu.c +1 -1
@@ -47,7 +47,7 @@ static vaddr m68k_cpu_get_pc(CPUState *cs)static TCGTBCPUState m68k_get_tb_cpu_state (CPUState *cs) {CPUM68KState *env =cpu_env (cs); -uint32_t flags; +uint64_t flags; flags = (env->macsr >>4 ) &TB_FLAGS_MACSR ;if (env->sr &SR_S ) {
Signature · 1 line
2.55.0
PATCH 12/24 target/microblaze: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/microblaze/translate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target/microblaze/translate.c +3 -3
@@ -68,8 +68,8 @@ typedef struct DisasContext {/* Decoder. */ uint32_t ext_imm; -unsigned int tb_flags; -unsigned int tb_flags_to_set; +uint64_t tb_flags; +uint64_t tb_flags_to_set;int mem_index;/* Condition under which to jump, including NEVER and ALWAYS. */
@@ -1668,7 +1668,7 @@ static void mb_tr_translate_insn(DisasContextBase *dcb, CPUState *cs)/* * Finish any return-from branch. */ -uint32_t rt_ibe = dc->tb_flags & (DRTI_FLAG |DRTB_FLAG |DRTE_FLAG ); +uint64_t rt_ibe = dc->tb_flags & (DRTI_FLAG |DRTB_FLAG |DRTE_FLAG );if (unlikely (rt_ibe !=0 )) { dc->tb_flags &= ~(DRTI_FLAG |DRTB_FLAG |DRTE_FLAG );if (rt_ibe &DRTI_FLAG ) {
Signature · 1 line
2.55.0
PATCH 8/24 target/hppa: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/hppa/cpu.c | 2 +- target/hppa/translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/hppa/cpu.c +1 -1
@@ -56,7 +56,7 @@ static vaddr hppa_cpu_get_pc(CPUState *cs)static TCGTBCPUState hppa_get_tb_cpu_state (CPUState *cs) {CPUHPPAState *env =cpu_env (cs); -uint32_t flags =0 ; +uint64_t flags =0 ;uint64_t cs_base =0 ;vaddr pc;
target/hppa/translate.c +1 -1
@@ -82,7 +82,7 @@ typedef struct DisasContext {TCGv_i64 zero;uint32_t insn; -uint32_t tb_flags; +uint64_t tb_flags;int mmu_idx;int privilege;uint32_t psw_xb;
Signature · 1 line
2.55.0
PATCH 16/24 target/riscv: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/riscv/tcg/tcg-cpu.c | 46 ++++++++++++++++++------------------ target/riscv/tcg/translate.c | 42 ++++++++++++++++---------------- 2 files changed, 44 insertions(+), 44 deletions(-)
target/riscv/tcg/tcg-cpu.c +23 -23
@@ -104,7 +104,7 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)CPURISCVState *env =cpu_env (cs);RISCVCPU *cpu =env_archcpu (env);RISCVExtStatus fs, vs; -uint32_t flags =0 ; +uint64_t flags =0 ;uint64_t ext_flags =0 ;bool pm_signext =riscv_cpu_virt_mem_enabled (env, false);
@@ -126,19 +126,19 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)uint32_t maxsz = vlmax << vsew;bool vl_eq_vlmax = (env->vstart ==0 ) && (vlmax == env->vl) && (maxsz >=8 ); - flags =FIELD_DP32 (flags,TB_FLAGS ,VILL , env->vill); - flags =FIELD_DP32 (flags,TB_FLAGS ,SEW , vsew); - flags =FIELD_DP32 (flags,TB_FLAGS ,LMUL , + flags =FIELD_DP64 (flags,TB_FLAGS ,VILL , env->vill); + flags =FIELD_DP64 (flags,TB_FLAGS ,SEW , vsew); + flags =FIELD_DP64 (flags,TB_FLAGS ,LMUL ,FIELD_EX64 (env->vtype,VTYPE ,VLMUL )); - flags =FIELD_DP32 (flags,TB_FLAGS ,VL_EQ_VLMAX , vl_eq_vlmax); - flags =FIELD_DP32 (flags,TB_FLAGS ,VTA , + flags =FIELD_DP64 (flags,TB_FLAGS ,VL_EQ_VLMAX , vl_eq_vlmax); + flags =FIELD_DP64 (flags,TB_FLAGS ,VTA ,FIELD_EX64 (env->vtype,VTYPE ,VTA )); - flags =FIELD_DP32 (flags,TB_FLAGS ,VMA , + flags =FIELD_DP64 (flags,TB_FLAGS ,VMA ,FIELD_EX64 (env->vtype,VTYPE ,VMA )); - flags =FIELD_DP32 (flags,TB_FLAGS ,VSTART_EQ_ZERO , env->vstart ==0 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,VSTART_EQ_ZERO , env->vstart ==0 ); ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,ALTFMT , altfmt); }else { - flags =FIELD_DP32 (flags,TB_FLAGS ,VILL ,1 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,VILL ,1 ); }if (cpu_get_fcfien (env)) {
@@ -147,26 +147,26 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)* the start of the block is tracked via env->elp. env->elp * is turned on during jalr translation. */ - flags =FIELD_DP32 (flags,TB_FLAGS ,FCFI_LP_EXPECTED , env->elp); - flags =FIELD_DP32 (flags,TB_FLAGS ,FCFI_ENABLED ,1 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,FCFI_LP_EXPECTED , env->elp); + flags =FIELD_DP64 (flags,TB_FLAGS ,FCFI_ENABLED ,1 ); }if (cpu_get_bcfien (env)) { - flags =FIELD_DP32 (flags,TB_FLAGS ,BCFI_ENABLED ,1 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,BCFI_ENABLED ,1 ); }#ifdef CONFIG_USER_ONLY fs =EXT_STATUS_DIRTY ; vs =EXT_STATUS_DIRTY ;#else - flags =FIELD_DP32 (flags,TB_FLAGS ,PRIV , env->priv); + flags =FIELD_DP64 (flags,TB_FLAGS ,PRIV , env->priv); flags |=riscv_env_mmu_index (env,0 ); fs =get_field (env->mstatus,MSTATUS_FS ); vs =get_field (env->mstatus,MSTATUS_VS );if (env->virt_enabled) { - flags =FIELD_DP32 (flags,TB_FLAGS ,VIRT_ENABLED ,1 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,VIRT_ENABLED ,1 );/* * Merge DISABLED and !DIRTY states using MIN. * We will set both fields when dirtying.
@@ -183,16 +183,16 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)if ((cpu->cfg.debug || cpu->cfg.ext_sdtrig) && !icount_enabled ()) { - flags =FIELD_DP32 (flags,TB_FLAGS ,ITRIGGER , env->itrigger_enabled); + flags =FIELD_DP64 (flags,TB_FLAGS ,ITRIGGER , env->itrigger_enabled); }#endif - flags =FIELD_DP32 (flags,TB_FLAGS ,FS , fs); - flags =FIELD_DP32 (flags,TB_FLAGS ,VS , vs); - flags =FIELD_DP32 (flags,TB_FLAGS ,XL , env->xl); - flags =FIELD_DP32 (flags,TB_FLAGS ,AXL ,cpu_address_xl (env)); - flags =FIELD_DP32 (flags,TB_FLAGS ,PM_PMM ,riscv_pm_get_pmm (env)); - flags =FIELD_DP32 (flags,TB_FLAGS ,PM_SIGNEXTEND , pm_signext); + flags =FIELD_DP64 (flags,TB_FLAGS ,FS , fs); + flags =FIELD_DP64 (flags,TB_FLAGS ,VS , vs); + flags =FIELD_DP64 (flags,TB_FLAGS ,XL , env->xl); + flags =FIELD_DP64 (flags,TB_FLAGS ,AXL ,cpu_address_xl (env)); + flags =FIELD_DP64 (flags,TB_FLAGS ,PM_PMM ,riscv_pm_get_pmm (env)); + flags =FIELD_DP64 (flags,TB_FLAGS ,PM_SIGNEXTEND , pm_signext); ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,MISA_EXT , env->misa_ext); ext_flags = FIELD_DP64(ext_flags, EXT_TB_FLAGS, BIG_ENDIAN,
@@ -216,7 +216,7 @@ static void riscv_cpu_synchronize_from_tb(CPUState *cs,if (!(tb_cflags (tb) &CF_PCREL )) {RISCVCPU *cpu =RISCV_CPU (cs);CPURISCVState *env = &cpu->env; -RISCVMXL xl =FIELD_EX32 (tb->flags,TB_FLAGS ,XL ); +RISCVMXL xl =FIELD_EX64 (tb->flags,TB_FLAGS ,XL );tcg_debug_assert (!tcg_cflags_has (cs,CF_PCREL ));
@@ -234,7 +234,7 @@ static void riscv_restore_state_to_opc(CPUState *cs, {RISCVCPU *cpu =RISCV_CPU (cs);CPURISCVState *env = &cpu->env; -RISCVMXL xl =FIELD_EX32 (tb->flags,TB_FLAGS ,XL ); +RISCVMXL xl =FIELD_EX64 (tb->flags,TB_FLAGS ,XL );target_ulong pc;if (tb_cflags (tb) &CF_PCREL ) {
target/riscv/tcg/translate.c +21 -21
66 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 14/24 target/or1k: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/or1k/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/or1k/translate.c +1 -1
@@ -45,7 +45,7 @@ typedef struct DisasContext { DisasContextBase base; uint32_t mem_idx; - uint32_t tb_flags; + uint64_t tb_flags; uint32_t delayed_branch; uint32_t cpucfgr; uint32_t avr;
Signature · 1 line
2.55.0
PATCH 18/24 target/rx: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/rx/cpu.c | 6 +++--- target/rx/translate.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-)
target/rx/cpu.c +3 -3
@@ -47,10 +47,10 @@ static vaddr rx_cpu_get_pc(CPUState *cs)static TCGTBCPUState rx_get_tb_cpu_state (CPUState *cs) {CPURXState *env =cpu_env (cs); -uint32_t flags =0 ; +uint64_t flags =0 ; - flags =FIELD_DP32 (flags,PSW ,PM , env->psw_pm); - flags =FIELD_DP32 (flags,PSW ,U , env->psw_u); + flags =FIELD_DP64 (flags,PSW ,PM , env->psw_pm); + flags =FIELD_DP64 (flags,PSW ,U , env->psw_u);return (TCGTBCPUState ){ .pc = env->pc, .flags = flags }; }
target/rx/translate.c +8 -8
@@ -36,7 +36,7 @@ typedef struct DisasContext {DisasContextBase base;CPURXState *env;uint32_t pc; -uint32_t tb_flags; +uint64_t tb_flags; } DisasContext; typedef struct DisasCompare {
@@ -243,7 +243,7 @@ static TCGv_i32 rx_load_source(DisasContext *ctx, TCGv_i32 mem,/* Processor mode check */ static int is_privileged (DisasContext *ctx,int is_exception) { -if (FIELD_EX32 (ctx->tb_flags,PSW ,PM )) { +if (FIELD_EX64 (ctx->tb_flags,PSW ,PM )) {if (is_exception) {gen_helper_raise_privilege_violation (tcg_env); }
@@ -332,7 +332,7 @@ static void move_from_cr(DisasContext *ctx, TCGv_i32 ret, int cr, uint32_t pc)tcg_gen_movi_i32 (ret, pc);break ;case 2 :/* USP */ -if (FIELD_EX32 (ctx->tb_flags,PSW ,U )) { +if (FIELD_EX64 (ctx->tb_flags,PSW ,U )) {tcg_gen_mov_i32 (ret, cpu_sp); }else {tcg_gen_mov_i32 (ret, cpu_usp);
@@ -348,7 +348,7 @@ static void move_from_cr(DisasContext *ctx, TCGv_i32 ret, int cr, uint32_t pc)tcg_gen_mov_i32 (ret, cpu_bpc);break ;case 10 :/* ISP */ -if (FIELD_EX32 (ctx->tb_flags,PSW ,U )) { +if (FIELD_EX64 (ctx->tb_flags,PSW ,U )) {tcg_gen_mov_i32 (ret, cpu_isp); }else {tcg_gen_mov_i32 (ret, cpu_sp);
@@ -386,7 +386,7 @@ static void move_to_cr(DisasContext *ctx, TCGv_i32 val, int cr)break ;/* case 1: to PC not supported */ case 2 :/* USP */ -if (FIELD_EX32 (ctx->tb_flags,PSW ,U )) { +if (FIELD_EX64 (ctx->tb_flags,PSW ,U )) {tcg_gen_mov_i32 (cpu_sp, val); }else {tcg_gen_mov_i32 (cpu_usp, val);
@@ -402,7 +402,7 @@ static void move_to_cr(DisasContext *ctx, TCGv_i32 val, int cr)tcg_gen_mov_i32 (cpu_bpc, val);break ;case 10 :/* ISP */ -if (FIELD_EX32 (ctx->tb_flags,PSW ,U )) { +if (FIELD_EX64 (ctx->tb_flags,PSW ,U )) {tcg_gen_mov_i32 (cpu_isp, val); }else {tcg_gen_mov_i32 (cpu_sp, val);
@@ -2080,8 +2080,8 @@ static void clrsetpsw(DisasContext *ctx, int cb, int val) ctx->base.is_jmp =DISAS_UPDATE ;break ;case PSW_U : -if (FIELD_EX32 (ctx->tb_flags,PSW ,U ) != val) { - ctx->tb_flags =FIELD_DP32 (ctx->tb_flags,PSW ,U , val); +if (FIELD_EX64 (ctx->tb_flags,PSW ,U ) != val) { + ctx->tb_flags =FIELD_DP64 (ctx->tb_flags,PSW ,U , val);tcg_gen_movi_i32 (cpu_psw_u, val);tcg_gen_mov_i32 (val ? cpu_isp : cpu_usp, cpu_sp);tcg_gen_mov_i32 (cpu_sp, val ? cpu_usp : cpu_isp);
Signature · 1 line
2.55.0
PATCH 13/24 target/mips: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/mips/cpu.c | 2 +- target/mips/tcg/translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/mips/cpu.c +1 -1
@@ -682,7 +682,7 @@ static int mips_cpu_mmu_index(CPUState *cs, bool ifunc)static TCGTBCPUState mips_get_tb_cpu_state (CPUState *cs) {CPUMIPSState *env =cpu_env (cs); -uint32_t flags = env->hflags &MIPS_HFLAG_TB_MASK ; +uint64_t flags = env->hflags &MIPS_HFLAG_TB_MASK ;#ifdef CONFIG_USER_ONLY if (!cs->prctl_unalign_sigbus) {
target/mips/tcg/translate.c +1 -1
@@ -15127,7 +15127,7 @@ static void mips_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base);CPUMIPSState *env =cpu_env (cs); -uint32_t tb_flags = ctx->base.tb->flags; +uint64_t tb_flags = ctx->base.tb->flags; ctx->page_start = ctx->base.pc_first &TARGET_PAGE_MASK ; ctx->saved_pc =-1 ;
Signature · 1 line
2.55.0
PATCH 17/24 target/riscv: Partially revert use of tb->cs_base
In reply to Philippe Mathieu-DaudéPartially revert commit 1c88ab9e77bd ("target/riscv: Use the tb->cs_base as the extend tb flags"): now that TranslationBlock::flags is 64-bit, keep only misa_ext in tb->cs_base (as in 55b490b58fbf) and move the other extended flags (ALTFMT, BIG_ENDIAN, SDEXT_STEP) into TB_FLAGS at bits 32+.
--- include/exec/translation-block.h | 2 +- target/riscv/cpu.h | 8 +++----- target/riscv/tcg/tcg-cpu.c | 12 +++++------- target/riscv/tcg/translate.c | 7 +++---- 4 files changed, 12 insertions(+), 17 deletions(-)
include/exec/translation-block.h +1 -1
@@ -65,7 +65,7 @@ struct TranslationBlock {* arm: an extension of tb->flags, * s390x: instruction data for EXECUTE, * sparc: the next pc of the instruction queue (for delay slots), -* riscv: an extension of tb->flags. +* riscv: misa_ext. */ uint64_t cs_base;
target/riscv/cpu.h +3 -5
@@ -777,12 +777,10 @@ FIELD(TB_FLAGS, BCFI_ENABLED, 28, 1)/* If pointer masking should be applied and address sign extended */ FIELD(TB_FLAGS, PM_PMM, 29, 2) FIELD(TB_FLAGS, PM_SIGNEXTEND, 31, 1) - -FIELD(EXT_TB_FLAGS, MISA_EXT, 0, 32) -FIELD(EXT_TB_FLAGS, ALTFMT, 32, 1) -FIELD (EXT_TB_FLAGS ,BIG_ENDIAN ,33 ,1 ) +FIELD(TB_FLAGS, ALTFMT, 32, 1) +FIELD (TB_FLAGS ,BIG_ENDIAN ,33 ,1 ) /* sdext single-step needs a TB flag to build 1-insn TBs */ -FIELD(EXT_TB_FLAGS, SDEXT_STEP, 34, 1) +FIELD(TB_FLAGS, SDEXT_STEP, 34, 1)#ifdef TARGET_RISCV32 #define riscv_cpu_mxl (env) ((void)(env), MXL_RV32)
target/riscv/tcg/tcg-cpu.c +5 -7
@@ -105,7 +105,6 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs)RISCVCPU *cpu =env_archcpu (env);RISCVExtStatus fs, vs;uint64_t flags =0 ; -uint64_t ext_flags =0 ;bool pm_signext =riscv_cpu_virt_mem_enabled (env, false);if (cpu->cfg.ext_zve32x) {
@@ -136,7 +135,7 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs) flags =FIELD_DP64 (flags,TB_FLAGS ,VMA ,FIELD_EX64 (env->vtype,VTYPE ,VMA )); flags =FIELD_DP64 (flags,TB_FLAGS ,VSTART_EQ_ZERO , env->vstart ==0 ); - ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,ALTFMT , altfmt); + flags =FIELD_DP64 (flags,TB_FLAGS ,ALTFMT , altfmt); }else { flags =FIELD_DP64 (flags,TB_FLAGS ,VILL ,1 ); }
@@ -194,19 +193,18 @@ static TCGTBCPUState riscv_get_tb_cpu_state(CPUState *cs) flags =FIELD_DP64 (flags,TB_FLAGS ,PM_PMM ,riscv_pm_get_pmm (env)); flags =FIELD_DP64 (flags,TB_FLAGS ,PM_SIGNEXTEND , pm_signext); - ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,MISA_EXT , env->misa_ext); - ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,BIG_ENDIAN , -mo_endian_env (env) ==MO_BE ); + flags =FIELD_DP64 (flags,TB_FLAGS ,BIG_ENDIAN , +mo_endian_env (env) ==MO_BE );#ifndef CONFIG_USER_ONLY if (cpu->cfg.ext_sdext && !env->debug_mode && (env->dcsr &DCSR_STEP )) { - ext_flags =FIELD_DP64 (ext_flags,EXT_TB_FLAGS ,SDEXT_STEP ,1 ); + flags =FIELD_DP64 (flags,TB_FLAGS ,SDEXT_STEP ,1 ); }#endif return (TCGTBCPUState ){ .pc = env->xl ==MXL_RV32 ? env->pc &UINT32_MAX : env->pc, .flags = flags, - .cs_base = ext_flags, + .cs_base = env->misa_ext, }; }
target/riscv/tcg/translate.c +3 -4
@@ -1324,7 +1324,6 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs)RISCVCPUClass *mcc =RISCV_CPU_GET_CLASS (cs);RISCVCPU *cpu =RISCV_CPU (cs);uint64_t tb_flags = ctx->base.tb->flags; -uint64_t ext_tb_flags = ctx->base.tb->cs_base; ctx->pc_save = ctx->base.pc_first; ctx->priv =FIELD_EX64 (tb_flags,TB_FLAGS ,PRIV );
@@ -1344,7 +1343,7 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->cfg_vta_all_1s = cpu->cfg.rvv_ta_all_1s; ctx->vstart_eq_zero =FIELD_EX64 (tb_flags,TB_FLAGS ,VSTART_EQ_ZERO ); ctx->vl_eq_vlmax =FIELD_EX64 (tb_flags,TB_FLAGS ,VL_EQ_VLMAX ); - ctx->altfmt =FIELD_EX64 (ext_tb_flags,EXT_TB_FLAGS ,ALTFMT ); + ctx->altfmt =FIELD_EX64 (tb_flags,TB_FLAGS ,ALTFMT ); ctx->misa_mxl_max = mcc->def->misa_mxl_max; ctx->xl =FIELD_EX64 (tb_flags,TB_FLAGS ,XL ); ctx->address_xl =FIELD_EX64 (tb_flags,TB_FLAGS ,AXL );
@@ -1362,11 +1361,11 @@ static void riscv_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) ctx->bcfi_enabled =FIELD_EX64 (tb_flags,TB_FLAGS ,BCFI_ENABLED ); ctx->fcfi_lp_expected =FIELD_EX64 (tb_flags,TB_FLAGS ,FCFI_LP_EXPECTED ); ctx->fcfi_enabled =FIELD_EX64 (tb_flags,TB_FLAGS ,FCFI_ENABLED ); - ctx->sdext_step =FIELD_EX64 (ext_tb_flags,EXT_TB_FLAGS ,SDEXT_STEP ); + ctx->sdext_step =FIELD_EX64 (tb_flags,TB_FLAGS ,SDEXT_STEP ); ctx->zero =tcg_constant_tl (0 ); ctx->virt_inst_excp = false; ctx->decoders = cpu->decoders; - ctx->mo_endianness =FIELD_EX64 (ext_tb_flags,EXT_TB_FLAGS ,BIG_ENDIAN ) + ctx->mo_endianness =FIELD_EX64 (tb_flags,TB_FLAGS ,BIG_ENDIAN ) ?MO_BE :MO_LE ; }
Signature · 1 line
2.55.0
PATCH 20/24 target/sh4: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/sh4/cpu.c | 2 +- target/sh4/translate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/sh4/cpu.c +1 -1
@@ -47,7 +47,7 @@ static vaddr superh_cpu_get_pc(CPUState *cs)static TCGTBCPUState superh_get_tb_cpu_state (CPUState *cs) {CPUSH4State *env =cpu_env (cs); -uint32_t flags; +uint64_t flags; flags = env->flags | (env->fpscr &TB_FLAG_FPSCR_MASK )
target/sh4/translate.c +2 -2
@@ -36,7 +36,7 @@ typedef struct DisasContext { DisasContextBase base; - uint32_t tbflags; /* should stay unmodified during the TB translation */ + uint64_t tbflags; /* should stay unmodified during the TB translation */ uint32_t envflags; /* should stay in sync with env->flags using TCG ops */ int memidx; int gbank;
@@ -2177,7 +2177,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State *env)static void sh4_tr_init_disas_context (DisasContextBase *dcbase,CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base); -uint32_t tbflags; +uint64_t tbflags;int bound; ctx->tbflags = tbflags = ctx->base.tb->flags;
Signature · 1 line
2.55.0
PATCH 15/24 target/ppc: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/ppc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/translate.c +1 -1
@@ -4996,7 +4996,7 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base);CPUPPCState *env =cpu_env (cs); -uint32_t hflags = ctx->base.tb->flags; +uint64_t hflags = ctx->base.tb->flags; ctx->spr_cb = env->spr_cb; ctx->pr = (hflags >>HFLAGS_PR ) &1 ;
Signature · 1 line
2.55.0
PATCH 19/24 target/s390x: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/s390x/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/s390x/cpu.c +1 -1
@@ -319,7 +319,7 @@ static int s390x_cpu_mmu_index(CPUState *cs, bool ifetch)static TCGTBCPUState s390x_get_tb_cpu_state (CPUState *cs) {CPUS390XState *env =cpu_env (cs); -uint32_t flags; +uint64_t flags;if (env->psw.addr &1 ) {/*
Signature · 1 line
2.55.0
PATCH 22/24 target/tricore: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/tricore/cpu.c | 2 +- target/tricore/translate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
target/tricore/cpu.c +1 -1
@@ -81,7 +81,7 @@ static TCGTBCPUState tricore_get_tb_cpu_state(CPUState *cs)return (TCGTBCPUState ){ .pc = env->PC, - .flags =FIELD_DP32 (0 ,TB_FLAGS ,PRIV ,extract32 (env->PSW,10 ,2 )), + .flags =FIELD_DP64 (0 ,TB_FLAGS ,PRIV ,extract32 (env->PSW,10 ,2 )), }; }
target/tricore/translate.c +2 -2
@@ -8389,8 +8389,8 @@ static void tricore_tr_init_disas_context(DisasContextBase *dcbase,CPUTriCoreState *env =cpu_env (cs); ctx->mem_idx =cpu_mmu_index (cs, false); -uint32_t tb_flags = (uint32_t )ctx->base.tb->flags; - ctx->priv =FIELD_EX32 (tb_flags,TB_FLAGS ,PRIV ); +uint64_t tb_flags = ctx->base.tb->flags; + ctx->priv =FIELD_EX64 (tb_flags,TB_FLAGS ,PRIV ); ctx->features = env->features;if (has_feature (ctx,TRICORE_FEATURE_161 )) {
Signature · 1 line
2.55.0
PATCH 23/24 target/xtensa: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/xtensa/cpu.c | 2 +- target/xtensa/translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
target/xtensa/cpu.c +1 -1
@@ -60,7 +60,7 @@ static vaddr xtensa_cpu_get_pc(CPUState *cs)static TCGTBCPUState xtensa_get_tb_cpu_state (CPUState *cs) {CPUXtensaState *env =cpu_env (cs); -uint32_t flags =0 ; +uint64_t flags =0 ;uint64_t cs_base =0 ; flags |=xtensa_get_ring (env);
target/xtensa/translate.c +1 -1
@@ -1121,7 +1121,7 @@ static void xtensa_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) {DisasContext *dc =container_of (dcbase, DisasContext, base); -uint32_t tb_flags = dc->base.tb->flags; +uint64_t tb_flags = dc->base.tb->flags; dc->config =cpu_env (cpu)->config; dc->pc = dc->base.pc_first;
Signature · 1 line
2.55.0
PATCH 24/24 accel/tcg: Update TranslationBlock::cs_base description
In reply to Philippe Mathieu-DaudéDescribe the current TranslationBlock::cs_base users.
Commits that introduced target use of cs_base:
arm: a378206a205a target/arm: Move mode specific TB flags to tb->cs_base
hppa: c301f34e798e target/hppa: Implement IASQ
ebd0e151149a target/hppa: Include priv level in user-only iaoq
microblaze: d7ecb757d199 target/microblaze: Ensure imm constant is always available
riscv: 55b490b58fbf target/riscv: Record misa_ext in TCGTBCPUState.cs_base
1c88ab9e77bd target/riscv: Use the tb->cs_base as the extend tb flags s390x: 303c681a8f50 target/s390x: Implement EXECUTE via new TranslationBlock sh4: 4bfa602bc222 target/sh4: Handle user-space atomics sparc: b453b70bd8e6 sparc fixes (first commit matching cs_base = env->npc) xtensa: 5d630cef4f91 target/xtensa: rework zero overhead loops implementation
--- include/exec/translation-block.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
include/exec/translation-block.h +11 -4
@@ -60,12 +60,19 @@ struct TranslationBlock {vaddr pc;/* -* Target-specific data associated with the TranslationBlock, e.g.: -* x86: the original user, the Code Segment virtual base, -* arm: an extension of tb->flags, +* cs_base: target-specific data associated with the TranslationBlock, +* as returned by cpu_get_tb_cpu_state() and part of the lookup key. +* +* Targets using it: +* x86: the Code Segment virtual base (0 in 64-bit mode), +* arm: an extension of tb->flags (CPUARMTBFlags::flags2), +* hppa: the CS_BASE_DIFF* bits and the IAOQ_B page offset, +* microblaze: the IMM prefix value, +* riscv: misa_ext (lookup key only, not read by the translator), * s390x: instruction data for EXECUTE, +* sh4: r0 (gUSA region end) when in a gUSA sequence (user-only), * sparc: the next pc of the instruction queue (for delay slots), -* riscv: misa_ext. +* xtensa: zero-overhead loop end distance and loop begin offset. */ uint64_t cs_base;
Signature · 1 line
2.55.0
PATCH 21/24 target/sparc: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéTranslationBlock::flags and TCGTBCPUState::flags are now 64-bit, use matching types for the values derived from them.
--- target/sparc/cpu.h | 4 ++-- target/sparc/cpu.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
target/sparc/cpu.h +2 -2
@@ -742,7 +742,7 @@ trap_state* cpu_tsptr(CPUSPARCState* env);#define TB_FLAG_FSR_QNE (1 << 8)#define TB_FLAG_ASI_SHIFT 24 -static inline bool tb_fpu_enabled (int tb_flags) +static inline bool tb_fpu_enabled (uint64_t tb_flags) {#if defined(CONFIG_USER_ONLY )return true;
@@ -751,7 +751,7 @@ static inline bool tb_fpu_enabled(int tb_flags)#endif } -static inline bool tb_am_enabled (int tb_flags) +static inline bool tb_am_enabled (uint64_t tb_flags) {#ifndef TARGET_SPARC64 return false;
target/sparc/cpu.c +2 -2
@@ -723,7 +723,7 @@ static void sparc_cpu_synchronize_from_tb(CPUState *cs,static TCGTBCPUState sparc_get_tb_cpu_state (CPUState *cs) {CPUSPARCState *env =cpu_env (cs); -uint32_t flags =cpu_mmu_index (cs, false); +uint64_t flags =cpu_mmu_index (cs, false);#ifndef CONFIG_USER_ONLY if (cpu_supervisor_mode (env)) {
@@ -742,7 +742,7 @@ static TCGTBCPUState sparc_get_tb_cpu_state(CPUState *cs)if ((env->pstate &PS_PEF ) && (env->fprs &FPRS_FEF )) { flags |=TB_FLAG_FPU_ENABLED ; } - flags |= env->asi <<TB_FLAG_ASI_SHIFT ; + flags |= (uint64_t )env->asi <<TB_FLAG_ASI_SHIFT ;#else if (env->psref) { flags |=TB_FLAG_FPU_ENABLED ;
Signature · 1 line
2.55.0
Re: [PATCH 07/24] target/hexagon: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéQuoted 8 lines · Philippe Mathieu-Daudé
TranslationBlock::flagsandTCGTBCPUState::flagsare now 64-bit, use matching types for the values derived from them.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/hexagon/cpu.c | 16 ++++++++-------- target/hexagon/translate.c | 14 +++++++------- 2 files changed, 15 insertions(+), 15 deletions(-)
Re: [PATCH 15/24] target/ppc: Use 64-bit TB flags
In reply to Philippe Mathieu-DaudéQuoted 4 lines · Philippe Mathieu-Daudé
TranslationBlock::flagsandTCGTBCPUState::flagsare now 64-bit, use matching types for the values derived from them.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Hi Philippe,
Few months back I was wondering why cs_base was used as an extension instead of extending flags to 64 bits. With this series, now I understand that it was to support 32 bit hosts. Thanks for that!
I was wondering if PPC env's internal hflags should also be extended to 64 bits with this, but I guess that can wait for when we actually have more than 32 bits needed there. With that,
Quoted 17 lines
--- target/ppc/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/translate.c +1
-1@@ -4996,7 +4996,7 @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) {DisasContext *ctx =container_of (dcbase, DisasContext, base);CPUPPCState *env =cpu_env (cs); -uint32_t hflags = ctx->base.tb->flags; +uint64_t hflags = ctx->base.tb->flags; ctx->spr_cb = env->spr_cb; ctx->pr = (hflags >>HFLAGS_PR ) &1 ;