VirtualBox

vbox的更動 67094 路徑 trunk/src/VBox/ValidationKit


忽略:
時間撮記:
2017-5-25 下午09:41:50 (7 年 以前)
作者:
vboxsync
訊息:

bs3-cpu-generated-1: cleanups

檔案:
修改 1 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c

    r67093 r67094  
    14461446}
    14471447
     1448/** Also encodes idxField of the register operand using idxFieldBase. */
     1449static unsigned BS3_NEAR_CODE
     1450Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaultsAddrOverride(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
    14481459
    14491460/** Also encodes idxField of the register operand using idxFieldBase. */
     
    14911502
    14921503
    1493 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Eb_Gb(PBS3CG1STATE pThis, unsigned iEncoding)
     1504static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Eb_Gb_OR_ViceVersa(PBS3CG1STATE pThis, unsigned iEncoding)
    14941505{
    14951506    unsigned off;
     
    14981509        /* Start by reg,reg encoding. */
    14991510        case 0:
     1511            pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    15001512            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);
    15041514            break;
    15051515        case 1:
    1506             pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_CH;
     1516            pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem;
    15071517            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*/);
    15091519            break;
    15101520        case 2:
    15111521            if ((g_uBs3CpuDetected & BS3CPU_TYPE_MASK) < BS3CPU_80386)
    15121522                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:
    15141530            pThis->abCurInstr[0] = P_AZ;
    15151531            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
    15181535        default:
    15191536            return 0;
     
    15241541
    15251542
    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)
     1543static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Gv_Ev__OR__MODRM_Ev_Gv(PBS3CG1STATE pThis, unsigned iEncoding)
    15611544{
    15621545    unsigned off;
     
    37363719    switch (pThis->enmEncoding)
    37373720    {
    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);
    37423721        case BS3CG1ENC_MODRM_Gv_Ev:
    37433722        case BS3CG1ENC_MODRM_Ev_Gv:
     
    38213800    {
    38223801        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;
    38293812            break;
    38303813
     
    38963879
    38973880        case BS3CG1ENC_MODRM_Gb_Eb:
     3881            pThis->pfnEncoder        = Bs3Cg1EncodeNext_MODRM_Eb_Gb_OR_ViceVersa;
     3882            pThis->iRegOp            = 0;
    38983883            pThis->iRmOp             = 1;
    3899             pThis->iRegOp            = 0;
    39003884            pThis->aOperands[0].cbOp = 1;
    39013885            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;
    39043891            break;
    39053892
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette