mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 06:15:28 +00:00
target/arm: Fix execution of ARM instructions
Previously we'd be checking prior to the actual decoding if we were at the ending address. This worked fine using the old model of the translation process in qemu. However, this causes the wrong behavior to occur in both ARM and Thumb/Thumb-2 modes using the newer translator model. Given the translator itself checks for the end address already, this needs to be placed within arm_post_translate_insn(). This prevents the emulation process being off-by-one as well when it comes to actually executing the instructions.
This commit is contained in:
parent
dcc9420555
commit
15440a83c5
|
@ -12595,13 +12595,6 @@ static void disas_thumb_insn(DisasContext *s, uint32_t insn)
|
|||
TCGv_i32 tmp2;
|
||||
TCGv_i32 addr;
|
||||
|
||||
// Unicorn: end address tells us to stop emulation
|
||||
if (s->pc == s->uc->addr_end) {
|
||||
// imitate WFI instruction to halt emulation
|
||||
s->base.is_jmp = DISAS_WFI;
|
||||
return;
|
||||
}
|
||||
|
||||
// Unicorn: trace this instruction on request
|
||||
if (HOOK_EXISTS_BOUNDED(s->uc, UC_HOOK_CODE, s->pc)) {
|
||||
// determine instruction size (Thumb/Thumb2)
|
||||
|
@ -13666,6 +13659,13 @@ static void arm_post_translate_insn(DisasContext *dc)
|
|||
{
|
||||
TCGContext *tcg_ctx = dc->uc->tcg_ctx;
|
||||
|
||||
// Unicorn: end address tells us to stop emulation
|
||||
if (dc->pc == dc->uc->addr_end) {
|
||||
// imitate WFI instruction to halt emulation
|
||||
dc->base.is_jmp = DISAS_WFI;
|
||||
return;
|
||||
}
|
||||
|
||||
if (dc->condjmp && !dc->base.is_jmp) {
|
||||
gen_set_label(tcg_ctx, dc->condlabel);
|
||||
dc->condjmp = 0;
|
||||
|
|
Loading…
Reference in a new issue