summaryrefslogtreecommitdiff
path: root/sys/arch/amd64
diff options
context:
space:
mode:
authorMike Larkin <mlarkin@cvs.openbsd.org>2017-03-24 08:52:54 +0000
committerMike Larkin <mlarkin@cvs.openbsd.org>2017-03-24 08:52:54 +0000
commit83d5e5c50b1b17d3b87f5ee02a5e3a644f41d40a (patch)
tree6cba8b58ec1854efd64cdb4b49b08c08cd82b5e6 /sys/arch/amd64
parent6ea8b87e1d381664dfc845d0ed1fedb4732536d1 (diff)
Exit to vmd on byte size PCI accesses.
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r--sys/arch/amd64/amd64/vmm.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index 3f00f3a5652..bd25f0f44b2 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.123 2017/03/24 08:02:02 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.124 2017/03/24 08:52:53 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -4073,14 +4073,20 @@ vmx_handle_inout(struct vcpu *vcpu)
case IO_ICU2 ... IO_ICU2 + 1:
case 0x3f8 ... 0x3ff:
case 0xcf8:
- case 0xcfc:
+ case 0xcfc ... 0xcff:
case VMM_PCI_IO_BAR_BASE ... VMM_PCI_IO_BAR_END:
ret = EAGAIN;
break;
default:
/* Read from unsupported ports returns FFs */
- if (vcpu->vc_exit.vei.vei_dir == 1)
- vcpu->vc_gueststate.vg_rax = 0xFFFFFFFF;
+ if (vcpu->vc_exit.vei.vei_dir == 1) {
+ if (vcpu->vc_exit.vei.vei_size == 4)
+ vcpu->vc_gueststate.vg_rax = 0xFFFFFFFF;
+ else if (vcpu->vc_exit.vei.vei_size == 2)
+ vcpu->vc_gueststate.vg_rax |= 0xFFFF;
+ else if (vcpu->vc_exit.vei.vei_size == 1)
+ vcpu->vc_gueststate.vg_rax |= 0xFF;
+ }
ret = 0;
}