Skip to content

Commit a0319a5

Browse files
Make ExceptionFrame methods #[inline(always)]
1 parent c27910b commit a0319a5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cortex-m-rt/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,41 +432,49 @@ pub struct ExceptionFrame {
432432

433433
impl ExceptionFrame {
434434
/// Returns the value of (general purpose) register 0.
435+
#[inline(always)]
435436
pub fn r0(&self) -> u32 {
436437
self.r0
437438
}
438439

439440
/// Returns the value of (general purpose) register 1.
441+
#[inline(always)]
440442
pub fn r1(&self) -> u32 {
441443
self.r1
442444
}
443445

444446
/// Returns the value of (general purpose) register 2.
447+
#[inline(always)]
445448
pub fn r2(&self) -> u32 {
446449
self.r2
447450
}
448451

449452
/// Returns the value of (general purpose) register 3.
453+
#[inline(always)]
450454
pub fn r3(&self) -> u32 {
451455
self.r3
452456
}
453457

454458
/// Returns the value of (general purpose) register 12.
459+
#[inline(always)]
455460
pub fn r12(&self) -> u32 {
456461
self.r12
457462
}
458463

459464
/// Returns the value of the Link Register.
465+
#[inline(always)]
460466
pub fn lr(&self) -> u32 {
461467
self.lr
462468
}
463469

464470
/// Returns the value of the Program Counter.
471+
#[inline(always)]
465472
pub fn pc(&self) -> u32 {
466473
self.pc
467474
}
468475

469476
/// Returns the value of the Program Status Register.
477+
#[inline(always)]
470478
pub fn xpsr(&self) -> u32 {
471479
self.xpsr
472480
}
@@ -477,6 +485,7 @@ impl ExceptionFrame {
477485
///
478486
/// This affects the `r0` register of the preempted code, which must not rely on it getting
479487
/// restored to its previous value.
488+
#[inline(always)]
480489
pub unsafe fn set_r0(&mut self, value: u32) {
481490
self.r0 = value;
482491
}
@@ -487,6 +496,7 @@ impl ExceptionFrame {
487496
///
488497
/// This affects the `r1` register of the preempted code, which must not rely on it getting
489498
/// restored to its previous value.
499+
#[inline(always)]
490500
pub unsafe fn set_r1(&mut self, value: u32) {
491501
self.r1 = value;
492502
}
@@ -497,6 +507,7 @@ impl ExceptionFrame {
497507
///
498508
/// This affects the `r2` register of the preempted code, which must not rely on it getting
499509
/// restored to its previous value.
510+
#[inline(always)]
500511
pub unsafe fn set_r2(&mut self, value: u32) {
501512
self.r2 = value;
502513
}
@@ -507,6 +518,7 @@ impl ExceptionFrame {
507518
///
508519
/// This affects the `r3` register of the preempted code, which must not rely on it getting
509520
/// restored to its previous value.
521+
#[inline(always)]
510522
pub unsafe fn set_r3(&mut self, value: u32) {
511523
self.r3 = value;
512524
}
@@ -517,6 +529,7 @@ impl ExceptionFrame {
517529
///
518530
/// This affects the `r12` register of the preempted code, which must not rely on it getting
519531
/// restored to its previous value.
532+
#[inline(always)]
520533
pub unsafe fn set_r12(&mut self, value: u32) {
521534
self.r12 = value;
522535
}
@@ -527,6 +540,7 @@ impl ExceptionFrame {
527540
///
528541
/// This affects the `lr` register of the preempted code, which must not rely on it getting
529542
/// restored to its previous value.
543+
#[inline(always)]
530544
pub unsafe fn set_lr(&mut self, value: u32) {
531545
self.lr = value;
532546
}
@@ -537,6 +551,7 @@ impl ExceptionFrame {
537551
///
538552
/// This affects the `pc` register of the preempted code, which must not rely on it getting
539553
/// restored to its previous value.
554+
#[inline(always)]
540555
pub unsafe fn set_pc(&mut self, value: u32) {
541556
self.pc = value;
542557
}
@@ -547,6 +562,7 @@ impl ExceptionFrame {
547562
///
548563
/// This affects the `xPSR` registers (`IPSR`, `APSR`, and `EPSR`) of the preempted code, which
549564
/// must not rely on them getting restored to their previous value.
565+
#[inline(always)]
550566
pub unsafe fn set_xpsr(&mut self, value: u32) {
551567
self.xpsr = value;
552568
}

0 commit comments

Comments
 (0)