Skip to content

Commit ef8164b

Browse files
committed
No, you have to do PSP before you drop your privileges
1 parent 6a46b61 commit ef8164b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cortex-m/src/asm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,14 @@ pub unsafe fn semihosting_syscall(nr: u32, arg: u32) -> u32 {
193193
/// program - stack overflows are obviously UB. If your processor supports
194194
/// it, you may wish to set the `PSPLIM` register to guard against this.
195195
#[cfg(cortex_m)]
196-
#[inline(always)]
196+
//#[inline(always)]
197197
pub unsafe fn enter_unprivileged_psp(psp: *const u32, entry: extern "C" fn() -> !) -> ! {
198198
unsafe {
199199
core::arch::asm!(
200+
"msr PSP, {psp}",
200201
"mrs {tmp}, CONTROL",
201202
"orrs {tmp}, {flags}",
202203
"msr CONTROL, {tmp}",
203-
"msr PSP, {psp}",
204204
"isb",
205205
"bx {ent}",
206206
tmp = in(reg) 0,

0 commit comments

Comments
 (0)