target/arm: Move PC alignment check

Move this earlier to make the next patch diff cleaner. While here
update the comment slightly to not give the impression that the
misalignment affects only TCG.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Fabiano Rosas 2023-02-13 17:29:03 -03:00 committed by Peter Maydell
parent d55b2a2aa3
commit 501e6d1f6c

View File

@ -839,6 +839,15 @@ static int cpu_post_load(void *opaque, int version_id)
}
}
/*
* Misaligned thumb pc is architecturally impossible. Fail the
* incoming migration. For TCG it would trigger the assert in
* thumb_tr_translate_insn().
*/
if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
return -1;
}
hw_breakpoint_update_all(cpu);
hw_watchpoint_update_all(cpu);
@ -856,15 +865,6 @@ static int cpu_post_load(void *opaque, int version_id)
}
}
/*
* Misaligned thumb pc is architecturally impossible.
* We have an assert in thumb_tr_translate_insn to verify this.
* Fail an incoming migrate to avoid this assert.
*/
if (!is_a64(env) && env->thumb && (env->regs[15] & 1)) {
return -1;
}
if (!kvm_enabled()) {
pmu_op_finish(&cpu->env);
}