Changeset 60669 in vbox
- Timestamp:
- Apr 23, 2016 12:06:24 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 106837
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-basic-2-template.c
r60657 r60669 1314 1314 uint8_t const cbBuf = 8*2; /* test buffer area */ 1315 1315 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+41318 : (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; 1319 1319 uint8_t bFiller; 1320 1320 unsigned off; 1321 //unsigned i, j;1322 1321 1323 1322 g_usBs3TestStep = 0; … … 1357 1356 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 1358 1357 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]); 1359 1360 if (!ASMMemIsZero(&abBuf[cbIdtr], cbBuf - cbIdtr)) 1360 1361 Bs3TestFailedF("Unexpected buffer bytes set (#1): cbIdtr=%u abBuf=%.*Rhxs\n", cbIdtr, cbBuf, pbBuf); … … 1371 1372 Bs3TrapSetJmpAndRestore(&Ctx, &TrapCtx); 1372 1373 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]); 1373 1376 if (!ASMMemIsAllU8(&abBuf[cbIdtr], cbBuf - cbIdtr, bFiller)) 1374 1377 Bs3TestFailedF("Unexpected buffer bytes set (#2): cbIdtr=%u bFiller=%#x abBuf=%.*Rhxs\n", cbIdtr, bFiller, cbBuf, pbBuf); … … 1395 1398 Bs3TestFailedF("Unexpected buffer bytes set after (#3): cbIdtr=%u off=%u abBuf=%.*Rhxs\n", 1396 1399 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]); 1397 1402 g_usBs3TestStep++; 1398 1403 … … 1410 1415 Bs3TestFailedF("Not all bytes touched (#4): cbIdtr=%u off=%u bFiller=%#x abBuf=%.*Rhxs\n", 1411 1416 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]); 1412 1419 g_usBs3TestStep++; 1413 1420 … … 1432 1439 1433 1440 CtxUdExpected.ds = Ctx.ds = BS3_SEL_TEST_PAGE_00; 1441 1442 /* Expand up (normal). */ 1434 1443 for (off = 0; off < 8; off++) 1435 1444 { … … 1446 1455 Bs3TestFailedF("Not all bytes touched (#5): cbIdtr=%u off=%u cbLimit=%u bFiller=%#x abBuf=%.*Rhxs\n", 1447 1456 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]); 1448 1459 } 1449 1460 else … … 1475 1486 } 1476 1487 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 1477 1532 CtxUdExpected.ds = Ctx.ds = uSavedDs; 1478 1533 CtxUdExpected.rbx.u = Ctx.rbx.u = BS3_FP_OFF(pbBuf);
Note:
See TracChangeset
for help on using the changeset viewer.