summaryrefslogtreecommitdiff
path: root/crates/kernel/src/alloc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/kernel/src/alloc.rs')
-rw-r--r--crates/kernel/src/alloc.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/kernel/src/alloc.rs b/crates/kernel/src/alloc.rs
index f634c73..93d8b15 100644
--- a/crates/kernel/src/alloc.rs
+++ b/crates/kernel/src/alloc.rs
@@ -2,7 +2,7 @@
use crate::paging::{
BuddyAllocator, MapError, MappingFlags, PageTable, ASID, LOMEM_TOP, MAX_PAGE_SIZE_BITS,
- PAGE_SIZES,
+ PAGE_SIZE, PAGE_SIZES,
};
use allocator_api2::alloc::AllocError;
use contracts::requires;
@@ -15,7 +15,7 @@ static BUDDY_ALLOCATOR: FairMutex<Option<BuddyAllocator>> = FairMutex::new(None)
/// The global kernel page table.
static KERNEL_PAGE_TABLE: FairMutex<Option<&'static mut PageTable>> = FairMutex::new(None);
-/// Initializes the allocator and enables paging.
+/// Initializes the kernel page table and enables paging.
///
/// # Safety
///
@@ -63,8 +63,14 @@ pub unsafe fn init_kernel_page_table(buddy_allocator: BuddyAllocator) {
*KERNEL_PAGE_TABLE.lock() = Some(page_table);
}
+/// Initializes the virtual memory allocator and the regular allocator.
+///
+/// # Safety
+///
+/// - `himem_top` must be accurate.
#[requires(BUDDY_ALLOCATOR.lock().is_some())]
#[requires(KERNEL_PAGE_TABLE.lock().is_some())]
+#[requires(himem_top & (PAGE_SIZE - 1) == 0)]
pub unsafe fn init_kernel_virtual_memory_allocator(himem_top: usize) {
todo!()
}