(
mapper: &mut impl Mapper<Size4KiB>,
frame_allocator: &mut impl FrameAllocator<Size4KiB>,
)
| 19 | use crate::memory; |
| 20 | |
| 21 | pub 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 | |
| 40 | use linked_list_allocator::LockedHeap; |
| 41 |
no test coverage detected