kernel/mem/
allocator.rs

1use slab_allocator_rs::LockedHeap;
2
3use crate::early_println;
4use crate::vm::vmem::MemoryArea;
5
6#[global_allocator]
7pub static ALLOCATOR: LockedHeap = LockedHeap::empty();
8
9pub fn init_heap(area: MemoryArea) {
10    let size = area.size();
11    if size == 0 {
12        early_println!("Heap size is zero, skipping initialization.");
13        return;
14    }
15
16    
17
18    unsafe {
19        ALLOCATOR.init(area.start, size);
20    }
21
22    early_println!("Heap initialized: {:#x} - {:#x}", area.start, area.end);
23}