diff options
author | Nadav Har'El <nyh@il.ibm.com> | 2011-05-25 16:08:00 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 04:45:13 -0400 |
commit | 6a4d7550601b5b17df227959bdbec208384f729c (patch) | |
tree | ccc7403ae0e31c34ad5f769bbcaf445817092a6b /arch/x86/kvm/vmx.c | |
parent | 63846663eac783eabbc1ab7c325e41a3627d986f (diff) |
KVM: nVMX: Implement VMPTRST
This patch implements the VMPTRST instruction.
Signed-off-by: Nadav Har'El <nyh@il.ibm.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 54866f538c6f..2bc521c9dabe 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -4937,6 +4937,32 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu) | |||
4937 | return 1; | 4937 | return 1; |
4938 | } | 4938 | } |
4939 | 4939 | ||
4940 | /* Emulate the VMPTRST instruction */ | ||
4941 | static int handle_vmptrst(struct kvm_vcpu *vcpu) | ||
4942 | { | ||
4943 | unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); | ||
4944 | u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); | ||
4945 | gva_t vmcs_gva; | ||
4946 | struct x86_exception e; | ||
4947 | |||
4948 | if (!nested_vmx_check_permission(vcpu)) | ||
4949 | return 1; | ||
4950 | |||
4951 | if (get_vmx_mem_address(vcpu, exit_qualification, | ||
4952 | vmx_instruction_info, &vmcs_gva)) | ||
4953 | return 1; | ||
4954 | /* ok to use *_system, as nested_vmx_check_permission verified cpl=0 */ | ||
4955 | if (kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, vmcs_gva, | ||
4956 | (void *)&to_vmx(vcpu)->nested.current_vmptr, | ||
4957 | sizeof(u64), &e)) { | ||
4958 | kvm_inject_page_fault(vcpu, &e); | ||
4959 | return 1; | ||
4960 | } | ||
4961 | nested_vmx_succeed(vcpu); | ||
4962 | skip_emulated_instruction(vcpu); | ||
4963 | return 1; | ||
4964 | } | ||
4965 | |||
4940 | /* | 4966 | /* |
4941 | * The exit handlers return 1 if the exit was handled fully and guest execution | 4967 | * The exit handlers return 1 if the exit was handled fully and guest execution |
4942 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs | 4968 | * may resume. Otherwise they set the kvm_run parameter to indicate what needs |
@@ -4961,7 +4987,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = { | |||
4961 | [EXIT_REASON_VMCLEAR] = handle_vmclear, | 4987 | [EXIT_REASON_VMCLEAR] = handle_vmclear, |
4962 | [EXIT_REASON_VMLAUNCH] = handle_vmx_insn, | 4988 | [EXIT_REASON_VMLAUNCH] = handle_vmx_insn, |
4963 | [EXIT_REASON_VMPTRLD] = handle_vmptrld, | 4989 | [EXIT_REASON_VMPTRLD] = handle_vmptrld, |
4964 | [EXIT_REASON_VMPTRST] = handle_vmx_insn, | 4990 | [EXIT_REASON_VMPTRST] = handle_vmptrst, |
4965 | [EXIT_REASON_VMREAD] = handle_vmx_insn, | 4991 | [EXIT_REASON_VMREAD] = handle_vmx_insn, |
4966 | [EXIT_REASON_VMRESUME] = handle_vmx_insn, | 4992 | [EXIT_REASON_VMRESUME] = handle_vmx_insn, |
4967 | [EXIT_REASON_VMWRITE] = handle_vmx_insn, | 4993 | [EXIT_REASON_VMWRITE] = handle_vmx_insn, |