VirtualBox

Changeset 47285 in vbox for trunk/src/VBox/VMM/VMMAll


Ignore:
Timestamp:
Jul 19, 2013 11:45:04 PM (12 years ago)
Author:
vboxsync
Message:

Fix: mov ss, ax; where ax is 0 in long mode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllCImpl.cpp.h

    r47283 r47285  
    27672767    if (!(uSel & X86_SEL_MASK_OFF_RPL))
    27682768    {
     2769        Assert(iSegReg != X86_SREG_CS); /** @todo testcase for \#UD on MOV CS, ax! */
    27692770        if (iSegReg == X86_SREG_SS)
    27702771        {
     2772            /* In 64-bit kernel mode, the stack can be 0 because of the way
     2773               interrupts are dispatched. AMD seems to have a slighly more
     2774               relaxed relationship to SS.RPL than intel does. */
     2775            /** @todo We cannot 'mov ss, 3' in 64-bit kernel mode, can we? There is a testcase (bs-cpu-xcpt-1), but double check this! */
    27712776            if (   pIemCpu->enmCpuMode != IEMMODE_64BIT
    2772                 || pIemCpu->uCpl != 0
    2773                 || uSel != 0) /** @todo We cannot 'mov ss, 3' in 64-bit kernel mode, can we?  */
     2777                || pIemCpu->uCpl > 2
     2778                || (   uSel != pIemCpu->uCpl
     2779                    && !IEM_IS_GUEST_CPU_AMD(pIemCpu)) )
    27742780            {
    2775                 Log(("load sreg -> invalid stack selector, #GP(0)\n", uSel));
     2781                Log(("load sreg %#x -> invalid stack selector, #GP(0)\n", uSel));
    27762782                return iemRaiseGeneralProtectionFault0(pIemCpu);
    27772783            }
    2778 
    2779             /* In 64-bit kernel mode, the stack can be 0 because of the way
    2780                interrupts are dispatched when in kernel ctx. Just load the
    2781                selector value into the register and leave the hidden bits
    2782                as is. */
    2783             *pSel = uSel;
    2784             pHid->ValidSel = uSel;
    2785             iemRegAddToRip(pIemCpu, cbInstr);
    2786             return VINF_SUCCESS;
    27872784        }
    27882785
    27892786        *pSel = uSel;   /* Not RPL, remember :-) */
    2790         if (   pIemCpu->enmCpuMode == IEMMODE_64BIT
    2791             && iSegReg != X86_SREG_FS
    2792             && iSegReg != X86_SREG_GS)
    2793         {
    2794             /** @todo figure out what this actually does, it works. Needs
    2795              *        testcase! */
    2796             pHid->Attr.u           = 0;
    2797             pHid->Attr.n.u1Present = 1;
    2798             pHid->Attr.n.u1Long    = 1;
    2799             pHid->Attr.n.u4Type    = X86_SEL_TYPE_RW;
    2800             pHid->Attr.n.u2Dpl     = 3;
    2801             pHid->u32Limit         = 0;
    2802             pHid->u64Base          = 0;
    2803             pHid->ValidSel         = uSel;
    2804             pHid->fFlags           = CPUMSELREG_FLAGS_VALID;
    2805         }
    2806         else
    2807             iemHlpLoadNullDataSelectorProt(pHid, uSel);
     2787        iemHlpLoadNullDataSelectorProt(pHid, uSel);
     2788        if (iSegReg == X86_SREG_SS)
     2789            pHid->Attr.u |= pIemCpu->uCpl << X86DESCATTR_DPL_SHIFT;
     2790
    28082791        Assert(CPUMSELREG_ARE_HIDDEN_PARTS_VALID(IEMCPU_TO_VMCPU(pIemCpu), pHid));
    28092792        CPUMSetChangedFlags(IEMCPU_TO_VMCPU(pIemCpu), CPUM_CHANGED_HIDDEN_SEL_REGS);
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