VirtualBox

Changeset 60669 in vbox


Ignore:
Timestamp:
Apr 23, 2016 12:06:24 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
106837
Message:

bs3kit: updates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c

    r60657 r60669  
    13141314    uint8_t const       cbBuf = 8*2;         /* test buffer area  */
    13151315    uint8_t             abBuf[8*2 + 8 + 8];  /* test buffer w/ misalignment test space and some extra guard. */
    1316     uint8_t BS3_FAR    *pbBuf = abBuf;
    1317     uint8_t const       cbIdtr = BS3_MODE_IS_64BIT_CODE(g_bTestMode) ? 2+8 : BS3_MODE_IS_32BIT_CODE(g_bTestMode) ? 2+4
    1318                         : (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) == BS3CPU_80286 ? 2+3 : 2+4;
     1316    uint8_t BS3_FAR    *pbBuf  = abBuf;
     1317    uint8_t const       cbIdtr = BS3_MODE_IS_64BIT_CODE(g_bTestMode) ? 2+8 : 2+4;
     1318    bool const          f286   = (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) == BS3CPU_80286;
    13191319    uint8_t             bFiller;
    13201320    unsigned            off;
    1321     //unsigned            i, j;
    13221321
    13231322    g_usBs3TestStep = 0;
     
    13571356    Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx);
    13581357    bs3CpuBasic2_CompareUdCtx(&TrapCtx, &CtxUdExpected);
     1358    if (f286 && abBuf[cbIdtr - 1] != 0xff)
     1359        Bs3TestFailedF("286: Top base byte isn't 0xff (#1): %#x\n", abBuf[cbIdtr - 1]);
    13591360    if (!ASMMemIsZero(&abBuf[cbIdtr], cbBuf - cbIdtr))
    13601361        Bs3TestFailedF("Unexpected buffer bytes set (#1): cbIdtr=%u abBuf=%.*Rhxs\n", cbIdtr, cbBuf, pbBuf);
     
    13711372    Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx);
    13721373    bs3CpuBasic2_CompareUdCtx(&TrapCtx, &CtxUdExpected);
     1374    if (f286 && abBuf[cbIdtr - 1] != 0xff)
     1375        Bs3TestFailedF("286: Top base byte isn't 0xff (#2): %#x\n", abBuf[cbIdtr - 1]);
    13731376    if (!ASMMemIsAllU8(&abBuf[cbIdtr], cbBuf - cbIdtr, bFiller))
    13741377        Bs3TestFailedF("Unexpected buffer bytes set (#2): cbIdtr=%u bFiller=%#x abBuf=%.*Rhxs\n", cbIdtr, bFiller, cbBuf, pbBuf);
     
    13951398            Bs3TestFailedF("Unexpected buffer bytes set after (#3): cbIdtr=%u off=%u abBuf=%.*Rhxs\n",
    13961399                           cbIdtr, off, off + cbBuf, abBuf);
     1400        if (f286 && abBuf[off + cbIdtr - 1] != 0xff)
     1401            Bs3TestFailedF("286: Top base byte isn't 0xff (#3): %#x\n", abBuf[off + cbIdtr - 1]);
    13971402        g_usBs3TestStep++;
    13981403
     
    14101415            Bs3TestFailedF("Not all bytes touched (#4): cbIdtr=%u off=%u bFiller=%#x abBuf=%.*Rhxs\n",
    14111416                           cbIdtr, off, bFiller, off + cbBuf, abBuf);
     1417        if (f286 && abBuf[off + cbIdtr - 1] != 0xff)
     1418            Bs3TestFailedF("286: Top base byte isn't 0xff (#4): %#x\n", abBuf[off + cbIdtr - 1]);
    14121419        g_usBs3TestStep++;
    14131420
     
    14321439
    14331440        CtxUdExpected.ds = Ctx.ds = BS3_SEL_TEST_PAGE_00;
     1441
     1442        /* Expand up (normal). */
    14341443        for (off = 0; off < 8; off++)
    14351444        {
     
    14461455                        Bs3TestFailedF("Not all bytes touched (#5): cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n",
    14471456                                       cbIdtr, off, cbLimit, bFiller, off + cbBuf, abBuf);
     1457                    if (f286 && abBuf[off + cbIdtr - 1] != 0xff)
     1458                        Bs3TestFailedF("286: Top base byte isn't 0xff (#5): %#x\n", abBuf[off + cbIdtr - 1]);
    14481459                }
    14491460                else
     
    14751486        }
    14761487
     1488        /* Expand down (weird).  Inverted valid area compared to expand up,
     1489           so a limit of zero give us a valid range for 0001..0ffffh (instead of
     1490           a segment with one valid byte at 0000h).  Whereas a limit of 0fffeh
     1491           means one valid byte at 0ffffh, and a limit of 0ffffh means none
     1492           (because in a normal expand up the 0ffffh means all 64KB are
     1493           accessible). */
     1494        Bs3GdteTestPage00.Gen.u4Type = X86_SEL_TYPE_RW_DOWN_ACC;
     1495        for (off = 0; off < 8; off++)
     1496        {
     1497            CtxUdExpected.rbx.u = Ctx.rbx.u = off;
     1498            for (cbLimit = 0; cbLimit < cbIdtr*2; cbLimit++)
     1499            {
     1500                Bs3GdteTestPage00.Gen.u16LimitLow = cbLimit;
     1501                Bs3MemSet(abBuf, bFiller, sizeof(abBuf));
     1502                Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx);
     1503
     1504                if (off > cbLimit)
     1505                {
     1506                    bs3CpuBasic2_CompareUdCtx(&TrapCtx, &CtxUdExpected);
     1507                    if (Bs3MemChr(&abBuf[off], bFiller, cbIdtr) != NULL)
     1508                        Bs3TestFailedF("Not all bytes touched (#5): cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n",
     1509                                       cbIdtr, off, cbLimit, bFiller, off + cbBuf, abBuf);
     1510                    if (f286 && abBuf[off + cbIdtr - 1] != 0xff)
     1511                        Bs3TestFailedF("286: Top base byte isn't 0xff (#5): %#x\n", abBuf[off + cbIdtr - 1]);
     1512                }
     1513                else
     1514                {
     1515                    bs3CpuBasic2_CompareGpCtx(&TrapCtx, &Ctx, 0);
     1516                    if (!ASMMemIsAllU8(abBuf, sizeof(abBuf), bFiller))
     1517                        Bs3TestFailedF("Bytes touched on #GP: cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n",
     1518                                       cbIdtr, off, cbLimit, bFiller, off + cbBuf, abBuf);
     1519                }
     1520
     1521                if (off > 0 && !ASMMemIsAllU8(abBuf, off, bFiller))
     1522                    Bs3TestFailedF("Leading bytes touched (#7): cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n",
     1523                                   cbIdtr, off, cbLimit, bFiller, off + cbBuf, abBuf);
     1524                if (!ASMMemIsAllU8(&abBuf[off + cbIdtr], sizeof(abBuf) - off - cbIdtr, bFiller))
     1525                    Bs3TestFailedF("Trailing bytes touched (#7): cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n",
     1526                                   cbIdtr, off, cbLimit, bFiller, off + cbBuf, abBuf);
     1527
     1528                g_usBs3TestStep++;
     1529            }
     1530        }
     1531
    14771532        CtxUdExpected.ds = Ctx.ds = uSavedDs;
    14781533        CtxUdExpected.rbx.u = Ctx.rbx.u = BS3_FP_OFF(pbBuf);
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