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

Function create_physical_range_pages

kernel/src/memory.rs:464–480  ·  view source on GitHub ↗

Create a mapping to a specific range of physical memory Doesn't do any frame allocation, so assumes that it's ok to use the memory. Used for mapping a memory chunk to VGA memory.

(
    level_4_physaddr: u64,
    start_virtaddr: VirtAddr,
    num_frames: u64,
    start_physaddr: PhysAddr)

Source from the content-addressed store, hash-verified

462/// to use the memory. Used for mapping a memory chunk to
463/// VGA memory.
464pub fn create_physical_range_pages(
465 level_4_physaddr: u64,
466 start_virtaddr: VirtAddr,
467 num_frames: u64,
468 start_physaddr: PhysAddr)
469 -> Result<PhysAddr, MapToError<Size4KiB>> {
470
471 let start_page = Page::from_start_address(start_virtaddr)
472 .map_err(|_| MapToError::FrameAllocationFailed)?;
473 let start_frame = PhysFrame::from_start_address(start_physaddr)
474 .map_err(|_| MapToError::FrameAllocationFailed)?;
475
476 map_consecutive_pages(level_4_physaddr,
477 start_page,
478 start_frame,
479 num_frames)
480}
481
482///////////////////////////////////////////////////////////////////////
483

Callers 1

special_memory_chunkFunction · 0.85

Calls 1

map_consecutive_pagesFunction · 0.85

Tested by

no test coverage detected