Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions cortex-m/src/register/lr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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.