diff options
author | Krish Sadhukhan <krish.sadhukhan@oracle.com> | 2020-05-22 20:26:03 -0400 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-07-06 12:47:52 -0400 |
commit | af7af811618fc4d88d5091fefa3eac683b1a6748 (patch) | |
tree | b7c2e75450ada036b566a2ab98e4e822fb8ddea3 | |
parent | 02ce1789f41c227b740f8c495a3548160d62a144 (diff) | |
download | kvm-unit-tests-af7af811618fc4d88d5091fefa3eac683b1a6748.tar.gz |
kvm-unit-tests: nVMX: Test GUEST_LIMIT_GDTR and GUEST_LIMIT_IDTR on vmentry of nested guests
According to section "Checks on Guest Descriptor-Table Registers" in Intel
SDM vol 3C, the following checks are performed on the Guest Descriptor-Table
Registers on vmentry of nested guests:
- Bits 31:16 of each limit field must be 0.
Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
Message-Id: <20200523002603.32450-4-krish.sadhukhan@oracle.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | x86/vmx_tests.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c index aec32fc..9ed43ee 100644 --- a/x86/vmx_tests.c +++ b/x86/vmx_tests.c @@ -7840,6 +7840,23 @@ static void vmx_guest_state_area_test(void) test_canonical(GUEST_BASE_IDTR, "GUEST_BASE_IDTR", false); #endif + u32 guest_desc_limit_saved = vmcs_read(GUEST_LIMIT_GDTR); + int i; + for (i = 16; i <= 31; i++) { + u32 tmp = guest_desc_limit_saved | (1ull << i); + vmcs_write(GUEST_LIMIT_GDTR, tmp); + test_guest_state("GUEST_LIMIT_GDTR", true, tmp, "GUEST_LIMIT_GDTR"); + } + vmcs_write(GUEST_LIMIT_GDTR, guest_desc_limit_saved); + + guest_desc_limit_saved = vmcs_read(GUEST_LIMIT_IDTR); + for (i = 16; i <= 31; i++) { + u32 tmp = guest_desc_limit_saved | (1ull << i); + vmcs_write(GUEST_LIMIT_IDTR, tmp); + test_guest_state("GUEST_LIMIT_IDTR", true, tmp, "GUEST_LIMIT_IDTR"); + } + vmcs_write(GUEST_LIMIT_IDTR, guest_desc_limit_saved); + /* * Let the guest finish execution */ |