[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [XTF PATCH 08/16] vvmx: test vmxon with invalidly wide VMXON region address
VMfailInvalid is expected in this test. Signed-off-by: Haozhong Zhang <haozhong.zhang@xxxxxxxxx> --- tests/vvmx/vmxon.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/tests/vvmx/vmxon.c b/tests/vvmx/vmxon.c index ca33b3c..8147679 100644 --- a/tests/vvmx/vmxon.c +++ b/tests/vvmx/vmxon.c @@ -53,6 +53,40 @@ static bool test_vmxon_in_user(void) VMXERR_FAULT, EXINFO_SYM(GP, 0), 0); } +static uint8_t get_cpu_paddr_bits(void) +{ + uint8_t paddr_bits = 36; + uint32_t eax; + + eax = cpuid_eax(0x80000000); + if ( (eax >> 16) == 0x8000 && eax >= 0x80000008 ) + { + eax = cpuid_eax(0x80000008); + paddr_bits = eax & 0xff; + if ( paddr_bits > 52 ) + paddr_bits = 52; + } + + return paddr_bits; +} + +/** + * vmxon with VMXON region address that expires the maximum physical + * address width + * + * Expect: VMfailInvalid + */ +static bool test_vmxon_invalid_paddr_width(void) +{ + uint8_t paddr_bits = get_cpu_paddr_bits(); + uint64_t invalid_vmxon_address = (1UL << paddr_bits); + exinfo_t fault; + uint8_t ret = vmxon(invalid_vmxon_address, &fault); + + return handle_vmxinsn_err(__func__, ret, fault, + VMXERR_VMFAIL_INVALID, 0, 0); +} + bool test_vmxon(void) { if ( !test_vmxon_novmxe() ) @@ -64,6 +98,9 @@ bool test_vmxon(void) if ( !test_vmxon_in_user() ) return false; + if ( !test_vmxon_invalid_paddr_width() ) + return false; + return true; } -- 2.10.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |