Skip to content

Commit 0eb9b80

Browse files
Mark asm::irq_enable as unsafe
Fixes #103
1 parent 93bd56b commit 0eb9b80

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

aarch32-cpu/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- Mark `asm::irq_enable()` as unsafe to match `interrupt::enable()`
11+
1012
## [aarch32-cpu v0.1.0]
1113

1214
### Added

aarch32-cpu/src/asmv4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn irq_disable() {
3030
/// Unmask IRQ
3131
#[cfg_attr(not(feature = "check-asm"), inline)]
3232
#[cfg_attr(target_arch = "arm", instruction_set(arm::a32))]
33-
pub fn irq_enable() {
33+
pub unsafe fn irq_enable() {
3434
#[cfg(target_arch = "arm")]
3535
unsafe {
3636
core::arch::asm!(r#"

aarch32-cpu/src/asmv7.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn irq_disable() {
8282

8383
/// Unmask IRQ
8484
#[cfg_attr(not(feature = "check-asm"), inline)]
85-
pub fn irq_enable() {
85+
pub unsafe fn irq_enable() {
8686
unsafe {
8787
core::arch::asm!("cpsie i");
8888
}

aarch32-cpu/src/interrupt.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ use core::sync::atomic::{compiler_fence, Ordering};
1414
pub unsafe fn enable() {
1515
// Ensure no preceeding memory accesses are reordered to after interrupts are enabled.
1616
compiler_fence(Ordering::SeqCst);
17-
crate::asm::irq_enable();
17+
// Safety: as per outer function
18+
unsafe {
19+
crate::asm::irq_enable();
20+
}
1821
}
1922

2023
/// Disable IRQ

0 commit comments

Comments
 (0)