Changeset 91304 in vbox
- Timestamp:
- Sep 17, 2021 8:43:17 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.mac
r91301 r91304 288 288 .hwvirt.vmx.aExitMsrStoreArea resb 0x2000 289 289 .hwvirt.vmx.aExitMsrLoadArea resb 0x2000 290 .hwvirt.vmx.abMsrBitmap resb 0x1000 290 291 alignb 8 291 292 .hwvirt.vmx.GCPhysVmxon resq 1 … … 302 303 .hwvirt.vmx.pvVirtApicPageR0 resq 1 303 304 .hwvirt.vmx.pvVirtApicPageR3 resq 1 304 .hwvirt.vmx.pvMsrBitmapR0 resq 1305 .hwvirt.vmx.pvMsrBitmapR3 resq 1306 305 .hwvirt.vmx.pvIoBitmapR0 resq 1 307 306 .hwvirt.vmx.pvIoBitmapR3 resq 1 -
trunk/include/VBox/vmm/cpumctx.h
r91301 r91304 553 553 /** 0xc000 - The VM-exit MSR-load area. */ 554 554 VMXAUTOMSR aExitMsrLoadArea[VMX_V_AUTOMSR_AREA_SIZE / sizeof(VMXAUTOMSR)]; 555 /** 0xe000 - The MSR permission bitmap. */ 556 uint8_t abMsrBitmap[VMX_V_MSR_BITMAP_SIZE]; 555 557 556 558 /** 0x300 - Guest physical address of the VMXON region. */ … … 582 584 /** 0x358 - The virtual-APIC page - R3 ptr. */ 583 585 R3PTRTYPE(void *) pvVirtApicPageR3; 584 /** 0x3b0 - MSR bitmap - R0 ptr. */585 R0PTRTYPE(void *) pvMsrBitmapR0;586 /** 0x3b8 - The MSR bitmap - R3 ptr. */587 R3PTRTYPE(void *) pvMsrBitmapR3;588 586 /** 0x3c0 - The I/O bitmap - R0 ptr. */ 589 587 R0PTRTYPE(void *) pvIoBitmapR0; … … 624 622 #endif 625 623 /** 0x530 - Pad to 64 byte boundary. */ 626 uint8_t abPadding0[8 ];624 uint8_t abPadding0[8+16]; 627 625 } hwvirt; 628 626 } CPUMCTX; … … 840 838 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.aExitMsrStoreArea, X86_PAGE_SIZE); 841 839 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.aExitMsrLoadArea, X86_PAGE_SIZE); 842 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx. pvMsrBitmapR0, 8);840 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.abMsrBitmap, X86_PAGE_SIZE); 843 841 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.pvIoBitmapR0, 8); 844 842 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.Msrs, 8); -
trunk/include/VBox/vmm/vm.h
r91301 r91304 305 305 CPUMCTX GstCtx; 306 306 #endif 307 uint8_t padding[ 86016]; /* multiple of 4096 */307 uint8_t padding[90112]; /* multiple of 4096 */ 308 308 } cpum; 309 309 -
trunk/include/VBox/vmm/vm.mac
r91301 r91304 91 91 .pgm resb 4096+28672 92 92 alignb 4096 93 .cpum resb 8601693 .cpum resb 90112 94 94 %define VMCPU.cpum.GstCtx VMCPU.cpum 95 95 alignb 4096 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r91301 r91304 6754 6754 /* Read the MSR bitmap. */ 6755 6755 RTGCPHYS const GCPhysMsrBitmap = pVmcs->u64AddrMsrBitmap.u; 6756 Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap)); 6757 int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), 6758 GCPhysMsrBitmap, VMX_V_MSR_BITMAP_SIZE); 6756 int rc = PGMPhysSimpleReadGCPhys(pVCpu->CTX_SUFF(pVM), &pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap[0], 6757 GCPhysMsrBitmap, sizeof(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap)); 6759 6758 if (RT_SUCCESS(rc)) 6760 6759 { /* likely */ } … … 7447 7446 if (pVmcs->u32ProcCtls & VMX_PROC_CTLS_USE_MSR_BITMAPS) 7448 7447 { 7449 Assert(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap)); 7450 uint32_t const fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap), idMsr); 7448 uint32_t const fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, idMsr); 7451 7449 if (uExitReason == VMX_EXIT_RDMSR) 7452 7450 return RT_BOOL(fMsrpm & VMXMSRPM_EXIT_RD); -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r91297 r91304 2127 2127 * 2128 2128 * @returns @c true if the MSR is intercepted, @c false otherwise. 2129 * @param p vMsrBitmap The MSR bitmap.2129 * @param pbMsrBitmap The MSR bitmap. 2130 2130 * @param offMsr The MSR byte offset. 2131 2131 * @param iBit The bit offset from the byte offset. 2132 2132 */ 2133 DECLINLINE(bool) hmR0VmxIsMsrBitSet(const void *pvMsrBitmap, uint16_t offMsr, int32_t iBit) 2134 { 2135 uint8_t const * const pbMsrBitmap = (uint8_t const * const)pvMsrBitmap; 2136 Assert(pbMsrBitmap); 2133 DECLINLINE(bool) hmR0VmxIsMsrBitSet(uint8_t const *pbMsrBitmap, uint16_t offMsr, int32_t iBit) 2134 { 2137 2135 Assert(offMsr + (iBit >> 3) <= X86_PAGE_4K_SIZE); 2138 2136 return ASMBitTest(pbMsrBitmap + offMsr, iBit); … … 2204 2202 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 2205 2203 bool const fClear = !fIsNstGstVmcs ? true 2206 : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pvMsrBitmap), offMsrRead, iBit);2204 : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, offMsrRead, iBit); 2207 2205 #else 2208 2206 RT_NOREF2(pVCpu, fIsNstGstVmcs); … … 2224 2222 #ifdef VBOX_WITH_NESTED_HWVIRT_VMX 2225 2223 bool const fClear = !fIsNstGstVmcs ? true 2226 : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pvMsrBitmap), offMsrWrite, iBit);2224 : !hmR0VmxIsMsrBitSet(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, offMsrWrite, iBit); 2227 2225 #else 2228 2226 RT_NOREF2(pVCpu, fIsNstGstVmcs); … … 2840 2838 * allow passthrough too. 2841 2839 */ 2842 void const *pvMsrBitmapNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pvMsrBitmap);2840 void const *pvMsrBitmapNstGst = pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap; 2843 2841 Assert(pvMsrBitmapNstGst); 2844 2842 uint32_t const fMsrpmNstGst = CPUMGetVmxMsrPermission(pvMsrBitmapNstGst, pGuestMsrLoad->u32Msr); … … 10422 10420 if (pVmcsNstGst->u32ProcCtls & VMX_PROC_CTLS_USE_MSR_BITMAPS) 10423 10421 { 10424 uint64_t const *pu64MsrBitmapNstGst = (uint64_t const *) pVCpu->cpum.GstCtx.hwvirt.vmx.CTX_SUFF(pvMsrBitmap);10422 uint64_t const *pu64MsrBitmapNstGst = (uint64_t const *)&pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap[0]; 10425 10423 uint64_t const *pu64MsrBitmapGst = (uint64_t const *)pVmcsInfoGst->pvMsrBitmap; 10426 10424 Assert(pu64MsrBitmapNstGst); … … 17325 17323 uint32_t fMsrpm; 17326 17324 if (CPUMIsGuestVmxProcCtlsSet(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS_USE_MSR_BITMAPS)) 17327 fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pvMsrBitmap), pVCpu->cpum.GstCtx.ecx);17325 fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, pVCpu->cpum.GstCtx.ecx); 17328 17326 else 17329 17327 fMsrpm = VMXMSRPM_EXIT_RD; … … 17347 17345 uint32_t fMsrpm; 17348 17346 if (CPUMIsGuestVmxProcCtlsSet(&pVCpu->cpum.GstCtx, VMX_PROC_CTLS_USE_MSR_BITMAPS)) 17349 fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pvMsrBitmap), pVCpu->cpum.GstCtx.ecx);17347 fMsrpm = CPUMGetVmxMsrPermission(pVCpu->cpum.GstCtx.hwvirt.vmx.abMsrBitmap, pVCpu->cpum.GstCtx.ecx); 17350 17348 else 17351 17349 fMsrpm = VMXMSRPM_EXIT_WR; -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r91301 r91304 1067 1067 pCtx->hwvirt.vmx.pvVirtApicPageR3 = NULL; 1068 1068 } 1069 if (pCtx->hwvirt.vmx.pvMsrBitmapR3)1070 {1071 SUPR3ContFree(pCtx->hwvirt.vmx.pvMsrBitmapR3, VMX_V_MSR_BITMAP_PAGES);1072 pCtx->hwvirt.vmx.pvMsrBitmapR3 = NULL;1073 }1074 1069 if (pCtx->hwvirt.vmx.pvIoBitmapR3) 1075 1070 { … … 1118 1113 AssertCompile(sizeof(pCtx->hwvirt.vmx.aExitMsrLoadArea) == VMX_V_AUTOMSR_AREA_PAGES * X86_PAGE_SIZE); 1119 1114 AssertCompile(sizeof(pCtx->hwvirt.vmx.aExitMsrLoadArea) == VMX_V_AUTOMSR_AREA_SIZE); 1115 AssertCompile(sizeof(pCtx->hwvirt.vmx.abMsrBitmap) == VMX_V_MSR_BITMAP_PAGES * X86_PAGE_SIZE); 1116 AssertCompile(sizeof(pCtx->hwvirt.vmx.abMsrBitmap) == VMX_V_MSR_BITMAP_SIZE); 1120 1117 1121 1118 /* … … 1135 1132 1136 1133 /* 1137 * Allocate the MSR bitmap.1138 */1139 pCtx->hwvirt.vmx.pvMsrBitmapR3 = SUPR3ContAlloc(VMX_V_MSR_BITMAP_PAGES, &pCtx->hwvirt.vmx.pvMsrBitmapR0, NULL);1140 if (pCtx->hwvirt.vmx.pvMsrBitmapR3)1141 { /* likely */ }1142 else1143 {1144 LogRel(("CPUM%u: Failed to alloc %u pages for the nested-guest's MSR bitmap\n", pVCpu->idCpu,1145 VMX_V_MSR_BITMAP_PAGES));1146 break;1147 }1148 1149 /*1150 1134 * Allocate the I/O bitmaps (A and B). 1151 1135 */ … … 1164 1148 * Zero out all allocated pages (should compress well for saved-state). 1165 1149 */ 1150 /** @todo this is and always was unnecessary - they are already zeroed. */ 1166 1151 RT_ZERO(pCtx->hwvirt.vmx.Vmcs); 1167 1152 RT_ZERO(pCtx->hwvirt.vmx.ShadowVmcs); … … 1171 1156 RT_ZERO(pCtx->hwvirt.vmx.aExitMsrStoreArea); 1172 1157 RT_ZERO(pCtx->hwvirt.vmx.aExitMsrLoadArea); 1173 memset(pCtx->hwvirt.vmx.CTX_SUFF(pvMsrBitmap), 0, VMX_V_MSR_BITMAP_SIZE);1158 RT_ZERO(pCtx->hwvirt.vmx.abMsrBitmap); 1174 1159 memset(pCtx->hwvirt.vmx.CTX_SUFF(pvIoBitmap), 0, VMX_V_IO_BITMAP_A_SIZE + VMX_V_IO_BITMAP_B_SIZE); 1175 1160 memset(pCtx->hwvirt.vmx.CTX_SUFF(pvVirtApicPage), 0, VMX_V_VIRT_APIC_SIZE); … … 2485 2470 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.vmx.aExitMsrStoreArea[0], sizeof(pGstCtx->hwvirt.vmx.aExitMsrStoreArea)); 2486 2471 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.vmx.aExitMsrLoadArea[0], sizeof(pGstCtx->hwvirt.vmx.aExitMsrLoadArea)); 2487 SSMR3PutMem(pSSM, pGstCtx->hwvirt.vmx.pvMsrBitmapR3, VMX_V_MSR_BITMAP_SIZE);2472 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.vmx.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.vmx.abMsrBitmap)); 2488 2473 SSMR3PutMem(pSSM, pGstCtx->hwvirt.vmx.pvIoBitmapR3, VMX_V_IO_BITMAP_A_SIZE + VMX_V_IO_BITMAP_B_SIZE); 2489 2474 SSMR3PutU64(pSSM, pGstCtx->hwvirt.vmx.uFirstPauseLoopTick); … … 2775 2760 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.vmx.aExitMsrStoreArea[0], sizeof(pGstCtx->hwvirt.vmx.aExitMsrStoreArea)); 2776 2761 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.vmx.aExitMsrLoadArea[0], sizeof(pGstCtx->hwvirt.vmx.aExitMsrLoadArea)); 2777 SSMR3GetMem(pSSM, pGstCtx->hwvirt.vmx.pvMsrBitmapR3, VMX_V_MSR_BITMAP_SIZE);2762 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.vmx.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.vmx.abMsrBitmap)); 2778 2763 SSMR3GetMem(pSSM, pGstCtx->hwvirt.vmx.pvIoBitmapR3, VMX_V_IO_BITMAP_A_SIZE + VMX_V_IO_BITMAP_B_SIZE); 2779 2764 SSMR3GetU64(pSSM, &pGstCtx->hwvirt.vmx.uFirstPauseLoopTick); -
trunk/src/VBox/VMM/include/CPUMInternal.mac
r91301 r91304 255 255 .Guest.hwvirt.vmx.aExitMsrStoreArea resb 0x2000 256 256 .Guest.hwvirt.vmx.aExitMsrLoadArea resb 0x2000 257 .Guest.hwvirt.vmx.abMsrBitmap resb 0x1000 257 258 alignb 8 258 259 .Guest.hwvirt.vmx.GCPhysVmxon resq 1 … … 269 270 .Guest.hwvirt.vmx.pvVirtApicPageR0 resq 1 270 271 .Guest.hwvirt.vmx.pvVirtApicPageR3 resq 1 271 .Guest.hwvirt.vmx.pvMsrBitmapR0 resq 1272 .Guest.hwvirt.vmx.pvMsrBitmapR3 resq 1273 272 .Guest.hwvirt.vmx.pvIoBitmapR0 resq 1 274 273 .Guest.hwvirt.vmx.pvIoBitmapR3 resq 1 -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r91301 r91304 150 150 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvVirtApicPageR0); 151 151 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvVirtApicPageR3); 152 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvMsrBitmapR0);153 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvMsrBitmapR3);154 152 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvIoBitmapR0); 155 153 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.pvIoBitmapR3); -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r91301 r91304 259 259 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.vmx.aExitMsrStoreArea, 4096); 260 260 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.vmx.aExitMsrLoadArea, 4096); 261 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.vmx.abMsrBitmap, 4096); 261 262 262 263 PVM pVM = NULL; NOREF(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.