Changeset 73739 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Aug 17, 2018 4:34:25 PM (6 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMAll/IEMAllCImplVmxInstr.cpp.h
r73732 r73739 452 452 DECLINLINE(void) iemVmxVmFailValid(PVMCPU pVCpu, VMXINSTRERR enmInsErr) 453 453 { 454 if (pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pVmcs))454 if (pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs != NIL_RTGCPHYS) 455 455 { 456 456 pVCpu->cpum.GstCtx.eflags.u32 &= ~(X86_EFL_CF | X86_EFL_PF | X86_EFL_AF | X86_EFL_ZF | X86_EFL_SF | X86_EFL_OF); … … 470 470 DECLINLINE(void) iemVmxVmFail(PVMCPU pVCpu, VMXINSTRERR enmInsErr) 471 471 { 472 if (pVCpu->cpum.GstCtx.hwvirt.vmx. CTX_SUFF(pVmcs))472 if (pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs != NIL_RTGCPHYS) 473 473 { 474 474 iemVmxVmFailValid(pVCpu, enmInsErr); … … 622 622 */ 623 623 pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmxon = GCPhysVmxon; 624 pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs = NIL_RTGCPHYS; 624 625 pVCpu->cpum.GstCtx.hwvirt.vmx.fInVmxRootMode = true; 625 pVCpu->cpum.GstCtx.hwvirt.vmx.GCPhysVmcs = NIL_RTGCPHYS;626 626 /** @todo NSTVMX: clear address-range monitoring. */ 627 627 /** @todo NSTVMX: Intel PT. */ -
trunk/src/VBox/VMM/VMMR3/CPUM.cpp
r73606 r73739 810 810 SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3, SVM_VMCB_PAGES); 811 811 pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR3 = NULL; 812 pVCpu->cpum.s.Guest.hwvirt.svm.pVmcbR0 = NULL; 812 813 } 813 814 pVCpu->cpum.s.Guest.hwvirt.svm.HCPhysVmcb = NIL_RTHCPHYS; … … 817 818 SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pvMsrBitmapR3, SVM_MSRPM_PAGES); 818 819 pVCpu->cpum.s.Guest.hwvirt.svm.pvMsrBitmapR3 = NULL; 820 pVCpu->cpum.s.Guest.hwvirt.svm.pvMsrBitmapR0 = NULL; 819 821 } 820 822 … … 823 825 SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3, SVM_IOPM_PAGES); 824 826 pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR3 = NULL; 827 pVCpu->cpum.s.Guest.hwvirt.svm.pvIoBitmapR0 = NULL; 825 828 } 826 829 } … … 895 898 if (RT_FAILURE(rc)) 896 899 cpumR3FreeSvmHwVirtState(pVM); 900 901 return rc; 902 } 903 904 905 /** 906 * Frees memory allocated for the VMX hardware virtualization state. 907 * 908 * @param pVM The cross context VM structure. 909 */ 910 static void cpumR3FreeVmxHwVirtState(PVM pVM) 911 { 912 Assert(pVM->cpum.ro.GuestFeatures.fVmx); 913 for (VMCPUID i = 0; i < pVM->cCpus; i++) 914 { 915 PVMCPU pVCpu = &pVM->aCpus[i]; 916 if (pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3) 917 { 918 SUPR3PageFreeEx(pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3, VMX_V_VMCS_PAGES); 919 pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3 = NULL; 920 pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR0 = NULL; 921 } 922 } 923 } 924 925 926 /** 927 * Allocates memory for the VMX hardware virtualization state. 928 * 929 * @returns VBox status code. 930 * @param pVM The cross context VM structure. 931 */ 932 static int cpumR3AllocVmxHwVirtState(PVM pVM) 933 { 934 int rc = VINF_SUCCESS; 935 LogRel(("CPUM: Allocating %u pages for the nested-guest VMCS\n", pVM->cCpus * VMX_V_VMCS_SIZE)); 936 for (VMCPUID i = 0; i < pVM->cCpus; i++) 937 { 938 PVMCPU pVCpu = &pVM->aCpus[i]; 939 940 /* 941 * Allocate the nested-guest current VMCS. 942 */ 943 SUPPAGE SupNstGstVmcsPage; 944 RT_ZERO(SupNstGstVmcsPage); 945 SupNstGstVmcsPage.Phys = NIL_RTHCPHYS; 946 Assert(VMX_V_VMCS_PAGES == 1); 947 Assert(!pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3); 948 rc = SUPR3PageAllocEx(VMX_V_VMCS_PAGES, 0 /* fFlags */, (void **)&pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3, 949 &pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR0, &SupNstGstVmcsPage); 950 if (RT_FAILURE(rc)) 951 { 952 Assert(!pVCpu->cpum.s.Guest.hwvirt.vmx.pVmcsR3); 953 LogRel(("CPUM%u: Failed to alloc %u pages for the nested-guest's VMCS\n", pVCpu->idCpu, VMX_V_VMCS_PAGES)); 954 break; 955 } 956 } 957 958 /* On any failure, cleanup. */ 959 if (RT_FAILURE(rc)) 960 cpumR3FreeVmxHwVirtState(pVM); 897 961 898 962 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.