Skip to content

Commit e520f57

Browse files
committed
[#60922] ARMv8A: Restore exception level and security state after deserialization
1 parent b684032 commit e520f57

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

arch/arm64/helper.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ void cpu_reset(CPUState *env)
6262
arm_rebuild_hflags(env);
6363
}
6464

65+
void cpu_after_load(CPUState *env)
66+
{
67+
// Trigger tlib_on_execution_mode_changed callback to allow subscribed cores
68+
// on the managed part update their Exception Level and Security State.
69+
// Otherwise cores with two security states like ARMv8A
70+
// will incorrectly update their state to the default after reset,
71+
// while the correct state is visible only after loading the state.
72+
// To circumvent it, we explicitly trigger callback after loading the state.
73+
tlib_on_execution_mode_changed(
74+
arm_current_el(env),
75+
arm_is_secure(env)
76+
);
77+
}
78+
6579
void do_interrupt(CPUState *env)
6680
{
6781
if (env->interrupt_begin_callback_enabled) {

0 commit comments

Comments
 (0)