Changeset 26014 in vbox
- Timestamp:
- Jan 25, 2010 3:28:14 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56898
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r25837 r26014 778 778 if (iGate != X86_XCPT_DF) 779 779 { 780 RTGCUINTPTR intInfo;781 782 intInfo = (iGate == X86_XCPT_GP) ? (uint32_t)X86_XCPT_DF : iGate;783 intInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);784 intInfo |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID;785 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HWEXCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);786 787 return VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo , 0, 0 /* no error code according to the Intel docs */);780 uint32_t intInfo2; 781 782 intInfo2 = (iGate == X86_XCPT_GP) ? (uint32_t)X86_XCPT_DF : iGate; 783 intInfo2 |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 784 intInfo2 |= VMX_EXIT_INTERRUPTION_INFO_ERROR_CODE_VALID; 785 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_HWEXCPT << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 786 787 return VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, 0, 0 /* no error code according to the Intel docs */); 788 788 } 789 789 Log(("Triple fault -> reset the VM!\n")); … … 939 939 { 940 940 uint8_t u8Vector; 941 int rc;942 941 TRPMEVENT enmType; 943 942 RTGCUINTPTR intInfo; … … 2300 2299 #ifdef VBOX_STRICT 2301 2300 { 2302 RTCCUINTREG val ;2303 2304 rc = VMXReadVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val );2305 AssertRC(rc); 2306 Log2(("VMX_VMCS_CTRL_PIN_EXEC_CONTROLS = %08x\n", val ));2301 RTCCUINTREG val2; 2302 2303 rc = VMXReadVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val2); 2304 AssertRC(rc); 2305 Log2(("VMX_VMCS_CTRL_PIN_EXEC_CONTROLS = %08x\n", val2)); 2307 2306 2308 2307 /* allowed zero */ 2309 if ((val & pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0)2308 if ((val2 & pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.disallowed0) 2310 2309 Log(("Invalid VMX_VMCS_CTRL_PIN_EXEC_CONTROLS: zero\n")); 2311 2310 2312 2311 /* allowed one */ 2313 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1) != 0)2312 if ((val2 & ~pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1) != 0) 2314 2313 Log(("Invalid VMX_VMCS_CTRL_PIN_EXEC_CONTROLS: one\n")); 2315 2314 2316 rc = VMXReadVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, &val );2317 AssertRC(rc); 2318 Log2(("VMX_VMCS_CTRL_PROC_EXEC_CONTROLS = %08x\n", val ));2315 rc = VMXReadVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, &val2); 2316 AssertRC(rc); 2317 Log2(("VMX_VMCS_CTRL_PROC_EXEC_CONTROLS = %08x\n", val2)); 2319 2318 2320 2319 /* Must be set according to the MSR, but can be cleared in case of EPT. */ 2321 2320 if (pVM->hwaccm.s.fNestedPaging) 2322 val |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_INVLPG_EXIT2323 | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT2324 | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT;2321 val2 |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_INVLPG_EXIT 2322 | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_LOAD_EXIT 2323 | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR3_STORE_EXIT; 2325 2324 2326 2325 /* allowed zero */ 2327 if ((val & pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0)2326 if ((val2 & pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.disallowed0) 2328 2327 Log(("Invalid VMX_VMCS_CTRL_PROC_EXEC_CONTROLS: zero\n")); 2329 2328 2330 2329 /* allowed one */ 2331 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1) != 0)2330 if ((val2 & ~pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1) != 0) 2332 2331 Log(("Invalid VMX_VMCS_CTRL_PROC_EXEC_CONTROLS: one\n")); 2333 2332 2334 rc = VMXReadVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, &val );2335 AssertRC(rc); 2336 Log2(("VMX_VMCS_CTRL_ENTRY_CONTROLS = %08x\n", val ));2333 rc = VMXReadVMCS(VMX_VMCS_CTRL_ENTRY_CONTROLS, &val2); 2334 AssertRC(rc); 2335 Log2(("VMX_VMCS_CTRL_ENTRY_CONTROLS = %08x\n", val2)); 2337 2336 2338 2337 /* allowed zero */ 2339 if ((val & pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0)2338 if ((val2 & pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_entry.n.disallowed0) 2340 2339 Log(("Invalid VMX_VMCS_CTRL_ENTRY_CONTROLS: zero\n")); 2341 2340 2342 2341 /* allowed one */ 2343 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_entry.n.allowed1) != 0)2342 if ((val2 & ~pVM->hwaccm.s.vmx.msr.vmx_entry.n.allowed1) != 0) 2344 2343 Log(("Invalid VMX_VMCS_CTRL_ENTRY_CONTROLS: one\n")); 2345 2344 2346 rc = VMXReadVMCS(VMX_VMCS_CTRL_EXIT_CONTROLS, &val );2347 AssertRC(rc); 2348 Log2(("VMX_VMCS_CTRL_EXIT_CONTROLS = %08x\n", val ));2345 rc = VMXReadVMCS(VMX_VMCS_CTRL_EXIT_CONTROLS, &val2); 2346 AssertRC(rc); 2347 Log2(("VMX_VMCS_CTRL_EXIT_CONTROLS = %08x\n", val2)); 2349 2348 2350 2349 /* allowed zero */ 2351 if ((val & pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0)2350 if ((val2 & pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0) != pVM->hwaccm.s.vmx.msr.vmx_exit.n.disallowed0) 2352 2351 Log(("Invalid VMX_VMCS_CTRL_EXIT_CONTROLS: zero\n")); 2353 2352 2354 2353 /* allowed one */ 2355 if ((val & ~pVM->hwaccm.s.vmx.msr.vmx_exit.n.allowed1) != 0)2354 if ((val2 & ~pVM->hwaccm.s.vmx.msr.vmx_exit.n.allowed1) != 0) 2356 2355 Log(("Invalid VMX_VMCS_CTRL_EXIT_CONTROLS: one\n")); 2357 2356 } 2358 2357 fWasInLongMode = CPUMIsGuestInLongModeEx(pCtx); 2359 #endif 2358 #endif /* VBOX_STRICT */ 2360 2359 2361 2360 #ifdef VBOX_WITH_CRASHDUMP_MAGIC … … 2486 2485 bool fPending; 2487 2486 2488 int rc = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending);2489 AssertRC(rc );2487 int rc2 = PDMApicGetTPR(pVCpu, &u8LastTPR, &fPending); 2488 AssertRC(rc2); 2490 2489 /* The TPR can be found at offset 0x80 in the APIC mmio page. */ 2491 2490 pVCpu->hwaccm.s.vmx.pVAPIC[0x80] = u8LastTPR; … … 3198 3197 case OP_INT: 3199 3198 { 3200 RTGCUINTPTR intInfo;3199 uint32_t intInfo2; 3201 3200 3202 3201 LogFlow(("Realmode: INT %x\n", pDis->param1.parval & 0xff)); 3203 intInfo = pDis->param1.parval & 0xff;3204 intInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);3205 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);3206 3207 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo , cbOp, 0);3202 intInfo2 = pDis->param1.parval & 0xff; 3203 intInfo2 |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 3204 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3205 3206 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3208 3207 AssertRC(rc); 3209 3208 fUpdateRIP = false; … … 3216 3215 if (pCtx->eflags.Bits.u1OF) 3217 3216 { 3218 RTGCUINTPTR intInfo;3217 uint32_t intInfo2; 3219 3218 3220 3219 LogFlow(("Realmode: INTO\n")); 3221 intInfo = X86_XCPT_OF;3222 intInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);3223 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);3224 3225 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo , cbOp, 0);3220 intInfo2 = X86_XCPT_OF; 3221 intInfo2 |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 3222 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3223 3224 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3226 3225 AssertRC(rc); 3227 3226 fUpdateRIP = false; … … 3233 3232 case OP_INT3: 3234 3233 { 3235 RTGCUINTPTR intInfo;3234 uint32_t intInfo2; 3236 3235 3237 3236 LogFlow(("Realmode: INT 3\n")); 3238 intInfo = 3;3239 intInfo |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT);3240 intInfo |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT);3241 3242 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo , cbOp, 0);3237 intInfo2 = 3; 3238 intInfo2 |= (1 << VMX_EXIT_INTERRUPTION_INFO_VALID_SHIFT); 3239 intInfo2 |= (VMX_EXIT_INTERRUPTION_INFO_TYPE_SW << VMX_EXIT_INTERRUPTION_INFO_TYPE_SHIFT); 3240 3241 rc = VMXR0InjectEvent(pVM, pVCpu, pCtx, intInfo2, cbOp, 0); 3243 3242 AssertRC(rc); 3244 3243 fUpdateRIP = false; … … 4041 4040 { 4042 4041 #ifdef VBOX_STRICT 4043 RTCCUINTREG val = 0;4042 RTCCUINTREG val2 = 0; 4044 4043 4045 4044 Log(("VMX_EXIT_ERR_INVALID_GUEST_STATE\n")); 4046 4045 4047 VMXReadVMCS(VMX_VMCS64_GUEST_RIP, &val );4048 Log(("Old eip %RGv new %RGv\n", (RTGCPTR)pCtx->rip, (RTGCPTR)val ));4049 4050 VMXReadVMCS(VMX_VMCS64_GUEST_CR0, &val );4051 Log(("VMX_VMCS_GUEST_CR0 %RX64\n", (uint64_t)val ));4052 4053 VMXReadVMCS(VMX_VMCS64_GUEST_CR3, &val );4054 Log(("VMX_VMCS_GUEST_CR3 %RX64\n", (uint64_t)val ));4055 4056 VMXReadVMCS(VMX_VMCS64_GUEST_CR4, &val );4057 Log(("VMX_VMCS_GUEST_CR4 %RX64\n", (uint64_t)val ));4058 4059 VMXReadVMCS(VMX_VMCS_GUEST_RFLAGS, &val );4060 Log(("VMX_VMCS_GUEST_RFLAGS %08x\n", val ));4046 VMXReadVMCS(VMX_VMCS64_GUEST_RIP, &val2); 4047 Log(("Old eip %RGv new %RGv\n", (RTGCPTR)pCtx->rip, (RTGCPTR)val2)); 4048 4049 VMXReadVMCS(VMX_VMCS64_GUEST_CR0, &val2); 4050 Log(("VMX_VMCS_GUEST_CR0 %RX64\n", (uint64_t)val2)); 4051 4052 VMXReadVMCS(VMX_VMCS64_GUEST_CR3, &val2); 4053 Log(("VMX_VMCS_GUEST_CR3 %RX64\n", (uint64_t)val2)); 4054 4055 VMXReadVMCS(VMX_VMCS64_GUEST_CR4, &val2); 4056 Log(("VMX_VMCS_GUEST_CR4 %RX64\n", (uint64_t)val2)); 4057 4058 VMXReadVMCS(VMX_VMCS_GUEST_RFLAGS, &val2); 4059 Log(("VMX_VMCS_GUEST_RFLAGS %08x\n", val2)); 4061 4060 4062 4061 VMX_LOG_SELREG(CS, "CS"); … … 4069 4068 VMX_LOG_SELREG(LDTR, "LDTR"); 4070 4069 4071 VMXReadVMCS(VMX_VMCS64_GUEST_GDTR_BASE, &val );4072 Log(("VMX_VMCS_GUEST_GDTR_BASE %RX64\n", (uint64_t)val ));4073 VMXReadVMCS(VMX_VMCS64_GUEST_IDTR_BASE, &val );4074 Log(("VMX_VMCS_GUEST_IDTR_BASE %RX64\n", (uint64_t)val ));4070 VMXReadVMCS(VMX_VMCS64_GUEST_GDTR_BASE, &val2); 4071 Log(("VMX_VMCS_GUEST_GDTR_BASE %RX64\n", (uint64_t)val2)); 4072 VMXReadVMCS(VMX_VMCS64_GUEST_IDTR_BASE, &val2); 4073 Log(("VMX_VMCS_GUEST_IDTR_BASE %RX64\n", (uint64_t)val2)); 4075 4074 #endif /* VBOX_STRICT */ 4076 4075 rc = VERR_VMX_INVALID_GUEST_STATE; … … 4335 4334 case VERR_VMX_UNABLE_TO_RESUME_VM: 4336 4335 { 4337 int rc ;4336 int rc2; 4338 4337 RTCCUINTREG exitReason, instrError; 4339 4338 4340 rc = VMXReadVMCS(VMX_VMCS32_RO_EXIT_REASON, &exitReason);4341 rc |= VMXReadVMCS(VMX_VMCS32_RO_VM_INSTR_ERROR, &instrError);4342 AssertRC(rc );4343 if (rc == VINF_SUCCESS)4339 rc2 = VMXReadVMCS(VMX_VMCS32_RO_EXIT_REASON, &exitReason); 4340 rc2 |= VMXReadVMCS(VMX_VMCS32_RO_VM_INSTR_ERROR, &instrError); 4341 AssertRC(rc2); 4342 if (rc2 == VINF_SUCCESS) 4344 4343 { 4345 4344 Log(("Unable to start/resume VM for reason: %x. Instruction error %x\n", (uint32_t)exitReason, (uint32_t)instrError)); 4346 Log(("Current stack %08x\n", &rc ));4345 Log(("Current stack %08x\n", &rc2)); 4347 4346 4348 4347 pVCpu->hwaccm.s.vmx.lasterror.ulInstrError = instrError;
Note:
See TracChangeset
for help on using the changeset viewer.