Skip to content

Commit c6565d6

Browse files
author
Mathieu Choplain
committed
arch: arm: pm_s2ram: fix compatibility with ARMv6-M again
Commit b4fb5d3 added a "pop {r0, lr}" to arch_pm_s2ram_resume, but this instruction is not valid on ARMv6-M or ARMv8-M Baseline. Modify the sequence to use "pop {r0, pc}" which is supported on all ARM M-profile implementations (v6/v7/v8 Baseline/v8 Mainline), and add comments to (hopefully) prevent this issue from re-appearing. Signed-off-by: Mathieu Choplain <[email protected]>
1 parent 8f2f97c commit c6565d6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

arch/arm/core/cortex_m/pm_s2ram.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,17 @@ SECTION_FUNC(TEXT, arch_pm_s2ram_resume)
219219
push {r0, lr}
220220
bl pm_s2ram_mark_check_and_clear
221221
cmp r0, #0x1
222-
pop {r0, lr}
223222
beq .L_resume
224-
bx lr
223+
pop {r0, pc}
225224

226225
.L_resume:
227226
/*
228-
* Restore the CPU context
227+
* Switch to the stack used to execute "arch_pm_s2ram_suspend"
228+
* and restore CPU context backed up by that function, then
229+
* return to the call site of "arch_pm_s2ram_suspend".
230+
*
231+
* Note: the "push {r0, lr}" performed earlier doesn't
232+
* need to be balanced out since we are switching stacks.
229233
*/
230234
ldr r0, =_cpu_context
231235

0 commit comments

Comments
 (0)