target/hexagon: implement SSR.SS single-step
PATCH 1/1 target/hexagon: implement SSR.SS single-step
SSR.SS enables a single-step debug event after each packet executed in user or guest mode.
Carry the state in a new SS_ACTIVE TB flag. When it is set, translate one packet per TB and raise HEX_EVENT_DEBUG w/PC at the next packet (which becomes ELR).
Signed-off-by Brian Cain <[email protected]>
--- target/hexagon/cpu.h | 1 + target/hexagon/translate.h | 1 + target/hexagon/cpu.c | 4 ++ target/hexagon/hexswi.c | 1 - target/hexagon/translate.c | 49 +++++++++++++++++++++++ tests/functional/hexagon/test_systests.py | 3 ++ 6 files changed, 58 insertions(+), 1 deletion(-)
target/hexagon/cpu.h +1 -0
@@ -228,6 +228,7 @@ FIELD(TB_FLAGS, IS_TIGHT_LOOP, 0, 1) FIELD(TB_FLAGS, MMU_INDEX, 1, 3) FIELD(TB_FLAGS, PCYCLE_ENABLED, 4, 1) FIELD(TB_FLAGS, HVX_COPROC_ENABLED, 5, 1) +FIELD(TB_FLAGS, SS_ACTIVE, 6, 1) G_NORETURN void hexagon_raise_exception_err(CPUHexagonState *env, uint32_t exception,
target/hexagon/translate.h +1 -0
@@ -45,6 +45,7 @@ typedef struct DisasContext {DECLARE_BITMAP (gpr_uncond,TOTAL_PER_THREAD_REGS );bool implicit_usr_write;#ifndef CONFIG_USER_ONLY +bool ss_active;int greg_log[GREG_WRITES_MAX ];int greg_log_idx;DECLARE_BITMAP (gregs_written,NUM_GREGS );
target/hexagon/cpu.c +4 -0
@@ -353,6 +353,10 @@ static TCGTBCPUState hexagon_get_tb_cpu_state(CPUState *cs) hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,HVX_COPROC_ENABLED , cpu->hvx_ctx[0 ] &&GET_SSR_FIELD (SSR_XE , env->t_sreg[HEX_SREG_SSR ])); +/* Single-step applies only to user and guest mode packets */ + hex_flags =FIELD_DP32 (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 );#else hex_flags =FIELD_DP32 (hex_flags,TB_FLAGS ,MMU_INDEX ,MMU_USER_IDX );#endif
target/hexagon/hexswi.c +0 -1
@@ -868,7 +868,6 @@ void hexagon_cpu_do_interrupt(CPUState *cs)case HEX_EVENT_DEBUG :hexagon_ssr_set_cause (env, env->cause_code);set_addresses (env,0 , cs->exception_index); -qemu_log_mask (LOG_UNIMP ,"single-step exception is not handled\n" );break ;case HEX_EVENT_PRECISE :
target/hexagon/translate.c +49 -0
71 lines not on this page · raw message
tests/functional/hexagon/test_systests.py +3 -0
@@ -108,5 +108,8 @@ def test_hvx_multi(self): def test_standalone_vec(self): self.run_exit_zero("standalone_vec") + def test_single_step(self): + self.run_exit_zero("single_step") + if __name__ == "__main__": QemuSystemTest.main()
Signature · 1 line
2.34.1
Quoted 8 lines · Brian Cain
SSR.SS enables a single-step debug event after each packet executed in user or guest mode.
Carry the state in a new
SS_ACTIVETB flag. When it is set, translate one packet per TB and raiseHEX_EVENT_DEBUGw/PC at the next packet (which becomes ELR).Signed-off-by Brian Cain <[email protected]>
Quoted 9 lines
--- target/hexagon/cpu.h | 1 + target/hexagon/translate.h | 1 + target/hexagon/cpu.c | 4 ++ target/hexagon/hexswi.c | 1 - target/hexagon/translate.c | 49 +++++++++++++++++++++++ tests/functional/hexagon/test_systests.py | 3 ++ 6 files changed, 58 insertions(+), 1 deletion(-)
Reviewed-by Pierrick Bouvier <[email protected]>