Changeset 14845 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Dec 1, 2008 10:12:25 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r14806 r14845 819 819 } 820 820 821 #if RT_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) 822 if (pVM->fHWACCMEnabled) 823 { 824 switch(PGMGetHostMode(pVM)) 825 { 826 case PGMMODE_32_BIT: 827 pVM->hwaccm.s.pfnHost32ToGuest64R0 = VMMR3GetHostToGuestSwitcher(pVM, VMMSWITCHER_32_TO_AMD64); 828 break; 829 830 case PGMMODE_PAE: 831 case PGMMODE_PAE_NX: 832 pVM->hwaccm.s.pfnHost32ToGuest64R0 = VMMR3GetHostToGuestSwitcher(pVM, VMMSWITCHER_PAE_TO_AMD64); 833 break; 834 835 default: 836 AssertFailed(); 837 break; 838 } 839 840 rc = PDMR3LdrGetSymbolRC(pVM, NULL, "VMXGCStartVM64", &pVM->hwaccm.pfnVMXGCStartVM64); 841 AssertMsgRCReturn(rc, ("VMXGCStartVM64 -> rc=%Rrc\n", rc), rc); 842 843 rc = PDMR3LdrGetSymbolRC(pVM, NULL, "SVMGCVMRun64", &pVM->hwaccm.pfnSVMGCVMRun64); 844 AssertMsgRCReturn(rc, ("SVMGCVMRun64 -> rc=%Rrc\n", rc), rc); 845 } 846 #endif 821 847 return VINF_SUCCESS; 822 848 } -
trunk/src/VBox/VMM/HWACCMInternal.h
r14804 r14845 200 200 201 201 #if HC_ARCH_BITS == 32 202 /** 32 to 64 bits switcher entrypoint. */ 203 RTR0PTR pfnHost32ToGuest64R0; 204 205 /* AMD-V 64 bits vmrun handler */ 206 RTRCPTR pfnSVMGCVMRun64; 207 208 /* VT-x 64 bits vmlaunch handler */ 209 RTRCPTR pfnVMXGCStartVM64; 210 202 211 uint32_t Alignment0; 203 212 #endif … … 383 392 384 393 /** Ring 0 handlers for VT-x. */ 385 DECLR0CALLBACKMEMBER(int, pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx ));394 DECLR0CALLBACKMEMBER(int, pfnStartVM,(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu)); 386 395 387 396 /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */ … … 515 524 516 525 VMMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpu(); 526 VMMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpuEx(RTCPUID idCpu); 517 527 518 528 -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r14804 r14845 1014 1014 * 1015 1015 * @returns cpu structure pointer 1016 * @param pVM The VM to operate on.1017 1016 */ 1018 1017 VMMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpu() … … 1020 1019 RTCPUID idCpu = RTMpCpuId(); 1021 1020 1021 return &HWACCMR0Globals.aCpuInfo[idCpu]; 1022 } 1023 1024 /** 1025 * Returns the cpu structure for the current cpu. 1026 * Keep in mind that there is no guarantee it will stay the same (long jumps to ring 3!!!). 1027 * 1028 * @returns cpu structure pointer 1029 * @param idCpu id of the VCPU 1030 */ 1031 VMMR0DECL(PHWACCM_CPUINFO) HWACCMR0GetCurrentCpuEx(RTCPUID idCpu) 1032 { 1022 1033 return &HWACCMR0Globals.aCpuInfo[idCpu]; 1023 1034 } -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r14805 r14845 1502 1502 if (pCtx->msrEFER & MSR_K6_EFER_LMA) 1503 1503 { 1504 #if !defined(VBOX_WITH_64_BITS_GUESTS) || HC_ARCH_BITS != 641504 #if !defined(VBOX_WITH_64_BITS_GUESTS) 1505 1505 return VERR_PGM_UNSUPPORTED_SHADOW_PAGING_MODE; 1506 #elif HC_ARCH_BITS == 32 1507 pVCpu->hwaccm.s.vmx.pfnStartVM = VMXR0SwitcherStartVM64; 1506 1508 #else 1507 1509 pVCpu->hwaccm.s.vmx.pfnStartVM = VMXR0StartVM64; … … 2041 2043 #endif 2042 2044 TMNotifyStartOfExecution(pVM); 2043 rc = pVCpu->hwaccm.s.vmx.pfnStartVM(pVCpu->hwaccm.s.fResumeVM, pCtx );2045 rc = pVCpu->hwaccm.s.vmx.pfnStartVM(pVCpu->hwaccm.s.fResumeVM, pCtx, pVM, pVCpu); 2044 2046 TMNotifyEndOfExecution(pVM); 2045 2047 … … 3422 3424 * @param fResume vmlauch/vmresume 3423 3425 * @param pCtx Guest context 3426 * @param pVM The VM to operate on. 3427 * @param pVCpu The VMCPU to operate on. 3424 3428 */ 3425 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx )3429 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu) 3426 3430 { 3427 return VERR_NOT_IMPLEMENTED; 3431 int rc, rc2; 3432 RTCCUINTREG uFlags; 3433 PHWACCM_CPUINFO pCpu; 3434 RTHCPHYS pPageCpuPhys; 3435 3436 pCpu = HWACCMR0GetCurrentCpuEx(pVCpu->idCpu); 3437 pPageCpuPhys = RTR0MemObjGetPagePhysAddr(pCpu->pMemObj, 0); 3438 3439 /* Clear VM Control Structure. Marking it inactive, clearing implementation specific data and writing back VMCS data to memory. */ 3440 VMXClearVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys); 3441 3442 /* Leave VMX Root Mode. */ 3443 VMXDisable(); 3444 3445 uFlags = ASMIntDisableFlags(); 3446 /* Call switcher. */ 3447 rc = VERR_ACCESS_DENIED; 3448 3449 ASMSetFlags(uFlags); 3450 3451 /* Make sure the VMX instructions don't cause #UD faults. */ 3452 ASMSetCR4(ASMGetCR4() | X86_CR4_VMXE); 3453 3454 /* Enter VMX Root Mode */ 3455 rc2 = VMXEnable(pPageCpuPhys); 3456 if (RT_FAILURE(rc2)) 3457 { 3458 if (pVM) 3459 VMXR0CheckError(pVM, pVCpu, rc2); 3460 ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE); 3461 return VERR_VMX_VMXON_FAILED; 3462 } 3463 3464 VMXActivateVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys); 3465 return rc; 3428 3466 } 3429 3467 #endif -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.h
r14649 r14845 196 196 * @param fResume vmlauch/vmresume 197 197 * @param pCtx Guest context 198 */ 199 DECLASM(int) VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx); 198 * @param pVM The VM to operate on. 199 * @param pVCpu The VMCPU to operate on. 200 */ 201 DECLASM(int) VMXR0StartVM32(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu); 200 202 201 203 /** … … 205 207 * @param fResume vmlauch/vmresume 206 208 * @param pCtx Guest context 207 */ 208 DECLASM(int) VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx); 209 * @param pVM The VM to operate on. 210 * @param pVCpu The VMCPU to operate on. 211 */ 212 DECLASM(int) VMXR0StartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu); 209 213 210 214 /** … … 214 218 * @param fResume vmlauch/vmresume 215 219 * @param pCtx Guest context 216 */ 217 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx); 220 * @param pVM The VM to operate on. 221 * @param pVCpu The VMCPU to operate on. 222 */ 223 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu); 218 224 219 225 #endif /* IN_RING0 */ -
trunk/src/VBox/VMM/VMMSwitcher.cpp
r14771 r14845 982 982 } 983 983 984 /** 985 * Gets the switcher to be used for switching to GC. 986 * 987 * @returns host to guest ring 0 switcher entrypoint 988 * @param pVM VM handle. 989 * @param enmSwitcher The new switcher. 990 */ 991 VMMR3DECL(RTR0PTR) VMMR3GetHostToGuestSwitcher(PVM pVM, VMMSWITCHER enmSwitcher) 992 { 993 /* 994 * Validate input. 995 */ 996 if ( enmSwitcher < VMMSWITCHER_INVALID 997 || enmSwitcher >= VMMSWITCHER_MAX) 998 { 999 AssertMsgFailed(("Invalid input enmSwitcher=%d\n", enmSwitcher)); 1000 return VERR_INVALID_PARAMETER; 1001 } 1002 1003 /* 1004 * Select the new switcher. 1005 */ 1006 PVMMSWITCHERDEF pSwitcher = s_apSwitchers[enmSwitcher]; 1007 if (pSwitcher) 1008 { 1009 RTR0PTR pbCodeR0 = (RTR0PTR)pVM->vmm.s.pvCoreCodeR0 + pVM->vmm.s.aoffSwitchers[enmSwitcher]; /** @todo fix the pvCoreCodeR0 type */ 1010 return pbCodeR0 + pSwitcher->offR0HostToGuest; 1011 } 1012 return (RTR0PTR)0; 1013 }
Note:
See TracChangeset
for help on using the changeset viewer.