Changeset View
Changeset View
Standalone View
Standalone View
head/sys/amd64/vmm/intel/vmx.c
Show First 20 Lines • Show All 2,276 Lines • ▼ Show 20 Lines | if (error) { | ||||
KASSERT(vmexit->exitcode != VM_EXITCODE_BOGUS, | KASSERT(vmexit->exitcode != VM_EXITCODE_BOGUS, | ||||
("emulate_wrmsr retu with bogus exitcode")); | ("emulate_wrmsr retu with bogus exitcode")); | ||||
} | } | ||||
break; | break; | ||||
case EXIT_REASON_HLT: | case EXIT_REASON_HLT: | ||||
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_HLT, 1); | vmm_stat_incr(vmx->vm, vcpu, VMEXIT_HLT, 1); | ||||
vmexit->exitcode = VM_EXITCODE_HLT; | vmexit->exitcode = VM_EXITCODE_HLT; | ||||
vmexit->u.hlt.rflags = vmcs_read(VMCS_GUEST_RFLAGS); | vmexit->u.hlt.rflags = vmcs_read(VMCS_GUEST_RFLAGS); | ||||
if (virtual_interrupt_delivery) | |||||
vmexit->u.hlt.intr_status = | |||||
vmcs_read(VMCS_GUEST_INTR_STATUS); | |||||
else | |||||
vmexit->u.hlt.intr_status = 0; | |||||
break; | break; | ||||
case EXIT_REASON_MTF: | case EXIT_REASON_MTF: | ||||
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_MTRAP, 1); | vmm_stat_incr(vmx->vm, vcpu, VMEXIT_MTRAP, 1); | ||||
vmexit->exitcode = VM_EXITCODE_MTRAP; | vmexit->exitcode = VM_EXITCODE_MTRAP; | ||||
vmexit->inst_length = 0; | vmexit->inst_length = 0; | ||||
break; | break; | ||||
case EXIT_REASON_PAUSE: | case EXIT_REASON_PAUSE: | ||||
vmm_stat_incr(vmx->vm, vcpu, VMEXIT_PAUSE, 1); | vmm_stat_incr(vmx->vm, vcpu, VMEXIT_PAUSE, 1); | ||||
▲ Show 20 Lines • Show All 969 Lines • ▼ Show 20 Lines | vmx_pending_intr(struct vlapic *vlapic, int *vecptr) | ||||
if (!pending) { | if (!pending) { | ||||
/* | /* | ||||
* While a virtual interrupt may have already been | * While a virtual interrupt may have already been | ||||
* processed the actual delivery maybe pending the | * processed the actual delivery maybe pending the | ||||
* interruptibility of the guest. Recognize a pending | * interruptibility of the guest. Recognize a pending | ||||
* interrupt by reevaluating virtual interrupts | * interrupt by reevaluating virtual interrupts | ||||
* following Section 29.2.1 in the Intel SDM Volume 3. | * following Section 29.2.1 in the Intel SDM Volume 3. | ||||
*/ | */ | ||||
uint64_t val; | struct vm_exit *vmexit; | ||||
uint8_t rvi, ppr; | uint8_t rvi, ppr; | ||||
vmx_getreg(vlapic_vtx->vmx, vlapic->vcpuid, | vmexit = vm_exitinfo(vlapic->vm, vlapic->vcpuid); | ||||
VMCS_IDENT(VMCS_GUEST_INTR_STATUS), &val); | KASSERT(vmexit->exitcode == VM_EXITCODE_HLT, | ||||
rvi = val & APIC_TPR_INT; | ("vmx_pending_intr: exitcode not 'HLT'")); | ||||
rvi = vmexit->u.hlt.intr_status & APIC_TPR_INT; | |||||
lapic = vlapic->apic_page; | lapic = vlapic->apic_page; | ||||
ppr = lapic->ppr & APIC_TPR_INT; | ppr = lapic->ppr & APIC_TPR_INT; | ||||
if (rvi > ppr) { | if (rvi > ppr) { | ||||
return (1); | return (1); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |