diff --git a/src/arch/aarch64/kernel/core_local.rs b/src/arch/aarch64/kernel/core_local.rs index 2eb667cb39..e3d4c7ef55 100644 --- a/src/arch/aarch64/kernel/core_local.rs +++ b/src/arch/aarch64/kernel/core_local.rs @@ -93,7 +93,7 @@ pub(crate) fn core_id() -> CoreId { #[inline] pub(crate) fn core_scheduler() -> &'static mut PerCoreScheduler { - unsafe { &mut *CoreLocal::get().scheduler.get() } + unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() } } pub(crate) fn async_tasks() -> RefMut<'static, Vec> { diff --git a/src/arch/riscv64/kernel/core_local.rs b/src/arch/riscv64/kernel/core_local.rs index 63550f2aec..fbfca0d1d4 100644 --- a/src/arch/riscv64/kernel/core_local.rs +++ b/src/arch/riscv64/kernel/core_local.rs @@ -76,7 +76,7 @@ pub fn core_id() -> CoreId { #[inline] pub fn core_scheduler() -> &'static mut PerCoreScheduler { - unsafe { &mut *(CoreLocal::get().scheduler.get()) } + unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() } } #[inline] diff --git a/src/arch/x86_64/kernel/core_local.rs b/src/arch/x86_64/kernel/core_local.rs index e4df262250..b2010e230f 100644 --- a/src/arch/x86_64/kernel/core_local.rs +++ b/src/arch/x86_64/kernel/core_local.rs @@ -107,7 +107,7 @@ pub(crate) fn core_id() -> CoreId { } pub(crate) fn core_scheduler() -> &'static mut PerCoreScheduler { - unsafe { &mut *CoreLocal::get().scheduler.get() } + unsafe { CoreLocal::get().scheduler.get().as_mut().unwrap() } } pub(crate) fn async_tasks() -> RefMut<'static, Vec> {