Changeset 67093 in vbox for trunk/src/VBox/ValidationKit/bootsectors
- Timestamp:
- May 25, 2017 8:36:03 PM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 115756
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r67086 r67093 193 193 /** End of rings being tested. */ 194 194 uint8_t iEndRing; 195 196 /** Default operand size. */ 197 uint8_t cbOpDefault; 198 /** Operand size when overridden by 066h. */ 199 uint8_t cbOpOvrd66; 200 /** Operand size when overridden by REX.W. */ 201 uint8_t cbOpOvrdRexW; 195 202 196 203 … … 1487 1494 { 1488 1495 unsigned off; 1489 /* Start by reg,reg encoding. */ 1490 if (iEncoding == 0) 1491 { 1492 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1493 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xAX, X86_GREG_xCX); 1494 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_AL; 1495 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_CL; 1496 } 1497 else if (iEncoding == 1) 1498 { 1499 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_CH; 1500 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1501 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, 1, 0, BS3CG1OPLOC_MEM_RW); 1502 } 1503 else if (iEncoding == 2 && (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386) 1504 { 1505 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_BH; 1506 pThis->abCurInstr[0] = P_AZ; 1507 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1508 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, 1, 0, BS3CG1OPLOC_MEM_RW); 1509 } 1510 else 1511 return 0; 1496 switch (iEncoding) 1497 { 1498 /* Start by reg,reg encoding. */ 1499 case 0: 1500 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1501 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xAX, X86_GREG_xCX); 1502 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_AL; 1503 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_CL; 1504 break; 1505 case 1: 1506 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_CH; 1507 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1508 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, 1, 0, BS3CG1OPLOC_MEM_RW); 1509 break; 1510 case 2: 1511 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 1512 return 0; 1513 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_BH; 1514 pThis->abCurInstr[0] = P_AZ; 1515 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1516 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, 1, 0, BS3CG1OPLOC_MEM_RW); 1517 break; 1518 default: 1519 return 0; 1520 } 1512 1521 pThis->cbCurInstr = off; 1513 1522 return iEncoding + 1; … … 1518 1527 { 1519 1528 unsigned off; 1520 /* Start by reg,reg encoding. */ 1521 if (iEncoding == 0) 1522 { 1523 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1524 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xAX, X86_GREG_xCX); 1525 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_AL; 1526 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_CL; 1527 } 1528 else if (iEncoding == 1) 1529 { 1530 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_CH; 1531 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1532 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, 1, 0, BS3CG1OPLOC_MEM); 1533 } 1534 else if (iEncoding == 2 && (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386) 1535 { 1536 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_BH; 1537 pThis->abCurInstr[0] = P_AZ; 1538 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1539 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, 1, 0, BS3CG1OPLOC_MEM); 1540 } 1541 else 1542 return 0; 1529 switch (iEncoding) 1530 { 1531 /* Start by reg,reg encoding. */ 1532 case 0: 1533 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1534 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xAX, X86_GREG_xCX); 1535 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_AL; 1536 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_CL; 1537 break; 1538 case 1: 1539 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_CH; 1540 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1541 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, 1, 0, BS3CG1OPLOC_MEM); 1542 break; 1543 case 2: 1544 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 1545 return 0; 1546 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_BH; 1547 pThis->abCurInstr[0] = P_AZ; 1548 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1549 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, 1, 0, BS3CG1OPLOC_MEM); 1550 break; 1551 default: 1552 return 0; 1553 } 1543 1554 pThis->cbCurInstr = off; 1544 1555 return iEncoding + 1; … … 2222 2233 2223 2234 2224 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_M q_WO_Pq(PBS3CG1STATE pThis, unsigned iEncoding)2235 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Msomething_Psomething(PBS3CG1STATE pThis, unsigned iEncoding) 2225 2236 { 2226 2237 unsigned off; … … 4156 4167 4157 4168 case BS3CG1ENC_MODRM_Mq_WO_Pq: 4158 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_M q_WO_Pq;4169 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Msomething_Psomething; 4159 4170 pThis->iRmOp = 0; 4160 4171 pThis->iRegOp = 1; … … 4607 4618 Bs3TestFailedF("Bs3Cg1CalcNoneIntelInvalidEncoding: Unsupported encoding: %d\n", enmEncoding); 4608 4619 return BS3CG1ENC_FIXED; 4620 } 4621 } 4622 4623 4624 /** 4625 * Sets cbOpDefault, cbOpOvrd66 and cbOpOvrdRexW. 4626 * 4627 * @param pThis The state. 4628 * @param bMode The mode (only code part is used). 4629 */ 4630 static void Bs3Cg1SetOpSizes(PBS3CG1STATE pThis, uint8_t bMode) 4631 { 4632 if (BS3_MODE_IS_16BIT_CODE(bMode)) 4633 { 4634 pThis->cbOpDefault = 2; 4635 pThis->cbOpOvrd66 = 4; 4636 pThis->cbOpOvrdRexW = 0; 4637 } 4638 else if (BS3_MODE_IS_32BIT_CODE(bMode)) 4639 { 4640 pThis->cbOpDefault = 4; 4641 pThis->cbOpOvrd66 = 2; 4642 pThis->cbOpOvrdRexW = 0; 4643 } 4644 else 4645 { 4646 pThis->cbOpDefault = 4; 4647 pThis->cbOpOvrd66 = 2; 4648 pThis->cbOpOvrdRexW = 8; 4609 4649 } 4610 4650 } … … 6096 6136 * Prep the operands and encoding handling. 6097 6137 */ 6138 Bs3Cg1SetOpSizes(pThis, pThis->bMode); 6098 6139 if (!Bs3Cg1EncodePrep(pThis)) 6099 6140 break;
Note:
See TracChangeset
for help on using the changeset viewer.