Changeset 67095 in vbox for trunk/src/VBox/ValidationKit
- Timestamp:
- May 25, 2017 10:08:01 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r67094 r67095 175 175 /** @} */ 176 176 177 /** Default operand size. */ 178 uint8_t cbOpDefault; 179 /** Operand size when overridden by 066h. */ 180 uint8_t cbOpOvrd66; 181 /** Operand size when overridden by REX.W. */ 182 uint8_t cbOpOvrdRexW; 183 177 184 /** Operand size in bytes (0 if not applicable). */ 178 185 uint8_t cbOperand; … … 193 200 /** End of rings being tested. */ 194 201 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;202 203 202 204 203 /** @name Current encoded instruction. … … 1526 1525 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, off, 6 /*DH*/); 1527 1526 break; 1528 /* Tests with address override goeslast! */1527 /* Tests with address overrides go last! */ 1529 1528 case 3: 1530 1529 pThis->abCurInstr[0] = P_AZ; … … 1545 1544 unsigned off; 1546 1545 unsigned cbOp; 1547 if (iEncoding == 0) 1548 { 1549 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 2 : 4; 1550 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1551 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xBX, X86_GREG_xDX); 1552 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBX; 1553 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_OZ_RDX; 1554 } 1555 else if (iEncoding == 1) 1556 { 1557 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 2 : 4; 1558 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBP; 1559 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1560 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xBP, cbOp, 0, 1561 pThis->enmEncoding == BS3CG1ENC_MODRM_Gv_Ev ? BS3CG1OPLOC_MEM : BS3CG1OPLOC_MEM_WO); 1562 } 1563 else if (iEncoding == 2 && (g_uBs3CpuDetected & BS3CPU_TYPE_MASK) >= BS3CPU_80386) 1564 { 1565 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 4 : 2; 1566 pThis->abCurInstr[0] = P_OZ; 1567 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1568 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xBX, X86_GREG_xDX); 1569 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RBX; 1570 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_OZ_RDX; 1571 pThis->aOperands[pThis->iRmOp ].enmLocation = BS3CG1OPLOC_CTX; 1572 } 1573 else if (iEncoding == 3) 1574 { 1575 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 4 : 2; 1576 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RSI; 1577 pThis->abCurInstr[0] = P_OZ; 1578 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1579 off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, X86_GREG_xSI, cbOp, 0, 1580 pThis->enmEncoding == BS3CG1ENC_MODRM_Gv_Ev ? BS3CG1OPLOC_MEM : BS3CG1OPLOC_MEM_WO); 1581 } 1582 else if (iEncoding == 4) 1583 { 1584 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 2 : 4; 1585 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RDI; 1586 pThis->abCurInstr[0] = P_AZ; 1587 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1588 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, cbOp, 0, 1589 pThis->enmEncoding == BS3CG1ENC_MODRM_Gv_Ev ? BS3CG1OPLOC_MEM : BS3CG1OPLOC_MEM_WO); 1590 } 1591 else if (iEncoding == 5) 1592 { 1593 cbOp = BS3_MODE_IS_16BIT_CODE(pThis->bMode) ? 4 : 2; 1594 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_OZ_RSI; 1595 pThis->abCurInstr[0] = P_OZ; 1596 pThis->abCurInstr[1] = P_AZ; 1597 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 2)); 1598 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xSI, cbOp, 0, 1599 pThis->enmEncoding == BS3CG1ENC_MODRM_Gv_Ev ? BS3CG1OPLOC_MEM : BS3CG1OPLOC_MEM_WO); 1600 } 1601 else if (iEncoding == 6 && BS3CG1_IS_64BIT_TARGET(pThis)) 1602 { 1603 cbOp = 8; 1604 off = Bs3Cg1InsertReqPrefix(pThis, 0); 1605 pThis->abCurInstr[off++] = REX_W___; 1606 off = Bs3Cg1InsertOpcodes(pThis, off); 1607 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, X86_GREG_xBX, X86_GREG_xDX); 1608 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_RBX; 1609 pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_RDX; 1610 pThis->aOperands[pThis->iRmOp ].enmLocation = BS3CG1OPLOC_CTX; 1611 } 1612 else 1613 return 0; 1546 switch (iEncoding) 1547 { 1548 case 0: 1549 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg; 1550 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1551 off = Bs3Cg1InsertModRmWithRegFields(pThis, off, X86_GREG_xBX, X86_GREG_xDX); 1552 cbOp = pThis->cbOpDefault; 1553 break; 1554 case 1: 1555 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem; 1556 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1557 cbOp = pThis->cbOpDefault; 1558 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaults(pThis, off, X86_GREG_xBP, cbOp); 1559 break; 1560 case 2: 1561 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 1562 return 0; 1563 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg; 1564 pThis->abCurInstr[0] = P_OZ; 1565 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1566 off = Bs3Cg1InsertModRmWithRegFields(pThis, off, X86_GREG_xAX, X86_GREG_xCX); 1567 cbOp = pThis->cbOpOvrd66; 1568 break; 1569 case 3: 1570 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem; 1571 pThis->abCurInstr[0] = P_OZ; 1572 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1573 cbOp = pThis->cbOpOvrd66; 1574 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaults(pThis, off, X86_GREG_xSI, cbOp); 1575 iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 2 : 0; 1576 break; 1577 case 4: 1578 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg; 1579 off = Bs3Cg1InsertReqPrefix(pThis, 0); 1580 pThis->abCurInstr[off++] = REX_W___; 1581 off = Bs3Cg1InsertOpcodes(pThis, off); 1582 off = Bs3Cg1InsertModRmWithRegFields(pThis, off, X86_GREG_xBX, X86_GREG_xDX); 1583 cbOp = pThis->cbOpOvrdRexW; 1584 break; 1585 case 5: 1586 off = Bs3Cg1InsertReqPrefix(pThis, 0); 1587 pThis->abCurInstr[off++] = REX__RB_; 1588 off = Bs3Cg1InsertOpcodes(pThis, off); 1589 off = Bs3Cg1InsertModRmWithRegFields(pThis, off, X86_GREG_x14, X86_GREG_x12); 1590 cbOp = pThis->cbOpDefault; 1591 break; 1592 /* Tests with address overrides go last!*/ 1593 case 6: 1594 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem; 1595 pThis->abCurInstr[0] = P_AZ; 1596 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1597 cbOp = pThis->cbOpDefault; 1598 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaultsAddrOverride(pThis, off, X86_GREG_xDI, cbOp); 1599 break; 1600 case 7: 1601 pThis->abCurInstr[0] = P_OZ; 1602 pThis->abCurInstr[1] = P_AZ; 1603 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 2)); 1604 cbOp = pThis->cbOpOvrd66; 1605 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndSizeAndDefaultsAddrOverride(pThis, off, X86_GREG_xDI, cbOp); 1606 break; 1607 default: 1608 return 0; 1609 } 1614 1610 pThis->aOperands[0].cbOp = cbOp; 1615 1611 pThis->aOperands[1].cbOp = cbOp; … … 3719 3715 switch (pThis->enmEncoding) 3720 3716 { 3721 case BS3CG1ENC_MODRM_Gv_Ev:3722 case BS3CG1ENC_MODRM_Ev_Gv:3723 return Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv(pThis, iEncoding);3724 3725 3717 case BS3CG1ENC_MODRM_Wss_WO_Vss: 3726 3718 return Bs3Cg1EncodeNext_MODRM_Wss_WO_Vss(pThis, iEncoding); … … 3813 3805 3814 3806 case BS3CG1ENC_MODRM_Ev_Gv: 3815 pThis->iRmOp = 0; 3816 pThis->iRegOp = 1; 3817 pThis->cbOperand = 2; 3818 pThis->aOperands[0].cbOp = 2; 3819 pThis->aOperands[1].cbOp = 2; 3820 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3821 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3807 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv; 3808 pThis->iRmOp = 0; 3809 pThis->iRegOp = 1; 3810 pThis->cbOperand = 2; 3811 pThis->aOperands[0].idxFieldBase = BS3CG1DST_OZ_RAX; 3812 pThis->aOperands[1].idxFieldBase = BS3CG1DST_OZ_RAX; 3813 pThis->aOperands[0].enmLocationReg = BS3CG1OPLOC_CTX; 3814 pThis->aOperands[0].enmLocationMem = BS3CG1OPLOC_MEM_RW; 3815 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3822 3816 break; 3823 3817 … … 3892 3886 3893 3887 case BS3CG1ENC_MODRM_Gv_Ev: 3894 pThis->iRmOp = 1; 3895 pThis->iRegOp = 0; 3896 pThis->cbOperand = 2; 3897 pThis->aOperands[0].cbOp = 2; 3898 pThis->aOperands[1].cbOp = 2; 3899 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3900 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3888 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv; 3889 pThis->iRegOp = 0; 3890 pThis->iRmOp = 1; 3891 pThis->cbOperand = 2; 3892 pThis->aOperands[0].idxFieldBase = BS3CG1DST_OZ_RAX; 3893 pThis->aOperands[1].idxFieldBase = BS3CG1DST_OZ_RAX; 3894 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3895 pThis->aOperands[1].enmLocationReg = BS3CG1OPLOC_CTX; 3896 pThis->aOperands[1].enmLocationMem = BS3CG1OPLOC_MEM; 3901 3897 break; 3902 3898
Note:
See TracChangeset
for help on using the changeset viewer.