Inject a scalable slab allocator

This commit is contained in:
Zhang Junyang
2025-01-13 14:24:32 +08:00
committed by Tate, Hongliang Tian
parent fdbe52c2ee
commit a708a0c046
23 changed files with 1166 additions and 626 deletions

View File

@ -20,6 +20,7 @@ aster-rights = { path = "libs/aster-rights" }
component = { path = "libs/comp-sys/component" }
controlled = { path = "libs/comp-sys/controlled" }
osdk-frame-allocator = { path = "../osdk/deps/frame-allocator" }
osdk-heap-allocator = { path = "../osdk/deps/heap-allocator" }
ostd = { path = "../ostd" }
typeflags = { path = "libs/typeflags" }
typeflags-util = { path = "libs/typeflags-util" }

View File

@ -17,6 +17,7 @@
//! as zero-cost capabilities.
use osdk_frame_allocator::FrameAllocator;
use osdk_heap_allocator::{type_from_layout, HeapAllocator};
pub mod page_fault_handler;
pub mod perms;
@ -27,6 +28,14 @@ pub mod vmo;
#[ostd::global_frame_allocator]
static FRAME_ALLOCATOR: FrameAllocator = FrameAllocator;
#[ostd::global_heap_allocator]
static HEAP_ALLOCATOR: HeapAllocator = HeapAllocator;
#[ostd::global_heap_allocator_slot_type_map]
const fn slot_type_from_layout(layout: core::alloc::Layout) -> Option<ostd::mm::heap::SlotInfo> {
type_from_layout(layout)
}
/// Total physical memory in the entire system in bytes.
pub fn mem_total() -> usize {
use ostd::boot::{boot_info, memory_region::MemoryRegionType};