MCPcopy Create free account
hub / github.com/bendudson/EuraliOS / init_heap

Function init_heap

kernel/src/memory/allocator.rs:21–38  ·  view source on GitHub ↗
(
    mapper: &mut impl Mapper<Size4KiB>,
    frame_allocator: &mut impl FrameAllocator<Size4KiB>,
)

Source from the content-addressed store, hash-verified

19use crate::memory;
20
21pub fn init_heap(
22 mapper: &mut impl Mapper<Size4KiB>,
23 frame_allocator: &mut impl FrameAllocator<Size4KiB>,
24) -> Result<(), MapToError<Size4KiB>> {
25
26 memory::allocate_pages_mapper(
27 frame_allocator,
28 mapper,
29 VirtAddr::new(HEAP_START as u64),
30 HEAP_SIZE as u64,
31 PageTableFlags::PRESENT | PageTableFlags::WRITABLE)?;
32
33 unsafe {
34 ALLOCATOR.lock().init(HEAP_START as *mut u8, HEAP_SIZE);
35 }
36
37 Ok(())
38}
39
40use linked_list_allocator::LockedHeap;
41

Callers 1

initFunction · 0.85

Calls 2

allocate_pages_mapperFunction · 0.85
initMethod · 0.80

Tested by

no test coverage detected