Changeset 7496 in vbox for trunk/src/VBox/VMM/HWACCM.cpp
- Timestamp:
- Mar 19, 2008 10:22:50 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 28954
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r7476 r7496 90 90 if (VBOX_FAILURE(rc)) 91 91 return rc; 92 93 /* Allocate one page for the VM control structure (VMCS). */94 pVM->hwaccm.s.vmx.pVMCS = SUPContAlloc(1, &pVM->hwaccm.s.vmx.pVMCSPhys);95 if (pVM->hwaccm.s.vmx.pVMCS == 0)96 {97 AssertMsgFailed(("SUPContAlloc failed!!\n"));98 return VERR_NO_MEMORY;99 }100 memset(pVM->hwaccm.s.vmx.pVMCS, 0, PAGE_SIZE);101 102 /* Allocate one page for the TSS we need for real mode emulation. */103 pVM->hwaccm.s.vmx.pRealModeTSS = (PVBOXTSS)SUPContAlloc(1, &pVM->hwaccm.s.vmx.pRealModeTSSPhys);104 if (pVM->hwaccm.s.vmx.pRealModeTSS == 0)105 {106 AssertMsgFailed(("SUPContAlloc failed!!\n"));107 return VERR_NO_MEMORY;108 }109 /* We initialize it properly later as we can reuse it for SVM */110 memset(pVM->hwaccm.s.vmx.pRealModeTSS, 0, PAGE_SIZE);111 112 /* Reuse those three pages for AMD SVM. (one is active; never both) */113 pVM->hwaccm.s.svm.pVMCB = pVM->hwaccm.s.vmx.pVMCS;114 pVM->hwaccm.s.svm.pVMCBPhys = pVM->hwaccm.s.vmx.pVMCSPhys;115 pVM->hwaccm.s.svm.pVMCBHost = pVM->hwaccm.s.vmx.pRealModeTSS;116 pVM->hwaccm.s.svm.pVMCBHostPhys = pVM->hwaccm.s.vmx.pRealModeTSSPhys;117 118 /* Allocate 12 KB for the IO bitmap (doesn't seem to be a way to convince SVM not to use it) */119 pVM->hwaccm.s.svm.pIOBitmap = SUPContAlloc(3, &pVM->hwaccm.s.svm.pIOBitmapPhys);120 if (pVM->hwaccm.s.svm.pIOBitmap == 0)121 {122 AssertMsgFailed(("SUPContAlloc failed!!\n"));123 return VERR_NO_MEMORY;124 }125 /* Set all bits to intercept all IO accesses. */126 memset(pVM->hwaccm.s.svm.pIOBitmap, 0xff, PAGE_SIZE*3);127 128 /* Allocate 8 KB for the MSR bitmap (doesn't seem to be a way to convince SVM not to use it) */129 pVM->hwaccm.s.svm.pMSRBitmap = SUPContAlloc(2, &pVM->hwaccm.s.svm.pMSRBitmapPhys);130 if (pVM->hwaccm.s.svm.pMSRBitmap == 0)131 {132 AssertMsgFailed(("SUPContAlloc failed!!\n"));133 return VERR_NO_MEMORY;134 }135 /* Set all bits to intercept all MSR accesses. */136 memset(pVM->hwaccm.s.svm.pMSRBitmap, 0xff, PAGE_SIZE*2);137 92 138 93 /* Misc initialisation. */ … … 431 386 pVM->hwaccm.s.fInitialized = true; 432 387 433 /* The I/O bitmap starts right after the virtual interrupt redirection bitmap. Outside the TSS on purpose; the CPU will not check it434 * for I/O operations. */435 pVM->hwaccm.s.vmx.pRealModeTSS->offIoBitmap = sizeof(*pVM->hwaccm.s.vmx.pRealModeTSS);436 /* Bit set to 0 means redirection enabled. */437 memset(pVM->hwaccm.s.vmx.pRealModeTSS->IntRedirBitmap, 0x0, sizeof(pVM->hwaccm.s.vmx.pRealModeTSS->IntRedirBitmap));438 439 388 rc = SUPCallVMMR0Ex(pVM->pVMR0, VMMR0_DO_HWACC_SETUP_VM, 0, NULL); 440 389 AssertRC(rc); … … 545 494 pVM->hwaccm.s.pStatExitReason = 0; 546 495 } 547 548 if (pVM->hwaccm.s.vmx.pVMCS)549 {550 SUPContFree(pVM->hwaccm.s.vmx.pVMCS, 1);551 pVM->hwaccm.s.vmx.pVMCS = 0;552 }553 if (pVM->hwaccm.s.vmx.pRealModeTSS)554 {555 SUPContFree(pVM->hwaccm.s.vmx.pRealModeTSS, 1);556 pVM->hwaccm.s.vmx.pRealModeTSS = 0;557 }558 if (pVM->hwaccm.s.svm.pIOBitmap)559 {560 SUPContFree(pVM->hwaccm.s.svm.pIOBitmap, 3);561 pVM->hwaccm.s.svm.pIOBitmap = 0;562 }563 if (pVM->hwaccm.s.svm.pMSRBitmap)564 {565 SUPContFree(pVM->hwaccm.s.svm.pMSRBitmap, 2);566 pVM->hwaccm.s.svm.pMSRBitmap = 0;567 }568 496 return 0; 569 497 }
Note:
See TracChangeset
for help on using the changeset viewer.