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

Function add_to_user_table

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

Source from the content-addressed store, hash-verified

55}
56
57pub fn add_to_user_table(
58 mapper: &mut impl Mapper<Size4KiB>,
59 frame_allocator: &mut impl FrameAllocator<Size4KiB>,
60) -> Result<(), MapToError<Size4KiB>> {
61 let page = Page::containing_address(
62 VirtAddr::new(KERNELINFO_VIRTADDR));
63 let frame = PhysFrame::containing_address(
64 PhysAddr::new(FRAME_PHYSADDR.load(Ordering::Relaxed)));
65
66 unsafe {
67 mapper.map_to(page,
68 frame,
69 // Page not writable
70 PageTableFlags::PRESENT |
71 PageTableFlags::USER_ACCESSIBLE,
72 frame_allocator)?.flush();
73 }
74 Ok(())
75}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected