VirtualBox

Changeset 67083 in vbox for trunk/src/VBox/ValidationKit


Ignore:
Timestamp:
May 25, 2017 11:07:11 AM (8 years ago)
Author:
vboxsync
Message:

bs3-cpu-generated-1: cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/ValidationKit/bootsectors/bs3-cpu-generated-1-template.c

    r67082 r67083  
    13001300
    13011301/**
     1302 * Inserts a ModR/M byte with mod=3 and set the two idxFields members.
     1303 *
     1304 * @returns off + 1.
     1305 * @param   pThis       The state.
     1306 * @param   off         Current instruction offset.
     1307 * @param   uReg        Register index for ModR/M.reg.
     1308 * @param   uRegMem     Register index for ModR/M.rm.
     1309 */
     1310static unsigned Bs3Cg1InsertModRmWithRegFields(PBS3CG1STATE pThis, unsigned off, uint8_t uReg, uint8_t uRegMem)
     1311{
     1312    pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, uReg & 7, uRegMem & 7);
     1313    pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + uReg;
     1314    pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + uRegMem;
     1315    return off;
     1316}
     1317
     1318
     1319
     1320/**
    13021321 * Cleans up state and context changes made by the encoder.
    13031322 *
     
    17331752            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    17341753            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1735             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    1736             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    1737             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     1754            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    17381755            break;
    17391756        case 1:
    17401757            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    17411758            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1742             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 7);
    1743             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 7;
    1744             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     1759            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 7);
    17451760            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
    17461761            break;
     
    17501765            pThis->abCurInstr[off++] = REX__RBX;
    17511766            off = Bs3Cg1InsertOpcodes(pThis, off);
    1752             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1753             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2; /* no +8*/
    1754             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6; /* no +8*/
     1767            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6 /*no +8*/, 2 /*no +8*/);
    17551768            break;
    17561769#endif
     
    18151828            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    18161829            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1817             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    1818             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    1819             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     1830            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    18201831            break;
    18211832        case 1:
    18221833            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1823             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1824             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    1825             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     1834            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    18261835            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
    18271836            break;
     
    18311840            pThis->abCurInstr[off++] = REX__RBX;
    18321841            off = Bs3Cg1InsertOpcodes(pThis, off);
    1833             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1834             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    1835             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6; /* no +8*/
     1842            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6 /*no +8*/, 2+8);
    18361843            break;
    18371844#endif
     
    18761883                pThis->abCurInstr[off++] = REX_W___;
    18771884                off = Bs3Cg1InsertOpcodes(pThis, off);
    1878                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    1879                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    1880                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     1885                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    18811886                break;
    18821887            case 1:
     
    18841889                pThis->abCurInstr[off++] = REX_W___;
    18851890                off = Bs3Cg1InsertOpcodes(pThis, off);
    1886                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1887                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    1888                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     1891                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    18891892                break;
    18901893            case 2:
     
    18921895                pThis->abCurInstr[off++] = REX_WRBX;
    18931896                off = Bs3Cg1InsertOpcodes(pThis, off);
    1894                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1895                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    1896                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6; /* no +8*/
     1897                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6 /*no +8*/, 2+8);
    18971898                break;
    18981899            case 3:
     
    19361937            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    19371938            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1938             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    1939             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    1940             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     1939            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    19411940            break;
    19421941        case 1:
    19431942            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    1944             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1945             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    1946             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     1943            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    19471944            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
    19481945            break;
     
    19521949            pThis->abCurInstr[off++] = REX__RBX;
    19531950            off = Bs3Cg1InsertOpcodes(pThis, off);
    1954             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    1955             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    1956             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6 + 8;
     1951            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6+8, 2+8);
    19571952            break;
    19581953#endif
     
    19981993                pThis->abCurInstr[off++] = REX_W___;
    19991994                off = Bs3Cg1InsertOpcodes(pThis, off);
    2000                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    2001                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    2002                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     1995                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    20031996                break;
    20041997            case 1:
     
    20061999                pThis->abCurInstr[off++] = REX_W___;
    20072000                off = Bs3Cg1InsertOpcodes(pThis, off);
    2008                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2009                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2010                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2001                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    20112002                break;
    20122003            case 2:
     
    20142005                pThis->abCurInstr[off++] = REX_WRBX;
    20152006                off = Bs3Cg1InsertOpcodes(pThis, off);
    2016                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2017                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    2018                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6 + 8;
     2007                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6+8, 2+8);
    20192008                break;
    20202009            case 4:
     
    22402229        case 0:
    22412230            pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    2242             off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2243             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    2244             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    2245             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     2231            off = Bs3Cg1InsertModRmWithRegFields(pThis, Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0)), 1, 0);
    22462232            break;
    22472233        case 1:
     
    22692255        case 0:
    22702256            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2271             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    2272             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    2273             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     2257            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    22742258            break;
    22752259        case 1:
    22762260            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2277             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 7);
    2278             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 7;
    2279             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2261            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 7);
    22802262            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
    22812263            break;
     
    22842266            pThis->abCurInstr[off++] = REX_WRBX;
    22852267            off = Bs3Cg1InsertOpcodes(pThis, off);
    2286             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 7);
    2287             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 7; /* no +8 here */
    2288             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6 + 8;
     2268            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6 + 8, 7 /*no +8*/);
    22892269            break;
    22902270
     
    26752655
    26762656
     2657/**
     2658 * Inserts a ModR/M byte with mod=3 and set the two idxFields members.
     2659 *
     2660 * @returns off + 1.
     2661 * @param   pThis       The state.
     2662 * @param   off         Current instruction offset.
     2663 * @param   uReg        Register index for ModR/M.reg.
     2664 * @param   uRegMem     Register index for ModR/M.rm.
     2665 * @param   uVexVvvv    The VEX.vvvv register.
     2666 */
     2667static unsigned Bs3Cg1InsertModRmWithRegFieldsAndVvvv(PBS3CG1STATE pThis, unsigned off,
     2668                                                      uint8_t uReg, uint8_t uRegMem, uint8_t uVexVvvv)
     2669{
     2670    pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, uReg & 7, uRegMem & 7);
     2671    pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + uReg;
     2672    pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + uVexVvvv;
     2673    pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + uRegMem;
     2674    return off;
     2675}
     2676
     2677
    26772678static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_VEX_MODRM_Vd_WO_Ed_WZ(PBS3CG1STATE pThis, unsigned iEncoding)
    26782679{
     
    26842685            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
    26852686            off = Bs3Cg1InsertOpcodes(pThis, off);
    2686             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    2687             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    2688             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     2687            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    26892688            break;
    26902689        case 1:
    26912690            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    26922691            off = Bs3Cg1InsertOpcodes(pThis, off);
    2693             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2694             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2695             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2692            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    26962693            break;
    26972694        case 2:
    26982695            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L-invalid*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    26992696            off = Bs3Cg1InsertOpcodes(pThis, off);
    2700             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2701             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2702             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2697            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    27032698            pThis->fInvalidEncoding = true;
    27042699            break;
     
    27062701            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xe /*~V-invalid*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    27072702            off = Bs3Cg1InsertOpcodes(pThis, off);
    2708             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2709             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2710             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2703            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    27112704            pThis->fInvalidEncoding = true;
    27122705            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
     
    27162709            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 0 /*~R*/, 1 /*~X*/, 0 /*~B*/, 0 /*W*/);
    27172710            off = Bs3Cg1InsertOpcodes(pThis, off);
    2718             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2719             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    2720             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6 + 8;
     2711            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6+8, 2+8);
    27212712            break;
    27222713#endif
     
    27762767        {
    27772768            case 0:
    2778                 pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
     2769                pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    27792770                off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W*/);
    27802771                off = Bs3Cg1InsertOpcodes(pThis, off);
    2781                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2782                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2783                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2772                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    27842773                break;
    27852774            case 1:
    27862775                off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L-invalid*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W*/);
    27872776                off = Bs3Cg1InsertOpcodes(pThis, off);
    2788                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2789                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2790                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2777                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    27912778                pThis->fInvalidEncoding = true;
    27922779                break;
     
    27942781                off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xe /*~V-invalid*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W*/);
    27952782                off = Bs3Cg1InsertOpcodes(pThis, off);
    2796                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2797                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
    2798                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
     2783                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6, 2);
    27992784                pThis->fInvalidEncoding = true;
    28002785                break;
     
    28022787                off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 0 /*~R*/, 1 /*~X*/, 0 /*~B*/, 1 /*W*/);
    28032788                off = Bs3Cg1InsertOpcodes(pThis, off);
    2804                 pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 6, 2);
    2805                 pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2 + 8;
    2806                 pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6 + 8;
     2789                off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 6+8, 2+8);
    28072790                break;
    28082791            case 4:
     
    28482831            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
    28492832            off = Bs3Cg1InsertOpcodes(pThis, off);
    2850             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2851             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2852             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2853             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2833            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    28542834            break;
    28552835        case 1:
    28562836            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0x8 /*~V*/, 1 /*L-ignored*/, 1 /*~R*/);
    28572837            off = Bs3Cg1InsertOpcodes(pThis, off);
    2858             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 1);
    2859             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 3;
    2860             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 7;
    2861             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2838            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 3, 1, 7);
    28622839            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
    28632840            break;
     
    28662843            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 0 /*~R*/);
    28672844            off = Bs3Cg1InsertOpcodes(pThis, off);
    2868             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 2);
    2869             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 11;
    2870             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 15;
    2871             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
     2845            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 3+8, 2, 15);
    28722846            break;
    28732847#endif
     
    28752849            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    28762850            off = Bs3Cg1InsertOpcodes(pThis, off);
    2877             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2878             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2879             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2880             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2851            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    28812852            break;
    28822853        case 4:
    28832854            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L - ignored*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    28842855            off = Bs3Cg1InsertOpcodes(pThis, off);
    2885             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2886             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2887             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2888             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2856            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    28892857            break;
    28902858        case 5:
    28912859            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xc /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W-ignored*/);
    28922860            off = Bs3Cg1InsertOpcodes(pThis, off);
    2893             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2894             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2895             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 3;
    2896             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2861            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 3);
    28972862            break;
    28982863        case 6:
    28992864            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W-ignored*/);
    29002865            off = Bs3Cg1InsertOpcodes(pThis, off);
    2901             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2902             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2903             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + (BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    2904             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2866            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    29052867            break;
    29062868        case 7:
    29072869            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    29082870            off = Bs3Cg1InsertOpcodes(pThis, off);
    2909             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2910             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2911             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + (BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    2912             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2871            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    29132872            break;
    29142873        default:
     
    29322891            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
    29332892            off = Bs3Cg1InsertOpcodes(pThis, off);
    2934             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2935             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2936             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2937             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2893            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    29382894            break;
    29392895        case 1:
    29402896            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0x8 /*~V*/, 1 /*L-ignored*/, 1 /*~R*/);
    29412897            off = Bs3Cg1InsertOpcodes(pThis, off);
    2942             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 1);
    2943             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 3;
    2944             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 7;
    2945             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2898            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 3, 1, 7);
    29462899            pThis->fInvalidEncoding = true;
    29472900            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
     
    29512904            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 0 /*~R*/);
    29522905            off = Bs3Cg1InsertOpcodes(pThis, off);
    2953             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 2);
    2954             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 11;
    2955             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 15;
    2956             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 2;
     2906            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 3+8, 2, 15);
    29572907            break;
    29582908#endif
     
    29602910            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    29612911            off = Bs3Cg1InsertOpcodes(pThis, off);
    2962             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2963             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2964             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2965             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2912            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    29662913            break;
    29672914        case 4:
    29682915            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L - ignored*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    29692916            off = Bs3Cg1InsertOpcodes(pThis, off);
    2970             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2971             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2972             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 0;
    2973             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2917            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 0);
    29742918            pThis->fInvalidEncoding = true;
    29752919            break;
     
    29772921            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xc /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W-ignored*/);
    29782922            off = Bs3Cg1InsertOpcodes(pThis, off);
    2979             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2980             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2981             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + 3;
    2982             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2923            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, 3);
    29832924            break;
    29842925        case 6:
    29852926            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W-ignored*/);
    29862927            off = Bs3Cg1InsertOpcodes(pThis, off);
    2987             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2988             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2989             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + (BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    2990             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2928            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    29912929            break;
    29922930        case 7:
    29932931            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    29942932            off = Bs3Cg1InsertOpcodes(pThis, off);
    2995             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 2, 1);
    2996             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 2;
    2997             pThis->aOperands[1            ].idxField = pThis->aOperands[1            ].idxFieldBase + (BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    2998             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 1;
     2933            off = Bs3Cg1InsertModRmWithRegFieldsAndVvvv(pThis, off, 2, 1, BS3CG1_IS_64BIT_TARGET(pThis) ? 15 : 7);
    29992934            break;
    30002935        default:
     
    35573492        /* 128-bit wide stuff goes first, then we'll update the operand widths afterwards. */
    35583493        case 0:
     3494            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    35593495            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
    35603496            off = Bs3Cg1InsertOpcodes(pThis, off);
    3561             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3562             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    3563             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3564             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     3497            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    35653498            break;
    35663499
     
    35683501            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    35693502            off = Bs3Cg1InsertOpcodes(pThis, off);
    3570             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3571             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3572             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3503            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    35733504            break;
    35743505        case 2:
    35753506            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored*/);
    35763507            off = Bs3Cg1InsertOpcodes(pThis, off);
    3577             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 5, 4);
    3578             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 4;
    3579             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 5;
     3508            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 5, 4);
    35803509            break;
    35813510        case 3:
     
    36113540        /* 128-bit invalid encodings: */
    36123541        case 8:
     3542            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    36133543            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xe /*~V*/, 0 /*L*/, 1 /*~R*/); /* Bad V value */
    36143544            off = Bs3Cg1InsertOpcodes(pThis, off);
    3615             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3616             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    3617             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3618             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     3545            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    36193546            pThis->fInvalidEncoding = true;
    36203547            break;
     
    36223549            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    36233550            off = Bs3Cg1InsertOpcodes(pThis, off);
    3624             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3625             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3626             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3551            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    36273552            pThis->fInvalidEncoding = true;
    36283553            iEncoding = 20-1;
     
    36583583            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/);
    36593584            off = Bs3Cg1InsertOpcodes(pThis, off);
    3660             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3661             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3662             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     3585            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    36633586            break;
    36643587
     
    36673590            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    36683591            off = Bs3Cg1InsertOpcodes(pThis, off);
    3669             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3670             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3671             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3592            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    36723593            break;
    36733594        case 2:
     
    36753596            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored*/);
    36763597            off = Bs3Cg1InsertOpcodes(pThis, off);
    3677             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 5, 4);
    3678             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 4;
    3679             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 5;
     3598            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 5, 4);
    36803599            break;
    36813600        case 3:
     
    37173636        case 8:
    37183637        case 28:
     3638            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    37193639            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xe /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/); /* Bad V value */
    37203640            off = Bs3Cg1InsertOpcodes(pThis, off);
    3721             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3722             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    3723             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3724             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     3641            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1, 0);
    37253642            pThis->fInvalidEncoding = true;
    37263643            break;
     
    37293646            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37303647            off = Bs3Cg1InsertOpcodes(pThis, off);
    3731             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3732             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3733             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3648            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    37343649            pThis->fInvalidEncoding = true;
    37353650            break;
     
    37403655            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37413656            off = Bs3Cg1InsertOpcodes(pThis, off);
    3742             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3743             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3744             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3657            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    37453658            pThis->fInvalidEncoding = true;
    37463659            break;
     
    37503663            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37513664            off = Bs3Cg1InsertOpcodes(pThis, off);
    3752             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3753             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3754             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3665            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    37553666            pThis->fInvalidEncoding = true;
    37563667            break;
     
    37603671            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37613672            off = Bs3Cg1InsertOpcodes(pThis, off);
    3762             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3763             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3764             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3673            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    37653674            pThis->fInvalidEncoding = true;
    37663675            break;
     
    37703679            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37713680            off = Bs3Cg1InsertOpcodes(pThis, off);
    3772             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3773             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3774             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
     3681            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 4, 5);
    37753682            pThis->fInvalidEncoding = true;
    37763683            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 2 + 4 : 0;
     
    37833690            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 0 /*~R*/);
    37843691            off = Bs3Cg1InsertOpcodes(pThis, off);
    3785             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 4);
    3786             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 4;
    3787             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 11;
     3692            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 3+8, 4);
    37883693            break;
    37893694        case 15:
     
    37913696            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 0 /*~R*/, 1 /*~X*/, 0 /*~B*/, 0 /*W*/);
    37923697            off = Bs3Cg1InsertOpcodes(pThis, off);
    3793             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 4);
    3794             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 12;
    3795             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 9;
     3698            off = Bs3Cg1InsertModRmWithRegFields(pThis, off, 1+8, 4+8);
    37963699            iEncoding += 4;
    37973700            break;
     
    64706373#if 0
    64716374    /* (for debugging) */
    6472     if (bMode != BS3_MODE_PP32)
     6375    if (bMode != BS3_MODE_LM64)
    64736376        return BS3TESTDOMODE_SKIPPED;
    64746377#endif
Note: See TracChangeset for help on using the changeset viewer.

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