Skip to content

Commit 8b84fc8

Browse files
Revised enter_unprivileged safety comments.
1 parent 539bce1 commit 8b84fc8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

cortex-m/src/asm.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,13 @@ pub unsafe fn semihosting_syscall(nr: u32, arg: u32) -> u32 {
180180
///
181181
/// # Safety
182182
///
183-
/// `psp` and `entry` must point to valid stack memory and executable
184-
/// code, respectively. `psp` must be 8 bytes aligned and point to
185-
/// stack top as stack grows towards lower addresses.
183+
/// * `psp` and `entry` must point to valid stack memory and executable code,
184+
/// respectively.
185+
/// * `psp` must be 8 bytes aligned and point to stack top as stack grows
186+
/// towards lower addresses.
187+
/// * The size of the stack provided here must be large enough for your
188+
/// program - stack overflows are obviously UB. If your processor supports
189+
/// it, you may wish to set the `PSPLIM` register to guard against this.
186190
#[cfg(cortex_m)]
187191
#[inline(always)]
188192
pub unsafe fn enter_unprivileged(psp: *const u32, entry: fn() -> !) -> ! {

0 commit comments

Comments
 (0)