Changeset 15141 in vbox
- Timestamp:
- Dec 9, 2008 9:19:20 AM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMGC/HWACCMGCA.asm
r15046 r15141 350 350 351 351 ; save host fs, gs, sysenter msr etc 352 mov rax, [rbp + 8 ]; pVMCBHostPhys (64 bits physical address)352 mov rax, [rbp + 8 + 8] ; pVMCBHostPhys (64 bits physical address) 353 353 push rax ; save for the vmload after vmrun 354 354 vmsave 355 355 356 356 ; setup eax for VMLOAD 357 mov rax, [rbp + 8 + RTHCPHYS_CB]; pVMCBPhys (64 bits physical address)357 mov rax, [rbp + 8 + 8 + RTHCPHYS_CB] ; pVMCBPhys (64 bits physical address) 358 358 359 359 ;/* Restore Guest's general purpose registers. */ -
trunk/src/VBox/VMM/VMMR0/HWACCMR0.cpp
r15134 r15141 1076 1076 { 1077 1077 if (pVM->hwaccm.s.vmx.fSupported) 1078 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64 );1079 1080 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64 );1078 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64, 0, NULL); 1079 1080 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestFPU64, 0, NULL); 1081 1081 } 1082 1082 … … 1092 1092 { 1093 1093 if (pVM->hwaccm.s.vmx.fSupported) 1094 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64 );1095 1096 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64 );1097 } 1098 1099 # ifdef DEBUG1094 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64, 0, NULL); 1095 1096 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnSaveGuestDebug64, 0, NULL); 1097 } 1098 1099 # ifdef DEBUG 1100 1100 /** 1101 1101 * Test the 32->64 bits switcher … … 1108 1108 PVMCPU pVCpu = &pVM->aCpus[0]; 1109 1109 CPUMCTX *pCtx; 1110 uint32_t aParam[5] = {0, 1, 2, 3, 4}; 1110 1111 1111 1112 pCtx = CPUMQueryGuestCtxPtrEx(pVM, pVCpu); 1112 1113 1113 1114 if (pVM->hwaccm.s.vmx.fSupported) 1114 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64 );1115 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64, 5, &aParam[0]); 1115 1116 1116 1117 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnTest64); 1117 1118 } 1118 # endif1119 # endif 1119 1120 1120 1121 #endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */ -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r15072 r15141 2290 2290 DECLASM(int) SVMR0VMSwitcherRun64(RTHCPHYS pVMCBHostPhys, RTHCPHYS pVMCBPhys, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu) 2291 2291 { 2292 int rc; 2293 RTCCUINTREG uFlags; 2294 2295 /* @todo This code is not guest SMP safe (hyper context) */ 2296 AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED); 2297 2298 uFlags = ASMIntDisableFlags(); 2299 2300 CPUMSetHyperESP(pVM, VMMGetStackRC(pVM)); 2301 CPUMPushHyper(pVM, (uint32_t)(pVMCBHostPhys >> 32)); /* Param 2: pVMCBHostPhys - Hi. */ 2302 CPUMPushHyper(pVM, (uint32_t)pVMCBHostPhys); /* Param 2: pVMCBHostPhys - Lo. */ 2303 CPUMPushHyper(pVM, (uint32_t)(pVMCBPhys >> 32)); /* Param 1: pVMCBPhys - Hi. */ 2304 CPUMPushHyper(pVM, (uint32_t)pVMCBPhys); /* Param 1: pVMCBPhys - Lo. */ 2305 CPUMSetHyperEIP(pVM, pVM->hwaccm.s.pfnVMXGCStartVM64); 2306 2307 /* Call switcher. */ 2308 rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM); 2309 2310 ASMSetFlags(uFlags); 2311 return rc; 2292 uint32_t aParam[4]; 2293 int rc; 2294 2295 aParam[0] = (uint32_t)(pVMCBHostPhys >> 32); /* Param 1: pVMCBHostPhys - Hi. */ 2296 aParam[1] = (uint32_t)(pVMCBHostPhys); /* Param 1: pVMCBHostPhys - Lo. */ 2297 aParam[2] = (uint32_t)(pVMCBPhys >> 32); /* Param 2: pVMCBPhys - Hi. */ 2298 aParam[3] = (uint32_t)(pVMCBPhys); /* Param 2: pVMCBPhys - Lo. */ 2299 2300 return SVMR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 4, &aParam[0]); 2312 2301 } 2313 2302 … … 2320 2309 * @param pCtx Guest context 2321 2310 * @param pfnHandler RC handler 2311 * @param cbParam Number of parameters 2312 * @param paParam Array of 32 bits parameters 2322 2313 */ 2323 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler )2314 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam) 2324 2315 { 2325 2316 int rc; … … 2333 2324 CPUMSetHyperESP(pVM, VMMGetStackRC(pVM)); 2334 2325 CPUMSetHyperEIP(pVM, pfnHandler); 2326 for (int i=(int)cbParam-1;i>=0;i++) 2327 CPUMPushHyper(pVM, paParam[i]); 2335 2328 2336 2329 /* Call switcher. */ -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.h
r14875 r15141 160 160 * @param pCtx Guest context 161 161 * @param pfnHandler RC handler 162 */ 163 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler); 162 * @param cbParam Number of parameters 163 * @param paParam Array of 32 bits parameters 164 */ 165 VMMR0DECL(int) SVMR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam); 164 166 165 167 #endif /* HC_ARCH_BITS == 32 && defined(VBOX_WITH_64_BITS_GUESTS) */ -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r15072 r15141 3441 3441 DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVM pVM, PVMCPU pVCpu) 3442 3442 { 3443 int rc, rc2;3444 RTCCUINTREG uFlags;3443 uint32_t aParam[4]; 3444 int rc; 3445 3445 PHWACCM_CPUINFO pCpu; 3446 3446 RTHCPHYS pPageCpuPhys; 3447 3447 3448 /* @todo This code is not guest SMP safe (hyper context) */3449 AssertReturn(pVM->cCPUs == 1, VERR_ACCESS_DENIED);3450 AssertReturn(pVM->hwaccm.s.pfnHost32ToGuest64R0, VERR_INTERNAL_ERROR);3451 3452 3448 pCpu = HWACCMR0GetCurrentCpuEx(pVCpu->idCpu); 3453 3449 pPageCpuPhys = RTR0MemObjGetPagePhysAddr(pCpu->pMemObj, 0); 3454 3450 3455 /* Clear VM Control Structure. Marking it inactive, clearing implementation specific data and writing back VMCS data to memory. */ 3456 VMXClearVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys); 3457 3458 /* Leave VMX Root Mode. */ 3459 VMXDisable(); 3460 3461 uFlags = ASMIntDisableFlags(); 3462 3463 CPUMSetHyperESP(pVM, VMMGetStackRC(pVM)); 3464 CPUMPushHyper(pVM, (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys >> 32)); /* Param 2: pVMCBHostPhys - Hi. */ 3465 CPUMPushHyper(pVM, (uint32_t)pVCpu->hwaccm.s.vmx.pVMCSPhys); /* Param 2: pVMCBHostPhys - Lo. */ 3466 CPUMPushHyper(pVM, (uint32_t)(pPageCpuPhys >> 32)); /* Param 1: pVMCBPhys - Hi. */ 3467 CPUMPushHyper(pVM, (uint32_t)pPageCpuPhys); /* Param 1: pVMCBPhys - Lo. */ 3468 CPUMSetHyperEIP(pVM, pVM->hwaccm.s.pfnVMXGCStartVM64); 3469 3470 /* Call switcher. */ 3471 rc = pVM->hwaccm.s.pfnHost32ToGuest64R0(pVM); 3472 3473 ASMSetFlags(uFlags); 3474 3475 /* Make sure the VMX instructions don't cause #UD faults. */ 3476 ASMSetCR4(ASMGetCR4() | X86_CR4_VMXE); 3477 3478 /* Enter VMX Root Mode */ 3479 rc2 = VMXEnable(pPageCpuPhys); 3480 if (RT_FAILURE(rc2)) 3481 { 3482 if (pVM) 3483 VMXR0CheckError(pVM, pVCpu, rc2); 3484 ASMSetCR4(ASMGetCR4() & ~X86_CR4_VMXE); 3485 return VERR_VMX_VMXON_FAILED; 3486 } 3487 3488 VMXActivateVMCS(pVCpu->hwaccm.s.vmx.pVMCSPhys); 3489 return rc; 3451 aParam[0] = (uint32_t)(pPageCpuPhys >> 32)); /* Param 1: VMXON physical address - Hi. */ 3452 aParam[1] = (uint32_t)(pPageCpuPhys); /* Param 1: VMXON physical address - Lo. */ 3453 aParam[2] = (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys >> 32); /* Param 2: VMCS physical address - Hi. */ 3454 aParam[3] = (uint32_t)(pVCpu->hwaccm.s.vmx.pVMCSPhys); /* Param 2: VMCS physical address - Lo. */ 3455 3456 return VMXR0Execute64BitsHandler(pVM, pVCpu, pCtx, pVM->hwaccm.s.pfnVMXGCStartVM64, 4, &aParam[0]); 3490 3457 } 3491 3458 … … 3498 3465 * @param pCtx Guest context 3499 3466 * @param pfnHandler RC handler 3467 * @param cbParam Number of parameters 3468 * @param paParam Array of 32 bits parameters 3500 3469 */ 3501 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler )3470 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam) 3502 3471 { 3503 3472 int rc, rc2; … … 3523 3492 CPUMSetHyperESP(pVM, VMMGetStackRC(pVM)); 3524 3493 CPUMSetHyperEIP(pVM, pfnHandler); 3494 for (int i=(int)cbParam-1;i>=0;i++) 3495 CPUMPushHyper(pVM, paParam[i]); 3525 3496 3526 3497 /* Call switcher. */ -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.h
r14997 r15141 148 148 * @param pCtx Guest context 149 149 * @param pfnHandler RC handler 150 */ 151 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler); 150 * @param cbParam Number of parameters 151 * @param paParam Array of 32 bits parameters 152 */ 153 VMMR0DECL(int) VMXR0Execute64BitsHandler(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx, RTRCPTR pfnHandler, uint32_t cbParam, uint32_t *paParam); 152 154 153 155 #define VMX_WRITE_SELREG(REG, reg) \
Note:
See TracChangeset
for help on using the changeset viewer.