@@ -256,6 +256,16 @@ void tb_free(TranslationBlock *tb);
void tb_flush(CPUState *cpu);
void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr);
+static inline void tb_mark_invalid(TranslationBlock *tb)
+{
+ cpu_get_invalid_tb_cpu_state(&tb->pc, &tb->cs_base, &tb->flags);
+}
+
+static inline bool tb_is_invalid(TranslationBlock *tb)
+{
+ return cpu_tb_cpu_state_is_invalidated(tb->pc, tb->cs_base, tb->flags);
+}
+
#if defined(USE_DIRECT_JUMP)
#if defined(CONFIG_TCG_INTERPRETER)
@@ -524,4 +524,18 @@ static inline void cpu_get_tb_cpu_state(CPUAlphaState *env, target_ulong *pc,
*pflags = flags;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#endif /* ALPHA_CPU_H */
@@ -2371,6 +2371,20 @@ static inline void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc,
*cs_base = 0;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
enum {
QEMU_PSCI_CONDUIT_DISABLED = 0,
QEMU_PSCI_CONDUIT_SMC = 1,
@@ -296,6 +296,20 @@ static inline void cpu_get_tb_cpu_state(CPUCRISState *env, target_ulong *pc,
| X_FLAG | PFIX_FLAG));
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#define cpu_list cris_cpu_list
void cris_cpu_list(FILE *f, fprintf_function cpu_fprintf);
@@ -130,6 +130,8 @@
positions to ease oring with eflags. */
/* current cpl */
#define HF_CPL_SHIFT 0
+/* used to mark invalidated translation blocks */
+#define HF_INVALID_SHIFT 2
/* true if hardware interrupts must be disabled for next instruction */
#define HF_INHIBIT_IRQ_SHIFT 3
/* 16 or 32 segments */
@@ -159,6 +161,7 @@
#define HF_MPX_IU_SHIFT 26 /* BND registers in-use */
#define HF_CPL_MASK (3 << HF_CPL_SHIFT)
+#define HF_INVALID_MASK (1 << HF_INVALID_SHIFT)
#define HF_INHIBIT_IRQ_MASK (1 << HF_INHIBIT_IRQ_SHIFT)
#define HF_CS32_MASK (1 << HF_CS32_SHIFT)
#define HF_SS32_MASK (1 << HF_SS32_SHIFT)
@@ -1490,6 +1493,20 @@ static inline void cpu_get_tb_cpu_state(CPUX86State *env, target_ulong *pc,
(env->eflags & (IOPL_MASK | TF_MASK | RF_MASK | VM_MASK | AC_MASK));
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *flags = HF_INVALID_MASK;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return flags == HF_INVALID_MASK;
+}
+
void do_cpu_init(X86CPU *cpu);
void do_cpu_sipi(X86CPU *cpu);
@@ -271,4 +271,18 @@ static inline void cpu_get_tb_cpu_state(CPULM32State *env, target_ulong *pc,
*flags = 0;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#endif
@@ -270,4 +270,18 @@ static inline void cpu_get_tb_cpu_state(CPUM68KState *env, target_ulong *pc,
| ((env->macsr >> 4) & 0xf); /* Bits 0-3 */
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#endif
@@ -372,6 +372,20 @@ static inline void cpu_get_tb_cpu_state(CPUMBState *env, target_ulong *pc,
(env->sregs[SR_MSR] & (MSR_UM | MSR_VM | MSR_EE));
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#if !defined(CONFIG_USER_ONLY)
void mb_cpu_unassigned_access(CPUState *cpu, hwaddr addr,
bool is_write, bool is_exec, int is_asi,
@@ -901,6 +901,20 @@ static inline void cpu_get_tb_cpu_state(CPUMIPSState *env, target_ulong *pc,
MIPS_HFLAG_HWRENA_ULR);
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
static inline int mips_vpe_active(CPUMIPSState *env)
{
int active = 1;
@@ -137,6 +137,20 @@ static inline void cpu_get_tb_cpu_state(CPUMoxieState *env, target_ulong *pc,
*flags = 0;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
int moxie_cpu_handle_mmu_fault(CPUState *cpu, vaddr address,
int rw, int mmu_idx);
@@ -398,6 +398,20 @@ static inline void cpu_get_tb_cpu_state(CPUOpenRISCState *env,
*flags = (env->flags & D_FLAG);
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
static inline int cpu_mmu_index(CPUOpenRISCState *env, bool ifetch)
{
if (!(env->sr & SR_IME)) {
@@ -2295,6 +2295,20 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
*flags = env->hflags;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#if !defined(CONFIG_USER_ONLY)
static inline int booke206_tlbm_id(CPUPPCState *env, ppcmas_tlb_t *tlbm)
{
@@ -394,6 +394,20 @@ static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
((env->psw.mask & PSW_MASK_32) ? FLAG_MASK_32 : 0);
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
/* While the PoO talks about ILC (a number between 1-3) what is actually
stored in LowCore is shifted left one bit (an even between 2-6). As
this is the actual length of the insn and therefore more useful, that
@@ -388,4 +388,18 @@ static inline void cpu_get_tb_cpu_state(CPUSH4State *env, target_ulong *pc,
| (env->movcal_backup ? TB_FLAG_PENDING_MOVCA : 0); /* Bit 4 */
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#endif /* SH4_CPU_H */
@@ -749,6 +749,20 @@ static inline void cpu_get_tb_cpu_state(CPUSPARCState *env, target_ulong *pc,
*pflags = flags;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1; /* npc must be a multible of 4 */
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
static inline bool tb_fpu_enabled(int tb_flags)
{
#if defined(CONFIG_USER_ONLY)
@@ -39,6 +39,7 @@
#define DYNAMIC_PC 1 /* dynamic pc value */
#define JUMP_PC 2 /* dynamic pc value which takes only two values
according to jump_pc[T2] */
+/* NOTE: -1 is reserved for cpu_get_invalid_tb_cpu_state() */
/* global register indexes */
static TCGv_env cpu_env;
@@ -175,4 +175,18 @@ static inline void cpu_get_tb_cpu_state(CPUTLGState *env, target_ulong *pc,
*flags = 0;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#endif
@@ -411,6 +411,20 @@ static inline void cpu_get_tb_cpu_state(CPUTriCoreState *env, target_ulong *pc,
*flags = 0;
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
TriCoreCPU *cpu_tricore_init(const char *cpu_model);
#define cpu_init(cpu_model) CPU(cpu_tricore_init(cpu_model))
@@ -180,6 +180,20 @@ static inline void cpu_get_tb_cpu_state(CPUUniCore32State *env, target_ulong *pc
}
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
int uc32_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int rw,
int mmu_idx);
void uc32_translate_init(void);
@@ -582,6 +582,20 @@ static inline void cpu_get_tb_cpu_state(CPUXtensaState *env, target_ulong *pc,
}
}
+static inline void cpu_get_invalid_tb_cpu_state(target_ulong *pc,
+ target_ulong *cs_base,
+ uint32_t *flags)
+{
+ *cs_base = -1;
+}
+
+static inline bool cpu_tb_cpu_state_is_invalidated(target_ulong pc,
+ target_ulong cs_base,
+ uint32_t flags)
+{
+ return cs_base == -1;
+}
+
#include "exec/cpu-all.h"
#endif