mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 17:03:23 +00:00
Inject a scalable slab allocator
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
fdbe52c2ee
commit
a708a0c046
@ -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" }
|
||||
|
@ -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};
|
||||
|
Reference in New Issue
Block a user