diff options
author | neel <neel@FreeBSD.org> | 2014-07-15 17:37:17 +0000 |
---|---|---|
committer | neel <neel@FreeBSD.org> | 2014-07-15 17:37:17 +0000 |
commit | eb07e4ed5522cd757da89e0a4914051310702c6d (patch) | |
tree | f9b95c2eed26d1f61c4f0e24c9fbd103d28acb2a /sys/amd64/vmm/intel | |
parent | 9e8e83700cfbbfc40ec8d46c207163a148d836d1 (diff) | |
download | FreeBSD-src-eb07e4ed5522cd757da89e0a4914051310702c6d.zip FreeBSD-src-eb07e4ed5522cd757da89e0a4914051310702c6d.tar.gz |
Add support for operand size and address size override prefixes in bhyve's
instruction emulation [1].
Fix bug in emulation of opcode 0x8A where the destination is a legacy high
byte register and the guest vcpu is in 32-bit mode. Prior to this change
instead of modifying %ah, %bh, %ch or %dh the emulation would end up
modifying %spl, %bpl, %sil or %dil instead.
Add support for moffsets by treating it as a 2, 4 or 8 byte immediate value
during instruction decoding.
Fix bug in verify_gla() where the linear address computed after decoding
the instruction was not being truncated to the effective address size [2].
Tested by: Leon Dang [1]
Reported by: Peter Grehan [2]
Sponsored by: Nahanni Systems
Diffstat (limited to 'sys/amd64/vmm/intel')
-rw-r--r-- | sys/amd64/vmm/intel/vmx.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/amd64/vmm/intel/vmx.c b/sys/amd64/vmm/intel/vmx.c index 5248c02..2a4f8ea 100644 --- a/sys/amd64/vmm/intel/vmx.c +++ b/sys/amd64/vmm/intel/vmx.c @@ -1793,10 +1793,25 @@ vmx_paging_info(struct vm_guest_paging *paging) static void vmexit_inst_emul(struct vm_exit *vmexit, uint64_t gpa, uint64_t gla) { + struct vm_guest_paging *paging; + uint32_t csar; + + paging = &vmexit->u.inst_emul.paging; + vmexit->exitcode = VM_EXITCODE_INST_EMUL; vmexit->u.inst_emul.gpa = gpa; vmexit->u.inst_emul.gla = gla; - vmx_paging_info(&vmexit->u.inst_emul.paging); + vmx_paging_info(paging); + switch (paging->cpu_mode) { + case CPU_MODE_PROTECTED: + case CPU_MODE_COMPATIBILITY: + csar = vmcs_read(VMCS_GUEST_CS_ACCESS_RIGHTS); + vmexit->u.inst_emul.cs_d = SEG_DESC_DEF32(csar); + break; + default: + vmexit->u.inst_emul.cs_d = 0; + break; + } } static int |