Changeset 91291 in vbox
- Timestamp:
- Sep 16, 2021 10:04:16 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/cpum.mac
r91289 r91291 265 265 266 266 alignb 4096 267 .hwvirt.svm.Vmcb resb 4096 268 .hwvirt.svm.abMsrBitmap resb 8192 267 .hwvirt.svm.Vmcb resb 4096 268 .hwvirt.svm.abMsrBitmap resb 8192 269 .hwvirt.svm.abIoBitmap resb 12288 269 270 .hwvirt.svm.uMsrHSavePa resq 1 270 271 .hwvirt.svm.GCPhysVmcb resq 1 … … 275 276 .hwvirt.svm.cPauseFilterThreshold resw 1 276 277 .hwvirt.svm.fInterceptEvents resb 1 277 alignb 8 278 .hwvirt.svm.pvIoBitmapR0 RTR0PTR_RES 1 279 alignb 8 280 .hwvirt.svm.pvIoBitmapR3 RTR3PTR_RES 1 278 ;.unnamed_padding.1 resb 0 281 279 alignb 8 282 280 .hwvirt.enmHwvirt resd 1 -
trunk/include/VBox/vmm/cpumctx.h
r91289 r91291 508 508 * This one is just used for caching the bitmap from guest physical memory. */ 509 509 uint8_t abMsrBitmap[0x2000]; 510 511 /** 0x300 - MSR holding physical address of the Guest's Host-state. */ 510 /** 0x7000 - The IOPM (IO Permission bitmap). 511 * 512 * This need not be physically contiguous pages because we re-use the ring-0 513 * allocated IOPM while executing the nested-guest using hardware-assisted SVM 514 * because it's identical (we trap all IO accesses). 515 * 516 * This one is just used for caching the IOPM from guest physical memory in 517 * case the guest hypervisor allows direct access to some IO ports. */ 518 uint8_t abIoBitmap[0x3000]; 519 520 /** 0xa000 - MSR holding physical address of the Guest's Host-state. */ 512 521 uint64_t uMsrHSavePa; 513 /** 0x 308 - Guest physical address of the nested-guest VMCB. */522 /** 0xa008 - Guest physical address of the nested-guest VMCB. */ 514 523 RTGCPHYS GCPhysVmcb; 515 /** 0x 320 - Guest's host-state save area. */524 /** 0xa010 - Guest's host-state save area. */ 516 525 SVMHOSTSTATE HostState; 517 /** 0x3d8 - Guest TSC time-stamp of when the previous PAUSE instr. was executed. */ 526 /** 0xa0c8 - Guest TSC time-stamp of when the previous PAUSE instr. was 527 * executed. */ 518 528 uint64_t uPrevPauseTick; 519 /** 0x 3e0 - Pause filter count. */529 /** 0xa0d0 - Pause filter count. */ 520 530 uint16_t cPauseFilter; 521 /** 0x 3e2 - Pause filter threshold. */531 /** 0xa0d2 - Pause filter threshold. */ 522 532 uint16_t cPauseFilterThreshold; 523 /** 0x 3e4 - Whether the injected event is subject to event intercepts. */533 /** 0xa0d4 - Whether the injected event is subject to event intercepts. */ 524 534 bool fInterceptEvents; 525 /** 0x 3e5 - Padding. */535 /** 0xa0d5 - Padding. */ 526 536 bool afPadding[3]; 527 /** 0x3f8 - IO permission bitmap - R0 ptr. */528 R0PTRTYPE(void *) pvIoBitmapR0;529 /** 0x400 - IO permission bitmap - R3 ptr. */530 R3PTRTYPE(void *) pvIoBitmapR3;531 537 } svm; 532 538 … … 631 637 #endif 632 638 /** 0x530 - Pad to 64 byte boundary. */ 633 uint8_t abPadding0[8 ];639 uint8_t abPadding0[8+16]; 634 640 } hwvirt; 635 641 } CPUMCTX; … … 839 845 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.Vmcb, 4096); 840 846 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.abMsrBitmap, 4096); 841 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm. pvIoBitmapR0, 8);847 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) svm.abIoBitmap, 4096); 842 848 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.pVmcsR0, 8); 843 849 AssertCompileMemberAlignment(CPUMCTX, hwvirt.CPUM_UNION_NM(s.) vmx.pShadowVmcsR0, 8); -
trunk/include/VBox/vmm/vm.h
r91289 r91291 305 305 CPUMCTX GstCtx; 306 306 #endif 307 uint8_t padding[ 49152]; /* multiple of 4096 */307 uint8_t padding[61440]; /* multiple of 4096 */ 308 308 } cpum; 309 309 -
trunk/include/VBox/vmm/vm.mac
r91289 r91291 91 91 .pgm resb 4096+28672 92 92 alignb 4096 93 .cpum resb 4915293 .cpum resb 61440 94 94 %define VMCPU.cpum.GstCtx VMCPU.cpum 95 95 alignb 4096 -
trunk/src/VBox/VMM/VMMAll/IEMAllCImplSvmInstr.cpp.h
r91289 r91291 563 563 * Copy the IO permission bitmap into the cache. 564 564 */ 565 Assert (pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap));566 rc = PGMPhysSimpleReadGCPhys(pVM, pVCpu->cpum.GstCtx.hwvirt.svm. CTX_SUFF(pvIoBitmap), GCPhysIOBitmap,567 SVM_IOPM_PAGES * X86_PAGE_4K_SIZE);565 AssertCompile(sizeof(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap) == SVM_IOPM_PAGES * X86_PAGE_4K_SIZE); 566 rc = PGMPhysSimpleReadGCPhys(pVM, pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap, GCPhysIOBitmap, 567 sizeof(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap)); 568 568 if (RT_FAILURE(rc)) 569 569 { … … 989 989 990 990 SVMIOIOEXITINFO IoExitInfo; 991 void *pvIoBitmap = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap); 992 bool const fIntercept = CPUMIsSvmIoInterceptSet(pvIoBitmap, u16Port, enmIoType, cbReg, cAddrSizeBits, iEffSeg, fRep, 993 fStrIo, &IoExitInfo); 991 bool const fIntercept = CPUMIsSvmIoInterceptSet(pVCpu->cpum.GstCtx.hwvirt.svm.abMsrBitmap, u16Port, enmIoType, cbReg, 992 cAddrSizeBits, iEffSeg, fRep, fStrIo, &IoExitInfo); 994 993 if (fIntercept) 995 994 { -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r91289 r91291 4962 4962 if (CPUMIsGuestSvmCtrlInterceptSet(pVCpu, pCtx, SVM_CTRL_INTERCEPT_IOIO_PROT)) 4963 4963 { 4964 void *pvIoBitmap = pVCpu->cpum.GstCtx.hwvirt.svm.CTX_SUFF(pvIoBitmap);4965 4964 SVMIOIOEXITINFO IoExitInfo; 4966 4965 IoExitInfo.u = pVmcbNstGst->ctrl.u64ExitInfo1; 4967 bool const fIntercept = hmR0SvmIsIoInterceptSet(p vIoBitmap, &IoExitInfo);4966 bool const fIntercept = hmR0SvmIsIoInterceptSet(pVCpu->cpum.GstCtx.hwvirt.svm.abIoBitmap, &IoExitInfo); 4968 4967 if (fIntercept) 4969 4968 NST_GST_VMEXIT_CALL_RET(pVCpu, uExitCode, uExitInfo1, uExitInfo2); -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r91289 r91291 1018 1018 { 1019 1019 Assert(pVM->cpum.s.GuestFeatures.fSvm); 1020 for (VMCPUID i = 0; i < pVM->cCpus; i++) 1021 { 1022 PVMCPU pVCpu = pVM->apCpusR3[i]; 1023 1024 if (pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3) 1025 { 1026 SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3, SVM_IOPM_PAGES); 1027 pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3 = NULL; 1028 } 1029 } 1020 RT_NOREF(pVM); 1030 1021 } 1031 1022 … … 1051 1042 AssertCompile(SVM_VMCB_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.Vmcb)); 1052 1043 AssertCompile(SVM_MSRPM_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.abMsrBitmap)); 1053 1054 /* 1055 * Allocate the IOPM (IO Permission bitmap). 1056 * 1057 * This need not be physically contiguous pages because we re-use the ring-0 1058 * allocated IOPM while executing the nested-guest using hardware-assisted SVM 1059 * because it's identical (we trap all IO accesses). 1060 * 1061 * This one is just used for caching the IOPM from guest physical memory in 1062 * case the guest hypervisor allows direct access to some IO ports. 1063 */ 1064 Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3); 1065 rc = SUPR3PageAllocEx(SVM_IOPM_PAGES, 0 /* fFlags */, &pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3, 1066 &pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR0, NULL /* paPages */); 1067 if (RT_FAILURE(rc)) 1068 { 1069 Assert(!pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3); 1070 LogRel(("CPUM%u: Failed to alloc %u pages for the nested-guest's IO permission bitmap\n", pVCpu->idCpu, 1071 SVM_IOPM_PAGES)); 1072 break; 1073 } 1044 AssertCompile(SVM_IOPM_PAGES * X86_PAGE_SIZE == sizeof(pVCpu->cpum.s.Guest.hwvirt.svm.abIoBitmap)); 1074 1045 } 1075 1046 … … 2631 2602 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.svm.Vmcb, sizeof(pGstCtx->hwvirt.svm.Vmcb)); 2632 2603 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.svm.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.svm.abMsrBitmap)); 2633 SSMR3PutMem(pSSM, pGstCtx->hwvirt.svm.pvIoBitmapR3, SVM_IOPM_PAGES << X86_PAGE_4K_SHIFT);2604 SSMR3PutMem(pSSM, &pGstCtx->hwvirt.svm.abIoBitmap[0], sizeof(pGstCtx->hwvirt.svm.abIoBitmap)); 2634 2605 SSMR3PutU32(pSSM, pGstCtx->hwvirt.fLocalForcedActions); 2635 2606 SSMR3PutBool(pSSM, pGstCtx->hwvirt.fGif); … … 2915 2886 SSMR3GetStructEx(pSSM, &pGstCtx->hwvirt.svm.HostState, sizeof(pGstCtx->hwvirt.svm.HostState), 2916 2887 0 /* fFlags */, g_aSvmHwvirtHostState, NULL /* pvUser */); 2917 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.svm.Vmcb, sizeof(pGstCtx->hwvirt.svm.Vmcb));2888 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.svm.Vmcb, sizeof(pGstCtx->hwvirt.svm.Vmcb)); 2918 2889 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.svm.abMsrBitmap[0], sizeof(pGstCtx->hwvirt.svm.abMsrBitmap)); 2919 SSMR3GetMem(pSSM, pGstCtx->hwvirt.svm.pvIoBitmapR3, SVM_IOPM_PAGES << X86_PAGE_4K_SHIFT);2890 SSMR3GetMem(pSSM, &pGstCtx->hwvirt.svm.abIoBitmap[0], sizeof(pGstCtx->hwvirt.svm.abIoBitmap)); 2920 2891 SSMR3GetU32(pSSM, &pGstCtx->hwvirt.fLocalForcedActions); 2921 2892 SSMR3GetBool(pSSM, &pGstCtx->hwvirt.fGif); … … 4134 4105 pHlp->pfnPrintf(pHlp, " cPauseFilterThreshold = %RU32\n", pCtx->hwvirt.svm.cPauseFilterThreshold); 4135 4106 pHlp->pfnPrintf(pHlp, " fInterceptEvents = %u\n", pCtx->hwvirt.svm.fInterceptEvents); 4136 pHlp->pfnPrintf(pHlp, " pvIoBitmapR3 = %p\n", pCtx->hwvirt.svm.pvIoBitmapR3);4137 pHlp->pfnPrintf(pHlp, " pvIoBitmapR0 = %RKv\n", pCtx->hwvirt.svm.pvIoBitmapR0);4138 4107 } 4139 4108 else if (fVmx) -
trunk/src/VBox/VMM/include/CPUMInternal.mac
r91289 r91291 233 233 .Guest.hwvirt.svm.Vmcb resb 4096 234 234 .Guest.hwvirt.svm.abMsrBitmap resb 8192 235 .Guest.hwvirt.svm.abIoBitmap resb 12288 235 236 .Guest.hwvirt.svm.uMsrHSavePa resq 1 236 237 .Guest.hwvirt.svm.GCPhysVmcb resq 1 … … 241 242 .Guest.hwvirt.svm.cPauseFilterThreshold resw 1 242 243 .Guest.hwvirt.svm.fInterceptEvents resb 1 243 alignb 8244 .Guest.hwvirt.svm.pvIoBitmapR0 RTR0PTR_RES 1245 alignb 8246 .Guest.hwvirt.svm.pvIoBitmapR3 RTR3PTR_RES 1247 244 248 245 ;.unnamed_padding.1 resb 0 -
trunk/src/VBox/VMM/testcase/tstVMStruct.h
r91289 r91291 130 130 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.Vmcb); 131 131 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.abMsrBitmap); 132 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.abIoBitmap); 132 133 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.uMsrHSavePa); 133 134 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.GCPhysVmcb); … … 137 138 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.cPauseFilterThreshold); 138 139 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.fInterceptEvents); 139 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.pvIoBitmapR0);140 GEN_CHECK_OFF(CPUMCTX, hwvirt.svm.pvIoBitmapR3);141 140 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.GCPhysVmxon); 142 141 GEN_CHECK_OFF(CPUMCTX, hwvirt.vmx.GCPhysVmcs); -
trunk/src/VBox/VMM/testcase/tstVMStructSize.cpp
r91290 r91291 251 251 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.Vmcb, 4096); 252 252 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.abMsrBitmap, 4096); 253 CHECK_MEMBER_ALIGNMENT(VMCPU, cpum.s.Guest.hwvirt.svm.abIoBitmap, 4096); 253 254 254 255 PVM pVM = NULL; NOREF(pVM);
Note:
See TracChangeset
for help on using the changeset viewer.