Skip to content

Commit

Permalink
Fix pausing within Thumb2 ITE blocks (#853) (#880)
Browse files Browse the repository at this point in the history
Co-authored-by: Rami Ali <[email protected]>
  • Loading branch information
Rami Ali and flowergrass authored Mar 29, 2021
1 parent 7ca7e8a commit 34ddafc
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions qemu/target-arm/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -10434,17 +10434,23 @@ static void disas_thumb_insn(CPUARMState *env, DisasContext *s) // qq
// Unicorn: trace this instruction on request
if (HOOK_EXISTS_BOUNDED(s->uc, UC_HOOK_CODE, s->pc)) {
// determine instruction size (Thumb/Thumb2)
switch(insn & 0xf800) {
// Thumb2: 32-bit
case 0xe800:
case 0xf000:
case 0xf800:
gen_uc_tracecode(tcg_ctx, 4, UC_HOOK_CODE_IDX, s->uc, s->pc);
break;
// Thumb: 16-bit
default:
gen_uc_tracecode(tcg_ctx, 2, UC_HOOK_CODE_IDX, s->uc, s->pc);
break;
// avoid terminating inside ITE clause
if (s->condexec_mask == 0) {
switch(insn & 0xf800) {
// Thumb2: 32-bit
case 0xe800:
case 0xf000:
case 0xf800:
gen_uc_tracecode(tcg_ctx, 4, UC_HOOK_CODE_IDX, s->uc, s->pc);
break;
// Thumb: 16-bit
default:
// avoid terminating at an IT instruction
if (!((insn & 0xff00) == 0xbf00)) {
gen_uc_tracecode(tcg_ctx, 2, UC_HOOK_CODE_IDX, s->uc, s->pc);
}
break;
}
}
// the callback might want to stop emulation immediately
check_exit_request(tcg_ctx);
Expand Down

0 comments on commit 34ddafc

Please sign in to comment.