From: Haozhong Zhang Date: Fri, 16 Dec 2016 13:43:44 +0000 (+0800) Subject: vvmx: Test the correct vmxon X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=6c9b86ca32ef8a375cd4346ba71d0e2b039d120b;p=people%2Fandrewcoop%2Fxen-test-framework.git vvmx: Test the correct vmxon No error is expected in this test. Signed-off-by: Haozhong Zhang Rebase and cleanup. Signed-off-by: Andrew Cooper --- diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c index 8b92d5d..8d0b24f 100644 --- a/tests/vvmx/vmxon.c +++ b/tests/vvmx/vmxon.c @@ -3,6 +3,9 @@ /* vmxon region which shouldn't be latched in the hardware vmxon pointer. */ static uint8_t vmxon_region_unused[PAGE_SIZE] __page_aligned_bss; +/* vmxon region which gets latched in hardware. */ +static uint8_t vmxon_region_real[PAGE_SIZE] __page_aligned_bss; + /** * vmxon with CR4.VMXE cleared * @@ -97,6 +100,19 @@ static void test_vmxon_revid_bit31(void) check(__func__, ex, VMERR_INVALID); } +/** + * vmxon expected to succeed + * + * Expect: Success + */ +static void test_vmxon_correct(void) +{ + clear_vmcs(vmxon_region_real, vmcs_revid); + exinfo_t ex = stub_vmxon(_u(vmxon_region_real)); + + check(__func__, ex, VMERR_SUCCESS); +} + void test_vmxon(void) { unsigned long cr4 = read_cr4(); @@ -116,6 +132,9 @@ void test_vmxon(void) test_vmxon_unaligned_paddr(); test_vmxon_mismatched_revid(); test_vmxon_revid_bit31(); + test_vmxon_correct(); + + /* Test should now be operating in VMX Root mode. */ } /*