arm_hyp: Access SPSR via non-banked instructions

Accessing the hyp mode SPSR register via the banked instruction syntax
is UNPREDICTABLE if hyp is the current mode. The direct syntax needs to
be used instead. This is documented in the ARMv7 Architecture reference
manual.

Signed-off-by: Kent McLeod <kent@kry10.com>
This commit is contained in:
Kent McLeod 2022-05-10 17:44:51 +10:00 committed by Kent McLeod
parent 9bc18febd7
commit e7c544ccf3
3 changed files with 3 additions and 3 deletions

View file

@ -144,7 +144,7 @@ static inline void NORETURN FORCE_INLINE fastpath_restore(word_t badge, word_t m
"msr elr_hyp, lr \n"
/* prepare the user status register */
"ldr lr, [sp, #8] \n"
"msr spsr_hyp, lr \n"
"msr spsr, lr \n"
/* Finally, pop our LR */
"pop {lr} \n"
/* Return to user */

View file

@ -48,7 +48,7 @@ void VISIBLE NORETURN restore_user_context(void)
"msr elr_hyp, lr \n"
/* prepare the user status register */
"ldr lr, [sp, #8] \n"
"msr spsr_hyp, lr \n"
"msr spsr, lr \n"
/* Finally, pop our LR */
"pop {lr} \n"
/* Return to user */

View file

@ -98,7 +98,7 @@ END_FUNC(arm_vector_table)
mrs lr, elr_hyp
str lr, [sp, #4]
/* Store SPSR */
mrs lr, spsr_hyp
mrs lr, spsr
str lr, [sp, #8]
/* Store SP_usr */
mrs lr, sp_usr