VirtualBox

Changeset 76993 in vbox for trunk/src/VBox/VMM/VMMR3


Ignore:
Timestamp:
Jan 25, 2019 2:34:46 PM (6 years ago)
Author:
vboxsync
Message:

VMM: Nested VMX: bugref:9180 Allowing fetching VM-exit names from ring-0 as well. Various naming cleanups. Added HMDumpHwvirtVmxState() to be able to dump virtual VMCS state from ring-0 as well. Remove unusued HMIsVmxSupported() function.

Location:
trunk/src/VBox/VMM/VMMR3
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/CPUM.cpp

    r76952 r76993  
    17631763            {
    17641764                if (fCaps & SUPVTCAPS_VT_X)
    1765                     HMVmxGetVmxMsrsFromHwvirtMsrs(&HwvirtMsrs, &pMsrs->hwvirt.vmx);
     1765                    HMGetVmxMsrsFromHwvirtMsrs(&HwvirtMsrs, &pMsrs->hwvirt.vmx);
    17661766                else
    1767                     HMVmxGetSvmMsrsFromHwvirtMsrs(&HwvirtMsrs, &pMsrs->hwvirt.svm);
     1767                    HMGetSvmMsrsFromHwvirtMsrs(&HwvirtMsrs, &pMsrs->hwvirt.svm);
    17681768                return VINF_SUCCESS;
    17691769            }
     
    33903390        pHlp->pfnPrintf(pHlp, "%sHeader:\n", pszPrefix);
    33913391        pHlp->pfnPrintf(pHlp, "  %sVMCS revision id           = %#RX32\n",   pszPrefix, pVmcs->u32VmcsRevId);
    3392         pHlp->pfnPrintf(pHlp, "  %sVMX-abort id               = %#RX32 (%s)\n", pszPrefix, pVmcs->enmVmxAbort, HMVmxGetAbortDesc(pVmcs->enmVmxAbort));
    3393         pHlp->pfnPrintf(pHlp, "  %sVMCS state                 = %#x (%s)\n", pszPrefix, pVmcs->fVmcsState, HMVmxGetVmcsStateDesc(pVmcs->fVmcsState));
     3392        pHlp->pfnPrintf(pHlp, "  %sVMX-abort id               = %#RX32 (%s)\n", pszPrefix, pVmcs->enmVmxAbort, HMGetVmxAbortDesc(pVmcs->enmVmxAbort));
     3393        pHlp->pfnPrintf(pHlp, "  %sVMCS state                 = %#x (%s)\n", pszPrefix, pVmcs->fVmcsState, HMGetVmxVmcsStateDesc(pVmcs->fVmcsState));
    33943394    }
    33953395
     
    34203420            uint8_t  const uType = VMX_ENTRY_INT_INFO_TYPE(fInfo);
    34213421            pHlp->pfnPrintf(pHlp, "    %sValid                      = %RTbool\n", pszPrefix, VMX_ENTRY_INT_INFO_IS_VALID(fInfo));
    3422             pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n", pszPrefix, uType, HMVmxGetEntryIntInfoTypeDesc(uType));
     3422            pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n", pszPrefix, uType, HMGetVmxEntryIntInfoTypeDesc(uType));
    34233423            pHlp->pfnPrintf(pHlp, "    %sVector                     = %#x\n",     pszPrefix, VMX_ENTRY_INT_INFO_VECTOR(fInfo));
    34243424            pHlp->pfnPrintf(pHlp, "    %sNMI-unblocking-IRET        = %RTbool\n", pszPrefix, VMX_ENTRY_INT_INFO_IS_NMI_UNBLOCK_IRET(fInfo));
     
    35613561
    35623562        /* 32-bit. */
    3563         pHlp->pfnPrintf(pHlp, "  %sExit reason                = %u (%s)\n",  pszPrefix, pVmcs->u32RoExitReason, HMR3GetVmxExitName(pVmcs->u32RoExitReason));
     3563        pHlp->pfnPrintf(pHlp, "  %sExit reason                = %u (%s)\n",  pszPrefix, pVmcs->u32RoExitReason, HMGetVmxExitName(pVmcs->u32RoExitReason));
    35643564        pHlp->pfnPrintf(pHlp, "  %sExit qualification         = %#RX64\n",   pszPrefix, pVmcs->u64RoExitQual.u);
    35653565        pHlp->pfnPrintf(pHlp, "  %sVM-instruction error       = %#RX32\n",   pszPrefix, pVmcs->u32RoVmInstrError);
     
    35693569            uint8_t  const uType = VMX_EXIT_INT_INFO_TYPE(fInfo);
    35703570            pHlp->pfnPrintf(pHlp, "    %sValid                      = %RTbool\n", pszPrefix, VMX_EXIT_INT_INFO_IS_VALID(fInfo));
    3571             pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n",     pszPrefix, uType, HMVmxGetExitIntInfoTypeDesc(uType));
     3571            pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n",     pszPrefix, uType, HMGetVmxExitIntInfoTypeDesc(uType));
    35723572            pHlp->pfnPrintf(pHlp, "    %sVector                     = %#x\n",     pszPrefix, VMX_EXIT_INT_INFO_VECTOR(fInfo));
    35733573            pHlp->pfnPrintf(pHlp, "    %sNMI-unblocking-IRET        = %RTbool\n", pszPrefix, VMX_EXIT_INT_INFO_IS_NMI_UNBLOCK_IRET(fInfo));
     
    35803580            uint8_t  const uType = VMX_IDT_VECTORING_INFO_TYPE(fInfo);
    35813581            pHlp->pfnPrintf(pHlp, "    %sValid                      = %RTbool\n", pszPrefix, VMX_IDT_VECTORING_INFO_IS_VALID(fInfo));
    3582             pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n",     pszPrefix, uType, HMVmxGetIdtVectoringInfoTypeDesc(uType));
     3582            pHlp->pfnPrintf(pHlp, "    %sType                       = %#x (%s)\n",     pszPrefix, uType, HMGetVmxIdtVectoringInfoTypeDesc(uType));
    35833583            pHlp->pfnPrintf(pHlp, "    %sVector                     = %#x\n",     pszPrefix, VMX_IDT_VECTORING_INFO_VECTOR(fInfo));
    35843584            pHlp->pfnPrintf(pHlp, "    %sError-code valid           = %RTbool\n", pszPrefix, VMX_IDT_VECTORING_INFO_IS_ERROR_CODE_VALID(fInfo));
     
    37073707        pHlp->pfnPrintf(pHlp, "  GCPhysVmcs                 = %#RGp\n",     pCtx->hwvirt.vmx.GCPhysVmcs);
    37083708        pHlp->pfnPrintf(pHlp, "  GCPhysShadowVmcs           = %#RGp\n",     pCtx->hwvirt.vmx.GCPhysShadowVmcs);
    3709         pHlp->pfnPrintf(pHlp, "  enmDiag                    = %u (%s)\n",   pCtx->hwvirt.vmx.enmDiag, HMVmxGetDiagDesc(pCtx->hwvirt.vmx.enmDiag));
    3710         pHlp->pfnPrintf(pHlp, "  enmAbort                   = %u (%s)\n",   pCtx->hwvirt.vmx.enmAbort, HMVmxGetAbortDesc(pCtx->hwvirt.vmx.enmAbort));
     3709        pHlp->pfnPrintf(pHlp, "  enmDiag                    = %u (%s)\n",   pCtx->hwvirt.vmx.enmDiag, HMGetVmxDiagDesc(pCtx->hwvirt.vmx.enmDiag));
     3710        pHlp->pfnPrintf(pHlp, "  enmAbort                   = %u (%s)\n",   pCtx->hwvirt.vmx.enmAbort, HMGetVmxAbortDesc(pCtx->hwvirt.vmx.enmAbort));
    37113711        pHlp->pfnPrintf(pHlp, "  uAbortAux                  = %u (%#x)\n",  pCtx->hwvirt.vmx.uAbortAux, pCtx->hwvirt.vmx.uAbortAux);
    37123712        pHlp->pfnPrintf(pHlp, "  fInVmxRootMode             = %RTbool\n",   pCtx->hwvirt.vmx.fInVmxRootMode);
  • trunk/src/VBox/VMM/VMMR3/EMR3Dbg.cpp

    r76553 r76993  
    130130
    131131        case EMEXIT_F_KIND_VMX:
    132             pszExitName = HMR3GetVmxExitName( uFlagsAndType & EMEXIT_F_TYPE_MASK);
     132            pszExitName = HMGetVmxExitName( uFlagsAndType & EMEXIT_F_TYPE_MASK);
    133133            break;
    134134
    135135        case EMEXIT_F_KIND_SVM:
    136             pszExitName = HMR3GetSvmExitName( uFlagsAndType & EMEXIT_F_TYPE_MASK);
     136            pszExitName = HMGetSvmExitName( uFlagsAndType & EMEXIT_F_TYPE_MASK);
    137137            break;
    138138
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r76886 r76993  
    7575
    7676/*********************************************************************************************************************************
    77 *   Global Variables                                                                                                             *
     77*   Defined Constants And Macros                                                                                                 *
    7878*********************************************************************************************************************************/
    79 #define EXIT_REASON(def, val, str) #def " - " #val " - " str
    80 #define EXIT_REASON_NIL() NULL
    81 /** Exit reason descriptions for VT-x, used to describe statistics and exit
    82  *  history. */
    83 static const char * const g_apszVmxExitReasons[MAX_EXITREASON_STAT] =
    84 {
    85     EXIT_REASON(VMX_EXIT_XCPT_OR_NMI            ,   0, "Exception or non-maskable interrupt (NMI)."),
    86     EXIT_REASON(VMX_EXIT_EXT_INT                ,   1, "External interrupt."),
    87     EXIT_REASON(VMX_EXIT_TRIPLE_FAULT           ,   2, "Triple fault."),
    88     EXIT_REASON(VMX_EXIT_INIT_SIGNAL            ,   3, "INIT signal."),
    89     EXIT_REASON(VMX_EXIT_SIPI                   ,   4, "Start-up IPI (SIPI)."),
    90     EXIT_REASON(VMX_EXIT_IO_SMI_IRQ             ,   5, "I/O system-management interrupt (SMI)."),
    91     EXIT_REASON(VMX_EXIT_SMI_IRQ                ,   6, "Other SMI."),
    92     EXIT_REASON(VMX_EXIT_INT_WINDOW             ,   7, "Interrupt window."),
    93     EXIT_REASON(VMX_EXIT_NMI_WINDOW             ,   8, "NMI window."),
    94     EXIT_REASON(VMX_EXIT_TASK_SWITCH            ,   9, "Task switch."),
    95     EXIT_REASON(VMX_EXIT_CPUID                  ,  10, "CPUID instruction."),
    96     EXIT_REASON(VMX_EXIT_GETSEC                 ,  11, "GETSEC instrunction."),
    97     EXIT_REASON(VMX_EXIT_HLT                    ,  12, "HLT instruction."),
    98     EXIT_REASON(VMX_EXIT_INVD                   ,  13, "INVD instruction."),
    99     EXIT_REASON(VMX_EXIT_INVLPG                 ,  14, "INVLPG instruction."),
    100     EXIT_REASON(VMX_EXIT_RDPMC                  ,  15, "RDPMCinstruction."),
    101     EXIT_REASON(VMX_EXIT_RDTSC                  ,  16, "RDTSC instruction."),
    102     EXIT_REASON(VMX_EXIT_RSM                    ,  17, "RSM instruction in SMM."),
    103     EXIT_REASON(VMX_EXIT_VMCALL                 ,  18, "VMCALL instruction."),
    104     EXIT_REASON(VMX_EXIT_VMCLEAR                ,  19, "VMCLEAR instruction."),
    105     EXIT_REASON(VMX_EXIT_VMLAUNCH               ,  20, "VMLAUNCH instruction."),
    106     EXIT_REASON(VMX_EXIT_VMPTRLD                ,  21, "VMPTRLD instruction."),
    107     EXIT_REASON(VMX_EXIT_VMPTRST                ,  22, "VMPTRST instruction."),
    108     EXIT_REASON(VMX_EXIT_VMREAD                 ,  23, "VMREAD instruction."),
    109     EXIT_REASON(VMX_EXIT_VMRESUME               ,  24, "VMRESUME instruction."),
    110     EXIT_REASON(VMX_EXIT_VMWRITE                ,  25, "VMWRITE instruction."),
    111     EXIT_REASON(VMX_EXIT_VMXOFF                 ,  26, "VMXOFF instruction."),
    112     EXIT_REASON(VMX_EXIT_VMXON                  ,  27, "VMXON instruction."),
    113     EXIT_REASON(VMX_EXIT_MOV_CRX                ,  28, "Control-register accesses."),
    114     EXIT_REASON(VMX_EXIT_MOV_DRX                ,  29, "Debug-register accesses."),
    115     EXIT_REASON(VMX_EXIT_PORT_IO                ,  30, "I/O instruction."),
    116     EXIT_REASON(VMX_EXIT_RDMSR                  ,  31, "RDMSR instruction."),
    117     EXIT_REASON(VMX_EXIT_WRMSR                  ,  32, "WRMSR instruction."),
    118     EXIT_REASON(VMX_EXIT_ERR_INVALID_GUEST_STATE,  33, "VM-entry failure due to invalid guest state."),
    119     EXIT_REASON(VMX_EXIT_ERR_MSR_LOAD           ,  34, "VM-entry failure due to MSR loading."),
    120     EXIT_REASON_NIL(),
    121     EXIT_REASON(VMX_EXIT_MWAIT                  ,  36, "MWAIT instruction."),
    122     EXIT_REASON(VMX_EXIT_MTF                    ,  37, "Monitor Trap Flag."),
    123     EXIT_REASON_NIL(),
    124     EXIT_REASON(VMX_EXIT_MONITOR                ,  39, "MONITOR instruction."),
    125     EXIT_REASON(VMX_EXIT_PAUSE                  ,  40, "PAUSE instruction."),
    126     EXIT_REASON(VMX_EXIT_ERR_MACHINE_CHECK      ,  41, "VM-entry failure due to machine-check."),
    127     EXIT_REASON_NIL(),
    128     EXIT_REASON(VMX_EXIT_TPR_BELOW_THRESHOLD    ,  43, "TPR below threshold (MOV to CR8)."),
    129     EXIT_REASON(VMX_EXIT_APIC_ACCESS            ,  44, "APIC access."),
    130     EXIT_REASON(VMX_EXIT_VIRTUALIZED_EOI        ,  45, "Virtualized EOI."),
    131     EXIT_REASON(VMX_EXIT_GDTR_IDTR_ACCESS       ,  46, "GDTR/IDTR access using LGDT/SGDT/LIDT/SIDT."),
    132     EXIT_REASON(VMX_EXIT_LDTR_TR_ACCESS         ,  47, "LDTR/TR access using LLDT/SLDT/LTR/STR."),
    133     EXIT_REASON(VMX_EXIT_EPT_VIOLATION          ,  48, "EPT violation."),
    134     EXIT_REASON(VMX_EXIT_EPT_MISCONFIG          ,  49, "EPT misconfiguration."),
    135     EXIT_REASON(VMX_EXIT_INVEPT                 ,  50, "INVEPT instruction."),
    136     EXIT_REASON(VMX_EXIT_RDTSCP                 ,  51, "RDTSCP instruction."),
    137     EXIT_REASON(VMX_EXIT_PREEMPT_TIMER          ,  52, "VMX-preemption timer expired."),
    138     EXIT_REASON(VMX_EXIT_INVVPID                ,  53, "INVVPID instruction."),
    139     EXIT_REASON(VMX_EXIT_WBINVD                 ,  54, "WBINVD instruction."),
    140     EXIT_REASON(VMX_EXIT_XSETBV                 ,  55, "XSETBV instruction."),
    141     EXIT_REASON(VMX_EXIT_APIC_WRITE             ,  56, "APIC write completed to virtual-APIC page."),
    142     EXIT_REASON(VMX_EXIT_RDRAND                 ,  57, "RDRAND instruction."),
    143     EXIT_REASON(VMX_EXIT_INVPCID                ,  58, "INVPCID instruction."),
    144     EXIT_REASON(VMX_EXIT_VMFUNC                 ,  59, "VMFUNC instruction."),
    145     EXIT_REASON(VMX_EXIT_ENCLS                  ,  60, "ENCLS instruction."),
    146     EXIT_REASON(VMX_EXIT_RDSEED                 ,  61, "RDSEED instruction."),
    147     EXIT_REASON(VMX_EXIT_PML_FULL               ,  62, "Page-modification log full."),
    148     EXIT_REASON(VMX_EXIT_XSAVES                 ,  63, "XSAVES instruction."),
    149     EXIT_REASON(VMX_EXIT_XRSTORS                ,  64, "XRSTORS instruction.")
    150 };
    151 /** Array index of the last valid VT-x exit reason. */
    152 #define MAX_EXITREASON_VTX                         64
    153 
    154 /** A partial list of \#EXIT reason descriptions for AMD-V, used to describe
    155  *  statistics and exit history.
    156  *
    157  *  @note AMD-V have annoyingly large gaps (e.g. \#NPF VMEXIT comes at 1024),
    158  *        this array doesn't contain the entire set of exit reasons, we
    159  *        handle them via hmSvmGetSpecialExitReasonDesc(). */
    160 static const char * const g_apszSvmExitReasons[MAX_EXITREASON_STAT] =
    161 {
    162     EXIT_REASON(SVM_EXIT_READ_CR0     ,    0, "Read CR0."),
    163     EXIT_REASON(SVM_EXIT_READ_CR1     ,    1, "Read CR1."),
    164     EXIT_REASON(SVM_EXIT_READ_CR2     ,    2, "Read CR2."),
    165     EXIT_REASON(SVM_EXIT_READ_CR3     ,    3, "Read CR3."),
    166     EXIT_REASON(SVM_EXIT_READ_CR4     ,    4, "Read CR4."),
    167     EXIT_REASON(SVM_EXIT_READ_CR5     ,    5, "Read CR5."),
    168     EXIT_REASON(SVM_EXIT_READ_CR6     ,    6, "Read CR6."),
    169     EXIT_REASON(SVM_EXIT_READ_CR7     ,    7, "Read CR7."),
    170     EXIT_REASON(SVM_EXIT_READ_CR8     ,    8, "Read CR8."),
    171     EXIT_REASON(SVM_EXIT_READ_CR9     ,    9, "Read CR9."),
    172     EXIT_REASON(SVM_EXIT_READ_CR10    ,   10, "Read CR10."),
    173     EXIT_REASON(SVM_EXIT_READ_CR11    ,   11, "Read CR11."),
    174     EXIT_REASON(SVM_EXIT_READ_CR12    ,   12, "Read CR12."),
    175     EXIT_REASON(SVM_EXIT_READ_CR13    ,   13, "Read CR13."),
    176     EXIT_REASON(SVM_EXIT_READ_CR14    ,   14, "Read CR14."),
    177     EXIT_REASON(SVM_EXIT_READ_CR15    ,   15, "Read CR15."),
    178     EXIT_REASON(SVM_EXIT_WRITE_CR0    ,   16, "Write CR0."),
    179     EXIT_REASON(SVM_EXIT_WRITE_CR1    ,   17, "Write CR1."),
    180     EXIT_REASON(SVM_EXIT_WRITE_CR2    ,   18, "Write CR2."),
    181     EXIT_REASON(SVM_EXIT_WRITE_CR3    ,   19, "Write CR3."),
    182     EXIT_REASON(SVM_EXIT_WRITE_CR4    ,   20, "Write CR4."),
    183     EXIT_REASON(SVM_EXIT_WRITE_CR5    ,   21, "Write CR5."),
    184     EXIT_REASON(SVM_EXIT_WRITE_CR6    ,   22, "Write CR6."),
    185     EXIT_REASON(SVM_EXIT_WRITE_CR7    ,   23, "Write CR7."),
    186     EXIT_REASON(SVM_EXIT_WRITE_CR8    ,   24, "Write CR8."),
    187     EXIT_REASON(SVM_EXIT_WRITE_CR9    ,   25, "Write CR9."),
    188     EXIT_REASON(SVM_EXIT_WRITE_CR10   ,   26, "Write CR10."),
    189     EXIT_REASON(SVM_EXIT_WRITE_CR11   ,   27, "Write CR11."),
    190     EXIT_REASON(SVM_EXIT_WRITE_CR12   ,   28, "Write CR12."),
    191     EXIT_REASON(SVM_EXIT_WRITE_CR13   ,   29, "Write CR13."),
    192     EXIT_REASON(SVM_EXIT_WRITE_CR14   ,   30, "Write CR14."),
    193     EXIT_REASON(SVM_EXIT_WRITE_CR15   ,   31, "Write CR15."),
    194     EXIT_REASON(SVM_EXIT_READ_DR0     ,   32, "Read DR0."),
    195     EXIT_REASON(SVM_EXIT_READ_DR1     ,   33, "Read DR1."),
    196     EXIT_REASON(SVM_EXIT_READ_DR2     ,   34, "Read DR2."),
    197     EXIT_REASON(SVM_EXIT_READ_DR3     ,   35, "Read DR3."),
    198     EXIT_REASON(SVM_EXIT_READ_DR4     ,   36, "Read DR4."),
    199     EXIT_REASON(SVM_EXIT_READ_DR5     ,   37, "Read DR5."),
    200     EXIT_REASON(SVM_EXIT_READ_DR6     ,   38, "Read DR6."),
    201     EXIT_REASON(SVM_EXIT_READ_DR7     ,   39, "Read DR7."),
    202     EXIT_REASON(SVM_EXIT_READ_DR8     ,   40, "Read DR8."),
    203     EXIT_REASON(SVM_EXIT_READ_DR9     ,   41, "Read DR9."),
    204     EXIT_REASON(SVM_EXIT_READ_DR10    ,   42, "Read DR10."),
    205     EXIT_REASON(SVM_EXIT_READ_DR11    ,   43, "Read DR11"),
    206     EXIT_REASON(SVM_EXIT_READ_DR12    ,   44, "Read DR12."),
    207     EXIT_REASON(SVM_EXIT_READ_DR13    ,   45, "Read DR13."),
    208     EXIT_REASON(SVM_EXIT_READ_DR14    ,   46, "Read DR14."),
    209     EXIT_REASON(SVM_EXIT_READ_DR15    ,   47, "Read DR15."),
    210     EXIT_REASON(SVM_EXIT_WRITE_DR0    ,   48, "Write DR0."),
    211     EXIT_REASON(SVM_EXIT_WRITE_DR1    ,   49, "Write DR1."),
    212     EXIT_REASON(SVM_EXIT_WRITE_DR2    ,   50, "Write DR2."),
    213     EXIT_REASON(SVM_EXIT_WRITE_DR3    ,   51, "Write DR3."),
    214     EXIT_REASON(SVM_EXIT_WRITE_DR4    ,   52, "Write DR4."),
    215     EXIT_REASON(SVM_EXIT_WRITE_DR5    ,   53, "Write DR5."),
    216     EXIT_REASON(SVM_EXIT_WRITE_DR6    ,   54, "Write DR6."),
    217     EXIT_REASON(SVM_EXIT_WRITE_DR7    ,   55, "Write DR7."),
    218     EXIT_REASON(SVM_EXIT_WRITE_DR8    ,   56, "Write DR8."),
    219     EXIT_REASON(SVM_EXIT_WRITE_DR9    ,   57, "Write DR9."),
    220     EXIT_REASON(SVM_EXIT_WRITE_DR10   ,   58, "Write DR10."),
    221     EXIT_REASON(SVM_EXIT_WRITE_DR11   ,   59, "Write DR11."),
    222     EXIT_REASON(SVM_EXIT_WRITE_DR12   ,   60, "Write DR12."),
    223     EXIT_REASON(SVM_EXIT_WRITE_DR13   ,   61, "Write DR13."),
    224     EXIT_REASON(SVM_EXIT_WRITE_DR14   ,   62, "Write DR14."),
    225     EXIT_REASON(SVM_EXIT_WRITE_DR15   ,   63, "Write DR15."),
    226     EXIT_REASON(SVM_EXIT_XCPT_0       ,   64, "Exception 0  (#DE)."),
    227     EXIT_REASON(SVM_EXIT_XCPT_1       ,   65, "Exception 1  (#DB)."),
    228     EXIT_REASON(SVM_EXIT_XCPT_2       ,   66, "Exception 2  (#NMI)."),
    229     EXIT_REASON(SVM_EXIT_XCPT_3       ,   67, "Exception 3  (#BP)."),
    230     EXIT_REASON(SVM_EXIT_XCPT_4       ,   68, "Exception 4  (#OF)."),
    231     EXIT_REASON(SVM_EXIT_XCPT_5       ,   69, "Exception 5  (#BR)."),
    232     EXIT_REASON(SVM_EXIT_XCPT_6       ,   70, "Exception 6  (#UD)."),
    233     EXIT_REASON(SVM_EXIT_XCPT_7       ,   71, "Exception 7  (#NM)."),
    234     EXIT_REASON(SVM_EXIT_XCPT_8       ,   72, "Exception 8  (#DF)."),
    235     EXIT_REASON(SVM_EXIT_XCPT_9       ,   73, "Exception 9  (#CO_SEG_OVERRUN)."),
    236     EXIT_REASON(SVM_EXIT_XCPT_10      ,   74, "Exception 10 (#TS)."),
    237     EXIT_REASON(SVM_EXIT_XCPT_11      ,   75, "Exception 11 (#NP)."),
    238     EXIT_REASON(SVM_EXIT_XCPT_12      ,   76, "Exception 12 (#SS)."),
    239     EXIT_REASON(SVM_EXIT_XCPT_13      ,   77, "Exception 13 (#GP)."),
    240     EXIT_REASON(SVM_EXIT_XCPT_14      ,   78, "Exception 14 (#PF)."),
    241     EXIT_REASON(SVM_EXIT_XCPT_15      ,   79, "Exception 15 (0x0f)."),
    242     EXIT_REASON(SVM_EXIT_XCPT_16      ,   80, "Exception 16 (#MF)."),
    243     EXIT_REASON(SVM_EXIT_XCPT_17      ,   81, "Exception 17 (#AC)."),
    244     EXIT_REASON(SVM_EXIT_XCPT_18      ,   82, "Exception 18 (#MC)."),
    245     EXIT_REASON(SVM_EXIT_XCPT_19      ,   83, "Exception 19 (#XF)."),
    246     EXIT_REASON(SVM_EXIT_XCPT_20      ,   84, "Exception 20 (#VE)."),
    247     EXIT_REASON(SVM_EXIT_XCPT_21      ,   85, "Exception 22 (0x15)."),
    248     EXIT_REASON(SVM_EXIT_XCPT_22      ,   86, "Exception 22 (0x16)."),
    249     EXIT_REASON(SVM_EXIT_XCPT_23      ,   87, "Exception 23 (0x17)."),
    250     EXIT_REASON(SVM_EXIT_XCPT_24      ,   88, "Exception 24 (0x18)."),
    251     EXIT_REASON(SVM_EXIT_XCPT_25      ,   89, "Exception 25 (0x19)."),
    252     EXIT_REASON(SVM_EXIT_XCPT_26      ,   90, "Exception 26 (0x1a)."),
    253     EXIT_REASON(SVM_EXIT_XCPT_27      ,   91, "Exception 27 (0x1b)."),
    254     EXIT_REASON(SVM_EXIT_XCPT_28      ,   92, "Exception 28 (0x1c)."),
    255     EXIT_REASON(SVM_EXIT_XCPT_29      ,   93, "Exception 29 (0x1d)."),
    256     EXIT_REASON(SVM_EXIT_XCPT_30      ,   94, "Exception 30 (#SX)."),
    257     EXIT_REASON(SVM_EXIT_XCPT_31      ,   95, "Exception 31 (0x1F)."),
    258     EXIT_REASON(SVM_EXIT_INTR         ,   96, "Physical maskable interrupt (host)."),
    259     EXIT_REASON(SVM_EXIT_NMI          ,   97, "Physical non-maskable interrupt (host)."),
    260     EXIT_REASON(SVM_EXIT_SMI          ,   98, "System management interrupt (host)."),
    261     EXIT_REASON(SVM_EXIT_INIT         ,   99, "Physical INIT signal (host)."),
    262     EXIT_REASON(SVM_EXIT_VINTR        ,  100, "Virtual interrupt-window exit."),
    263     EXIT_REASON(SVM_EXIT_CR0_SEL_WRITE,  101, "Selective CR0 Write (to bits other than CR0.TS and CR0.MP)."),
    264     EXIT_REASON(SVM_EXIT_IDTR_READ    ,  102, "Read IDTR."),
    265     EXIT_REASON(SVM_EXIT_GDTR_READ    ,  103, "Read GDTR."),
    266     EXIT_REASON(SVM_EXIT_LDTR_READ    ,  104, "Read LDTR."),
    267     EXIT_REASON(SVM_EXIT_TR_READ      ,  105, "Read TR."),
    268     EXIT_REASON(SVM_EXIT_IDTR_WRITE   ,  106, "Write IDTR."),
    269     EXIT_REASON(SVM_EXIT_GDTR_WRITE   ,  107, "Write GDTR."),
    270     EXIT_REASON(SVM_EXIT_LDTR_WRITE   ,  108, "Write LDTR."),
    271     EXIT_REASON(SVM_EXIT_TR_WRITE     ,  109, "Write TR."),
    272     EXIT_REASON(SVM_EXIT_RDTSC        ,  110, "RDTSC instruction."),
    273     EXIT_REASON(SVM_EXIT_RDPMC        ,  111, "RDPMC instruction."),
    274     EXIT_REASON(SVM_EXIT_PUSHF        ,  112, "PUSHF instruction."),
    275     EXIT_REASON(SVM_EXIT_POPF         ,  113, "POPF instruction."),
    276     EXIT_REASON(SVM_EXIT_CPUID        ,  114, "CPUID instruction."),
    277     EXIT_REASON(SVM_EXIT_RSM          ,  115, "RSM instruction."),
    278     EXIT_REASON(SVM_EXIT_IRET         ,  116, "IRET instruction."),
    279     EXIT_REASON(SVM_EXIT_SWINT        ,  117, "Software interrupt (INTn instructions)."),
    280     EXIT_REASON(SVM_EXIT_INVD         ,  118, "INVD instruction."),
    281     EXIT_REASON(SVM_EXIT_PAUSE        ,  119, "PAUSE instruction."),
    282     EXIT_REASON(SVM_EXIT_HLT          ,  120, "HLT instruction."),
    283     EXIT_REASON(SVM_EXIT_INVLPG       ,  121, "INVLPG instruction."),
    284     EXIT_REASON(SVM_EXIT_INVLPGA      ,  122, "INVLPGA instruction."),
    285     EXIT_REASON(SVM_EXIT_IOIO         ,  123, "IN/OUT/INS/OUTS instruction."),
    286     EXIT_REASON(SVM_EXIT_MSR          ,  124, "RDMSR or WRMSR access to protected MSR."),
    287     EXIT_REASON(SVM_EXIT_TASK_SWITCH  ,  125, "Task switch."),
    288     EXIT_REASON(SVM_EXIT_FERR_FREEZE  ,  126, "FERR Freeze; CPU frozen in an x87/mmx instruction waiting for interrupt."),
    289     EXIT_REASON(SVM_EXIT_SHUTDOWN     ,  127, "Shutdown."),
    290     EXIT_REASON(SVM_EXIT_VMRUN        ,  128, "VMRUN instruction."),
    291     EXIT_REASON(SVM_EXIT_VMMCALL      ,  129, "VMCALL instruction."),
    292     EXIT_REASON(SVM_EXIT_VMLOAD       ,  130, "VMLOAD instruction."),
    293     EXIT_REASON(SVM_EXIT_VMSAVE       ,  131, "VMSAVE instruction."),
    294     EXIT_REASON(SVM_EXIT_STGI         ,  132, "STGI instruction."),
    295     EXIT_REASON(SVM_EXIT_CLGI         ,  133, "CLGI instruction."),
    296     EXIT_REASON(SVM_EXIT_SKINIT       ,  134, "SKINIT instruction."),
    297     EXIT_REASON(SVM_EXIT_RDTSCP       ,  135, "RDTSCP instruction."),
    298     EXIT_REASON(SVM_EXIT_ICEBP        ,  136, "ICEBP instruction."),
    299     EXIT_REASON(SVM_EXIT_WBINVD       ,  137, "WBINVD instruction."),
    300     EXIT_REASON(SVM_EXIT_MONITOR      ,  138, "MONITOR instruction."),
    301     EXIT_REASON(SVM_EXIT_MWAIT        ,  139, "MWAIT instruction."),
    302     EXIT_REASON(SVM_EXIT_MWAIT_ARMED  ,  140, "MWAIT instruction when armed."),
    303     EXIT_REASON(SVM_EXIT_XSETBV       ,  141, "XSETBV instruction."),
    304 };
    305 /** Array index of the last valid AMD-V exit reason. */
    306 #define MAX_EXITREASON_AMDV              141
    307 
    308 /** Special exit reasons not covered in the array above. */
    309 #define SVM_EXIT_REASON_NPF                  EXIT_REASON(SVM_EXIT_NPF                , 1024, "Nested Page Fault.")
    310 #define SVM_EXIT_REASON_AVIC_INCOMPLETE_IPI  EXIT_REASON(SVM_EXIT_AVIC_INCOMPLETE_IPI, 1025, "AVIC - Incomplete IPI delivery.")
    311 #define SVM_EXIT_REASON_AVIC_NOACCEL         EXIT_REASON(SVM_EXIT_AVIC_NOACCEL       , 1026, "AVIC - Unhandled register.")
    312 
    313 /**
    314  * Gets the SVM exit reason if it's one of the reasons not present in the @c
    315  * g_apszSvmExitReasons array.
    316  *
    317  * @returns The exit reason or NULL if unknown.
    318  * @param   uExit       The exit.
    319  */
    320 DECLINLINE(const char *) hmSvmGetSpecialExitReasonDesc(uint16_t uExit)
    321 {
    322     switch (uExit)
    323     {
    324         case SVM_EXIT_NPF:                 return SVM_EXIT_REASON_NPF;
    325         case SVM_EXIT_AVIC_INCOMPLETE_IPI: return SVM_EXIT_REASON_AVIC_INCOMPLETE_IPI;
    326         case SVM_EXIT_AVIC_NOACCEL:        return SVM_EXIT_REASON_AVIC_NOACCEL;
    327     }
    328     return EXIT_REASON_NIL();
    329 }
    330 #undef EXIT_REASON_NIL
    331 #undef EXIT_REASON
    332 
    33379/** @def HMVMX_REPORT_FEAT
    33480 * Reports VT-x feature to the release log.
     
    1090836#undef HM_REG_COUNTER
    1091837
    1092         const char *const *papszDesc =
    1093             ASMIsIntelCpu() || ASMIsViaCentaurCpu() || ASMIsShanghaiCpu()
    1094             ? &g_apszVmxExitReasons[0]
    1095             : &g_apszSvmExitReasons[0];
     838        bool const fCpuSupportsVmx = ASMIsIntelCpu() || ASMIsViaCentaurCpu() || ASMIsShanghaiCpu();
    1096839
    1097840        /*
     
    1102845                          (void **)&pVCpu->hm.s.paStatExitReason);
    1103846        AssertRCReturn(rc, rc);
    1104         for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     847
     848        if (fCpuSupportsVmx)
    1105849        {
    1106             if (papszDesc[j])
     850            for (int j = 0; j < MAX_EXITREASON_STAT; j++)
    1107851            {
    1108                 rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
    1109                                      STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/Exit/Reason/%02x", i, j);
    1110                 AssertRCReturn(rc, rc);
     852                const char *pszExitName = HMGetVmxExitName(j);
     853                if (pszExitName)
     854                {
     855                    rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     856                                         STAMUNIT_OCCURENCES, pszExitName, "/HM/CPU%d/Exit/Reason/%02x", i, j);
     857                    AssertRCReturn(rc, rc);
     858                }
     859            }
     860        }
     861        else
     862        {
     863            for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     864            {
     865                const char *pszExitName = HMGetSvmExitName(j);
     866                if (pszExitName)
     867                {
     868                    rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     869                                         STAMUNIT_OCCURENCES, pszExitName, "/HM/CPU%d/Exit/Reason/%02x", i, j);
     870                    AssertRCReturn(rc, rc);
     871                }
    1111872            }
    1112873        }
     
    1121882# endif
    1122883
    1123 #ifdef VBOX_WITH_NESTED_HWVIRT_SVM
     884#if defined(VBOX_WITH_NESTED_HWVIRT_SVM) || defined(VBOX_WITH_NESTED_HWVIRT_VMX)
    1124885        /*
    1125          * Nested-guest Exit reason stats.
     886         * Nested-guest VM-exit reason stats.
    1126887         */
    1127888        pVCpu->hm.s.paStatNestedExitReason = NULL;
     
    1129890                          (void **)&pVCpu->hm.s.paStatNestedExitReason);
    1130891        AssertRCReturn(rc, rc);
    1131         for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     892        if (fCpuSupportsVmx)
    1132893        {
    1133             if (papszDesc[j])
     894            for (int j = 0; j < MAX_EXITREASON_STAT; j++)
    1134895            {
    1135                 rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatNestedExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
    1136                                      STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/NestedExit/Reason/%02x", i, j);
    1137                 AssertRC(rc);
     896                const char *pszExitName = HMGetVmxExitName(j);
     897                if (pszExitName)
     898                {
     899                    rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatNestedExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     900                                         STAMUNIT_OCCURENCES, pszExitName, "/HM/CPU%d/NestedExit/Reason/%02x", i, j);
     901                    AssertRC(rc);
     902                }
     903            }
     904        }
     905        else
     906        {
     907            for (int j = 0; j < MAX_EXITREASON_STAT; j++)
     908            {
     909                const char *pszExitName = HMGetSvmExitName(j);
     910                if (pszExitName)
     911                {
     912                    rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatNestedExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     913                                         STAMUNIT_OCCURENCES, pszExitName, "/HM/CPU%d/NestedExit/Reason/%02x", i, j);
     914                    AssertRC(rc);
     915                }
    1138916            }
    1139917        }
     
    19811759    uint32_t u32Model;
    19821760    uint32_t u32Stepping;
    1983     if (HMSvmIsSubjectToErratum170(&u32Family, &u32Model, &u32Stepping))
     1761    if (HMIsSubjectToSvmErratum170(&u32Family, &u32Model, &u32Stepping))
    19841762        LogRel(("HM: AMD Cpu with erratum 170 family %#x model %#x stepping %#x\n", u32Family, u32Model, u32Stepping));
    19851763    LogRel(("HM: Max resume loops                  = %u\n",     pVM->hm.s.cMaxResumeLoops));
     
    34433221
    34443222/**
    3445  * Gets the name of a VT-x exit code.
    3446  *
    3447  * @returns Pointer to read only string if @a uExit is known, otherwise NULL.
    3448  * @param   uExit               The VT-x exit to name.
    3449  */
    3450 VMMR3DECL(const char *) HMR3GetVmxExitName(uint32_t uExit)
    3451 {
    3452     if (uExit < RT_ELEMENTS(g_apszVmxExitReasons))
    3453         return g_apszVmxExitReasons[uExit];
    3454     return NULL;
    3455 }
    3456 
    3457 
    3458 /**
    3459  * Gets the name of an AMD-V exit code.
    3460  *
    3461  * @returns Pointer to read only string if @a uExit is known, otherwise NULL.
    3462  * @param   uExit               The AMD-V exit to name.
    3463  */
    3464 VMMR3DECL(const char *) HMR3GetSvmExitName(uint32_t uExit)
    3465 {
    3466     if (uExit < RT_ELEMENTS(g_apszSvmExitReasons))
    3467         return g_apszSvmExitReasons[uExit];
    3468     return hmSvmGetSpecialExitReasonDesc(uExit);
    3469 }
    3470 
    3471 
    3472 /**
    34733223 * Displays HM info.
    34743224 *
  • trunk/src/VBox/VMM/VMMR3/PGM.cpp

    r76553 r76993  
    21812181            VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    21822182            pgmR3RefreshShadowModeAfterA20Change(pVCpu);
    2183             HMFlushTLB(pVCpu);
     2183            HMFlushTlb(pVCpu);
    21842184#endif
    21852185        }
  • trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp

    r76553 r76993  
    45744574        VMCPU_FF_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3);
    45754575        pgmR3RefreshShadowModeAfterA20Change(pVCpu);
    4576         HMFlushTLB(pVCpu);
     4576        HMFlushTlb(pVCpu);
    45774577#endif
    45784578        IEMTlbInvalidateAllPhysical(pVCpu);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette