VirtualBox

Changeset 24248 in vbox


Ignore:
Timestamp:
Nov 2, 2009 12:16:09 PM (15 years ago)
Author:
vboxsync
Message:

VT-x: Must save the host's LSTAR msr in case the guest changed it (TPR patching case only).

File:
1 edited

Legend:

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

    r24243 r24248  
    22592259    RTGCUINTPTR errCode, instrInfo;
    22602260    bool        fSetupTPRCaching = false;
     2261    bool        fRestoreLSTAR = false;
     2262    uint64_t    u64LSTAR = 0;
    22612263    uint8_t     u8LastTPR = 0;
    22622264    RTCCUINTREG uOldEFlags = ~(RTCCUINTREG)0;
     
    24982500
    24992501            if (fPending)
     2502            {
    25002503                /* A TPR change could activate a pending interrupt, so catch lstar writes. */
    25012504                vmxR0SetMSRPermission(pVCpu, MSR_K8_LSTAR, true, false);
     2505                fRestoreLSTAR = false;
     2506            }
    25022507            else
     2508            {
    25032509                /* No interrupts are pending, so we don't need to be explicitely notified.
    25042510                 * There are enough world switches for detecting pending interrupts.
    25052511                 */
    25062512                vmxR0SetMSRPermission(pVCpu, MSR_K8_LSTAR, true, true);
     2513
     2514                /* Must save the host LSTAR msr to restore it later. */
     2515                fRestoreLSTAR = true;
     2516                u64LSTAR = ASMRdMsr(MSR_K8_LSTAR);
     2517            }
    25072518        }
    25082519    }
     
    26182629    VMCPU_SET_STATE(pVCpu, VMCPUSTATE_STARTED);
    26192630    Assert(!(ASMGetFlags() & X86_EFL_IF));
     2631
     2632    /* Restore the host LSTAR msr if the guest could have changed it. */
     2633    if (fRestoreLSTAR)
     2634    {
     2635        Assert(pVM->hwaccm.s.fTPRPatchingActive);
     2636        ASMWrMsr(MSR_K8_LSTAR, u64LSTAR);
     2637    }
     2638
    26202639    ASMSetFlags(uOldEFlags);
    26212640#ifdef VBOX_WITH_VMMR0_DISABLE_PREEMPTION
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