Skip to content
This repository has been archived by the owner on Sep 1, 2024. It is now read-only.

Commit

Permalink
Added is_page_split
Browse files Browse the repository at this point in the history
  • Loading branch information
memN0ps committed Jun 6, 2024
1 parent 5dd589b commit 4c6d9f8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions hypervisor/src/intel/ept.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,25 @@ impl Ept {

Ok(())
}

/// Checks if a guest physical address is part of a large 2MB page.
///
/// This function is used to determine if a guest physical address is part of a large 2MB page.
///
/// # Arguments
///
/// * `guest_pa` - The guest physical address to check.
///
/// # Returns
///
/// `true` if the guest physical address is part of a large 2MB page, otherwise `false`.
pub fn is_page_split(&self, guest_pa: u64) -> bool {
let guest_pa = VAddr::from(guest_pa);
let pdpt_index = pdpt_index(guest_pa);
let pd_index = pd_index(guest_pa);
let pde = &self.pd[pdpt_index].0.entries[pd_index];
pde.large()
}

/// Splits a large 2MB page into 512 smaller 4KB pages for a given guest physical address.
///
Expand Down

0 comments on commit 4c6d9f8

Please sign in to comment.