mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 01:43:22 +00:00
Inject a scalable slab allocator
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
fdbe52c2ee
commit
a708a0c046
@ -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