VirtualBox

Changeset 24959 in vbox for trunk/src/VBox/VMM


Ignore:
Timestamp:
Nov 25, 2009 3:31:10 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
55257
Message:

CPUM,HWACCM: Moved the fixing up of csHid.n.u1Granularity to HWACCM because several SELM APIs expect it to be set correctly.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/CPUM.cpp

    r24852 r24959  
    19481948                if (uVersion >= CPUM_SAVED_STATE_VERSION_VER3_0)
    19491949                    SSMR3GetMem(pSSM, &pVM->aCpus[i].cpum.s.GuestMsr, sizeof(pVM->aCpus[i].cpum.s.GuestMsr));
    1950 
    1951                 /*
    1952                  * HACK ALERT! Workaround for missing granularity flag in CS on
    1953                  *             AMD-v.  This will cause trouble if the host now
    1954                  *             is using VT-x (teleporting, cold migration).
    1955                  * May consider moving this into SVM_READ_SELREG or there about.
    1956                  */
    1957                 if (    !pVM->aCpus[i].cpum.s.Guest.csHid.Attr.n.u1Granularity
    1958                     &&   pVM->aCpus[i].cpum.s.Guest.csHid.u32Limit > UINT16_MAX)
    1959                     pVM->aCpus[i].cpum.s.Guest.csHid.Attr.n.u1Granularity = 1;
    19601950            }
    19611951        }
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r24829 r24959  
    14351435    SVM_READ_SELREG(GS, gs);
    14361436
     1437    /* Correct the hidden CS granularity flag.  Haven't seen it being wrong in
     1438       any other register (yet). */
     1439    if (   !pCtx->csHid.Attr.n.u1Granularity
     1440        &&  pCtx->csHid.Attr.n.u1Present
     1441        &&  pCtx->csHid.u32Limit > UINT32_C(0xffff))
     1442    {
     1443        Assert((pCtx->csHid.u32Limit & 0xfff) == 0xfff);
     1444        pCtx->csHid.Attr.n.u1Granularity = 1;
     1445    }
     1446#define SVM_ASSERT_SEL_GRANULARITY(reg) \
     1447        AssertMsg(!pCtx->reg##Hid.Attr.n.u1Present \
     1448                  || (   pCtx->reg##Hid.Attr.n.u1Granularity \
     1449                      ? (pCtx->reg##Hid.u32Limit & 0xfff) == 0xfff \
     1450                      :  pCtx->reg##Hid.u32Limit <= 0xffff), \
     1451                  ("%#x\n", pCtx->reg##Hid.u32Limit))
     1452    SVM_ASSERT_SEL_GRANULARITY(ss);
     1453    SVM_ASSERT_SEL_GRANULARITY(cs);
     1454    SVM_ASSERT_SEL_GRANULARITY(ds);
     1455    SVM_ASSERT_SEL_GRANULARITY(es);
     1456    SVM_ASSERT_SEL_GRANULARITY(fs);
     1457    SVM_ASSERT_SEL_GRANULARITY(gs);
     1458#undef  SVM_ASSERT_SEL_GRANULARITY
     1459
    14371460    /* Remaining guest CPU context: TR, IDTR, GDTR, LDTR; must sync everything otherwise we can get out of sync when jumping to ring 3. */
    14381461    SVM_READ_SELREG(LDTR, ldtr);
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