[kvm-unit-tests PATCH 1/2] x86: nSVM: Use PT_* macro for NPT tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No functional change intended.

Signed-off-by: Eiichi Tsukata <eiichi.tsukata@xxxxxxxxxxx>
---
 x86/svm_npt.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/x86/svm_npt.c b/x86/svm_npt.c
index b791f1ac..09c33783 100644
--- a/x86/svm_npt.c
+++ b/x86/svm_npt.c
@@ -16,7 +16,7 @@ static void npt_np_prepare(struct svm_test *test)
 	scratch_page = alloc_page();
 	pte = npt_get_pte((u64) scratch_page);
 
-	*pte &= ~1ULL;
+	*pte &= ~PT_PRESENT_MASK;
 }
 
 static void npt_np_test(struct svm_test *test)
@@ -28,7 +28,7 @@ static bool npt_np_check(struct svm_test *test)
 {
 	u64 *pte = npt_get_pte((u64) scratch_page);
 
-	*pte |= 1ULL;
+	*pte |= PT_PRESENT_MASK;
 
 	return (vmcb->control.exit_code == SVM_EXIT_NPF)
 	    && (vmcb->control.exit_info_1 == 0x100000004ULL);
@@ -68,7 +68,7 @@ static void npt_us_prepare(struct svm_test *test)
 	scratch_page = alloc_page();
 	pte = npt_get_pte((u64) scratch_page);
 
-	*pte &= ~(1ULL << 2);
+	*pte &= ~PT_USER_MASK;
 }
 
 static void npt_us_test(struct svm_test *test)
@@ -80,7 +80,7 @@ static bool npt_us_check(struct svm_test *test)
 {
 	u64 *pte = npt_get_pte((u64) scratch_page);
 
-	*pte |= (1ULL << 2);
+	*pte |= PT_USER_MASK;
 
 	return (vmcb->control.exit_code == SVM_EXIT_NPF)
 	    && (vmcb->control.exit_info_1 == 0x100000005ULL);
@@ -93,7 +93,7 @@ static void npt_rw_prepare(struct svm_test *test)
 
 	pte = npt_get_pte(0x80000);
 
-	*pte &= ~(1ULL << 1);
+	*pte &= ~PT_WRITABLE_MASK;
 }
 
 static void npt_rw_test(struct svm_test *test)
@@ -107,7 +107,7 @@ static bool npt_rw_check(struct svm_test *test)
 {
 	u64 *pte = npt_get_pte(0x80000);
 
-	*pte |= (1ULL << 1);
+	*pte |= PT_WRITABLE_MASK;
 
 	return (vmcb->control.exit_code == SVM_EXIT_NPF)
 	    && (vmcb->control.exit_info_1 == 0x100000007ULL);
@@ -120,14 +120,14 @@ static void npt_rw_pfwalk_prepare(struct svm_test *test)
 
 	pte = npt_get_pte(read_cr3());
 
-	*pte &= ~(1ULL << 1);
+	*pte &= ~PT_WRITABLE_MASK;
 }
 
 static bool npt_rw_pfwalk_check(struct svm_test *test)
 {
 	u64 *pte = npt_get_pte(read_cr3());
 
-	*pte |= (1ULL << 1);
+	*pte |= PT_WRITABLE_MASK;
 
 	return (vmcb->control.exit_code == SVM_EXIT_NPF)
 	    && (vmcb->control.exit_info_1 == 0x200000007ULL)
@@ -164,7 +164,7 @@ static void npt_rw_l1mmio_prepare(struct svm_test *test)
 
 	pte = npt_get_pte(0xfee00080);
 
-	*pte &= ~(1ULL << 1);
+	*pte &= ~PT_WRITABLE_MASK;
 }
 
 static void npt_rw_l1mmio_test(struct svm_test *test)
@@ -178,7 +178,7 @@ static bool npt_rw_l1mmio_check(struct svm_test *test)
 {
 	u64 *pte = npt_get_pte(0xfee00080);
 
-	*pte |= (1ULL << 1);
+	*pte |= PT_WRITABLE_MASK;
 
 	return (vmcb->control.exit_code == SVM_EXIT_NPF)
 	    && (vmcb->control.exit_info_1 == 0x100000007ULL);
-- 
2.49.0





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux