From 33e9a945ebb498c86fffd330075eaa7495fa39a9 Mon Sep 17 00:00:00 2001 From: Mathieu Strypsteen Date: Fri, 27 Dec 2024 15:11:43 +0100 Subject: [PATCH] Remove HEAP_PHYS_MAPPING --- kernel/src/cpu/paging.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/kernel/src/cpu/paging.rs b/kernel/src/cpu/paging.rs index a0f1b9b..77f5c28 100644 --- a/kernel/src/cpu/paging.rs +++ b/kernel/src/cpu/paging.rs @@ -5,7 +5,7 @@ use core::{ sync::atomic::{AtomicBool, AtomicU64, Ordering}, }; -use alloc::{boxed::Box, vec::Vec}; +use alloc::boxed::Box; use bitvec::{order::Lsb0, vec::BitVec}; use kernel_common::{ loader_struct::LoaderStruct, @@ -36,7 +36,6 @@ pub struct AddressSpace { static PAGING_ACTIVE: AtomicBool = AtomicBool::new(false); static HEAP_PHYS_START: AtomicU64 = AtomicU64::new(0); static PHYSICAL_FRAMES: Spinlock>> = Spinlock::new(OnceCell::new()); -static HEAP_PHYS_MAPPING: Spinlock> = Spinlock::new(Vec::new()); const KERNEL_MAPPINGS_START: u64 = 0xfffffffd00000000; const KERNEL_MAPPINGS_END: u64 = 0xfffffffe00000000; pub const USER_END: u64 = 0x800000000000 - 0x1000; // Avoid accidentally jumping to non-canonical address @@ -319,12 +318,8 @@ pub fn setup_paging(loader_struct: &LoaderStruct, phys_start: u64, heap_start: u for i in bss_start..bss_end { address_space.map(i * 0x1000, i * 0x1000 - KERNEL_VIRT_START + phys_start, false, true, false, false, false); } - { - let mut heap_map = HEAP_PHYS_MAPPING.lock(); - for i in 0..KERNEL_HEAP_INITIAL_SIZE / 0x1000 { - address_space.map(KERNEL_HEAP_START + i as u64 * 0x1000, heap_start + i as u64 * 0x1000, false, true, false, false, false); - heap_map.push(heap_start + i as u64 * 0x1000); - } + for i in 0..KERNEL_HEAP_INITIAL_SIZE / 0x1000 { + address_space.map(KERNEL_HEAP_START + i as u64 * 0x1000, heap_start + i as u64 * 0x1000, false, true, false, false, false); } unsafe { address_space.update_flags_range(stack_guard, 0x1000, false, false, false);