diff --git a/cortex-m/src/register/lr.rs b/cortex-m/src/register/lr.rs index 02708ae4..5752ff72 100644 --- a/cortex-m/src/register/lr.rs +++ b/cortex-m/src/register/lr.rs @@ -4,6 +4,9 @@ use core::arch::asm; /// Reads the CPU register +/// +/// Note that this function can't be used reliably: The value returned at least depends +/// on whether the compiler chooses to inline the function or not. #[cfg(cortex_m)] #[inline] pub fn read() -> u32 { @@ -12,9 +15,4 @@ pub fn read() -> u32 { r } -/// Writes `bits` to the CPU register -#[cfg(cortex_m)] -#[inline] -pub unsafe fn write(bits: u32) { - asm!("mov lr, {}", in(reg) bits, options(nomem, nostack, preserves_flags)); -} +// No `write` function for the LR register, as it can't be used soundly.