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

Function free_page_chunk

kernel/src/memory.rs:530–545  ·  view source on GitHub ↗

Free a memory chunk, releasing the pages back to the frame allocator

(
    level_4_physaddr: u64,
    address: VirtAddr
)

Source from the content-addressed store, hash-verified

528
529/// Free a memory chunk, releasing the pages back to the frame allocator
530pub fn free_page_chunk(
531 level_4_physaddr: u64,
532 address: VirtAddr
533) -> Result<(), usize> {
534 let memory_info = unsafe {MEMORY_INFO.as_mut().unwrap()};
535
536 // Remove from page table, get address of l3 entry
537 let (physaddr, level) = get_page_chunk(level_4_physaddr, address, true)?;
538
539 // Free page tables and pages recursively
540 free_pages_rec(memory_info.physical_memory_offset,
541 &mut memory_info.frame_allocator,
542 physaddr,
543 level); // Page table level
544 Ok(())
545}
546
547/// Remove a page chunk from a page table
548/// Doesn't free any of the pages

Callers 1

free_memory_chunkFunction · 0.85

Calls 2

get_page_chunkFunction · 0.85
free_pages_recFunction · 0.85

Tested by

no test coverage detected