Skip to content

Commit 9c025d7

Browse files
committed
Remove lr::write() function, and add comment to lr::read() function.
Fixes #570
1 parent 118b9a7 commit 9c025d7

File tree

1 file changed

+4
-6
lines changed
  • cortex-m/src/register

1 file changed

+4
-6
lines changed

Diff for: cortex-m/src/register/lr.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
use core::arch::asm;
55

66
/// Reads the CPU register
7+
///
8+
/// Note that this function can't be used reliably: The value returned at least depends
9+
/// on whether the compiler chooses to inline the function or not.
710
#[cfg(cortex_m)]
811
#[inline]
912
pub fn read() -> u32 {
@@ -12,9 +15,4 @@ pub fn read() -> u32 {
1215
r
1316
}
1417

15-
/// Writes `bits` to the CPU register
16-
#[cfg(cortex_m)]
17-
#[inline]
18-
pub unsafe fn write(bits: u32) {
19-
asm!("mov lr, {}", in(reg) bits, options(nomem, nostack, preserves_flags));
20-
}
18+
// No `write` function for the LR register, as it can't be used soundly.

0 commit comments

Comments
 (0)