Changeset 15852 in vbox for trunk/src/VBox
- Timestamp:
- Jan 8, 2009 10:56:11 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCMInternal.h
r15702 r15852 435 435 typedef struct HWACCMCPU 436 436 { 437 /** Time of entry into the ring 0 world switcher code. */ 438 uint64_t u64TimeEntry; 439 437 440 /** Old style FPU reporting trap mask override performed (optimization) */ 438 441 bool fFPUOldStyleOverride; -
trunk/src/VBox/VMM/VMM.cpp
r15508 r15852 1426 1426 LogRel((pVM->vmm.s.szRing0AssertMsg2)); 1427 1427 return VERR_VMM_RING0_ASSERTION; 1428 1429 /* 1430 * A forced switch to ring 0 for preemption purposes. 1431 */ 1432 case VMMCALLHOST_VM_R0_PREEMPT: 1433 pVM->vmm.s.rcCallHost = VINF_SUCCESS; 1434 break; 1428 1435 1429 1436 default: -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r15749 r15852 39 39 #include <iprt/asm.h> 40 40 #include <iprt/string.h> 41 #include <iprt/time.h> 41 42 #include "HWVMXR0.h" 42 43 … … 1893 1894 RTGCUINTPTR errCode, instrInfo; 1894 1895 bool fSyncTPR = false; 1896 bool fPreemptPending = false; 1895 1897 PHWACCM_CPUINFO pCpu = 0; 1896 1898 unsigned cResume = 0; … … 1966 1968 } 1967 1969 #endif 1970 1971 /* Fetch the current time so we can bail out when necessary. */ 1972 pVCpu->hwaccm.s.u64TimeEntry = RTTimeNanoTS(); 1968 1973 1969 1974 /* We can jump to this point to resume execution after determining that a VM-exit is innocent. … … 1980 1985 1981 1986 /* Safety precaution; looping for too long here can have a very bad effect on the host */ 1982 if (++cResume > HWACCM_MAX_RESUME_LOOPS) 1987 if ( ++cResume > HWACCM_MAX_RESUME_LOOPS 1988 || RTTimeNanoTS() - pVCpu->hwaccm.s.u64TimeEntry >= 2000000) 1983 1989 { 1984 1990 STAM_COUNTER_INC(&pVCpu->hwaccm.s.StatExitMaxResume); … … 2157 2163 STAM_PROFILE_ADV_START(&pVCpu->hwaccm.s.StatExit1, v); 2158 2164 2159 if ( rc != VINF_SUCCESS)2165 if (VBOX_FAILURE(rc)) 2160 2166 { 2161 2167 VMXR0ReportWorldSwitchError(pVM, pVCpu, rc, pCtx); 2162 2168 goto end; 2163 2169 } 2170 if (rc == VINF_VMX_PREEMPT_PENDING) 2171 fPreemptPending = true; 2172 2164 2173 /* Success. Query the guest state and figure out what has happened. */ 2165 2174 … … 2236 2245 { 2237 2246 rc = PDMApicSetTPR(pVM, pVM->hwaccm.s.vmx.pAPIC[0x80] >> 4); 2247 AssertRC(rc); 2248 } 2249 2250 if (fPreemptPending) 2251 { 2252 fPreemptPending = false; 2253 rc = VMMR0CallHost(pVM, VMMCALLHOST_VM_R0_PREEMPT, 0); 2238 2254 AssertRC(rc); 2239 2255 } … … 3009 3025 3010 3026 case VMX_EXIT_PREEMPTION_TIMER: /* 52 VMX-preemption timer expired. The preemption timer counted down to zero. */ 3011 #ifdef RT_OS_WINDOWS3012 3027 goto ResumeExecution; 3013 #else3014 break; /* enable interrupts again */3015 #endif3016 3028 3017 3029 default: … … 3583 3595 aParam[5] = 0; 3584 3596 3585 if (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1 & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER)3586 {3587 uint32_t uBit, val;3588 3589 rc = VMXReadVMCS32(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val);3590 AssertRC(rc);3591 val = val | VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER;3592 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, val);3593 AssertRC(rc);3594 3595 uBit = MSR_IA32_VMX_MISC_PREEMPT_TSC_BIT(pVM->hwaccm.s.vmx.msr.vmx_misc);3596 val = 1000000 / RT_BIT(uBit);3597 VMXWriteVMCS(VMX_VMCS32_GUEST_PREEMPTION_TIMER_VALUE, val);3598 }3599 3600 3597 rc = VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 6, &aParam[0]); 3601 3602 if (pVM->hwaccm.s.vmx.msr.vmx_pin_ctls.n.allowed1 & VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER)3603 {3604 uint32_t val;3605 3606 rc = VMXReadVMCS32(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, &val);3607 AssertRC(rc);3608 val = val & ~VMX_VMCS_CTRL_PIN_EXEC_CONTROLS_PREEMPT_TIMER;3609 rc = VMXWriteVMCS(VMX_VMCS_CTRL_PIN_EXEC_CONTROLS, val);3610 AssertRC(rc);3611 }3612 3598 3613 3599 #ifdef DEBUG … … 3621 3607 #endif 3622 3608 3609 /* Check if we've been running too long. */ 3610 if ( rc == VINF_SUCCESS 3611 && RTTimeNanoTS() - pVM->hwaccm.s.u64TimeEntry >= 2000000 3612 { 3613 return VINF_VMX_PREEMPT_PENDING; 3614 } 3623 3615 return rc; 3624 3616 }
Note:
See TracChangeset
for help on using the changeset viewer.