summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2017-08-20 05:14:17 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2017-08-20 05:14:17 +0000
commit8e89a33b507de13f189091293597119ea814d5af (patch)
tree865a6e73962f6f1c16cbfbbd04fcf89abe40e65c
parent446aab4b85454231ab596c782f28539a346f77ef (diff)
vmm: don't mangle %rax on OUT instructions if vmd(8) modified the exit
information data.
-rw-r--r--sys/arch/amd64/amd64/vmm.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 746fa9f1c46..5262b37b949 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.166 2017/08/20 04:56:41 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.167 2017/08/20 05:14:16 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -3658,8 +3658,9 @@ vcpu_run_vmx(struct vcpu *vcpu, struct vm_run_params *vrp)
if (vrp->vrp_continue) {
switch (vcpu->vc_gueststate.vg_exit_reason) {
case VMX_EXIT_IO:
- vcpu->vc_gueststate.vg_rax =
- vcpu->vc_exit.vei.vei_data;
+ if (vcpu->vc_exit.vei.vei_dir == VEI_DIR_IN)
+ vcpu->vc_gueststate.vg_rax =
+ vcpu->vc_exit.vei.vei_data;
break;
case VMX_EXIT_HLT:
break;
@@ -5687,9 +5688,11 @@ vcpu_run_svm(struct vcpu *vcpu, struct vm_run_params *vrp)
if (vrp->vrp_continue) {
switch (vcpu->vc_gueststate.vg_exit_reason) {
case SVM_VMEXIT_IOIO:
- vcpu->vc_gueststate.vg_rax =
- vcpu->vc_exit.vei.vei_data;
- vmcb->v_rax = vcpu->vc_gueststate.vg_rax;
+ if (vcpu->vc_exit.vei.vei_dir == VEI_DIR_IN) {
+ vcpu->vc_gueststate.vg_rax =
+ vcpu->vc_exit.vei.vei_data;
+ vmcb->v_rax = vcpu->vc_gueststate.vg_rax;
+ }
}
}