VirtualBox

Changeset 76831 in vbox for trunk


Ignore:
Timestamp:
Jan 16, 2019 9:09:45 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
128188
Message:

VMM/IEM: Nested VMX: bugref:9180 Try to do less within the loop, put common stuff outside.

File:
1 edited

Legend:

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

    r76828 r76831  
    21602160        pVCpu->cpum.GstCtx.aSRegs[iSegReg].u32Limit = 0xffffffff;
    21612161
    2162         /* Base and Attributes. */
    2163         switch (iSegReg)
    2164         {
    2165             case X86_SREG_CS:
    2166             {
    2167                 pVCpu->cpum.GstCtx.cs.u64Base = 0;
    2168                 pVCpu->cpum.GstCtx.cs.Attr.n.u4Type        = X86_SEL_TYPE_CODE | X86_SEL_TYPE_READ | X86_SEL_TYPE_ACCESSED;
    2169                 pVCpu->cpum.GstCtx.ss.Attr.n.u1DescType    = 1;
    2170                 pVCpu->cpum.GstCtx.cs.Attr.n.u2Dpl         = 0;
    2171                 pVCpu->cpum.GstCtx.cs.Attr.n.u1Present     = 1;
    2172                 pVCpu->cpum.GstCtx.cs.Attr.n.u1Long        = fHostInLongMode;
    2173                 pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig      = !fHostInLongMode;
    2174                 pVCpu->cpum.GstCtx.cs.Attr.n.u1Granularity = 1;
    2175                 Assert(!pVCpu->cpum.GstCtx.cs.Attr.n.u1Unusable);
    2176                 Assert(!fUnusable);
    2177                 break;
    2178             }
    2179 
    2180             case X86_SREG_SS:
    2181             case X86_SREG_ES:
    2182             case X86_SREG_DS:
    2183             {
    2184                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].u64Base = 0;
    2185                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u4Type        = X86_SEL_TYPE_RW | X86_SEL_TYPE_ACCESSED;
    2186                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1DescType    = 1;
    2187                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u2Dpl         = 0;
    2188                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Present     = 1;
    2189                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1DefBig      = 1;
    2190                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Granularity = 1;
    2191                 pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Unusable    = fUnusable;
    2192                 break;
    2193             }
    2194 
    2195             case X86_SREG_FS:
    2196             {
    2197                 if (   !fUnusable
    2198                     ||  fHostInLongMode)
    2199                 {
    2200                     Assert(X86_IS_CANONICAL(pVmcs->u64HostFsBase.u));
    2201                     pVCpu->cpum.GstCtx.fs.u64Base = pVmcs->u64HostFsBase.u;
    2202                 }
    2203                 else
    2204                     pVCpu->cpum.GstCtx.fs.u64Base = 0;
    2205                 pVCpu->cpum.GstCtx.fs.Attr.n.u4Type        = X86_SEL_TYPE_RW | X86_SEL_TYPE_ACCESSED;
    2206                 pVCpu->cpum.GstCtx.fs.Attr.n.u1DescType    = 1;
    2207                 pVCpu->cpum.GstCtx.fs.Attr.n.u2Dpl         = 0;
    2208                 pVCpu->cpum.GstCtx.fs.Attr.n.u1Present     = 1;
    2209                 pVCpu->cpum.GstCtx.fs.Attr.n.u1DefBig      = 1;
    2210                 pVCpu->cpum.GstCtx.fs.Attr.n.u1Granularity = 1;
    2211                 pVCpu->cpum.GstCtx.fs.Attr.n.u1Unusable    = fUnusable;
    2212                 break;
    2213             }
    2214 
    2215             case X86_SREG_GS:
    2216             {
    2217                 if (   !fUnusable
    2218                     ||  fHostInLongMode)
    2219                 {
    2220                     Assert(X86_IS_CANONICAL(pVmcs->u64HostGsBase.u));
    2221                     pVCpu->cpum.GstCtx.gs.u64Base = pVmcs->u64HostGsBase.u;
    2222                 }
    2223                 else
    2224                     pVCpu->cpum.GstCtx.gs.u64Base = 0;
    2225                 pVCpu->cpum.GstCtx.gs.Attr.n.u4Type        = X86_SEL_TYPE_RW | X86_SEL_TYPE_ACCESSED;
    2226                 pVCpu->cpum.GstCtx.gs.Attr.n.u1DescType    = 1;
    2227                 pVCpu->cpum.GstCtx.gs.Attr.n.u2Dpl         = 0;
    2228                 pVCpu->cpum.GstCtx.gs.Attr.n.u1Present     = 1;
    2229                 pVCpu->cpum.GstCtx.gs.Attr.n.u1DefBig      = 1;
    2230                 pVCpu->cpum.GstCtx.gs.Attr.n.u1Granularity = 1;
    2231                 pVCpu->cpum.GstCtx.gs.Attr.n.u1Unusable    = fUnusable;
    2232                 break;
    2233             }
    2234         }
     2162        /* Base. */
     2163        pVCpu->cpum.GstCtx.aSRegs[iSegReg].u64Base = 0;
     2164
     2165        /* Attributes. */
     2166        if (iSegReg == X86_SREG_CS)
     2167        {
     2168            pVCpu->cpum.GstCtx.cs.Attr.n.u4Type        = X86_SEL_TYPE_CODE | X86_SEL_TYPE_READ | X86_SEL_TYPE_ACCESSED;
     2169            pVCpu->cpum.GstCtx.ss.Attr.n.u1DescType    = 1;
     2170            pVCpu->cpum.GstCtx.cs.Attr.n.u2Dpl         = 0;
     2171            pVCpu->cpum.GstCtx.cs.Attr.n.u1Present     = 1;
     2172            pVCpu->cpum.GstCtx.cs.Attr.n.u1Long        = fHostInLongMode;
     2173            pVCpu->cpum.GstCtx.cs.Attr.n.u1DefBig      = !fHostInLongMode;
     2174            pVCpu->cpum.GstCtx.cs.Attr.n.u1Granularity = 1;
     2175            Assert(!pVCpu->cpum.GstCtx.cs.Attr.n.u1Unusable);
     2176            Assert(!fUnusable);
     2177        }
     2178        else
     2179        {
     2180            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u4Type        = X86_SEL_TYPE_RW | X86_SEL_TYPE_ACCESSED;
     2181            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1DescType    = 1;
     2182            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u2Dpl         = 0;
     2183            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Present     = 1;
     2184            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1DefBig      = 1;
     2185            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Granularity = 1;
     2186            pVCpu->cpum.GstCtx.aSRegs[iSegReg].Attr.n.u1Unusable    = fUnusable;
     2187        }
     2188    }
     2189
     2190    /* FS base. */
     2191    if (   !pVCpu->cpum.GstCtx.fs.Attr.n.u1Unusable
     2192        ||  fHostInLongMode)
     2193    {
     2194        Assert(X86_IS_CANONICAL(pVmcs->u64HostFsBase.u));
     2195        pVCpu->cpum.GstCtx.fs.u64Base = pVmcs->u64HostFsBase.u;
     2196    }
     2197
     2198    /* GS base. */
     2199    if (   !pVCpu->cpum.GstCtx.gs.Attr.n.u1Unusable
     2200        ||  fHostInLongMode)
     2201    {
     2202        Assert(X86_IS_CANONICAL(pVmcs->u64HostGsBase.u));
     2203        pVCpu->cpum.GstCtx.gs.u64Base = pVmcs->u64HostGsBase.u;
    22352204    }
    22362205
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette