aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cortex-m-rt/src/lib.rs')
-rw-r--r--cortex-m-rt/src/lib.rs40
1 files changed, 40 insertions, 0 deletions
diff --git a/cortex-m-rt/src/lib.rs b/cortex-m-rt/src/lib.rs
index bf3a458..9697843 100644
--- a/cortex-m-rt/src/lib.rs
+++ b/cortex-m-rt/src/lib.rs
@@ -472,41 +472,81 @@ impl ExceptionFrame {
}
/// Sets the stacked value of (general purpose) register 0.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `r0` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_r0(&mut self, value: u32) {
self.r0 = value;
}
/// Sets the stacked value of (general purpose) register 1.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `r1` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_r1(&mut self, value: u32) {
self.r1 = value;
}
/// Sets the stacked value of (general purpose) register 2.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `r2` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_r2(&mut self, value: u32) {
self.r2 = value;
}
/// Sets the stacked value of (general purpose) register 3.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `r3` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_r3(&mut self, value: u32) {
self.r3 = value;
}
/// Sets the stacked value of (general purpose) register 12.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `r12` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_r12(&mut self, value: u32) {
self.r12 = value;
}
/// Sets the stacked value of the Link Register.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `lr` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_lr(&mut self, value: u32) {
self.lr = value;
}
/// Sets the stacked value of the Program Counter.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `pc` register of the preempted code, which must not rely on it getting
+ /// restored to its previous value.
pub unsafe fn set_pc(&mut self, value: u32) {
self.pc = value;
}
/// Sets the stacked value of the Program Status Register.
+ ///
+ /// # Safety
+ ///
+ /// This affects the `xPSR` registers (`IPSR`, `APSR`, and `EPSR`) of the preempted code, which
+ /// must not rely on them getting restored to their previous value.
pub unsafe fn set_xpsr(&mut self, value: u32) {
self.xpsr = value;
}