Signed-off-by: Peter Feiner <pfeiner@xxxxxxxxxx> --- x86/vmx.c | 6 +++--- x86/vmx.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/x86/vmx.c b/x86/vmx.c index 3fa1a73..9811a28 100644 --- a/x86/vmx.c +++ b/x86/vmx.c @@ -246,7 +246,7 @@ void install_ept_entry(unsigned long *pml4, | EPT_RA | EPT_WA | EPT_EA; } else pt[offset] &= ~EPT_LARGE_PAGE; - pt = phys_to_virt(pt[offset] & 0xffffffffff000ull); + pt = phys_to_virt(pt[offset] & EPT_ADDR_MASK); } offset = ((unsigned long)guest_addr >> ((level-1) * EPT_PGDIR_WIDTH + 12)) & EPT_PGDIR_MASK; @@ -334,7 +334,7 @@ unsigned long get_ept_pte(unsigned long *pml4, break; if (l < 4 && (pte & EPT_LARGE_PAGE)) return pte; - pt = (unsigned long *)(pte & 0xffffffffff000ull); + pt = (unsigned long *)(pte & EPT_ADDR_MASK); } offset = (guest_addr >> (((l-1) * EPT_PGDIR_WIDTH) + 12)) & EPT_PGDIR_MASK; @@ -378,7 +378,7 @@ int set_ept_pte(unsigned long *pml4, unsigned long guest_addr, break; if (!(pt[offset] & (EPT_PRESENT))) return -1; - pt = (unsigned long *)(pt[offset] & 0xffffffffff000ull); + pt = (unsigned long *)(pt[offset] & EPT_ADDR_MASK); } offset = (guest_addr >> (((l-1) * EPT_PGDIR_WIDTH) + 12)) & EPT_PGDIR_MASK; diff --git a/x86/vmx.h b/x86/vmx.h index 8b79191..616ffc0 100644 --- a/x86/vmx.h +++ b/x86/vmx.h @@ -3,6 +3,7 @@ #include "libcflat.h" #include "processor.h" +#include "bitops.h" struct vmcs { u32 revision_id; /* vmcs revision identifier */ @@ -466,6 +467,7 @@ enum Ctrl1 { #define EPT_PAGE_LEVEL 4 #define EPT_PGDIR_WIDTH 9 #define EPT_PGDIR_MASK 511 +#define EPT_ADDR_MASK GENMASK(52, 11) #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_MASK_2M (~(PAGE_SIZE_2M-1)) -- 2.7.0.rc3.207.g0ac5344 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html