mirror of
https://github.com/qemu/qemu.git
synced 2024-11-25 11:53:39 +08:00
target/ppc: Validate hflags with CONFIG_DEBUG_TCG
Verify that hflags was updated correctly whenever we change cpu state that is used by hflags. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210323184340.619757-11-richard.henderson@linaro.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
75da499733
commit
2da8a6bcdc
@ -2425,6 +2425,10 @@ void cpu_write_xer(CPUPPCState *env, target_ulong xer);
|
||||
*/
|
||||
#define is_book3s_arch2x(ctx) (!!((ctx)->insns_flags & PPC_SEGMENT_64B))
|
||||
|
||||
#ifdef CONFIG_DEBUG_TCG
|
||||
void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
|
||||
target_ulong *cs_base, uint32_t *flags);
|
||||
#else
|
||||
static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
|
||||
target_ulong *cs_base, uint32_t *flags)
|
||||
{
|
||||
@ -2432,6 +2436,7 @@ static inline void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
|
||||
*cs_base = 0;
|
||||
*flags = env->hflags;
|
||||
}
|
||||
#endif
|
||||
|
||||
void QEMU_NORETURN raise_exception(CPUPPCState *env, uint32_t exception);
|
||||
void QEMU_NORETURN raise_exception_ra(CPUPPCState *env, uint32_t exception,
|
||||
|
@ -43,7 +43,7 @@ void hreg_swap_gpr_tgpr(CPUPPCState *env)
|
||||
env->tgpr[3] = tmp;
|
||||
}
|
||||
|
||||
void hreg_compute_hflags(CPUPPCState *env)
|
||||
static uint32_t hreg_compute_hflags_value(CPUPPCState *env)
|
||||
{
|
||||
target_ulong msr = env->msr;
|
||||
uint32_t ppc_flags = env->flags;
|
||||
@ -155,9 +155,34 @@ void hreg_compute_hflags(CPUPPCState *env)
|
||||
hflags |= dmmu_idx << HFLAGS_DMMU_IDX;
|
||||
#endif
|
||||
|
||||
env->hflags = hflags | (msr & msr_mask);
|
||||
return hflags | (msr & msr_mask);
|
||||
}
|
||||
|
||||
void hreg_compute_hflags(CPUPPCState *env)
|
||||
{
|
||||
env->hflags = hreg_compute_hflags_value(env);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DEBUG_TCG
|
||||
void cpu_get_tb_cpu_state(CPUPPCState *env, target_ulong *pc,
|
||||
target_ulong *cs_base, uint32_t *flags)
|
||||
{
|
||||
uint32_t hflags_current = env->hflags;
|
||||
uint32_t hflags_rebuilt;
|
||||
|
||||
*pc = env->nip;
|
||||
*cs_base = 0;
|
||||
*flags = hflags_current;
|
||||
|
||||
hflags_rebuilt = hreg_compute_hflags_value(env);
|
||||
if (unlikely(hflags_current != hflags_rebuilt)) {
|
||||
cpu_abort(env_cpu(env),
|
||||
"TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n",
|
||||
hflags_current, hflags_rebuilt);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void cpu_interrupt_exittb(CPUState *cs)
|
||||
{
|
||||
if (!kvm_enabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user