VirtualBox

Changeset 48237 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Sep 2, 2013 9:26:02 PM (11 years ago)
Author:
vboxsync
Message:

VMM/HMVMXR0: Nits.

File:
1 edited

Legend:

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

    r48230 r48237  
    12651265 * @param   pVM             Pointer to the VM.
    12661266 * @param   pVCpu           Pointer to the VMCPU.
     1267 * @param   pCpu            Pointer to the global HM struct.
    12671268 *
    12681269 * @remarks Called with interrupts disabled.
    12691270 */
    1270 static void hmR0VmxFlushTaggedTlbNone(PVM pVM, PVMCPU pVCpu)
    1271 {
     1271static void hmR0VmxFlushTaggedTlbNone(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
     1272{
     1273    AssertPtr(pVCpu);
     1274    AssertPtr(pCpu);
    12721275    NOREF(pVM);
    1273     AssertPtr(pVCpu);
     1276
    12741277    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_FLUSH);
    12751278    VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_TLB_SHOOTDOWN);
    1276 
    1277     PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();
    1278     AssertPtr(pCpu);
    12791279
    12801280    pVCpu->hm.s.TlbShootdown.cPages = 0;
     
    12911291 * @param    pVM            Pointer to the VM.
    12921292 * @param    pVCpu          Pointer to the VMCPU.
     1293 * @param    pCpu           Pointer to the global HM CPU struct.
    12931294 * @remarks All references to "ASID" in this function pertains to "VPID" in
    12941295 *          Intel's nomenclature. The reason is, to avoid confusion in compare
     
    12971298 * @remarks Called with interrupts disabled.
    12981299 */
    1299 static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu)
     1300static void hmR0VmxFlushTaggedTlbBoth(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
    13001301{
    13011302#ifdef VBOX_WITH_STATISTICS
     
    13121313
    13131314    AssertPtr(pVM);
     1315    AssertPtr(pCpu);
    13141316    AssertPtr(pVCpu);
    13151317    AssertMsg(pVM->hm.s.fNestedPaging && pVM->hm.s.vmx.fVpid,
     
    13171319               "fNestedPaging=%RTbool fVpid=%RTbool", pVM->hm.s.fNestedPaging, pVM->hm.s.vmx.fVpid));
    13181320
    1319     PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();
    1320     AssertPtr(pCpu);
    13211321
    13221322    /*
     
    14161416 * @param   pVM         Pointer to the VM.
    14171417 * @param   pVCpu       Pointer to the VMCPU.
     1418 * @param   pCpu        Pointer to the global HM CPU struct.
    14181419 *
    14191420 * @remarks Called with interrupts disabled.
    14201421 */
    1421 static void hmR0VmxFlushTaggedTlbEpt(PVM pVM, PVMCPU pVCpu)
     1422static void hmR0VmxFlushTaggedTlbEpt(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
    14221423{
    14231424    AssertPtr(pVM);
    14241425    AssertPtr(pVCpu);
     1426    AssertPtr(pCpu);
    14251427    AssertMsg(pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with NestedPaging disabled."));
    14261428    AssertMsg(!pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTaggedTlbEpt cannot be invoked with VPID enabled."));
    1427 
    1428     PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();
    1429     AssertPtr(pCpu);
    14301429
    14311430    /*
     
    14811480 * @param   pVM         Pointer to the VM.
    14821481 * @param   pVCpu       Pointer to the VMCPU.
     1482 * @param   pCpu        Pointer to the global HM CPU struct.
    14831483 *
    14841484 * @remarks Called with interrupts disabled.
    14851485 */
    1486 static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu)
     1486static void hmR0VmxFlushTaggedTlbVpid(PVM pVM, PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
    14871487{
    14881488    AssertPtr(pVM);
    14891489    AssertPtr(pVCpu);
     1490    AssertPtr(pCpu);
    14901491    AssertMsg(pVM->hm.s.vmx.fVpid, ("hmR0VmxFlushTlbVpid cannot be invoked with VPID disabled."));
    14911492    AssertMsg(!pVM->hm.s.fNestedPaging, ("hmR0VmxFlushTlbVpid cannot be invoked with NestedPaging enabled"));
    1492 
    1493     PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();
    14941493
    14951494    /*
     
    15771576 * Flushes the guest TLB entry based on CPU capabilities.
    15781577 *
    1579  * @param pVCpu     Pointer to the VMCPU.
    1580  */
    1581 DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu)
     1578 * @param   pVCpu     Pointer to the VMCPU.
     1579 * @param   pCpu      Pointer to the global HM CPU struct.
     1580 */
     1581DECLINLINE(void) hmR0VmxFlushTaggedTlb(PVMCPU pVCpu, PHMGLOBALCPUINFO pCpu)
    15821582{
    15831583    PVM pVM = pVCpu->CTX_SUFF(pVM);
    15841584    switch (pVM->hm.s.vmx.uFlushTaggedTlb)
    15851585    {
    1586         case HMVMX_FLUSH_TAGGED_TLB_EPT_VPID: hmR0VmxFlushTaggedTlbBoth(pVM, pVCpu); break;
    1587         case HMVMX_FLUSH_TAGGED_TLB_EPT:      hmR0VmxFlushTaggedTlbEpt(pVM, pVCpu);  break;
    1588         case HMVMX_FLUSH_TAGGED_TLB_VPID:     hmR0VmxFlushTaggedTlbVpid(pVM, pVCpu); break;
    1589         case HMVMX_FLUSH_TAGGED_TLB_NONE:     hmR0VmxFlushTaggedTlbNone(pVM, pVCpu); break;
     1586        case HMVMX_FLUSH_TAGGED_TLB_EPT_VPID: hmR0VmxFlushTaggedTlbBoth(pVM, pVCpu, pCpu); break;
     1587        case HMVMX_FLUSH_TAGGED_TLB_EPT:      hmR0VmxFlushTaggedTlbEpt(pVM, pVCpu, pCpu);  break;
     1588        case HMVMX_FLUSH_TAGGED_TLB_VPID:     hmR0VmxFlushTaggedTlbVpid(pVM, pVCpu, pCpu); break;
     1589        case HMVMX_FLUSH_TAGGED_TLB_NONE:     hmR0VmxFlushTaggedTlbNone(pVM, pVCpu, pCpu); break;
    15901590        default:
    15911591            AssertMsgFailed(("Invalid flush-tag function identifier\n"));
     
    44664466DECLASM(int) VMXR0SwitcherStartVM64(RTHCUINT fResume, PCPUMCTX pCtx, PVMCSCACHE pCache, PVM pVM, PVMCPU pVCpu)
    44674467{
    4468     uint32_t        aParam[6];
     4468    uint32_t         aParam[6];
    44694469    PHMGLOBALCPUINFO pCpu          = NULL;
    4470     RTHCPHYS        HCPhysCpuPage = 0;
    4471     int             rc            = VERR_INTERNAL_ERROR_5;
     4470    RTHCPHYS         HCPhysCpuPage = 0;
     4471    int              rc            = VERR_INTERNAL_ERROR_5;
    44724472
    44734473    pCpu = HMR0GetCurrentCpu();
     
    48524852        /* We can't use TSC-offsetting (non-fixed TSC, warp drive active etc.), VM-exit on RDTSC(P). */
    48534853        pVCpu->hm.s.vmx.u32ProcCtls |= VMX_VMCS_CTRL_PROC_EXEC_RDTSC_EXIT;
    4854         rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);               AssertRC(rc);
     4854        rc = VMXWriteVmcs32(VMX_VMCS32_CTRL_PROC_EXEC, pVCpu->hm.s.vmx.u32ProcCtls);              AssertRC(rc);
    48554855        STAM_COUNTER_INC(&pVCpu->hm.s.StatTscIntercept);
    48564856    }
     
    49514951{
    49524952    int rc = hmR0VmxReadIdtVectoringInfoVmcs(pVmxTransient);
    4953     AssertRC(rc);
     4953    AssertRCReturn(rc, rc);
    49544954    if (VMX_IDT_VECTORING_INFO_VALID(pVmxTransient->uIdtVectoringInfo))
    49554955    {
     
    54175417            case MSR_K8_TSC_AUX:        CPUMSetGuestMsr(pVCpu, MSR_K8_TSC_AUX, pMsr->u64Value);  break;
    54185418            case MSR_K8_KERNEL_GS_BASE: pMixedCtx->msrKERNELGSBASE = pMsr->u64Value;             break;
    5419             case MSR_K6_EFER:          /* EFER can't be changed without causing a VM-exit. */    break;
     5419            case MSR_K6_EFER:           /* EFER can't be changed without causing a VM-exit. */   break;
    54205420            default:
    54215421            {
     
    57935793        return VINF_SUCCESS;
    57945794
    5795     /* Though we can longjmp to ring-3 due to log-flushes here and get recalled again on the ring-3 callback path,
    5796        there is no real need to. */
     5795    /* Though we can longjmp to ring-3 due to log-flushes here and get recalled
     5796       again on the ring-3 callback path, there is no real need to. */
    57975797    if (VMMRZCallRing3IsEnabled(pVCpu))
    57985798        VMMR0LogFlushDisable(pVCpu);
     
    58985898        if (VMCPU_FF_IS_PENDING(pVCpu,VMCPU_FF_PGM_SYNC_CR3 | VMCPU_FF_PGM_SYNC_CR3_NON_GLOBAL))
    58995899        {
    5900             int rc2 = PGMSyncCR3(pVCpu, pMixedCtx->cr0, pMixedCtx->cr3, pMixedCtx->cr4, VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
     5900            int rc2 = PGMSyncCR3(pVCpu, pMixedCtx->cr0, pMixedCtx->cr3, pMixedCtx->cr4,
     5901                                 VMCPU_FF_IS_SET(pVCpu, VMCPU_FF_PGM_SYNC_CR3));
    59015902            if (rc2 != VINF_SUCCESS)
    59025903            {
     
    59085909
    59095910        /* Pending HM-to-R3 operations (critsects, timers, EMT rendezvous etc.) */
    5910         /* -XXX- what was that about single stepping?  */
    59115911        if (   VM_FF_IS_PENDING(pVM, VM_FF_HM_TO_R3_MASK)
    59125912            || VMCPU_FF_IS_PENDING(pVCpu, VMCPU_FF_HM_TO_R3_MASK))
     
    59415941    }
    59425942
    5943     /* Paranoia. */
    59445943    return VINF_SUCCESS;
    59455944}
     
    62986297
    62996298    /*
    6300      * Clear the X86_EFL_TF if necessary .
     6299     * Clear the X86_EFL_TF if necessary.
    63016300     */
    63026301    if (pVCpu->hm.s.fClearTrapFlag)
     
    74527451        pVmxTransient->u8GuestTpr = pVCpu->hm.s.vmx.pbVirtApic[0x80];
    74537452
     7453    PHMGLOBALCPUINFO pCpu = HMR0GetCurrentCpu();
     7454    RTCPUID idCurrentCpu  = pCpu->idCpu;
    74547455    if (   pVmxTransient->fUpdateTscOffsettingAndPreemptTimer
    7455         || HMR0GetCurrentCpu()->idCpu != pVCpu->hm.s.idLastCpu)
     7456        || idCurrentCpu != pVCpu->hm.s.idLastCpu)
    74567457    {
    74577458        hmR0VmxUpdateTscOffsettingAndPreemptTimer(pVCpu, pMixedCtx);
     
    74607461
    74617462    ASMAtomicWriteBool(&pVCpu->hm.s.fCheckedTLBFlush, true);    /* Used for TLB-shootdowns, set this across the world switch. */
    7462     hmR0VmxFlushTaggedTlb(pVCpu);                               /* Invalidate the appropriate guest entries from the TLB. */
    7463 
    7464     RTCPUID idCurrentCpu = HMR0GetCurrentCpu()->idCpu;
     7463    hmR0VmxFlushTaggedTlb(pVCpu, pCpu);                         /* Invalidate the appropriate guest entries from the TLB. */
     7464
    74657465    Assert(idCurrentCpu == pVCpu->hm.s.idLastCpu);
    74667466    pVCpu->hm.s.vmx.LastError.idCurrentCpu = idCurrentCpu;      /* Update the error reporting info. with the current host CPU. */
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