Changeset 11696 in vbox
- Timestamp:
- Aug 27, 2008 12:09:59 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 35421
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCMInternal.h
r11474 r11696 218 218 /** Virtual address of the virtual APIC mmio cache. */ 219 219 R0PTRTYPE(uint8_t *) pAPIC; 220 221 /** R0 memory object for the MSR bitmap (1 page). */ 222 RTR0MEMOBJ pMemObjMSRBitmap; 223 /** Physical address of the MSR bitmap (1 page). */ 224 RTHCPHYS pMSRBitmapPhys; 225 /** Virtual address of the MSR bitmap (1 page). */ 226 R0PTRTYPE(uint8_t *) pMSRBitmap; 227 228 /** R0 memory object for the MSR entry load page (guest MSRs). */ 229 RTR0MEMOBJ pMemObjMSREntryLoad; 230 /** Physical address of the MSR entry load page (guest MSRs). */ 231 RTHCPHYS pMSREntryLoadPhys; 232 /** Virtual address of the MSR entry load page (guest MSRs). */ 233 R0PTRTYPE(uint8_t *) pMSREntryLoad; 234 235 /** R0 memory object for the MSR exit store page (guest MSRs). */ 236 RTR0MEMOBJ pMemObjMSRExitStore; 237 /** Physical address of the MSR exit store page (guest MSRs). */ 238 RTHCPHYS pMSRExitStorePhys; 239 /** Virtual address of the MSR exit store page (guest MSRs). */ 240 R0PTRTYPE(uint8_t *) pMSRExitStore; 241 242 /** R0 memory object for the MSR exit load page (host MSRs). */ 243 RTR0MEMOBJ pMemObjMSRExitLoad; 244 /** Physical address of the MSR exit load page (host MSRs). */ 245 RTHCPHYS pMSRExitLoadPhys; 246 /** Virtual address of the MSR exit load page (host MSRs). */ 247 R0PTRTYPE(uint8_t *) pMSRExitLoad; 220 248 221 249 /** Ring 0 handlers for VT-x. */ -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r11517 r11696 189 189 } 190 190 191 /* Allocate the MSR bitmap if this feature is supported. */ 192 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS) 193 { 194 rc = RTR0MemObjAllocCont(&pVM->hwaccm.s.vmx.pMemObjMSRBitmap, 1 << PAGE_SHIFT, true /* executable R0 mapping */); 195 AssertRC(rc); 196 if (RT_FAILURE(rc)) 197 return rc; 198 199 pVM->hwaccm.s.vmx.pMSRBitmap = (uint8_t *)RTR0MemObjAddress(pVM->hwaccm.s.vmx.pMemObjMSRBitmap); 200 pVM->hwaccm.s.vmx.pMSRBitmapPhys = RTR0MemObjGetPagePhysAddr(pVM->hwaccm.s.vmx.pMemObjMSRBitmap, 0); 201 memset(pVM->hwaccm.s.vmx.pMSRBitmap, 0xff, PAGE_SIZE); 202 } 191 203 #ifdef LOG_ENABLED 192 204 SUPR0Printf("VMXR0InitVM %x VMCS=%x (%x) RealModeTSS=%x (%x)\n", pVM, pVM->hwaccm.s.vmx.pVMCS, (uint32_t)pVM->hwaccm.s.vmx.pVMCSPhys, pVM->hwaccm.s.vmx.pRealModeTSS, (uint32_t)pVM->hwaccm.s.vmx.pRealModeTSSPhys); … … 223 235 pVM->hwaccm.s.vmx.pAPIC = 0; 224 236 pVM->hwaccm.s.vmx.pAPICPhys = 0; 237 } 238 if (pVM->hwaccm.s.vmx.pMemObjMSRBitmap != NIL_RTR0MEMOBJ) 239 { 240 RTR0MemObjFree(pVM->hwaccm.s.vmx.pMemObjMSRBitmap, false); 241 pVM->hwaccm.s.vmx.pMemObjMSRBitmap = NIL_RTR0MEMOBJ; 242 pVM->hwaccm.s.vmx.pMSRBitmap = 0; 243 pVM->hwaccm.s.vmx.pMSRBitmapPhys = 0; 225 244 } 226 245 return VINF_SUCCESS; … … 291 310 val |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_STORE_EXIT | VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_CR8_LOAD_EXIT; 292 311 #endif 312 313 if (pVM->hwaccm.s.vmx.msr.vmx_proc_ctls.n.allowed1 & VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS) 314 { 315 Assert(pVM->hwaccm.s.vmx.pMSRBitmapPhys); 316 val |= VMX_VMCS_CTRL_PROC_EXEC_CONTROLS_USE_MSR_BITMAPS; 317 } 318 293 319 /* Mask away the bits that the CPU doesn't support */ 294 320 /** @todo make sure they don't conflict with the above requirements. */ … … 363 389 { 364 390 /* Optional */ 365 rc = VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_FULL, 0);391 rc = VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_FULL, pVM->hwaccm.s.vmx.pMSRBitmapPhys); 366 392 #if HC_ARCH_BITS == 32 367 rc |= VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_HIGH, 0);393 rc |= VMXWriteVMCS(VMX_VMCS_CTRL_MSR_BITMAP_HIGH, pVM->hwaccm.s.vmx.pMSRBitmapPhys >> 32); 368 394 #endif 369 395 AssertRC(rc);
Note:
See TracChangeset
for help on using the changeset viewer.