Changeset 69930 in vbox
- Timestamp:
- Dec 5, 2017 10:12:57 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 119417
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/hm_svm.h
r69764 r69930 1002 1002 /** @name Nested-guest VMCB guest state. 1003 1003 * @{ */ 1004 /** Cache of CR0. */ 1005 uint64_t u64CR0; 1004 1006 /** Cache of CR3. */ 1005 1007 uint64_t u64CR3; -
trunk/src/VBox/VMM/VMMAll/HMSVMAll.cpp
r69764 r69930 359 359 pVmcbNstGstCtrl->u32InterceptXcpt = pNstGstVmcbCache->u32InterceptXcpt; 360 360 pVmcbNstGstCtrl->u64InterceptCtrl = pNstGstVmcbCache->u64InterceptCtrl; 361 pVmcbNstGstState->u64CR0 = pNstGstVmcbCache->u64CR0; 361 362 pVmcbNstGstState->u64CR3 = pNstGstVmcbCache->u64CR3; 362 363 pVmcbNstGstState->u64CR4 = pNstGstVmcbCache->u64CR4; -
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r69928 r69930 679 679 680 680 /** 681 * Returns whether VMCB Clean Bits feature is supported. 682 * 683 * @param pVCpu The cross context virtual CPU structure. 684 * @param pCtx Pointer to the guest-CPU context. 685 */ 686 DECLINLINE(bool) hmR0SvmSupportsVmcbCleanBits(PVMCPU pVCpu, PCPUMCTX pCtx) 687 { 688 PVM pVM = pVCpu->CTX_SUFF(pVM); 689 #ifdef VBOX_WITH_NESTED_HWVIRT 690 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 691 { 692 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN) 693 && pVM->cpum.ro.GuestFeatures.fSvmVmcbClean; 694 } 695 #else 696 RT_NOREF(pCtx); 697 #endif 698 return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN); 699 } 700 701 702 /** 703 * Returns whether decode-assist feature is supported. 704 * 705 * @param pVCpu The cross context virtual CPU structure. 706 * @param pCtx Pointer to the guest-CPU context. 707 */ 708 DECLINLINE(bool) hmR0SvmSupportsDecodeAssist(PVMCPU pVCpu, PCPUMCTX pCtx) 709 { 710 PVM pVM = pVCpu->CTX_SUFF(pVM); 711 #ifdef VBOX_WITH_NESTED_HWVIRT 712 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 713 { 714 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST) 715 && pVM->cpum.ro.GuestFeatures.fSvmDecodeAssist; 716 } 717 #else 718 RT_NOREF(pCtx); 719 #endif 720 return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST); 721 } 722 723 724 /** 725 * Returns whether NRIP_SAVE feature is supported. 726 * 727 * @param pVCpu The cross context virtual CPU structure. 728 * @param pCtx Pointer to the guest-CPU context. 729 */ 730 DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPU pVCpu, PCPUMCTX pCtx) 731 { 732 PVM pVM = pVCpu->CTX_SUFF(pVM); 733 #ifdef VBOX_WITH_NESTED_HWVIRT 734 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx)) 735 { 736 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE) 737 && pVM->cpum.ro.GuestFeatures.fSvmNextRipSave; 738 } 739 #else 740 RT_NOREF(pCtx); 741 #endif 742 return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE); 743 } 744 745 746 /** 681 747 * Sets the permission bits for the specified MSR in the MSRPM. 682 748 * … … 2078 2144 pNstGstVmcbCache->u32InterceptXcpt = pVmcbNstGstCtrl->u32InterceptXcpt; 2079 2145 pNstGstVmcbCache->u64InterceptCtrl = pVmcbNstGstCtrl->u64InterceptCtrl; 2146 pNstGstVmcbCache->u64CR0 = pVmcbNstGstState->u64CR0; 2080 2147 pNstGstVmcbCache->u64CR3 = pVmcbNstGstState->u64CR3; 2081 2148 pNstGstVmcbCache->u64CR4 = pVmcbNstGstState->u64CR4; … … 3989 4056 * mark all state-bits as dirty indicating to the CPU to re-load from VMCB. 3990 4057 */ 3991 if ( !(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN)3992 || !(pVM->cpum.ro.GuestFeatures.fSvmVmcbClean))4058 bool const fSupportsVmcbCleanBits = hmR0SvmSupportsVmcbCleanBits(pVCpu, pCtx); 4059 if (!fSupportsVmcbCleanBits) 3993 4060 pVmcbNstGst->ctrl.u64VmcbCleanBits = 0; 3994 4061 } … … 4098 4165 4099 4166 /* If VMCB Clean bits isn't supported by the CPU, simply mark all state-bits as dirty, indicating (re)load-from-VMCB. */ 4100 if (!(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_VMCB_CLEAN)) 4167 bool const fSupportsVmcbCleanBits = hmR0SvmSupportsVmcbCleanBits(pVCpu, pCtx); 4168 if (!fSupportsVmcbCleanBits) 4101 4169 pVmcb->ctrl.u64VmcbCleanBits = 0; 4102 4170 } … … 5828 5896 5829 5897 /** 5830 * Returns whether decode-assist feature is supported.5831 *5832 * @param pVCpu The cross context virtual CPU structure.5833 * @param pCtx Pointer to the guest-CPU context.5834 */5835 DECLINLINE(bool) hmR0SvmSupportsDecodeAssist(PVMCPU pVCpu, PCPUMCTX pCtx)5836 {5837 PVM pVM = pVCpu->CTX_SUFF(pVM);5838 #ifdef VBOX_WITH_NESTED_HWVIRT5839 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))5840 {5841 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST)5842 && pVM->cpum.ro.GuestFeatures.fSvmDecodeAssist;5843 }5844 #else5845 RT_NOREF(pCtx);5846 #endif5847 return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_DECODE_ASSIST);5848 }5849 5850 5851 /**5852 * Returns whether NRIP_SAVE feature is supported.5853 *5854 * @param pVCpu The cross context virtual CPU structure.5855 * @param pCtx Pointer to the guest-CPU context.5856 */5857 DECLINLINE(bool) hmR0SvmSupportsNextRipSave(PVMCPU pVCpu, PCPUMCTX pCtx)5858 {5859 PVM pVM = pVCpu->CTX_SUFF(pVM);5860 #ifdef VBOX_WITH_NESTED_HWVIRT5861 if (CPUMIsGuestInSvmNestedHwVirtMode(pCtx))5862 {5863 return (pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE)5864 && pVM->cpum.ro.GuestFeatures.fSvmNextRipSave;5865 }5866 #else5867 RT_NOREF(pCtx);5868 #endif5869 return RT_BOOL(pVM->hm.s.svm.u32Features & X86_CPUID_SVM_FEATURE_EDX_NRIP_SAVE);5870 }5871 5872 5873 /**5874 5898 * Advances the guest RIP making use of the CPU's NRIP_SAVE feature if 5875 5899 * supported, otherwise advances the RIP by the number of bytes specified in … … 6308 6332 6309 6333 case 3: /* CR3. */ 6310 Assert(!pVM->hm.s.fNestedPaging);6311 6334 HMCPU_CF_SET(pVCpu, HM_CHANGED_GUEST_CR3); 6312 6335 break;
Note:
See TracChangeset
for help on using the changeset viewer.