Skip to content

Commit

Permalink
Introduce tracing nops for aarch64.
Browse files Browse the repository at this point in the history
Use the hlt instruction with a custom set of immediates to issue
tracing commands. This mirrors the behaviour of the ARM FVP Tarmac
trace plugin, which uses the hlt instruction with configurable
immediate values to start and stop tracing.

Introduce the following hlt immediates:
 - 0xff00: start instruction tracing
 - 0xff01: stop instruction tracing
 - 0xff02: start user-mode instruction tracing
  • Loading branch information
qwattash committed Jul 8, 2024
1 parent 0e11f73 commit 6f6f935
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions target/arm/translate-a64.c
Original file line number Diff line number Diff line change
Expand Up @@ -2697,7 +2697,32 @@ static void disas_exc(DisasContext *s, uint32_t insn)
#endif
gen_exception_internal_insn(s, s->pc_curr, EXCP_SEMIHOST);
} else {
#ifdef CONFIG_TCG_LOG_INSTR
TCGv tpc = tcg_const_tl(s->base.pc_next);
switch (imm16) {
case 0xff00:
gen_helper_qemu_log_instr_start(cpu_env, tpc);
s->base.is_jmp = DISAS_EXIT;
break;
case 0xff01:
gen_helper_qemu_log_instr_stop(cpu_env, tpc);
s->base.is_jmp = DISAS_EXIT;
break;
case 0xff02:
gen_helper_qemu_log_instr_user_start(cpu_env, tpc);
s->base.is_jmp = DISAS_EXIT;
break;
default:
unsupported_encoding(s, insn);
}
tcg_temp_free(tpc);

if (s->base.is_jmp != DISAS_NEXT) {
gen_a64_set_pc_im(s->base.pc_next);
}
#else
unsupported_encoding(s, insn);
#endif
}
break;
case 5:
Expand Down

0 comments on commit 6f6f935

Please sign in to comment.