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

Function active_level_4_table

kernel/src/memory.rs:90–101  ·  view source on GitHub ↗

This should only be called from the init function because each call will result in a mutable reference

(physical_memory_offset: VirtAddr)

Source from the content-addressed store, hash-verified

88/// This should only be called from the init function
89/// because each call will result in a mutable reference
90unsafe fn active_level_4_table(physical_memory_offset: VirtAddr)
91 -> &'static mut PageTable {
92 use x86_64::registers::control::Cr3;
93
94 let (level_4_table_frame, _) = Cr3::read();
95
96 let phys = level_4_table_frame.start_address();
97 let virt = physical_memory_offset + phys.as_u64();
98 let page_table_ptr: *mut PageTable = virt.as_mut_ptr();
99
100 &mut *page_table_ptr // unsafe
101}
102
103/// Create a new page table
104///

Callers 2

initFunction · 0.85
allocate_active_pagesFunction · 0.85

Calls 2

as_mut_ptrMethod · 0.80
as_u64Method · 0.45

Tested by

no test coverage detected