mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Read rflags directly in is_local_enabled
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
eff41b6e97
commit
a06662b58e
@ -9,6 +9,7 @@ use alloc::{boxed::Box, fmt::Debug, sync::Arc, vec::Vec};
|
|||||||
use id_alloc::IdAlloc;
|
use id_alloc::IdAlloc;
|
||||||
use spin::Once;
|
use spin::Once;
|
||||||
use trapframe::TrapFrame;
|
use trapframe::TrapFrame;
|
||||||
|
use x86_64::registers::rflags::{self, RFlags};
|
||||||
|
|
||||||
use crate::sync::{Mutex, PreemptDisabled, SpinLock, SpinLockGuard};
|
use crate::sync::{Mutex, PreemptDisabled, SpinLock, SpinLockGuard};
|
||||||
|
|
||||||
@ -53,7 +54,7 @@ pub(crate) fn disable_local() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_local_enabled() -> bool {
|
pub(crate) fn is_local_enabled() -> bool {
|
||||||
x86_64::instructions::interrupts::are_enabled()
|
(rflags::read_raw() & RFlags::INTERRUPT_FLAG.bits()) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
static CALLBACK_ID_ALLOCATOR: Once<Mutex<IdAlloc>> = Once::new();
|
static CALLBACK_ID_ALLOCATOR: Once<Mutex<IdAlloc>> = Once::new();
|
||||||
|
Reference in New Issue
Block a user