This commit is contained in:
parent
825ed695e7
commit
33e9a945eb
1 changed files with 3 additions and 8 deletions
|
@ -5,7 +5,7 @@ use core::{
|
||||||
sync::atomic::{AtomicBool, AtomicU64, Ordering},
|
sync::atomic::{AtomicBool, AtomicU64, Ordering},
|
||||||
};
|
};
|
||||||
|
|
||||||
use alloc::{boxed::Box, vec::Vec};
|
use alloc::boxed::Box;
|
||||||
use bitvec::{order::Lsb0, vec::BitVec};
|
use bitvec::{order::Lsb0, vec::BitVec};
|
||||||
use kernel_common::{
|
use kernel_common::{
|
||||||
loader_struct::LoaderStruct,
|
loader_struct::LoaderStruct,
|
||||||
|
@ -36,7 +36,6 @@ pub struct AddressSpace {
|
||||||
static PAGING_ACTIVE: AtomicBool = AtomicBool::new(false);
|
static PAGING_ACTIVE: AtomicBool = AtomicBool::new(false);
|
||||||
static HEAP_PHYS_START: AtomicU64 = AtomicU64::new(0);
|
static HEAP_PHYS_START: AtomicU64 = AtomicU64::new(0);
|
||||||
static PHYSICAL_FRAMES: Spinlock<OnceCell<BitVec<u64>>> = Spinlock::new(OnceCell::new());
|
static PHYSICAL_FRAMES: Spinlock<OnceCell<BitVec<u64>>> = Spinlock::new(OnceCell::new());
|
||||||
static HEAP_PHYS_MAPPING: Spinlock<Vec<u64>> = Spinlock::new(Vec::new());
|
|
||||||
const KERNEL_MAPPINGS_START: u64 = 0xfffffffd00000000;
|
const KERNEL_MAPPINGS_START: u64 = 0xfffffffd00000000;
|
||||||
const KERNEL_MAPPINGS_END: u64 = 0xfffffffe00000000;
|
const KERNEL_MAPPINGS_END: u64 = 0xfffffffe00000000;
|
||||||
pub const USER_END: u64 = 0x800000000000 - 0x1000; // Avoid accidentally jumping to non-canonical address
|
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 {
|
for i in bss_start..bss_end {
|
||||||
address_space.map(i * 0x1000, i * 0x1000 - KERNEL_VIRT_START + phys_start, false, true, false, false, false);
|
address_space.map(i * 0x1000, i * 0x1000 - KERNEL_VIRT_START + phys_start, false, true, false, false, false);
|
||||||
}
|
}
|
||||||
{
|
for i in 0..KERNEL_HEAP_INITIAL_SIZE / 0x1000 {
|
||||||
let mut heap_map = HEAP_PHYS_MAPPING.lock();
|
address_space.map(KERNEL_HEAP_START + i as u64 * 0x1000, heap_start + i as u64 * 0x1000, false, true, false, false, false);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
address_space.update_flags_range(stack_guard, 0x1000, false, false, false);
|
address_space.update_flags_range(stack_guard, 0x1000, false, false, false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue