From 583129bc6dbd6dbf533c2d5a1e46f690c681affc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Tue, 14 May 2024 16:09:43 +0200 Subject: [PATCH] Revert "fix(x86_64): allocate kernel stacks from heap" This reverts commit 589e8a940c22e68cdcddc52625edfd638bdd6e74. --- src/arch/x86_64/kernel/apic.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/arch/x86_64/kernel/apic.rs b/src/arch/x86_64/kernel/apic.rs index d38ec8ea39..53868b1248 100644 --- a/src/arch/x86_64/kernel/apic.rs +++ b/src/arch/x86_64/kernel/apic.rs @@ -1,6 +1,4 @@ -use alloc::alloc::alloc; use alloc::vec::Vec; -use core::alloc::Layout; #[cfg(feature = "smp")] use core::arch::x86_64::_mm_mfence; #[cfg(feature = "acpi")] @@ -29,7 +27,7 @@ use crate::arch::x86_64::mm::{paging, virtualmem, PhysAddr, VirtAddr}; use crate::arch::x86_64::swapgs; use crate::config::*; use crate::scheduler::CoreId; -use crate::{arch, env, scheduler}; +use crate::{arch, env, mm, scheduler}; const MP_FLT_SIGNATURE: u32 = 0x5f504d5f; const MP_CONFIG_SIGNATURE: u32 = 0x504d4350; @@ -686,10 +684,8 @@ pub fn init_x2apic() { /// Initialize the required _start variables for the next CPU to be booted. pub fn init_next_processor_variables() { // Allocate stack for the CPU and pass the addresses. - let layout = Layout::from_size_align(KERNEL_STACK_SIZE, BasePageSize::SIZE as usize).unwrap(); - let stack = unsafe { alloc(layout) }; - assert!(!stack.is_null()); - CURRENT_STACK_ADDRESS.store(stack, Ordering::Relaxed); + let stack = mm::allocate(KERNEL_STACK_SIZE, true); + CURRENT_STACK_ADDRESS.store(stack.as_mut_ptr(), Ordering::Relaxed); } /// Boot all Application Processors