Fix pausing within Thumb2 ITE blocks (#853) (#880)

Co-authored-by: Rami Ali <flowergrass@users.noreply.github.com>
This commit is contained in:
Rami Ali 2021-03-30 01:54:45 +11:00 committed by GitHub
parent 7ca7e8a79d
commit 34ddafcbcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);