Changeset 13048 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Oct 7, 2008 1:33:00 PM (16 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r13025 r13048 530 530 531 531 /* Allocate three pages for the TSS we need for real mode emulation. (2 page for the IO bitmap) */ 532 rc = PDMR3VMMDevHeapAlloc(pVM, HWACCM_VTX_T SS_SIZE, (RTR3PTR *)&pVM->hwaccm.s.vmx.pRealModeTSS);532 rc = PDMR3VMMDevHeapAlloc(pVM, HWACCM_VTX_TOTAL_DEVHEAP_MEM, (RTR3PTR *)&pVM->hwaccm.s.vmx.pRealModeTSS); 533 533 AssertRC(rc); 534 534 if (RT_FAILURE(rc)) … … 543 543 memset(pVM->hwaccm.s.vmx.pRealModeTSS + 1, 0, PAGE_SIZE*2); 544 544 *((unsigned char *)pVM->hwaccm.s.vmx.pRealModeTSS + HWACCM_VTX_TSS_SIZE - 2) = 0xff; 545 546 /* Construct a 1024 element page directory with 4 MB pages for the identity mapped page table used in 547 * real and protected mode without paging with EPT. 548 */ 549 pVM->hwaccm.s.vmx.pRealModeEPTPageTable = (PX86PD)((char *)pVM->hwaccm.s.vmx.pRealModeTSS + PAGE_SIZE * 3); 550 for (unsigned i=0;i<X86_PG_ENTRIES;i++) 551 { 552 pVM->hwaccm.s.vmx.pRealModeEPTPageTable->a[i].u = X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_A | X86_PDE4M_D | X86_PDE4M_PS | X86_PDE4M_G; 553 pVM->hwaccm.s.vmx.pRealModeEPTPageTable->a[i].b.u10PageNo = _4M * i; 554 } 545 555 546 556 rc = SUPCallVMMR0Ex(pVM->pVMR0, VMMR0_DO_HWACC_SETUP_VM, 0, NULL); -
trunk/src/VBox/VMM/HWACCMInternal.h
r13026 r13048 125 125 #define HWACCM_MAX_RESUME_LOOPS 1024 126 126 127 /** Size for the EPT identity page table (1024 4 MB pages to cover the entire address space). */ 128 #define HWACCM_EPT_IDENTITY_PG_TABLE_SIZE PAGE_SIZE 127 129 /** Size of the TSS structure + 2 pages for the IO bitmap + end byte. */ 128 130 #define HWACCM_VTX_TSS_SIZE (sizeof(VBOXTSS) + 2*PAGE_SIZE + 1) 131 /** Total guest mapped memory needed. */ 132 #define HWACCM_VTX_TOTAL_DEVHEAP_MEM (HWACCM_EPT_IDENTITY_PG_TABLE_SIZE + HWACCM_VTX_TSS_SIZE) 129 133 130 134 /** HWACCM SSM version … … 235 239 /** Virtual address of the TSS page used for real mode emulation. */ 236 240 R3PTRTYPE(PVBOXTSS) pRealModeTSS; 237 #if HC_ARCH_BITS == 32 238 uint32_t padding2; /**< explicit alignment for 32-bit gcc*/239 #endif 241 242 /** Virtual address of the identity page table used for real mode emulation in EPT mode. */ 243 R3PTRTYPE(PX86PD) pRealModeEPTPageTable; 240 244 241 245 /** R0 memory object for the virtual APIC mmio cache. */ -
trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp
r13043 r13048 1092 1092 } 1093 1093 } 1094 else 1095 if (!(pCtx->cr0 & X86_CR0_PG)) 1096 { 1097 /* We use 4 MB pages in our identity mapping page table for real and protected mode without paging. */ 1098 val |= X86_CR4_PSE; 1099 } 1094 1100 1095 1101 #ifdef HWACCM_VMX_EMULATE_REALMODE … … 1137 1143 AssertRC(rc); 1138 1144 1139 /* Save the real guest CR3 in VMX_VMCS_GUEST_CR3 */ 1140 val = pCtx->cr3; 1145 if (!(pCtx->cr0 & X86_CR0_PG)) 1146 { 1147 RTGCPHYS GCPhys; 1148 1149 /* We convert it here every time as pci regions could be reconfigured. */ 1150 rc = PDMVMMDevHeapR3ToGCPhys(pVM, pVM->hwaccm.s.vmx.pRealModeEPTPageTable, &GCPhys); 1151 AssertRC(rc); 1152 1153 /* We use our identity mapping page table here as we need to map guest virtual to guest physical addresses; EPT will 1154 * take care of the translation to host physical addresses. 1155 */ 1156 val = GCPhys; 1157 } 1158 else 1159 { 1160 /* Save the real guest CR3 in VMX_VMCS_GUEST_CR3 */ 1161 val = pCtx->cr3; 1162 } 1141 1163 } 1142 1164 /* Save our shadow CR3 register. */
Note:
See TracChangeset
for help on using the changeset viewer.