Skip to content
This repository was archived by the owner on Jul 11, 2024. It is now read-only.

Commit ce4f4d6

Browse files
committed
Update paging.rs
1 parent f8864f1 commit ce4f4d6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hypervisor/src/intel/paging.rs

+5
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,13 @@ impl PageTables {
8888
/// # Errors
8989
/// Returns `HypervisorError::InvalidCr3BaseAddress` if the address is not 4KB aligned.
9090
pub fn get_pml4_pa(&self) -> Result<u64, HypervisorError> {
91+
// Retrieve the virtual address of the PML4 table.
9192
let addr = addr_of!(self.pml4) as u64;
93+
94+
// Get the physical address of the PML4 table for CR3.
9295
let pa = PhysicalAddress::pa_from_va(addr);
96+
97+
// Check if the base address is 4KB aligned (the lower 12 bits should be zero).
9398
if pa.trailing_zeros() >= BASE_PAGE_SHIFT as u32 {
9499
Ok(pa)
95100
} else {

0 commit comments

Comments
 (0)