Skip to content

Commit

Permalink
Fixed GuestVirtAddr in aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
jounathaen committed Nov 25, 2024
1 parent 046b2d7 commit 3bc06e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/arch/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl PageTableEntry {
/// Return the stored physical address.
pub fn address(&self) -> GuestPhysAddr {
// For other granules than 4KiB or hugepages we should check the DESCRIPTOR_TYPE bit and modify the address translation accordingly.
GuestPhysAddr(
GuestPhysAddr::new(
self.physical_address_and_flags.as_u64() & !(PAGE_SIZE as u64 - 1) & !(u64::MAX << 48),
)
}
Expand All @@ -108,7 +108,7 @@ impl From<u64> for PageTableEntry {
/// The upper bits must always be 0 or 1 and indicate whether TBBR0 or TBBR1 contains the
/// base address. So always enforce 0 here.
fn is_valid_address(virtual_address: GuestVirtAddr) -> bool {
virtual_address < GuestVirtAddr(0x1_0000_0000_0000)
virtual_address < GuestVirtAddr::new(0x1_0000_0000_0000)
}

/// Converts a virtual address in the guest to a physical address in the guest
Expand Down

0 comments on commit 3bc06e8

Please sign in to comment.