VirtualBox

Changeset 41908 in vbox


Ignore:
Timestamp:
Jun 25, 2012 1:19:18 AM (13 years ago)
Author:
vboxsync
Message:

Check loaded selector register the GDT changes.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/cpumctx.h

    r41906 r41908  
    236236    /** @name General Register.
    237237     * @note  These follow the encoding order (X86_GREG_XXX) and can be accessed as
    238      *        an array starting a rax.
     238     *        an array starting at rax.
    239239     * @{ */
    240240    union
     
    304304    /** @name Segment registers.
    305305     * @note These follow the encoding order (X86_SREG_XXX) and can be accessed as
    306      *       an array starting a es.
     306     *       an array starting at es.
    307307     * @{  */
    308308    CPUMSELREG          es;
  • trunk/src/VBox/VMM/VMMRC/SELMRC.cpp

    r41906 r41908  
    132132    *pShadowDescr = Desc;
    133133
    134     /* Check if we change the LDT selector */
     134    /*
     135     * Detect and mark stale registers.
     136     */
     137    PCPUMCTX    pCtx      = CPUMQueryGuestCtxPtr(pVCpu);
     138    PCPUMSELREG paSRegCtx = &pCtx->es;
     139    PCPUMSELREG paSRegFrm = &pRegFrame->es;
     140    for (unsigned i = 0; i <= X86_SREG_GS; i++)
     141        if (Sel == (paSRegFrm[i].Sel & X86_SEL_MASK))
     142        {
     143            /** @todo we clear the valid flag here, maybe we shouldn't... but that would
     144             *        require implementing handling of stale registers in raw-mode.
     145             *        Tricky, at least for SS and CS. */
     146            paSRegFrm[i].fFlags = CPUMSELREG_FLAGS_STALE;
     147            paSRegCtx[i].fFlags = CPUMSELREG_FLAGS_STALE;
     148        }
     149
     150    /*
     151     * Check if we change the LDT selector.
     152     */
    135153    if (Sel == CPUMGetGuestLDTR(pVCpu)) /** @todo this isn't correct in two(+) ways! 1. It shouldn't be done until the LDTR is reloaded. 2. It caused the next instruction to be emulated.  */
    136154    {
     
    153171        Log(("GDT write to selector in SS register %04X\n", pRegFrame->ss.Sel));
    154172#endif
     173
    155174    return VINF_SUCCESS;
    156175}
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