Skip to content

Commit 7b57c86

Browse files
Add unsafe setters
Otherwise this would be a regression in functionality
1 parent 4666507 commit 7b57c86

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

cortex-m-rt/src/lib.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,46 @@ impl ExceptionFrame {
470470
pub fn xpsr(&self) -> u32 {
471471
self.xpsr
472472
}
473+
474+
/// Sets the stacked value of (general purpose) register 0.
475+
pub unsafe fn set_r0(&mut self, value: u32) {
476+
self.r0 = value;
477+
}
478+
479+
/// Sets the stacked value of (general purpose) register 1.
480+
pub unsafe fn set_r1(&mut self, value: u32) {
481+
self.r1 = value;
482+
}
483+
484+
/// Sets the stacked value of (general purpose) register 2.
485+
pub unsafe fn set_r2(&mut self, value: u32) {
486+
self.r2 = value;
487+
}
488+
489+
/// Sets the stacked value of (general purpose) register 3.
490+
pub unsafe fn set_r3(&mut self, value: u32) {
491+
self.r3 = value;
492+
}
493+
494+
/// Sets the stacked value of (general purpose) register 12.
495+
pub unsafe fn set_r12(&mut self, value: u32) {
496+
self.r12 = value;
497+
}
498+
499+
/// Sets the stacked value of the Link Register.
500+
pub unsafe fn set_lr(&mut self, value: u32) {
501+
self.lr = value;
502+
}
503+
504+
/// Sets the stacked value of the Program Counter.
505+
pub unsafe fn set_pc(&mut self, value: u32) {
506+
self.pc = value;
507+
}
508+
509+
/// Sets the stacked value of the Program Status Register.
510+
pub unsafe fn set_xpsr(&mut self, value: u32) {
511+
self.xpsr = value;
512+
}
473513
}
474514

475515
impl fmt::Debug for ExceptionFrame {

0 commit comments

Comments
 (0)