Skip to content

Commit

Permalink
fix(interrupts): activate interrupt masking on AArch64
Browse files Browse the repository at this point in the history
Co-authored-by: Edmund Grimley Evans <[email protected]>
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening and egrimley-arm committed Sep 6, 2023
1 parent 77c63e8 commit 9d4b616
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,19 @@ mod imp {
pub type Flags = u64;
pub type AtomicFlags = core::sync::atomic::AtomicU64;

pub const DISABLE: u64 = 0;
/// Set the `A`, `I`, and `F` bit for _masking_ interrupts.
pub const DISABLE: u64 = 0b111000000;

#[inline]
pub fn get() -> u64 {
DAIF.get()
// Return only the relevant bits
DAIF.get() & DISABLE
}

#[inline]
pub fn set(value: u64) {
// Set only the relevant bits
let value = (DAIF.get() & !DISABLE) | value;
DAIF.set(value);
}
}
Expand Down

0 comments on commit 9d4b616

Please sign in to comment.