Skip to content

Commit

Permalink
ARM: 8671/1: V7M: Preserve registers across switch from Thread to Han…
Browse files Browse the repository at this point in the history
…dler mode

According to ARMv7 ARM, when exception is taken content of r0-r3, r12
is unknown (see ExceptionTaken() pseudocode). Even though existent
implementations keep these register unchanged, preserve them to be in
line with architecture.

Reported-by: Dobromir Stefanov <[email protected]>
Signed-off-by: Vladimir Murzin <[email protected]>
Signed-off-by: Russell King <[email protected]>
  • Loading branch information
Vladimir Murzin authored and Russell King committed Apr 26, 2017
1 parent 6f05d07 commit b70cd40
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/arm/mm/proc-v7m.S
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,11 @@ __v7m_setup_cont:
dsb
mov r6, lr @ save LR
ldr sp, =init_thread_union + THREAD_START_SP
stmia sp, {r0-r3, r12}
cpsie i
svc #0
1: cpsid i
ldmia sp, {r0-r3, r12}
str r5, [r12, #11 * 4] @ restore the original SVC vector entry
mov lr, r6 @ restore LR

Expand Down

0 comments on commit b70cd40

Please sign in to comment.