VirtualBox

Changeset 43509 in vbox


Ignore:
Timestamp:
Oct 2, 2012 2:15:17 PM (12 years ago)
Author:
vboxsync
Message:

HM: refactor.

Location:
trunk/src/VBox/VMM
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r43496 r43509  
    10041004            pvVMCB->ctrl.u32InterceptCtrl1 &= ~SVM_CTRL1_INTERCEPT_RDTSC;
    10051005            pvVMCB->ctrl.u32InterceptCtrl2 &= ~SVM_CTRL2_INTERCEPT_RDTSCP;
    1006             STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCOffset);
     1006            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
    10071007        }
    10081008        else
     
    10141014            pvVMCB->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_RDTSC;
    10151015            pvVMCB->ctrl.u32InterceptCtrl2 |= SVM_CTRL2_INTERCEPT_RDTSCP;
    1016             STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCInterceptOverFlow);
     1016            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscInterceptOverFlow);
    10171017        }
    10181018    }
     
    10211021        pvVMCB->ctrl.u32InterceptCtrl1 |= SVM_CTRL1_INTERCEPT_RDTSC;
    10221022        pvVMCB->ctrl.u32InterceptCtrl2 |= SVM_CTRL2_INTERCEPT_RDTSCP;
    1023         STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCIntercept);
     1023        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
    10241024    }
    10251025
     
    11791179#ifdef VBOX_WITH_STATISTICS
    11801180    if (pvVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_NOTHING)
    1181         STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTLBWorldSwitch);
     1181        STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTlbWorldSwitch);
    11821182    else if (   pvVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_SINGLE_CONTEXT
    11831183             || pvVMCB->ctrl.TLBCtrl.n.u8TLBFlush == SVM_TLB_FLUSH_SINGLE_CONTEXT_RETAIN_GLOBALS)
     
    11861186    }
    11871187    else
    1188         STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTLBWorldSwitch);
     1188        STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTlbWorldSwitch);
    11891189#endif
    11901190}
     
    17971797#ifdef VBOX_WITH_STATISTICS
    17981798    if (exitCode == SVM_EXIT_NPF)
    1799         STAM_COUNTER_INC(&pVCpu->hm.s.StatExitReasonNPF);
     1799        STAM_COUNTER_INC(&pVCpu->hm.s.StatExitReasonNpf);
    18001800    else
    18011801        STAM_COUNTER_INC(&pVCpu->hm.s.paStatExitReasonR0[exitCode & MASK_EXITREASON_STAT]);
     
    25232523                    static uint32_t const aIOSize[4] = { 1, 2, 0, 4 };
    25242524
    2525                     STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIOCheck);
     2525                    STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIoCheck);
    25262526                    for (unsigned i = 0; i < 4; i++)
    25272527                    {
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r43498 r43509  
    22462246            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hm.s.vmx.proc_ctls);
    22472247            AssertRC(rc);
    2248             STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCOffset);
     2248            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscOffset);
    22492249        }
    22502250        else
     
    22582258            rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hm.s.vmx.proc_ctls);
    22592259            AssertRC(rc);
    2260             STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCInterceptOverFlow);
     2260            STAM_COUNTER_INC(&pVCpu->hm.s.StatTscInterceptOverFlow);
    22612261        }
    22622262    }
     
    22662266        rc = VMXWriteVMCS(VMX_VMCS_CTRL_PROC_EXEC_CONTROLS, pVCpu->hm.s.vmx.proc_ctls);
    22672267        AssertRC(rc);
    2268         STAM_COUNTER_INC(&pVCpu->hm.s.StatTSCIntercept);
     2268        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
    22692269    }
    22702270
     
    25532553        }
    25542554        else
    2555         {
    2556 #ifdef VBOX_WITH_STATISTICS
    2557             STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTLBWorldSwitch);
    2558 #endif
    2559         }
    2560     }
     2555            STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTlbWorldSwitch);
     2556    }
     2557
    25612558    pVCpu->hm.s.TlbShootdown.cPages = 0;
    25622559    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_SHOOTDOWN);
     
    26312628
    26322629#ifdef VBOX_WITH_STATISTICS
     2630    /** @todo r=ramshankar: this is not accurate anymore with the VPID+EPT
     2631     *        handling. Should be fixed later. */
    26332632    if (pVCpu->hm.s.fForceTLBFlush)
    2634         STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTLBWorldSwitch);
     2633        STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTlbWorldSwitch);
    26352634    else
    2636         STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTLBWorldSwitch);
     2635        STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTlbWorldSwitch);
    26372636#endif
    26382637}
     
    27312730
    27322731# ifdef VBOX_WITH_STATISTICS
     2732    /** @todo r=ramshankar: this is not accurate anymore with EPT+VPID handling.
     2733     *        Should be fixed later. */
    27332734    if (pVCpu->hm.s.fForceTLBFlush)
    2734         STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTLBWorldSwitch);
     2735        STAM_COUNTER_INC(&pVCpu->hm.s.StatFlushTlbWorldSwitch);
    27352736    else
    2736         STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTLBWorldSwitch);
     2737        STAM_COUNTER_INC(&pVCpu->hm.s.StatNoFlushTlbWorldSwitch);
    27372738# endif
    27382739}
     
    40344035            /* We've successfully synced our shadow pages, so let's just continue execution. */
    40354036            Log2(("Shadow page fault at %RGv cr2=%RGp error code %x\n", (RTGCPTR)pCtx->rip, exitQualification , errCode));
    4036             STAM_COUNTER_INC(&pVCpu->hm.s.StatExitReasonNPF);
     4037            STAM_COUNTER_INC(&pVCpu->hm.s.StatExitReasonNpf);
    40374038
    40384039            TRPMResetTrap(pVCpu);
     
    45124513                if (pCtx->dr[7] & X86_DR7_ENABLED_MASK)
    45134514                {
    4514                     STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIOCheck);
     4515                    STAM_COUNTER_INC(&pVCpu->hm.s.StatDRxIoCheck);
    45154516                    for (unsigned i = 0; i < 4; i++)
    45164517                    {
  • trunk/src/VBox/VMM/VMMR3/HM.cpp

    r43496 r43509  
    120120static const char * const g_apszAmdVExitReasons[MAX_EXITREASON_STAT] =
    121121{
    122     EXIT_REASON(SVM_EXIT_READ_CR0                   ,  0, "Read CR0."),
    123     EXIT_REASON(SVM_EXIT_READ_CR1                   ,  1, "Read CR1."),
    124     EXIT_REASON(SVM_EXIT_READ_CR2                   ,  2, "Read CR2."),
    125     EXIT_REASON(SVM_EXIT_READ_CR3                   ,  3, "Read CR3."),
    126     EXIT_REASON(SVM_EXIT_READ_CR4                   ,  4, "Read CR4."),
    127     EXIT_REASON(SVM_EXIT_READ_CR5                   ,  5, "Read CR5."),
    128     EXIT_REASON(SVM_EXIT_READ_CR6                   ,  6, "Read CR6."),
    129     EXIT_REASON(SVM_EXIT_READ_CR7                   ,  7, "Read CR7."),
    130     EXIT_REASON(SVM_EXIT_READ_CR8                   ,  8, "Read CR8."),
    131     EXIT_REASON(SVM_EXIT_READ_CR9                   ,  9, "Read CR9."),
    132     EXIT_REASON(SVM_EXIT_READ_CR10                  , 10, "Read CR10."),
    133     EXIT_REASON(SVM_EXIT_READ_CR11                  , 11, "Read CR11."),
    134     EXIT_REASON(SVM_EXIT_READ_CR12                  , 12, "Read CR12."),
    135     EXIT_REASON(SVM_EXIT_READ_CR13                  , 13, "Read CR13."),
    136     EXIT_REASON(SVM_EXIT_READ_CR14                  , 14, "Read CR14."),
    137     EXIT_REASON(SVM_EXIT_READ_CR15                  , 15, "Read CR15."),
    138     EXIT_REASON(SVM_EXIT_WRITE_CR0                  , 16, "Write CR0."),
    139     EXIT_REASON(SVM_EXIT_WRITE_CR1                  , 17, "Write CR1."),
    140     EXIT_REASON(SVM_EXIT_WRITE_CR2                  , 18, "Write CR2."),
    141     EXIT_REASON(SVM_EXIT_WRITE_CR3                  , 19, "Write CR3."),
    142     EXIT_REASON(SVM_EXIT_WRITE_CR4                  , 20, "Write CR4."),
    143     EXIT_REASON(SVM_EXIT_WRITE_CR5                  , 21, "Write CR5."),
    144     EXIT_REASON(SVM_EXIT_WRITE_CR6                  , 22, "Write CR6."),
    145     EXIT_REASON(SVM_EXIT_WRITE_CR7                  , 23, "Write CR7."),
    146     EXIT_REASON(SVM_EXIT_WRITE_CR8                  , 24, "Write CR8."),
    147     EXIT_REASON(SVM_EXIT_WRITE_CR9                  , 25, "Write CR9."),
    148     EXIT_REASON(SVM_EXIT_WRITE_CR10                 , 26, "Write CR10."),
    149     EXIT_REASON(SVM_EXIT_WRITE_CR11                 , 27, "Write CR11."),
    150     EXIT_REASON(SVM_EXIT_WRITE_CR12                 , 28, "Write CR12."),
    151     EXIT_REASON(SVM_EXIT_WRITE_CR13                 , 29, "Write CR13."),
    152     EXIT_REASON(SVM_EXIT_WRITE_CR14                 , 30, "Write CR14."),
    153     EXIT_REASON(SVM_EXIT_WRITE_CR15                 , 31, "Write CR15."),
    154     EXIT_REASON(SVM_EXIT_READ_DR0                   , 32, "Read DR0."),
    155     EXIT_REASON(SVM_EXIT_READ_DR1                   , 33, "Read DR1."),
    156     EXIT_REASON(SVM_EXIT_READ_DR2                   , 34, "Read DR2."),
    157     EXIT_REASON(SVM_EXIT_READ_DR3                   , 35, "Read DR3."),
    158     EXIT_REASON(SVM_EXIT_READ_DR4                   , 36, "Read DR4."),
    159     EXIT_REASON(SVM_EXIT_READ_DR5                   , 37, "Read DR5."),
    160     EXIT_REASON(SVM_EXIT_READ_DR6                   , 38, "Read DR6."),
    161     EXIT_REASON(SVM_EXIT_READ_DR7                   , 39, "Read DR7."),
    162     EXIT_REASON(SVM_EXIT_READ_DR8                   , 40, "Read DR8."),
    163     EXIT_REASON(SVM_EXIT_READ_DR9                   , 41, "Read DR9."),
    164     EXIT_REASON(SVM_EXIT_READ_DR10                  , 42, "Read DR10."),
    165     EXIT_REASON(SVM_EXIT_READ_DR11                  , 43, "Read DR11"),
    166     EXIT_REASON(SVM_EXIT_READ_DR12                  , 44, "Read DR12."),
    167     EXIT_REASON(SVM_EXIT_READ_DR13                  , 45, "Read DR13."),
    168     EXIT_REASON(SVM_EXIT_READ_DR14                  , 46, "Read DR14."),
    169     EXIT_REASON(SVM_EXIT_READ_DR15                  , 47, "Read DR15."),
    170     EXIT_REASON(SVM_EXIT_WRITE_DR0                  , 48, "Write DR0."),
    171     EXIT_REASON(SVM_EXIT_WRITE_DR1                  , 49, "Write DR1."),
    172     EXIT_REASON(SVM_EXIT_WRITE_DR2                  , 50, "Write DR2."),
    173     EXIT_REASON(SVM_EXIT_WRITE_DR3                  , 51, "Write DR3."),
    174     EXIT_REASON(SVM_EXIT_WRITE_DR4                  , 52, "Write DR4."),
    175     EXIT_REASON(SVM_EXIT_WRITE_DR5                  , 53, "Write DR5."),
    176     EXIT_REASON(SVM_EXIT_WRITE_DR6                  , 54, "Write DR6."),
    177     EXIT_REASON(SVM_EXIT_WRITE_DR7                  , 55, "Write DR7."),
    178     EXIT_REASON(SVM_EXIT_WRITE_DR8                  , 56, "Write DR8."),
    179     EXIT_REASON(SVM_EXIT_WRITE_DR9                  , 57, "Write DR9."),
    180     EXIT_REASON(SVM_EXIT_WRITE_DR10                 , 58, "Write DR10."),
    181     EXIT_REASON(SVM_EXIT_WRITE_DR11                 , 59, "Write DR11."),
    182     EXIT_REASON(SVM_EXIT_WRITE_DR12                 , 60, "Write DR12."),
    183     EXIT_REASON(SVM_EXIT_WRITE_DR13                 , 61, "Write DR13."),
    184     EXIT_REASON(SVM_EXIT_WRITE_DR14                 , 62, "Write DR14."),
    185     EXIT_REASON(SVM_EXIT_WRITE_DR15                 , 63, "Write DR15."),
    186     EXIT_REASON(SVM_EXIT_EXCEPTION_0                , 64, "Exception Vector 0  (0x0)."),
    187     EXIT_REASON(SVM_EXIT_EXCEPTION_1                , 65, "Exception Vector 1  (0x1)."),
    188     EXIT_REASON(SVM_EXIT_EXCEPTION_2                , 66, "Exception Vector 2  (0x2)."),
    189     EXIT_REASON(SVM_EXIT_EXCEPTION_3                , 67, "Exception Vector 3  (0x3)."),
    190     EXIT_REASON(SVM_EXIT_EXCEPTION_4                , 68, "Exception Vector 4  (0x4)."),
    191     EXIT_REASON(SVM_EXIT_EXCEPTION_5                , 69, "Exception Vector 5  (0x5)."),
    192     EXIT_REASON(SVM_EXIT_EXCEPTION_6                , 70, "Exception Vector 6  (0x6)."),
    193     EXIT_REASON(SVM_EXIT_EXCEPTION_7                , 71, "Exception Vector 7  (0x7)."),
    194     EXIT_REASON(SVM_EXIT_EXCEPTION_8                , 72, "Exception Vector 8  (0x8)."),
    195     EXIT_REASON(SVM_EXIT_EXCEPTION_9                , 73, "Exception Vector 9  (0x9)."),
    196     EXIT_REASON(SVM_EXIT_EXCEPTION_A                , 74, "Exception Vector 10 (0xA)."),
    197     EXIT_REASON(SVM_EXIT_EXCEPTION_B                , 75, "Exception Vector 11 (0xB)."),
    198     EXIT_REASON(SVM_EXIT_EXCEPTION_C                , 76, "Exception Vector 12 (0xC)."),
    199     EXIT_REASON(SVM_EXIT_EXCEPTION_D                , 77, "Exception Vector 13 (0xD)."),
    200     EXIT_REASON(SVM_EXIT_EXCEPTION_E                , 78, "Exception Vector 14 (0xE)."),
    201     EXIT_REASON(SVM_EXIT_EXCEPTION_F                , 79, "Exception Vector 15 (0xF)."),
    202     EXIT_REASON(SVM_EXIT_EXCEPTION_10               , 80, "Exception Vector 16 (0x10)."),
    203     EXIT_REASON(SVM_EXIT_EXCEPTION_11               , 81, "Exception Vector 17 (0x11)."),
    204     EXIT_REASON(SVM_EXIT_EXCEPTION_12               , 82, "Exception Vector 18 (0x12)."),
    205     EXIT_REASON(SVM_EXIT_EXCEPTION_13               , 83, "Exception Vector 19 (0x13)."),
    206     EXIT_REASON(SVM_EXIT_EXCEPTION_14               , 84, "Exception Vector 20 (0x14)."),
    207     EXIT_REASON(SVM_EXIT_EXCEPTION_15               , 85, "Exception Vector 22 (0x15)."),
    208     EXIT_REASON(SVM_EXIT_EXCEPTION_16               , 86, "Exception Vector 22 (0x16)."),
    209     EXIT_REASON(SVM_EXIT_EXCEPTION_17               , 87, "Exception Vector 23 (0x17)."),
    210     EXIT_REASON(SVM_EXIT_EXCEPTION_18               , 88, "Exception Vector 24 (0x18)."),
    211     EXIT_REASON(SVM_EXIT_EXCEPTION_19               , 89, "Exception Vector 25 (0x19)."),
    212     EXIT_REASON(SVM_EXIT_EXCEPTION_1A               , 90, "Exception Vector 26 (0x1A)."),
    213     EXIT_REASON(SVM_EXIT_EXCEPTION_1B               , 91, "Exception Vector 27 (0x1B)."),
    214     EXIT_REASON(SVM_EXIT_EXCEPTION_1C               , 92, "Exception Vector 28 (0x1C)."),
    215     EXIT_REASON(SVM_EXIT_EXCEPTION_1D               , 93, "Exception Vector 29 (0x1D)."),
    216     EXIT_REASON(SVM_EXIT_EXCEPTION_1E               , 94, "Exception Vector 30 (0x1E)."),
    217     EXIT_REASON(SVM_EXIT_EXCEPTION_1F               , 95, "Exception Vector 31 (0x1F)."),
    218     EXIT_REASON(SVM_EXIT_INTR                       , 96, "Physical maskable interrupt."),
    219     EXIT_REASON(SVM_EXIT_NMI                        , 97, "Physical non-maskable interrupt."),
    220     EXIT_REASON(SVM_EXIT_SMI                        , 98, "System management interrupt."),
    221     EXIT_REASON(SVM_EXIT_INIT                       , 99, "Physical INIT signal."),
    222     EXIT_REASON(SVM_EXIT_VINTR                      ,100, "Virtual interrupt."),
    223     EXIT_REASON(SVM_EXIT_CR0_SEL_WRITE              ,101, "Write to CR0 that changed any bits other than CR0.TS or CR0.MP."),
    224     EXIT_REASON(SVM_EXIT_IDTR_READ                  ,102, "Read IDTR"),
    225     EXIT_REASON(SVM_EXIT_GDTR_READ                  ,103, "Read GDTR"),
    226     EXIT_REASON(SVM_EXIT_LDTR_READ                  ,104, "Read LDTR."),
    227     EXIT_REASON(SVM_EXIT_TR_READ                    ,105, "Read TR."),
    228     EXIT_REASON(SVM_EXIT_TR_READ                    ,106, "Write IDTR."),
    229     EXIT_REASON(SVM_EXIT_TR_READ                    ,107, "Write GDTR."),
    230     EXIT_REASON(SVM_EXIT_TR_READ                    ,108, "Write LDTR."),
    231     EXIT_REASON(SVM_EXIT_TR_READ                    ,109, "Write TR."),
    232     EXIT_REASON(SVM_EXIT_RDTSC                      ,110, "RDTSC instruction."),
    233     EXIT_REASON(SVM_EXIT_RDPMC                      ,111, "RDPMC instruction."),
    234     EXIT_REASON(SVM_EXIT_PUSHF                      ,112, "PUSHF instruction."),
    235     EXIT_REASON(SVM_EXIT_POPF                       ,113, "POPF instruction."),
    236     EXIT_REASON(SVM_EXIT_CPUID                      ,114, "CPUID instruction."),
    237     EXIT_REASON(SVM_EXIT_RSM                        ,115, "RSM instruction."),
    238     EXIT_REASON(SVM_EXIT_IRET                       ,116, "IRET instruction."),
    239     EXIT_REASON(SVM_EXIT_SWINT                      ,117, "Software interrupt (INTn instructions)."),
    240     EXIT_REASON(SVM_EXIT_INVD                       ,118, "INVD instruction."),
    241     EXIT_REASON(SVM_EXIT_PAUSE                      ,119, "PAUSE instruction."),
    242     EXIT_REASON(SVM_EXIT_HLT                        ,120, "HLT instruction."),
    243     EXIT_REASON(SVM_EXIT_INVLPG                     ,121, "INVLPG instruction."),
    244     EXIT_REASON(SVM_EXIT_INVLPGA                    ,122, "INVLPGA instruction."),
    245     EXIT_REASON(SVM_EXIT_IOIO                       ,123, "IN/OUT accessing protected port (EXITINFO1 field provides more information)."),
    246     EXIT_REASON(SVM_EXIT_MSR                        ,124, "RDMSR or WRMSR access to protected MSR."),
    247     EXIT_REASON(SVM_EXIT_TASK_SWITCH                ,125, "Task switch."),
    248     EXIT_REASON(SVM_EXIT_FERR_FREEZE                ,126, "FP legacy handling enabled, and processor is frozen in an x87/mmx instruction waiting for an interrupt"),
    249     EXIT_REASON(SVM_EXIT_SHUTDOWN                   ,127, "Shutdown."),
    250     EXIT_REASON(SVM_EXIT_VMRUN                      ,128, "VMRUN instruction."),
    251     EXIT_REASON(SVM_EXIT_VMMCALL                    ,129, "VMCALL instruction."),
    252     EXIT_REASON(SVM_EXIT_VMLOAD                     ,130, "VMLOAD instruction."),
    253     EXIT_REASON(SVM_EXIT_VMSAVE                     ,131, "VMSAVE instruction."),
    254     EXIT_REASON(SVM_EXIT_STGI                       ,132, "STGI instruction."),
    255     EXIT_REASON(SVM_EXIT_CLGI                       ,133, "CLGI instruction."),
    256     EXIT_REASON(SVM_EXIT_SKINIT                     ,134, "SKINIT instruction."),
    257     EXIT_REASON(SVM_EXIT_RDTSCP                     ,135, "RDTSCP instruction."),
    258     EXIT_REASON(SVM_EXIT_ICEBP                      ,136, "ICEBP instruction."),
    259     EXIT_REASON(SVM_EXIT_WBINVD                     ,137, "WBINVD instruction."),
    260     EXIT_REASON(SVM_EXIT_MONITOR                    ,138, "MONITOR instruction."),
    261     EXIT_REASON(SVM_EXIT_MWAIT_UNCOND               ,139, "MWAIT instruction unconditional."),
    262     EXIT_REASON(SVM_EXIT_MWAIT_ARMED                ,140, "MWAIT instruction when armed."),
    263     EXIT_REASON(SVM_EXIT_NPF                        ,1024, "Nested paging: host-level page fault occurred (EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault)."),
     122    EXIT_REASON(SVM_EXIT_READ_CR0           ,  0, "Read CR0."),
     123    EXIT_REASON(SVM_EXIT_READ_CR1           ,  1, "Read CR1."),
     124    EXIT_REASON(SVM_EXIT_READ_CR2           ,  2, "Read CR2."),
     125    EXIT_REASON(SVM_EXIT_READ_CR3           ,  3, "Read CR3."),
     126    EXIT_REASON(SVM_EXIT_READ_CR4           ,  4, "Read CR4."),
     127    EXIT_REASON(SVM_EXIT_READ_CR5           ,  5, "Read CR5."),
     128    EXIT_REASON(SVM_EXIT_READ_CR6           ,  6, "Read CR6."),
     129    EXIT_REASON(SVM_EXIT_READ_CR7           ,  7, "Read CR7."),
     130    EXIT_REASON(SVM_EXIT_READ_CR8           ,  8, "Read CR8."),
     131    EXIT_REASON(SVM_EXIT_READ_CR9           ,  9, "Read CR9."),
     132    EXIT_REASON(SVM_EXIT_READ_CR10          , 10, "Read CR10."),
     133    EXIT_REASON(SVM_EXIT_READ_CR11          , 11, "Read CR11."),
     134    EXIT_REASON(SVM_EXIT_READ_CR12          , 12, "Read CR12."),
     135    EXIT_REASON(SVM_EXIT_READ_CR13          , 13, "Read CR13."),
     136    EXIT_REASON(SVM_EXIT_READ_CR14          , 14, "Read CR14."),
     137    EXIT_REASON(SVM_EXIT_READ_CR15          , 15, "Read CR15."),
     138    EXIT_REASON(SVM_EXIT_WRITE_CR0          , 16, "Write CR0."),
     139    EXIT_REASON(SVM_EXIT_WRITE_CR1          , 17, "Write CR1."),
     140    EXIT_REASON(SVM_EXIT_WRITE_CR2          , 18, "Write CR2."),
     141    EXIT_REASON(SVM_EXIT_WRITE_CR3          , 19, "Write CR3."),
     142    EXIT_REASON(SVM_EXIT_WRITE_CR4          , 20, "Write CR4."),
     143    EXIT_REASON(SVM_EXIT_WRITE_CR5          , 21, "Write CR5."),
     144    EXIT_REASON(SVM_EXIT_WRITE_CR6          , 22, "Write CR6."),
     145    EXIT_REASON(SVM_EXIT_WRITE_CR7          , 23, "Write CR7."),
     146    EXIT_REASON(SVM_EXIT_WRITE_CR8          , 24, "Write CR8."),
     147    EXIT_REASON(SVM_EXIT_WRITE_CR9          , 25, "Write CR9."),
     148    EXIT_REASON(SVM_EXIT_WRITE_CR10         , 26, "Write CR10."),
     149    EXIT_REASON(SVM_EXIT_WRITE_CR11         , 27, "Write CR11."),
     150    EXIT_REASON(SVM_EXIT_WRITE_CR12         , 28, "Write CR12."),
     151    EXIT_REASON(SVM_EXIT_WRITE_CR13         , 29, "Write CR13."),
     152    EXIT_REASON(SVM_EXIT_WRITE_CR14         , 30, "Write CR14."),
     153    EXIT_REASON(SVM_EXIT_WRITE_CR15         , 31, "Write CR15."),
     154    EXIT_REASON(SVM_EXIT_READ_DR0           , 32, "Read DR0."),
     155    EXIT_REASON(SVM_EXIT_READ_DR1           , 33, "Read DR1."),
     156    EXIT_REASON(SVM_EXIT_READ_DR2           , 34, "Read DR2."),
     157    EXIT_REASON(SVM_EXIT_READ_DR3           , 35, "Read DR3."),
     158    EXIT_REASON(SVM_EXIT_READ_DR4           , 36, "Read DR4."),
     159    EXIT_REASON(SVM_EXIT_READ_DR5           , 37, "Read DR5."),
     160    EXIT_REASON(SVM_EXIT_READ_DR6           , 38, "Read DR6."),
     161    EXIT_REASON(SVM_EXIT_READ_DR7           , 39, "Read DR7."),
     162    EXIT_REASON(SVM_EXIT_READ_DR8           , 40, "Read DR8."),
     163    EXIT_REASON(SVM_EXIT_READ_DR9           , 41, "Read DR9."),
     164    EXIT_REASON(SVM_EXIT_READ_DR10          , 42, "Read DR10."),
     165    EXIT_REASON(SVM_EXIT_READ_DR11          , 43, "Read DR11"),
     166    EXIT_REASON(SVM_EXIT_READ_DR12          , 44, "Read DR12."),
     167    EXIT_REASON(SVM_EXIT_READ_DR13          , 45, "Read DR13."),
     168    EXIT_REASON(SVM_EXIT_READ_DR14          , 46, "Read DR14."),
     169    EXIT_REASON(SVM_EXIT_READ_DR15          , 47, "Read DR15."),
     170    EXIT_REASON(SVM_EXIT_WRITE_DR0          , 48, "Write DR0."),
     171    EXIT_REASON(SVM_EXIT_WRITE_DR1          , 49, "Write DR1."),
     172    EXIT_REASON(SVM_EXIT_WRITE_DR2          , 50, "Write DR2."),
     173    EXIT_REASON(SVM_EXIT_WRITE_DR3          , 51, "Write DR3."),
     174    EXIT_REASON(SVM_EXIT_WRITE_DR4          , 52, "Write DR4."),
     175    EXIT_REASON(SVM_EXIT_WRITE_DR5          , 53, "Write DR5."),
     176    EXIT_REASON(SVM_EXIT_WRITE_DR6          , 54, "Write DR6."),
     177    EXIT_REASON(SVM_EXIT_WRITE_DR7          , 55, "Write DR7."),
     178    EXIT_REASON(SVM_EXIT_WRITE_DR8          , 56, "Write DR8."),
     179    EXIT_REASON(SVM_EXIT_WRITE_DR9          , 57, "Write DR9."),
     180    EXIT_REASON(SVM_EXIT_WRITE_DR10         , 58, "Write DR10."),
     181    EXIT_REASON(SVM_EXIT_WRITE_DR11         , 59, "Write DR11."),
     182    EXIT_REASON(SVM_EXIT_WRITE_DR12         , 60, "Write DR12."),
     183    EXIT_REASON(SVM_EXIT_WRITE_DR13         , 61, "Write DR13."),
     184    EXIT_REASON(SVM_EXIT_WRITE_DR14         , 62, "Write DR14."),
     185    EXIT_REASON(SVM_EXIT_WRITE_DR15         , 63, "Write DR15."),
     186    EXIT_REASON(SVM_EXIT_EXCEPTION_0        , 64, "Exception Vector 0  (0x0)."),
     187    EXIT_REASON(SVM_EXIT_EXCEPTION_1        , 65, "Exception Vector 1  (0x1)."),
     188    EXIT_REASON(SVM_EXIT_EXCEPTION_2        , 66, "Exception Vector 2  (0x2)."),
     189    EXIT_REASON(SVM_EXIT_EXCEPTION_3        , 67, "Exception Vector 3  (0x3)."),
     190    EXIT_REASON(SVM_EXIT_EXCEPTION_4        , 68, "Exception Vector 4  (0x4)."),
     191    EXIT_REASON(SVM_EXIT_EXCEPTION_5        , 69, "Exception Vector 5  (0x5)."),
     192    EXIT_REASON(SVM_EXIT_EXCEPTION_6        , 70, "Exception Vector 6  (0x6)."),
     193    EXIT_REASON(SVM_EXIT_EXCEPTION_7        , 71, "Exception Vector 7  (0x7)."),
     194    EXIT_REASON(SVM_EXIT_EXCEPTION_8        , 72, "Exception Vector 8  (0x8)."),
     195    EXIT_REASON(SVM_EXIT_EXCEPTION_9        , 73, "Exception Vector 9  (0x9)."),
     196    EXIT_REASON(SVM_EXIT_EXCEPTION_A        , 74, "Exception Vector 10 (0xA)."),
     197    EXIT_REASON(SVM_EXIT_EXCEPTION_B        , 75, "Exception Vector 11 (0xB)."),
     198    EXIT_REASON(SVM_EXIT_EXCEPTION_C        , 76, "Exception Vector 12 (0xC)."),
     199    EXIT_REASON(SVM_EXIT_EXCEPTION_D        , 77, "Exception Vector 13 (0xD)."),
     200    EXIT_REASON(SVM_EXIT_EXCEPTION_E        , 78, "Exception Vector 14 (0xE)."),
     201    EXIT_REASON(SVM_EXIT_EXCEPTION_F        , 79, "Exception Vector 15 (0xF)."),
     202    EXIT_REASON(SVM_EXIT_EXCEPTION_10       , 80, "Exception Vector 16 (0x10)."),
     203    EXIT_REASON(SVM_EXIT_EXCEPTION_11       , 81, "Exception Vector 17 (0x11)."),
     204    EXIT_REASON(SVM_EXIT_EXCEPTION_12       , 82, "Exception Vector 18 (0x12)."),
     205    EXIT_REASON(SVM_EXIT_EXCEPTION_13       , 83, "Exception Vector 19 (0x13)."),
     206    EXIT_REASON(SVM_EXIT_EXCEPTION_14       , 84, "Exception Vector 20 (0x14)."),
     207    EXIT_REASON(SVM_EXIT_EXCEPTION_15       , 85, "Exception Vector 22 (0x15)."),
     208    EXIT_REASON(SVM_EXIT_EXCEPTION_16       , 86, "Exception Vector 22 (0x16)."),
     209    EXIT_REASON(SVM_EXIT_EXCEPTION_17       , 87, "Exception Vector 23 (0x17)."),
     210    EXIT_REASON(SVM_EXIT_EXCEPTION_18       , 88, "Exception Vector 24 (0x18)."),
     211    EXIT_REASON(SVM_EXIT_EXCEPTION_19       , 89, "Exception Vector 25 (0x19)."),
     212    EXIT_REASON(SVM_EXIT_EXCEPTION_1A       , 90, "Exception Vector 26 (0x1A)."),
     213    EXIT_REASON(SVM_EXIT_EXCEPTION_1B       , 91, "Exception Vector 27 (0x1B)."),
     214    EXIT_REASON(SVM_EXIT_EXCEPTION_1C       , 92, "Exception Vector 28 (0x1C)."),
     215    EXIT_REASON(SVM_EXIT_EXCEPTION_1D       , 93, "Exception Vector 29 (0x1D)."),
     216    EXIT_REASON(SVM_EXIT_EXCEPTION_1E       , 94, "Exception Vector 30 (0x1E)."),
     217    EXIT_REASON(SVM_EXIT_EXCEPTION_1F       , 95, "Exception Vector 31 (0x1F)."),
     218    EXIT_REASON(SVM_EXIT_INTR               , 96, "Physical maskable interrupt."),
     219    EXIT_REASON(SVM_EXIT_NMI                , 97, "Physical non-maskable interrupt."),
     220    EXIT_REASON(SVM_EXIT_SMI                , 98, "System management interrupt."),
     221    EXIT_REASON(SVM_EXIT_INIT               , 99, "Physical INIT signal."),
     222    EXIT_REASON(SVM_EXIT_VINTR              ,100, "Virtual interrupt."),
     223    EXIT_REASON(SVM_EXIT_CR0_SEL_WRITE      ,101, "Write to CR0 that changed any bits other than CR0.TS or CR0.MP."),
     224    EXIT_REASON(SVM_EXIT_IDTR_READ          ,102, "Read IDTR"),
     225    EXIT_REASON(SVM_EXIT_GDTR_READ          ,103, "Read GDTR"),
     226    EXIT_REASON(SVM_EXIT_LDTR_READ          ,104, "Read LDTR."),
     227    EXIT_REASON(SVM_EXIT_TR_READ            ,105, "Read TR."),
     228    EXIT_REASON(SVM_EXIT_TR_READ            ,106, "Write IDTR."),
     229    EXIT_REASON(SVM_EXIT_TR_READ            ,107, "Write GDTR."),
     230    EXIT_REASON(SVM_EXIT_TR_READ            ,108, "Write LDTR."),
     231    EXIT_REASON(SVM_EXIT_TR_READ            ,109, "Write TR."),
     232    EXIT_REASON(SVM_EXIT_RDTSC              ,110, "RDTSC instruction."),
     233    EXIT_REASON(SVM_EXIT_RDPMC              ,111, "RDPMC instruction."),
     234    EXIT_REASON(SVM_EXIT_PUSHF              ,112, "PUSHF instruction."),
     235    EXIT_REASON(SVM_EXIT_POPF               ,113, "POPF instruction."),
     236    EXIT_REASON(SVM_EXIT_CPUID              ,114, "CPUID instruction."),
     237    EXIT_REASON(SVM_EXIT_RSM                ,115, "RSM instruction."),
     238    EXIT_REASON(SVM_EXIT_IRET               ,116, "IRET instruction."),
     239    EXIT_REASON(SVM_EXIT_SWINT              ,117, "Software interrupt (INTn instructions)."),
     240    EXIT_REASON(SVM_EXIT_INVD               ,118, "INVD instruction."),
     241    EXIT_REASON(SVM_EXIT_PAUSE              ,119, "PAUSE instruction."),
     242    EXIT_REASON(SVM_EXIT_HLT                ,120, "HLT instruction."),
     243    EXIT_REASON(SVM_EXIT_INVLPG             ,121, "INVLPG instruction."),
     244    EXIT_REASON(SVM_EXIT_INVLPGA            ,122, "INVLPGA instruction."),
     245    EXIT_REASON(SVM_EXIT_IOIO               ,123, "IN/OUT accessing protected port (EXITINFO1 field provides more information)."),
     246    EXIT_REASON(SVM_EXIT_MSR                ,124, "RDMSR or WRMSR access to protected MSR."),
     247    EXIT_REASON(SVM_EXIT_TASK_SWITCH        ,125, "Task switch."),
     248    EXIT_REASON(SVM_EXIT_FERR_FREEZE        ,126, "FP legacy handling enabled, and processor is frozen in an x87/mmx instruction waiting for an interrupt"),
     249    EXIT_REASON(SVM_EXIT_SHUTDOWN           ,127, "Shutdown."),
     250    EXIT_REASON(SVM_EXIT_VMRUN              ,128, "VMRUN instruction."),
     251    EXIT_REASON(SVM_EXIT_VMMCALL            ,129, "VMCALL instruction."),
     252    EXIT_REASON(SVM_EXIT_VMLOAD             ,130, "VMLOAD instruction."),
     253    EXIT_REASON(SVM_EXIT_VMSAVE             ,131, "VMSAVE instruction."),
     254    EXIT_REASON(SVM_EXIT_STGI               ,132, "STGI instruction."),
     255    EXIT_REASON(SVM_EXIT_CLGI               ,133, "CLGI instruction."),
     256    EXIT_REASON(SVM_EXIT_SKINIT             ,134, "SKINIT instruction."),
     257    EXIT_REASON(SVM_EXIT_RDTSCP             ,135, "RDTSCP instruction."),
     258    EXIT_REASON(SVM_EXIT_ICEBP              ,136, "ICEBP instruction."),
     259    EXIT_REASON(SVM_EXIT_WBINVD             ,137, "WBINVD instruction."),
     260    EXIT_REASON(SVM_EXIT_MONITOR            ,138, "MONITOR instruction."),
     261    EXIT_REASON(SVM_EXIT_MWAIT_UNCOND       ,139, "MWAIT instruction unconditional."),
     262    EXIT_REASON(SVM_EXIT_MWAIT_ARMED        ,140, "MWAIT instruction when armed."),
     263    EXIT_REASON(SVM_EXIT_NPF                ,1024, "Nested paging: host-level page fault occurred (EXITINFO1 contains fault errorcode; EXITINFO2 contains the guest physical address causing the fault)."),
    264264    EXIT_REASON_NIL()
    265265};
     
    310310    AssertReleaseMsg(RT_OFFSETOF(SVM_VMCB, guest.u64LASTEXCPTO) == 0x690, ("guest.u64LASTEXCPTO offset = %x\n", RT_OFFSETOF(SVM_VMCB, guest.u64LASTEXCPTO)));
    311311    AssertReleaseMsg(sizeof(SVM_VMCB) == 0x1000, ("SVM_VMCB size = %x\n", sizeof(SVM_VMCB)));
    312 
    313312
    314313    /*
     
    439438
    440439#ifdef VBOX_WITH_STATISTICS
    441     STAM_REG(pVM, &pVM->hm.s.StatTPRPatchSuccess,   STAMTYPE_COUNTER, "/HM/TPR/Patch/Success",  STAMUNIT_OCCURENCES,    "Number of times an instruction was successfully patched.");
    442     STAM_REG(pVM, &pVM->hm.s.StatTPRPatchFailure,   STAMTYPE_COUNTER, "/HM/TPR/Patch/Failed",   STAMUNIT_OCCURENCES,    "Number of unsuccessful patch attempts.");
    443     STAM_REG(pVM, &pVM->hm.s.StatTPRReplaceSuccess, STAMTYPE_COUNTER, "/HM/TPR/Replace/Success",STAMUNIT_OCCURENCES,    "Number of times an instruction was successfully patched.");
    444     STAM_REG(pVM, &pVM->hm.s.StatTPRReplaceFailure, STAMTYPE_COUNTER, "/HM/TPR/Replace/Failed", STAMUNIT_OCCURENCES,    "Number of unsuccessful patch attempts.");
     440    STAM_REG(pVM, &pVM->hm.s.StatTprPatchSuccess,   STAMTYPE_COUNTER, "/HM/TPR/Patch/Success",  STAMUNIT_OCCURENCES, "Number of times an instruction was successfully patched.");
     441    STAM_REG(pVM, &pVM->hm.s.StatTprPatchFailure,   STAMTYPE_COUNTER, "/HM/TPR/Patch/Failed",   STAMUNIT_OCCURENCES, "Number of unsuccessful patch attempts.");
     442    STAM_REG(pVM, &pVM->hm.s.StatTprReplaceSuccess, STAMTYPE_COUNTER, "/HM/TPR/Replace/Success",STAMUNIT_OCCURENCES, "Number of times an instruction was successfully patched.");
     443    STAM_REG(pVM, &pVM->hm.s.StatTprReplaceFailure, STAMTYPE_COUNTER, "/HM/TPR/Replace/Failed", STAMUNIT_OCCURENCES, "Number of unsuccessful patch attempts.");
    445444
    446445    /*
     
    452451        int    rc;
    453452
    454         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatPoke, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of RTMpPokeCpu",
     453        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatPoke, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     454                             "Profiling of RTMpPokeCpu",
    455455                             "/PROF/HM/CPU%d/Poke", i);
    456456        AssertRC(rc);
    457         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatSpinPoke, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of poke wait",
     457        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatSpinPoke, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     458                             "Profiling of poke wait",
    458459                             "/PROF/HM/CPU%d/PokeWait", i);
    459460        AssertRC(rc);
    460         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatSpinPokeFailed, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of poke wait when RTMpPokeCpu fails",
     461        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatSpinPokeFailed, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     462                             "Profiling of poke wait when RTMpPokeCpu fails",
    461463                             "/PROF/HM/CPU%d/PokeWaitFailed", i);
    462464        AssertRC(rc);
    463         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatEntry, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode entry",
     465        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatEntry, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     466                             "Profiling of VMXR0RunGuestCode entry",
    464467                             "/PROF/HM/CPU%d/SwitchToGC", i);
    465468        AssertRC(rc);
    466         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit1, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit part 1",
     469        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit1, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     470                             "Profiling of VMXR0RunGuestCode exit part 1",
    467471                             "/PROF/HM/CPU%d/SwitchFromGC_1", i);
    468472        AssertRC(rc);
    469         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of VMXR0RunGuestCode exit part 2",
     473        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     474                             "Profiling of VMXR0RunGuestCode exit part 2",
    470475                             "/PROF/HM/CPU%d/SwitchFromGC_2", i);
    471476        AssertRC(rc);
    472477# if 1 /* temporary for tracking down darwin holdup. */
    473         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub1, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Temporary - I/O",
     478        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub1, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     479                             "Temporary - I/O",
    474480                             "/PROF/HM/CPU%d/SwitchFromGC_2/Sub1", i);
    475481        AssertRC(rc);
    476         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub2, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Temporary - CRx RWs",
     482        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub2, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     483                             "Temporary - CRx RWs",
    477484                             "/PROF/HM/CPU%d/SwitchFromGC_2/Sub2", i);
    478485        AssertRC(rc);
    479         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Temporary - Exceptions",
     486        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExit2Sub3, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     487                             "Temporary - Exceptions",
    480488                             "/PROF/HM/CPU%d/SwitchFromGC_2/Sub3", i);
    481489        AssertRC(rc);
    482490# endif
    483         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatInGC, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of vmlaunch",
     491        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatInGC, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL,
     492                             "Profiling of vmlaunch",
    484493                             "/PROF/HM/CPU%d/InGC", i);
    485494        AssertRC(rc);
    486495
    487496# if HC_ARCH_BITS == 32 && defined(VBOX_ENABLE_64_BITS_GUESTS) && !defined(VBOX_WITH_HYBRID_32BIT_KERNEL)
    488         rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatWorldSwitch3264, STAMTYPE_PROFILE, STAMVISIBILITY_USED, STAMUNIT_TICKS_PER_CALL, "Profiling of the 32/64 switcher",
     497        rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatWorldSwitch3264, STAMTYPE_PROFILE, STAMVISIBILITY_USED,
     498                             STAMUNIT_TICKS_PER_CALL, "Profiling of the 32/64 switcher",
    489499                             "/PROF/HM/CPU%d/Switcher3264", i);
    490500        AssertRC(rc);
     
    550560        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushPageManual,        "/HM/CPU%d/Flush/Page/Virt");
    551561        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushPhysPageManual,    "/HM/CPU%d/Flush/Page/Phys");
    552         HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTLB,               "/HM/CPU%d/Flush/TLB");
    553         HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTLBManual,         "/HM/CPU%d/Flush/TLB/Manual");
    554         HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTLBCRxChange,      "/HM/CPU%d/Flush/TLB/CRx");
     562        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTlb,               "/HM/CPU%d/Flush/TLB");
     563        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTlbManual,         "/HM/CPU%d/Flush/TLB/Manual");
     564        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTlbCRxChange,      "/HM/CPU%d/Flush/TLB/CRx");
    555565        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushPageInvlpg,        "/HM/CPU%d/Flush/Page/Invlpg");
    556         HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTLBWorldSwitch,    "/HM/CPU%d/Flush/TLB/Switch");
    557         HM_REG_COUNTER(&pVCpu->hm.s.StatNoFlushTLBWorldSwitch,  "/HM/CPU%d/Flush/TLB/Skipped");
     566        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushTlbWorldSwitch,    "/HM/CPU%d/Flush/TLB/Switch");
     567        HM_REG_COUNTER(&pVCpu->hm.s.StatNoFlushTlbWorldSwitch,  "/HM/CPU%d/Flush/TLB/Skipped");
    558568        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushAsid,              "/HM/CPU%d/Flush/TLB/ASID");
    559569        HM_REG_COUNTER(&pVCpu->hm.s.StatFlushNestedPaging,      "/HM/CPU%d/Flush/TLB/NestedPaging");
     
    562572        HM_REG_COUNTER(&pVCpu->hm.s.StatTlbShootdownFlush,      "/HM/CPU%d/Flush/Shootdown/TLB");
    563573
    564         HM_REG_COUNTER(&pVCpu->hm.s.StatTSCOffset,              "/HM/CPU%d/TSC/Offset");
    565         HM_REG_COUNTER(&pVCpu->hm.s.StatTSCIntercept,           "/HM/CPU%d/TSC/Intercept");
    566         HM_REG_COUNTER(&pVCpu->hm.s.StatTSCInterceptOverFlow,   "/HM/CPU%d/TSC/InterceptOverflow");
     574        HM_REG_COUNTER(&pVCpu->hm.s.StatTscOffset,              "/HM/CPU%d/TSC/Offset");
     575        HM_REG_COUNTER(&pVCpu->hm.s.StatTscIntercept,           "/HM/CPU%d/TSC/Intercept");
     576        HM_REG_COUNTER(&pVCpu->hm.s.StatTscInterceptOverFlow,   "/HM/CPU%d/TSC/InterceptOverflow");
    567577
    568578        HM_REG_COUNTER(&pVCpu->hm.s.StatDRxArmed,               "/HM/CPU%d/Debug/Armed");
    569579        HM_REG_COUNTER(&pVCpu->hm.s.StatDRxContextSwitch,       "/HM/CPU%d/Debug/ContextSwitch");
    570         HM_REG_COUNTER(&pVCpu->hm.s.StatDRxIOCheck,             "/HM/CPU%d/Debug/IOCheck");
     580        HM_REG_COUNTER(&pVCpu->hm.s.StatDRxIoCheck,             "/HM/CPU%d/Debug/IOCheck");
    571581
    572582        HM_REG_COUNTER(&pVCpu->hm.s.StatLoadMinimal,            "/HM/CPU%d/Load/Minimal");
     
    580590        for (unsigned j = 0; j < RT_ELEMENTS(pVCpu->hm.s.StatExitCRxWrite); j++)
    581591        {
    582             rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitCRxWrite[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Profiling of CRx writes",
    583                                 "/HM/CPU%d/Exit/Instr/CR/Write/%x", i, j);
     592            rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitCRxWrite[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     593                                 STAMUNIT_OCCURENCES, "Profiling of CRx writes",
     594                                 "/HM/CPU%d/Exit/Instr/CR/Write/%x", i, j);
    584595            AssertRC(rc);
    585             rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitCRxRead[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Profiling of CRx reads",
    586                                 "/HM/CPU%d/Exit/Instr/CR/Read/%x", i, j);
     596            rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitCRxRead[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     597                                 STAMUNIT_OCCURENCES, "Profiling of CRx reads",
     598                                 "/HM/CPU%d/Exit/Instr/CR/Read/%x", i, j);
    587599            AssertRC(rc);
    588600        }
     
    592604        pVCpu->hm.s.paStatExitReason = NULL;
    593605
    594         rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVCpu->hm.s.paStatExitReason), 0, MM_TAG_HM, (void **)&pVCpu->hm.s.paStatExitReason);
     606        rc = MMHyperAlloc(pVM, MAX_EXITREASON_STAT*sizeof(*pVCpu->hm.s.paStatExitReason), 0, MM_TAG_HM,
     607                          (void **)&pVCpu->hm.s.paStatExitReason);
    595608        AssertRC(rc);
    596609        if (RT_SUCCESS(rc))
     
    601614                if (papszDesc[j])
    602615                {
    603                     rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
    604                                         papszDesc[j], "/HM/CPU%d/Exit/Reason/%02x", i, j);
     616                    rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatExitReason[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED,
     617                                         STAMUNIT_OCCURENCES, papszDesc[j], "/HM/CPU%d/Exit/Reason/%02x", i, j);
    605618                    AssertRC(rc);
    606619                }
    607620            }
    608             rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitReasonNPF, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Nested page fault", "/HM/CPU%d/Exit/Reason/#NPF", i);
     621            rc = STAMR3RegisterF(pVM, &pVCpu->hm.s.StatExitReasonNpf, STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     622                                 "Nested page fault", "/HM/CPU%d/Exit/Reason/#NPF", i);
    609623            AssertRC(rc);
    610624        }
     
    625639# endif
    626640        for (unsigned j = 0; j < 255; j++)
    627             STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatInjectedIrqs[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES, "Forwarded interrupts.",
     641        {
     642            STAMR3RegisterF(pVM, &pVCpu->hm.s.paStatInjectedIrqs[j], STAMTYPE_COUNTER, STAMVISIBILITY_USED, STAMUNIT_OCCURENCES,
     643                            "Forwarded interrupts.",
    628644                            (j < 0x20) ? "/HM/CPU%d/Interrupt/Trap/%02X" : "/HM/CPU%d/Interrupt/IRQ/%02X", i, j);
     645        }
    629646
    630647    }
     
    11681185                    {
    11691186                        pVM->hm.s.vmx.pNonPagingModeEPTPageTable->a[i].u  = _4M * i;
    1170                         pVM->hm.s.vmx.pNonPagingModeEPTPageTable->a[i].u |= X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US | X86_PDE4M_A | X86_PDE4M_D | X86_PDE4M_PS | X86_PDE4M_G;
     1187                        pVM->hm.s.vmx.pNonPagingModeEPTPageTable->a[i].u |= X86_PDE4M_P | X86_PDE4M_RW | X86_PDE4M_US
     1188                                                                            | X86_PDE4M_A | X86_PDE4M_D | X86_PDE4M_PS
     1189                                                                            | X86_PDE4M_G;
    11711190                    }
    11721191
     
    15631582        if (pVCpu->hm.s.vmx.enmLastSeenGuestMode == enmGuestMode)
    15641583        {
    1565             Log(("HMR3PagingModeChanged missed %s->%s transition (prev %s)\n", PGMGetModeName(pVCpu->hm.s.vmx.enmPrevGuestMode), PGMGetModeName(pVCpu->hm.s.vmx.enmCurrGuestMode), PGMGetModeName(pVCpu->hm.s.vmx.enmLastSeenGuestMode)));
     1584            Log(("HMR3PagingModeChanged missed %s->%s transition (prev %s)\n", PGMGetModeName(pVCpu->hm.s.vmx.enmPrevGuestMode),
     1585                 PGMGetModeName(pVCpu->hm.s.vmx.enmCurrGuestMode), PGMGetModeName(pVCpu->hm.s.vmx.enmLastSeenGuestMode)));
    15661586            pVCpu->hm.s.vmx.enmLastSeenGuestMode = pVCpu->hm.s.vmx.enmPrevGuestMode;
    15671587        }
     
    18281848
    18291849    /* @todo Potential deadlock when other VCPUs are waiting on the IOM lock (we own it)!! */
    1830     int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hmR3RemovePatches, (void *)(uintptr_t)VMMGetCpuId(pVM));
     1850    int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hmR3RemovePatches,
     1851                                (void *)(uintptr_t)VMMGetCpuId(pVM));
    18311852    AssertRC(rc);
    18321853
     
    19942015
    19952016        pVM->hm.s.cPatches++;
    1996         STAM_COUNTER_INC(&pVM->hm.s.StatTPRReplaceSuccess);
     2017        STAM_COUNTER_INC(&pVM->hm.s.StatTprReplaceSuccess);
    19972018        return VINF_SUCCESS;
    19982019    }
     
    20072028    AssertRC(rc);
    20082029    pVM->hm.s.cPatches++;
    2009     STAM_COUNTER_INC(&pVM->hm.s.StatTPRReplaceFailure);
     2030    STAM_COUNTER_INC(&pVM->hm.s.StatTprReplaceFailure);
    20102031    return VINF_SUCCESS;
    20112032}
     
    22212242            pVM->hm.s.cPatches++;
    22222243            pVM->hm.s.fTPRPatchingActive = true;
    2223             STAM_COUNTER_INC(&pVM->hm.s.StatTPRPatchSuccess);
     2244            STAM_COUNTER_INC(&pVM->hm.s.StatTprPatchSuccess);
    22242245            return VINF_SUCCESS;
    22252246        }
     
    22402261    AssertRC(rc);
    22412262    pVM->hm.s.cPatches++;
    2242     STAM_COUNTER_INC(&pVM->hm.s.StatTPRPatchFailure);
     2263    STAM_COUNTER_INC(&pVM->hm.s.StatTprPatchFailure);
    22432264    return VINF_SUCCESS;
    22442265}
     
    23232344
    23242345    /* Note! The context supplied by REM is partial. If we add more checks here, be sure to verify that REM provides this info! */
    2325     Assert((pVM->hm.s.vmx.fUnrestrictedGuest && !pVM->hm.s.vmx.pRealModeTSS) || (!pVM->hm.s.vmx.fUnrestrictedGuest && pVM->hm.s.vmx.pRealModeTSS));
     2346    Assert(   (pVM->hm.s.vmx.fUnrestrictedGuest && !pVM->hm.s.vmx.pRealModeTSS)
     2347           || (!pVM->hm.s.vmx.fUnrestrictedGuest && pVM->hm.s.vmx.pRealModeTSS));
    23262348
    23272349    bool fSupportsRealMode = pVM->hm.s.vmx.fUnrestrictedGuest || PDMVMMDevHeapIsEnabled(pVM);
     
    23972419                pVM->aCpus[0].hm.s.fContextUseFlags |= HM_CHANGED_ALL_GUEST;
    23982420
    2399                 if (    !pVM->hm.s.fNestedPaging        /* requires a fake PD for real *and* protected mode without paging - stored in the VMM device heap*/
    2400                     ||  CPUMIsGuestInRealModeEx(pCtx))      /* requires a fake TSS for real mode - stored in the VMM device heap */
     2421                if (    !pVM->hm.s.fNestedPaging        /* requires a fake PD for real *and* protected mode without paging - stored in the VMM device heap */
     2422                    ||  CPUMIsGuestInRealModeEx(pCtx))  /* requires a fake TSS for real mode - stored in the VMM device heap */
    24012423                    return false;
    24022424
  • trunk/src/VBox/VMM/include/HMInternal.h

    r43495 r43509  
    426426    bool                    u8Alignment1[7];
    427427
    428     STAMCOUNTER             StatTPRPatchSuccess;
    429     STAMCOUNTER             StatTPRPatchFailure;
    430     STAMCOUNTER             StatTPRReplaceSuccess;
    431     STAMCOUNTER             StatTPRReplaceFailure;
     428    STAMCOUNTER             StatTprPatchSuccess;
     429    STAMCOUNTER             StatTprPatchFailure;
     430    STAMCOUNTER             StatTprReplaceSuccess;
     431    STAMCOUNTER             StatTprReplaceFailure;
    432432} HM;
    433433/** Pointer to HM VM instance data. */
     
    513513    /** Old style FPU reporting trap mask override performed (optimization) */
    514514    bool                        fFPUOldStyleOverride;
    515 
    516515    /** Set if we don't have to flush the TLB on VM entry. */
    517516    bool                        fResumeVM;
    518 
    519517    /** Set if we need to flush the TLB during the world switch. */
    520518    bool                        fForceTLBFlush;
    521 
    522519    /** Set when we're using VT-x or AMD-V at that moment. */
    523520    bool                        fActive;
    524 
    525521    /** Set when the TLB has been checked until we return from the world switch. */
    526522    volatile bool               fCheckedTLBFlush;
    527     uint8_t                     bAlignment[3];
     523    uint8_t                     u8Alignment[3];
    528524
    529525    /** World switch exit counter. */
    530526    volatile uint32_t           cWorldSwitchExits;
    531 
    532527    /** HM_CHANGED_* flags. */
    533528    uint32_t                    fContextUseFlags;
    534 
    535529    /** Id of the last cpu we were executing code on (NIL_RTCPUID for the first time) */
    536530    RTCPUID                     idLastCpu;
    537 
    538531    /** TLB flush count */
    539532    uint32_t                    cTlbFlushes;
    540 
    541533    /** Current ASID in use by the VM */
    542534    uint32_t                    uCurrentAsid;
    543 
    544535    uint32_t                    u32Alignment;
    545536
     
    555546        /** Virtual address of the VM control structure (VMCS). */
    556547        R0PTRTYPE(void *)           pvVMCS;
    557 
    558548        /** Ring 0 handlers for VT-x. */
    559         PFNHMVMXSTARTVM         pfnStartVM;
     549        PFNHMVMXSTARTVM             pfnStartVM;
    560550
    561551#if HC_ARCH_BITS == 32
     
    565555        /** Current VMX_VMCS_CTRL_PROC_EXEC_CONTROLS. */
    566556        uint64_t                    proc_ctls;
    567 
    568557        /** Current VMX_VMCS_CTRL_PROC_EXEC2_CONTROLS. */
    569558        uint64_t                    proc_ctls2;
    570 
    571559        /** Physical address of the virtual APIC page for TPR caching. */
    572560        RTHCPHYS                    HCPhysVAPIC;
     
    580568        /** Current CR4 mask. */
    581569        uint64_t                    cr4_mask;
    582 
    583570        /** Current EPTP. */
    584571        RTHCPHYS                    GCPhysEPTP;
     
    616603        /* Last use TSC offset value. (cached) */
    617604        uint64_t                    u64TSCOffset;
    618 
    619605        /** VMCS cache. */
    620606        VMCSCACHE                   VMCSCache;
     
    803789    STAMCOUNTER             StatFlushPageManual;
    804790    STAMCOUNTER             StatFlushPhysPageManual;
    805     STAMCOUNTER             StatFlushTLB;
    806     STAMCOUNTER             StatFlushTLBManual;
     791    STAMCOUNTER             StatFlushTlb;
     792    STAMCOUNTER             StatFlushTlbManual;
    807793    STAMCOUNTER             StatFlushPageInvlpg;
    808     STAMCOUNTER             StatFlushTLBWorldSwitch;
    809     STAMCOUNTER             StatNoFlushTLBWorldSwitch;
    810     STAMCOUNTER             StatFlushTLBCRxChange;
     794    STAMCOUNTER             StatFlushTlbWorldSwitch;
     795    STAMCOUNTER             StatNoFlushTlbWorldSwitch;
     796    STAMCOUNTER             StatFlushTlbCRxChange;
    811797    STAMCOUNTER             StatFlushAsid;
    812798    STAMCOUNTER             StatFlushNestedPaging;
     
    818804    STAMCOUNTER             StatSwitchToR3;
    819805
    820     STAMCOUNTER             StatTSCOffset;
    821     STAMCOUNTER             StatTSCIntercept;
    822     STAMCOUNTER             StatTSCInterceptOverFlow;
    823 
    824     STAMCOUNTER             StatExitReasonNPF;
     806    STAMCOUNTER             StatTscOffset;
     807    STAMCOUNTER             StatTscIntercept;
     808    STAMCOUNTER             StatTscInterceptOverFlow;
     809
     810    STAMCOUNTER             StatExitReasonNpf;
    825811    STAMCOUNTER             StatDRxArmed;
    826812    STAMCOUNTER             StatDRxContextSwitch;
    827     STAMCOUNTER             StatDRxIOCheck;
     813    STAMCOUNTER             StatDRxIoCheck;
    828814
    829815    STAMCOUNTER             StatLoadMinimal;
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