From a06662b58ec1f666480adf395f86a51f72035b75 Mon Sep 17 00:00:00 2001 From: Yuke Peng Date: Thu, 29 Aug 2024 19:05:20 +0800 Subject: [PATCH] Read rflags directly in is_local_enabled --- ostd/src/arch/x86/irq.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ostd/src/arch/x86/irq.rs b/ostd/src/arch/x86/irq.rs index 9b46fb3e8..f4cb86548 100644 --- a/ostd/src/arch/x86/irq.rs +++ b/ostd/src/arch/x86/irq.rs @@ -9,6 +9,7 @@ use alloc::{boxed::Box, fmt::Debug, sync::Arc, vec::Vec}; use id_alloc::IdAlloc; use spin::Once; use trapframe::TrapFrame; +use x86_64::registers::rflags::{self, RFlags}; use crate::sync::{Mutex, PreemptDisabled, SpinLock, SpinLockGuard}; @@ -53,7 +54,7 @@ pub(crate) fn disable_local() { } 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> = Once::new();