MCPcopy Create free account
hub / github.com/Infinity-OS/infinity / map_to

Method map_to

src/memory/paging/mapper.rs:73–82  ·  view source on GitHub ↗

Maps the page to the frame with the provided flags. The `PRESENT` flag is added by default. Needs a `FrameAllocator` as it might need to create new page tables.

(&mut self, page: Page, frame: Frame, flags: EntryFlags, allocator: &mut A)

Source from the content-addressed store, hash-verified

71 /// The `PRESENT` flag is added by default. Needs a `FrameAllocator` as it might need to create
72 /// new page tables.
73 pub fn map_to<A>(&mut self, page: Page, frame: Frame, flags: EntryFlags, allocator: &mut A)
74 where A: FrameAllocator
75 {
76 let mut p3 = self.p4_mut().next_table_create(page.p4_index(), allocator);
77 let mut p2 = p3.next_table_create(page.p3_index(), allocator);
78 let mut p1 = p2.next_table_create(page.p2_index(), allocator);
79
80 assert!(p1[page.p1_index()].is_unused());
81 p1[page.p1_index()].set(frame, flags | PRESENT);
82 }
83
84 /// Maps the page to some free frame with the provided flags.
85 /// The free frame is allocated from the given `FrameAllocator`.

Callers 3

mapMethod · 0.45
mapMethod · 0.45
identity_mapMethod · 0.45

Calls 7

next_table_createMethod · 0.80
p4_mutMethod · 0.80
p4_indexMethod · 0.80
p3_indexMethod · 0.80
p2_indexMethod · 0.80
setMethod · 0.80
p1_indexMethod · 0.80

Tested by

no test coverage detected