Deleted Added
full compact
26c26
< * $FreeBSD: stable/10/sys/amd64/vmm/intel/vmx.c 276349 2014-12-28 21:27:13Z neel $
---
> * $FreeBSD: stable/10/sys/amd64/vmm/intel/vmx.c 276403 2014-12-30 08:24:14Z neel $
30c30
< __FBSDID("$FreeBSD: stable/10/sys/amd64/vmm/intel/vmx.c 276349 2014-12-28 21:27:13Z neel $");
---
> __FBSDID("$FreeBSD: stable/10/sys/amd64/vmm/intel/vmx.c 276403 2014-12-30 08:24:14Z neel $");
286,287c286,287
< case EXIT_REASON_MCE:
< return "mce";
---
> case EXIT_REASON_MCE_DURING_ENTRY:
> return "mce-during-entry";
823a824
> uint32_t exc_bitmap;
913a915,922
>
> /* exception bitmap */
> if (vcpu_trace_exceptions(vm, i))
> exc_bitmap = 0xffffffff;
> else
> exc_bitmap = 1 << IDT_MC;
> error += vmwrite(VMCS_EXCEPTION_BITMAP, exc_bitmap);
>
1749,1750d1757
<
< /* XXX modify svm.c to update bit 16 of seg_desc.access (unusable) */
1783a1791
> vie_init(&vmexit->u.inst_emul.vie, NULL, 0);
2059a2068
> struct vm_exception vmexc;
2061c2070
< uint32_t intr_type, reason;
---
> uint32_t intr_type, intr_vec, reason;
2077a2087,2098
> * VM-entry failures during or after loading guest state.
> *
> * These VM-exits are uncommon but must be handled specially
> * as most VM-exit fields are not populated as usual.
> */
> if (__predict_false(reason == EXIT_REASON_MCE_DURING_ENTRY)) {
> VCPU_CTR0(vmx->vm, vcpu, "Handling MCE during VM-entry");
> __asm __volatile("int $18");
> return (1);
> }
>
> /*
2308a2330,2332
> intr_vec = intr_info & 0xff;
> intr_type = intr_info & VMCS_INTR_T_MASK;
>
2319c2343
< (intr_info & 0xff) != IDT_DF &&
---
> (intr_vec != IDT_DF) &&
2326c2350
< if ((intr_info & VMCS_INTR_T_MASK) == VMCS_INTR_T_NMI)
---
> if (intr_type == VMCS_INTR_T_NMI)
2328c2352,2391
< break;
---
>
> /*
> * Call the machine check handler by hand. Also don't reflect
> * the machine check back into the guest.
> */
> if (intr_vec == IDT_MC) {
> VCPU_CTR0(vmx->vm, vcpu, "Vectoring to MCE handler");
> __asm __volatile("int $18");
> return (1);
> }
>
> if (intr_vec == IDT_PF) {
> error = vmxctx_setreg(vmxctx, VM_REG_GUEST_CR2, qual);
> KASSERT(error == 0, ("%s: vmxctx_setreg(cr2) error %d",
> __func__, error));
> }
>
> /*
> * Software exceptions exhibit trap-like behavior. This in
> * turn requires populating the VM-entry instruction length
> * so that the %rip in the trap frame is past the INT3/INTO
> * instruction.
> */
> if (intr_type == VMCS_INTR_T_SWEXCEPTION)
> vmcs_write(VMCS_ENTRY_INST_LENGTH, vmexit->inst_length);
>
> /* Reflect all other exceptions back into the guest */
> bzero(&vmexc, sizeof(struct vm_exception));
> vmexc.vector = intr_vec;
> if (intr_info & VMCS_INTR_DEL_ERRCODE) {
> vmexc.error_code_valid = 1;
> vmexc.error_code = vmcs_read(VMCS_EXIT_INTR_ERRCODE);
> }
> VCPU_CTR2(vmx->vm, vcpu, "Reflecting exception %d/%#x into "
> "the guest", vmexc.vector, vmexc.error_code);
> error = vm_inject_exception(vmx->vm, vcpu, &vmexc);
> KASSERT(error == 0, ("%s: vm_inject_exception error %d",
> __func__, error));
> return (1);
>