Read rflags directly in is_local_enabled

This commit is contained in:
Yuke Peng
2024-08-29 19:05:20 +08:00
committed by Tate, Hongliang Tian
parent eff41b6e97
commit a06662b58e

View File

@ -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();