-
Notifications
You must be signed in to change notification settings - Fork 8.2k
arch: arm: pm_s2ram: fix compatibility with ARMv6-M again #88263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arch: arm: pm_s2ram: fix compatibility with ARMv6-M again #88263
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took the latest commit as the file's history is quite complicated. Originally (e.g., in 2590c48), there was a I will update the commit message based on your input though. |
The original 'arch_pm_s2ram_resume' implementation saved lr on the stack
using 'push {lr}' and restored it using 'pop {lr}'. However, the Thumb-1
'pop' does not support lr as a target register, so this code would not
compile for ARMv6-M or ARMv8-M Baseline. r0 was added to these push/pop
later in 2590c48.
In 474d4c3, arch_pm_s2ram* functions were
modified to no longer use the stack, which incidentally "fixed" this issue.
b4fb5d3 reverted this commit and brought
back 'pop {r0, lr}' as-is, without taking compatibility into account.
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]>
c6565d6 to
3d494c7
Compare
|
@wearyzen updated commit message. Let me know what you think 🙂 |
LGTM, Thank you ! |
Commit b4fb5d3 added a
pop {r0, lr}toarch_pm_s2ram_resumebut 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.