Changeset 52125 in vbox
- Timestamp:
- Jul 22, 2014 10:11:37 AM (11 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/HMSVMR0.cpp
r52099 r52125 672 672 AssertMsgReturn(pVmcb, ("Invalid pVmcb for vcpu[%u]\n", i), VERR_SVM_INVALID_PVMCB); 673 673 674 /* Initialize the #VMEXIT history array with end-of-array markers (UINT16_MAX). */ 675 Assert(!pVCpu->hm.s.idxExitHistoryFree); 676 HMCPU_EXIT_HISTORY_RESET(pVCpu); 677 674 678 /* Trap exceptions unconditionally (debug purposes). */ 675 679 #ifdef HMSVM_ALWAYS_TRAP_PF … … 3215 3219 3216 3220 pSvmTransient->u64ExitCode = pVmcb->ctrl.u64ExitCode; /* Save the #VMEXIT reason. */ 3221 HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmcb->ctrl.u64ExitCode); /* Update the #VMEXIT history array. */ 3217 3222 pSvmTransient->fVectoringPF = false; /* Vectoring page-fault needs to be determined later. */ 3223 3218 3224 hmR0SvmSaveGuestState(pVCpu, pMixedCtx); /* Save the guest state from the VMCB to the guest-CPU context. */ 3219 3225 -
trunk/src/VBox/VMM/VMMR0/HMVMXR0.cpp
r52073 r52125 23 23 #include <iprt/asm-amd64-x86.h> 24 24 #include <iprt/thread.h> 25 #include <iprt/string.h>26 25 27 26 #include "HMInternal.h" … … 2778 2777 Log4(("VMXR0SetupVM: pVCpu=%p idCpu=%RU32\n", pVCpu, pVCpu->idCpu)); 2779 2778 2779 /* Initialize the VM-exit history array with end-of-array markers (UINT16_MAX). */ 2780 Assert(!pVCpu->hm.s.idxExitHistoryFree); 2781 HMCPU_EXIT_HISTORY_RESET(pVCpu); 2782 2780 2783 /* Set revision dword at the beginning of the VMCS structure. */ 2781 2784 *(uint32_t *)pVCpu->hm.s.vmx.pvVmcs = MSR_IA32_VMX_BASIC_INFO_VMCS_ID(pVM->hm.s.vmx.Msrs.u64BasicInfo); … … 6133 6136 else 6134 6137 { 6135 if ( (uIntrState & VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS)6136 || (uIntrState &VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI))6138 if (uIntrState & ( VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_MOVSS 6139 | VMX_VMCS_GUEST_INTERRUPTIBILITY_STATE_BLOCK_STI)) 6137 6140 { 6138 6141 rc = hmR0VmxSaveGuestRip(pVCpu, pMixedCtx); … … 7118 7121 pVCpu->hm.s.fLeaveDone = true; 7119 7122 } 7123 Assert(HMVMXCPU_GST_VALUE(pVCpu) == HMVMX_UPDATED_GUEST_ALL); 7120 7124 7121 7125 /* … … 8741 8745 pVmxTransient->uExitReason = (uint16_t)VMX_EXIT_REASON_BASIC(uExitReason); 8742 8746 pVmxTransient->fVMEntryFailed = VMX_ENTRY_INTERRUPTION_INFO_IS_VALID(pVmxTransient->uEntryIntInfo); 8747 8748 /* Update the VM-exit history array. */ 8749 HMCPU_EXIT_HISTORY_ADD(pVCpu, pVmxTransient->uExitReason); 8743 8750 8744 8751 /* If the VMLAUNCH/VMRESUME failed, we can bail out early. This does -not- cover VMX_EXIT_ERR_*. */ … … 9945 9952 /* 9946 9953 * Clear block-by-STI if it's active. The force-flag couldn't have been set by block-by-Mov SS in 9947 * hmR0VmxSaveGuestIntrState() when this VM-exit happen sas Intel CPUs are consistent with9954 * hmR0VmxSaveGuestIntrState() when this VM-exit happened, as Intel CPUs are consistent with 9948 9955 * block-by-Mov SS and NMIs. See @bugref{7445}. 9949 9956 */ -
trunk/src/VBox/VMM/VMMR3/HM.cpp
r52041 r52125 48 48 #include <iprt/asm.h> 49 49 #include <iprt/asm-amd64-x86.h> 50 #include <iprt/string.h>51 50 #include <iprt/env.h> 52 51 #include <iprt/thread.h> … … 72 71 EXIT_REASON(VMX_EXIT_NMI_WINDOW , 8, "NMI window."), 73 72 EXIT_REASON(VMX_EXIT_TASK_SWITCH , 9, "Task switch."), 74 EXIT_REASON(VMX_EXIT_CPUID , 10, " Guest attempted to execute CPUID."),73 EXIT_REASON(VMX_EXIT_CPUID , 10, "CPUID instruction."), 75 74 EXIT_REASON_NIL(), 76 EXIT_REASON(VMX_EXIT_HLT , 12, " Guest attempted to execute HLT."),77 EXIT_REASON(VMX_EXIT_INVD , 13, " Guest attempted to execute INVD."),78 EXIT_REASON(VMX_EXIT_INVLPG , 14, " Guest attempted to execute INVLPG."),79 EXIT_REASON(VMX_EXIT_RDPMC , 15, " Guest attempted to execute RDPMC."),80 EXIT_REASON(VMX_EXIT_RDTSC , 16, " Guest attempted to execute RDTSC."),81 EXIT_REASON(VMX_EXIT_RSM , 17, " Guest attempted to execute RSMin SMM."),82 EXIT_REASON(VMX_EXIT_VMCALL , 18, " Guest attempted to execute VMCALL."),83 EXIT_REASON(VMX_EXIT_VMCLEAR , 19, " Guest attempted to execute VMCLEAR."),84 EXIT_REASON(VMX_EXIT_VMLAUNCH , 20, " Guest attempted to execute VMLAUNCH."),85 EXIT_REASON(VMX_EXIT_VMPTRLD , 21, " Guest attempted to execute VMPTRLD."),86 EXIT_REASON(VMX_EXIT_VMPTRST , 22, " Guest attempted to execute VMPTRST."),87 EXIT_REASON(VMX_EXIT_VMREAD , 23, " Guest attempted to execute VMREAD."),88 EXIT_REASON(VMX_EXIT_VMRESUME , 24, " Guest attempted to execute VMRESUME."),89 EXIT_REASON(VMX_EXIT_VMWRITE , 25, " Guest attempted to execute VMWRITE."),90 EXIT_REASON(VMX_EXIT_VMXOFF , 26, " Guest attempted to execute VMXOFF."),91 EXIT_REASON(VMX_EXIT_VMXON , 27, " Guest attempted to execute VMXON."),75 EXIT_REASON(VMX_EXIT_HLT , 12, "HLT instruction."), 76 EXIT_REASON(VMX_EXIT_INVD , 13, "INVD instruction."), 77 EXIT_REASON(VMX_EXIT_INVLPG , 14, "INVLPG instruction."), 78 EXIT_REASON(VMX_EXIT_RDPMC , 15, "RDPMCinstruction."), 79 EXIT_REASON(VMX_EXIT_RDTSC , 16, "RDTSC instruction."), 80 EXIT_REASON(VMX_EXIT_RSM , 17, "RSM instruction in SMM."), 81 EXIT_REASON(VMX_EXIT_VMCALL , 18, "VMCALL instruction."), 82 EXIT_REASON(VMX_EXIT_VMCLEAR , 19, "VMCLEAR instruction."), 83 EXIT_REASON(VMX_EXIT_VMLAUNCH , 20, "VMLAUNCH instruction."), 84 EXIT_REASON(VMX_EXIT_VMPTRLD , 21, "VMPTRLD instruction."), 85 EXIT_REASON(VMX_EXIT_VMPTRST , 22, "VMPTRST instruction."), 86 EXIT_REASON(VMX_EXIT_VMREAD , 23, "VMREAD instruction."), 87 EXIT_REASON(VMX_EXIT_VMRESUME , 24, "VMRESUME instruction."), 88 EXIT_REASON(VMX_EXIT_VMWRITE , 25, "VMWRITE instruction."), 89 EXIT_REASON(VMX_EXIT_VMXOFF , 26, "VMXOFF instruction."), 90 EXIT_REASON(VMX_EXIT_VMXON , 27, "VMXON instruction."), 92 91 EXIT_REASON(VMX_EXIT_MOV_CRX , 28, "Control-register accesses."), 93 92 EXIT_REASON(VMX_EXIT_MOV_DRX , 29, "Debug-register accesses."), … … 98 97 EXIT_REASON(VMX_EXIT_ERR_MSR_LOAD , 34, "VM-entry failure due to MSR loading."), 99 98 EXIT_REASON_NIL(), 100 EXIT_REASON(VMX_EXIT_MWAIT , 36, " Guest executed MWAIT."),99 EXIT_REASON(VMX_EXIT_MWAIT , 36, "MWAIT instruction."), 101 100 EXIT_REASON(VMX_EXIT_MTF , 37, "Monitor Trap Flag."), 102 101 EXIT_REASON_NIL(), 103 EXIT_REASON(VMX_EXIT_MONITOR , 39, " Guest attempted to execute MONITOR."),104 EXIT_REASON(VMX_EXIT_PAUSE , 40, " Guest attempted to execute PAUSE."),102 EXIT_REASON(VMX_EXIT_MONITOR , 39, "MONITOR instruction."), 103 EXIT_REASON(VMX_EXIT_PAUSE , 40, "PAUSE instruction."), 105 104 EXIT_REASON(VMX_EXIT_ERR_MACHINE_CHECK , 41, "VM-entry failure due to machine-check."), 106 105 EXIT_REASON_NIL(), 107 106 EXIT_REASON(VMX_EXIT_TPR_BELOW_THRESHOLD, 43, "TPR below threshold. Guest attempted to execute MOV to CR8."), 108 EXIT_REASON(VMX_EXIT_APIC_ACCESS , 44, "APIC access. Guest attempted to access memory at a physical address on the APIC-access page."),107 EXIT_REASON(VMX_EXIT_APIC_ACCESS , 44, "APIC access."), 109 108 EXIT_REASON_NIL(), 110 EXIT_REASON(VMX_EXIT_XDTR_ACCESS , 46, "Access to GDTR or IDTR . Guest attempted to executeLGDT, LIDT, SGDT, or SIDT."),111 EXIT_REASON(VMX_EXIT_TR_ACCESS , 47, "Access to LDTR or TR . Guest attempted to executeLLDT, LTR, SLDT, or STR."),112 EXIT_REASON(VMX_EXIT_EPT_VIOLATION , 48, "EPT violation. An attempt to access memory with a guest-physical address was disallowed by the configuration of the EPT paging structures."),113 EXIT_REASON(VMX_EXIT_EPT_MISCONFIG , 49, "EPT misconfiguration. An attempt to access memory with a guest-physical address encountered a misconfigured EPT paging-structure entry."),114 EXIT_REASON(VMX_EXIT_INVEPT , 50, " Guest attempted to execute INVEPT."),115 EXIT_REASON(VMX_EXIT_RDTSCP , 51, " Guest attempted to execute RDTSCP."),109 EXIT_REASON(VMX_EXIT_XDTR_ACCESS , 46, "Access to GDTR or IDTR using LGDT, LIDT, SGDT, or SIDT."), 110 EXIT_REASON(VMX_EXIT_TR_ACCESS , 47, "Access to LDTR or TR using LLDT, LTR, SLDT, or STR."), 111 EXIT_REASON(VMX_EXIT_EPT_VIOLATION , 48, "EPT violation."), 112 EXIT_REASON(VMX_EXIT_EPT_MISCONFIG , 49, "EPT misconfiguration."), 113 EXIT_REASON(VMX_EXIT_INVEPT , 50, "INVEPT instruction."), 114 EXIT_REASON(VMX_EXIT_RDTSCP , 51, "RDTSCP instruction."), 116 115 EXIT_REASON(VMX_EXIT_PREEMPT_TIMER , 52, "VMX-preemption timer expired."), 117 EXIT_REASON(VMX_EXIT_INVVPID , 53, " Guest attempted to execute INVVPID."),118 EXIT_REASON(VMX_EXIT_WBINVD , 54, " Guest attempted to execute WBINVD."),119 EXIT_REASON(VMX_EXIT_XSETBV , 55, " Guest attempted to execute XSETBV."),116 EXIT_REASON(VMX_EXIT_INVVPID , 53, "INVVPID instruction."), 117 EXIT_REASON(VMX_EXIT_WBINVD , 54, "WBINVD instruction."), 118 EXIT_REASON(VMX_EXIT_XSETBV , 55, "XSETBV instruction."), 120 119 EXIT_REASON_NIL(), 121 EXIT_REASON(VMX_EXIT_RDRAND , 57, " Guest attempted to execute RDRAND."),122 EXIT_REASON(VMX_EXIT_INVPCID , 58, " Guest attempted to execute INVPCID."),123 EXIT_REASON(VMX_EXIT_VMFUNC , 59, " Guest attempted to execute VMFUNC.")120 EXIT_REASON(VMX_EXIT_RDRAND , 57, "RDRAND instruction."), 121 EXIT_REASON(VMX_EXIT_INVPCID , 58, "INVPCID instruction."), 122 EXIT_REASON(VMX_EXIT_VMFUNC , 59, "VMFUNC instruction.") 124 123 }; 125 124 /** Exit reason descriptions for AMD-V, used to describe statistics. */ … … 2950 2949 { 2951 2950 LogRel(("HM: CPU[%u] HM error %#x (%u)\n", i, pVCpu->hm.s.u32HMError, pVCpu->hm.s.u32HMError)); 2951 LogRel(("HM: CPU[%u] idxExitHistoryFree %u\n", i, pVCpu->hm.s.idxExitHistoryFree)); 2952 unsigned const idxLast = pVCpu->hm.s.idxExitHistoryFree > 0 ? 2953 pVCpu->hm.s.idxExitHistoryFree - 1 : 2954 RT_ELEMENTS(pVCpu->hm.s.auExitHistory) - 1; 2955 for (unsigned k = 0; k < RT_ELEMENTS(pVCpu->hm.s.auExitHistory); k++) 2956 { 2957 LogRel(("HM: CPU[%u] auExitHistory[%2u] = %#x (%u) %s\n", i, k, pVCpu->hm.s.auExitHistory[k], 2958 pVCpu->hm.s.auExitHistory[k], idxLast == k ? "<-- Last" : "")); 2959 } 2952 2960 break; 2953 2961 } -
trunk/src/VBox/VMM/include/HMInternal.h
r52006 r52125 32 32 #include <iprt/mp.h> 33 33 #include <iprt/avl.h> 34 #include <iprt/string.h> 34 35 35 36 #if HC_ARCH_BITS == 64 || defined(VBOX_WITH_HYBRID_32BIT_KERNEL) || defined (VBOX_WITH_64_BITS_GUESTS) … … 121 122 #define HMCPU_CF_VALUE(pVCpu) (ASMAtomicUoReadU32(&(pVCpu)->hm.s.fContextUseFlags)) 122 123 124 125 /** Resets/initializes the VM-exit/#VMEXIT history array. */ 126 #define HMCPU_EXIT_HISTORY_RESET(pVCpu) (memset(&(pVCpu)->hm.s.auExitHistory, sizeof((pVCpu)->hm.s.auExitHistory), 0)) 127 128 /** Updates the VM-exit/#VMEXIT history array. */ 129 #define HMCPU_EXIT_HISTORY_ADD(pVCpu, a_ExitReason) \ 130 do { \ 131 AssertMsg((pVCpu)->hm.s.idxExitHistoryFree < RT_ELEMENTS((pVCpu)->hm.s.auExitHistory), ("%u\n", (pVCpu)->hm.s.idxExitHistoryFree)); \ 132 (pVCpu)->hm.s.auExitHistory[(pVCpu)->hm.s.idxExitHistoryFree++] = (uint16_t)(a_ExitReason); \ 133 if ((pVCpu)->hm.s.idxExitHistoryFree == RT_ELEMENTS((pVCpu)->hm.s.auExitHistory)) \ 134 (pVCpu)->hm.s.idxExitHistoryFree = 0; \ 135 (pVCpu)->hm.s.auExitHistory[(pVCpu)->hm.s.idxExitHistoryFree] = UINT16_MAX; \ 136 } while (0) 123 137 124 138 /** Maximum number of exit reason statistics counters. */ … … 807 821 uint32_t u32Alignment0; /**< Explicit alignment padding. */ 808 822 } TlbShootdown; 823 824 /** VT-x/AMD-V VM-exit/#VMXEXIT history, circular array. */ 825 uint16_t auExitHistory[31]; 826 /** The index of the next free slot in the history array. */ 827 uint16_t idxExitHistoryFree; 809 828 810 829 /** For saving stack space, the disassembler state is allocated here instead of
Note:
See TracChangeset
for help on using the changeset viewer.