Minimal interrupts, prevent deadlocks
This commit is contained in:
@ -1,9 +1,9 @@
|
||||
use bitflags::bitflags;
|
||||
use core::arch::asm;
|
||||
use core::{fmt, ops::Deref};
|
||||
|
||||
use super::VirtAddr;
|
||||
|
||||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
/// The EFLAGS register. All bit patterns are valid representations for this type.
|
||||
///
|
||||
@ -82,6 +82,24 @@ bitflags! {
|
||||
}
|
||||
}
|
||||
|
||||
impl EFlags {
|
||||
#[inline]
|
||||
pub fn read() -> EFlags {
|
||||
EFlags::from_bits_truncate(EFlags::read_raw())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn read_raw() -> u32 {
|
||||
let r: u32;
|
||||
|
||||
unsafe {
|
||||
asm!("pushfd; pop {0:e}", out(reg) r, options(nomem, preserves_flags));
|
||||
}
|
||||
|
||||
r
|
||||
}
|
||||
}
|
||||
|
||||
/// Wrapper type for the interrupt stack frame pushed by the CPU.
|
||||
///
|
||||
/// This type derefs to an [`InterruptStackFrameValue`], which allows reading the actual values.
|
||||
|
Reference in New Issue
Block a user