qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

target/arm: Display helpful message when hflags mismatch

Instead of crashing in a confuse way, give some hint to the user
about why we aborted. He might report the issue without having
to use a debugger.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20191209134552.27733-1-philmd@redhat.com
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

authored by

Philippe Mathieu-Daudé and committed by
Peter Maydell
0ee8b24a b255cafb

+15 -3
+15 -3
target/arm/helper.c
··· 11512 11512 env->hflags = rebuild_hflags_a64(env, el, fp_el, mmu_idx); 11513 11513 } 11514 11514 11515 + static inline void assert_hflags_rebuild_correctly(CPUARMState *env) 11516 + { 11517 + #ifdef CONFIG_DEBUG_TCG 11518 + uint32_t env_flags_current = env->hflags; 11519 + uint32_t env_flags_rebuilt = rebuild_hflags_internal(env); 11520 + 11521 + if (unlikely(env_flags_current != env_flags_rebuilt)) { 11522 + fprintf(stderr, "TCG hflags mismatch (current:0x%08x rebuilt:0x%08x)\n", 11523 + env_flags_current, env_flags_rebuilt); 11524 + abort(); 11525 + } 11526 + #endif 11527 + } 11528 + 11515 11529 void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, 11516 11530 target_ulong *cs_base, uint32_t *pflags) 11517 11531 { ··· 11519 11533 uint32_t pstate_for_ss; 11520 11534 11521 11535 *cs_base = 0; 11522 - #ifdef CONFIG_DEBUG_TCG 11523 - assert(flags == rebuild_hflags_internal(env)); 11524 - #endif 11536 + assert_hflags_rebuild_correctly(env); 11525 11537 11526 11538 if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { 11527 11539 *pc = env->pc;