Changeset 67094 in vbox for trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
- Timestamp:
- May 25, 2017 9:41:50 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c
r67093 r67094 1446 1446 } 1447 1447 1448 /** Also encodes idxField of the register operand using idxFieldBase. */ 1449 static unsigned BS3_NEAR_CODE 1450 Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaultsAddrOverride(PBS3CG1STATE pThis, unsigned off, uint8_t iReg) 1451 { 1452 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + iReg; 1453 return Bs3Cfg1EncodeMemMod0Disp(pThis, true /*fAddrOverride*/, off, iReg & 7, 1454 pThis->aOperands[pThis->iRmOp].cbOp, 1455 0 /*cbMisalign*/, 1456 pThis->aOperands[pThis->iRmOp].enmLocation); 1457 } 1458 1448 1459 1449 1460 /** Also encodes idxField of the register operand using idxFieldBase. */ … … 1491 1502 1492 1503 1493 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Eb_Gb (PBS3CG1STATE pThis, unsigned iEncoding)1504 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Eb_Gb_OR_ViceVersa(PBS3CG1STATE pThis, unsigned iEncoding) 1494 1505 { 1495 1506 unsigned off; … … 1498 1509 /* Start by reg,reg encoding. */ 1499 1510 case 0: 1511 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg; 1500 1512 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; 1513 off = Bs3Cg1InsertModRmWithRegFields(pThis, off, X86_GREG_xAX, X86_GREG_xCX); 1504 1514 break; 1505 1515 case 1: 1506 pThis->aOperands[pThis->iR egOp].idxField = BS3CG1DST_CH;1516 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem; 1507 1517 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1508 off = Bs3Cfg1EncodeMemMod0Disp (pThis, false, off, X86_GREG_xBP, 1, 0, BS3CG1OPLOC_MEM_RW);1518 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, off, 5 /*CH*/); 1509 1519 break; 1510 1520 case 2: 1511 1521 if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386) 1512 1522 return 0; 1513 pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_BH; 1523 pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem; 1524 pThis->abCurInstr[0] = P_OZ; 1525 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)); 1526 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, off, 6 /*DH*/); 1527 break; 1528 /* Tests with address override goes last! */ 1529 case 3: 1514 1530 pThis->abCurInstr[0] = P_AZ; 1515 1531 off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 1)); 1516 off = Bs3Cfg1EncodeMemMod0Disp(pThis, true, off, X86_GREG_xDI, 1, 0, BS3CG1OPLOC_MEM_RW); 1517 break; 1532 off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaultsAddrOverride(pThis, off, 7 /*BH*/); 1533 break; 1534 1518 1535 default: 1519 1536 return 0; … … 1524 1541 1525 1542 1526 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Gb_Eb(PBS3CG1STATE pThis, unsigned iEncoding) 1527 { 1528 unsigned off; 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 } 1554 pThis->cbCurInstr = off; 1555 return iEncoding + 1; 1556 } 1557 1558 1559 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv(PBS3CG1STATE pThis, 1560 unsigned iEncoding) 1543 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv(PBS3CG1STATE pThis, unsigned iEncoding) 1561 1544 { 1562 1545 unsigned off; … … 3736 3719 switch (pThis->enmEncoding) 3737 3720 { 3738 case BS3CG1ENC_MODRM_Eb_Gb:3739 return Bs3Cg1EncodeNext_MODRM_Eb_Gb(pThis, iEncoding);3740 case BS3CG1ENC_MODRM_Gb_Eb:3741 return Bs3Cg1EncodeNext_MODRM_Gb_Eb(pThis, iEncoding);3742 3721 case BS3CG1ENC_MODRM_Gv_Ev: 3743 3722 case BS3CG1ENC_MODRM_Ev_Gv: … … 3821 3800 { 3822 3801 case BS3CG1ENC_MODRM_Eb_Gb: 3823 pThis->iRmOp = 0; 3824 pThis->iRegOp = 1; 3825 pThis->aOperands[0].cbOp = 1; 3826 pThis->aOperands[1].cbOp = 1; 3827 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3828 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3802 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Eb_Gb_OR_ViceVersa; 3803 pThis->iRmOp = 0; 3804 pThis->iRegOp = 1; 3805 pThis->aOperands[0].cbOp = 1; 3806 pThis->aOperands[1].cbOp = 1; 3807 pThis->aOperands[0].idxFieldBase = BS3CG1DST_AL; 3808 pThis->aOperands[1].idxFieldBase = BS3CG1DST_AL; 3809 pThis->aOperands[0].enmLocationReg = BS3CG1OPLOC_CTX; 3810 pThis->aOperands[0].enmLocationMem = BS3CG1OPLOC_MEM_RW; 3811 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3829 3812 break; 3830 3813 … … 3896 3879 3897 3880 case BS3CG1ENC_MODRM_Gb_Eb: 3881 pThis->pfnEncoder = Bs3Cg1EncodeNext_MODRM_Eb_Gb_OR_ViceVersa; 3882 pThis->iRegOp = 0; 3898 3883 pThis->iRmOp = 1; 3899 pThis->iRegOp = 0;3900 3884 pThis->aOperands[0].cbOp = 1; 3901 3885 pThis->aOperands[1].cbOp = 1; 3902 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3903 pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX; 3886 pThis->aOperands[0].idxFieldBase = BS3CG1DST_AL; 3887 pThis->aOperands[1].idxFieldBase = BS3CG1DST_AL; 3888 pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX; 3889 pThis->aOperands[1].enmLocationReg = BS3CG1OPLOC_CTX; 3890 pThis->aOperands[1].enmLocationMem = BS3CG1OPLOC_MEM; 3904 3891 break; 3905 3892
Note:
See TracChangeset
for help on using the changeset viewer.