Changeset 20234 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Jun 3, 2009 2:54:22 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCMInternal.h
r20142 r20234 346 346 bool padding[1]; 347 347 348 /** R0 memory object for the host VM control block (VMCB). */349 RTR0MEMOBJ pMemObjVMCBHost;350 /** Physical address of the host VM control block (VMCB). */351 RTHCPHYS pVMCBHostPhys;352 /** Virtual address of the host VM control block (VMCB). */353 R0PTRTYPE(void *) pVMCBHost;354 355 348 /** R0 memory object for the IO bitmap (12kb). */ 356 349 RTR0MEMOBJ pMemObjIOBitmap; … … 544 537 struct 545 538 { 539 /** R0 memory object for the host VM control block (VMCB). */ 540 RTR0MEMOBJ pMemObjVMCBHost; 541 /** Physical address of the host VM control block (VMCB). */ 542 RTHCPHYS pVMCBHostPhys; 543 /** Virtual address of the host VM control block (VMCB). */ 544 R0PTRTYPE(void *) pVMCBHost; 545 546 546 /** R0 memory object for the VM control block (VMCB). */ 547 547 RTR0MEMOBJ pMemObjVMCB; -
trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp
r20222 r20234 128 128 int rc; 129 129 130 pVM->hwaccm.s.svm.pMemObjVMCBHost = NIL_RTR0MEMOBJ;131 130 pVM->hwaccm.s.svm.pMemObjIOBitmap = NIL_RTR0MEMOBJ; 132 131 pVM->hwaccm.s.svm.pMemObjMSRBitmap = NIL_RTR0MEMOBJ; 133 134 /* Allocate one page for the host context */135 rc = RTR0MemObjAllocCont(&pVM->hwaccm.s.svm.pMemObjVMCBHost, 1 << PAGE_SHIFT, true /* executable R0 mapping */);136 if (RT_FAILURE(rc))137 return rc;138 139 pVM->hwaccm.s.svm.pVMCBHost = RTR0MemObjAddress(pVM->hwaccm.s.svm.pMemObjVMCBHost);140 pVM->hwaccm.s.svm.pVMCBHostPhys = RTR0MemObjGetPagePhysAddr(pVM->hwaccm.s.svm.pMemObjVMCBHost, 0);141 ASMMemZeroPage(pVM->hwaccm.s.svm.pVMCBHost);142 132 143 133 /* Allocate 12 KB for the IO bitmap (doesn't seem to be a way to convince SVM not to use it) */ … … 195 185 for (unsigned i=0;i<pVM->cCPUs;i++) 196 186 { 197 pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB = NIL_RTR0MEMOBJ; 198 199 /* Allocate one page for the VM control block (VMCB). */ 200 rc = RTR0MemObjAllocCont(&pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB, 1 << PAGE_SHIFT, true /* executable R0 mapping */); 187 PVMCPU pVCpu = &pVM->aCpus[i]; 188 189 pVCpu->hwaccm.s.svm.pMemObjVMCBHost = NIL_RTR0MEMOBJ; 190 pVCpu->hwaccm.s.svm.pMemObjVMCB = NIL_RTR0MEMOBJ; 191 192 /* Allocate one page for the host context */ 193 rc = RTR0MemObjAllocCont(&pVCpu->hwaccm.s.svm.pMemObjVMCBHost, 1 << PAGE_SHIFT, true /* executable R0 mapping */); 201 194 if (RT_FAILURE(rc)) 202 195 return rc; 203 196 204 pVM->aCpus[i].hwaccm.s.svm.pVMCB = RTR0MemObjAddress(pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB); 205 pVM->aCpus[i].hwaccm.s.svm.pVMCBPhys = RTR0MemObjGetPagePhysAddr(pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB, 0); 206 ASMMemZeroPage(pVM->aCpus[i].hwaccm.s.svm.pVMCB); 197 pVCpu->hwaccm.s.svm.pVMCBHost = RTR0MemObjAddress(pVCpu->hwaccm.s.svm.pMemObjVMCBHost); 198 pVCpu->hwaccm.s.svm.pVMCBHostPhys = RTR0MemObjGetPagePhysAddr(pVCpu->hwaccm.s.svm.pMemObjVMCBHost, 0); 199 ASMMemZeroPage(pVCpu->hwaccm.s.svm.pVMCBHost); 200 201 /* Allocate one page for the VM control block (VMCB). */ 202 rc = RTR0MemObjAllocCont(&pVCpu->hwaccm.s.svm.pMemObjVMCB, 1 << PAGE_SHIFT, true /* executable R0 mapping */); 203 if (RT_FAILURE(rc)) 204 return rc; 205 206 pVCpu->hwaccm.s.svm.pVMCB = RTR0MemObjAddress(pVCpu->hwaccm.s.svm.pMemObjVMCB); 207 pVCpu->hwaccm.s.svm.pVMCBPhys = RTR0MemObjGetPagePhysAddr(pVCpu->hwaccm.s.svm.pMemObjVMCB, 0); 208 ASMMemZeroPage(pVCpu->hwaccm.s.svm.pVMCB); 207 209 } 208 210 … … 220 222 for (unsigned i=0;i<pVM->cCPUs;i++) 221 223 { 222 if (pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB != NIL_RTR0MEMOBJ) 223 { 224 RTR0MemObjFree(pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB, false); 225 pVM->aCpus[i].hwaccm.s.svm.pVMCB = 0; 226 pVM->aCpus[i].hwaccm.s.svm.pVMCBPhys = 0; 227 pVM->aCpus[i].hwaccm.s.svm.pMemObjVMCB = NIL_RTR0MEMOBJ; 228 } 229 } 230 if (pVM->hwaccm.s.svm.pMemObjVMCBHost != NIL_RTR0MEMOBJ) 231 { 232 RTR0MemObjFree(pVM->hwaccm.s.svm.pMemObjVMCBHost, false); 233 pVM->hwaccm.s.svm.pVMCBHost = 0; 234 pVM->hwaccm.s.svm.pVMCBHostPhys = 0; 235 pVM->hwaccm.s.svm.pMemObjVMCBHost = NIL_RTR0MEMOBJ; 224 PVMCPU pVCpu = &pVM->aCpus[i]; 225 226 if (pVCpu->hwaccm.s.svm.pMemObjVMCBHost != NIL_RTR0MEMOBJ) 227 { 228 RTR0MemObjFree(pVCpu->hwaccm.s.svm.pMemObjVMCBHost, false); 229 pVCpu->hwaccm.s.svm.pVMCBHost = 0; 230 pVCpu->hwaccm.s.svm.pVMCBHostPhys = 0; 231 pVCpu->hwaccm.s.svm.pMemObjVMCBHost = NIL_RTR0MEMOBJ; 232 } 233 234 if (pVCpu->hwaccm.s.svm.pMemObjVMCB != NIL_RTR0MEMOBJ) 235 { 236 RTR0MemObjFree(pVCpu->hwaccm.s.svm.pMemObjVMCB, false); 237 pVCpu->hwaccm.s.svm.pVMCB = 0; 238 pVCpu->hwaccm.s.svm.pVMCBPhys = 0; 239 pVCpu->hwaccm.s.svm.pMemObjVMCB = NIL_RTR0MEMOBJ; 240 } 236 241 } 237 242 if (pVM->hwaccm.s.svm.pMemObjIOBitmap != NIL_RTR0MEMOBJ) … … 1110 1115 #endif 1111 1116 TMNotifyStartOfExecution(pVCpu); 1112 pVCpu->hwaccm.s.svm.pfnVMRun(pV M->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx, pVM, pVCpu);1117 pVCpu->hwaccm.s.svm.pfnVMRun(pVCpu->hwaccm.s.svm.pVMCBHostPhys, pVCpu->hwaccm.s.svm.pVMCBPhys, pCtx, pVM, pVCpu); 1113 1118 TMNotifyEndOfExecution(pVCpu); 1114 1119 VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
Note:
See TracChangeset
for help on using the changeset viewer.