VirtualBox

Ignore:
Timestamp:
May 25, 2017 10:39:07 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

    r67081 r67082  
    22332233
    22342234
    2235 static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_VsdZx_WO_Wsd__OR__MODRM_VqZx_WO_Wq(PBS3CG1STATE pThis,
    2236                                                                                                   unsigned iEncoding)
     2235static unsigned BS3_NEAR_CODE Bs3Cg1EncodeNext_MODRM_Vsomething_Wsomething_OR_ViceVersa(PBS3CG1STATE pThis, unsigned iEncoding)
    22372236{
    22382237    unsigned off;
    2239     if (iEncoding == 0)
    2240     {
    2241         off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2242         pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    2243         pThis->aOperands[pThis->iRmOp ].idxField = BS3CG1DST_XMM0_LO;
    2244         pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_XMM1_LO_ZX;
    2245     }
    2246     else if (iEncoding == 1)
    2247     {
    2248         pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_XMM2_LO_ZX;
    2249         off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2250         off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, 2 /*iReg*/, 8, 0, BS3CG1OPLOC_MEM);
    2251     }
    2252     else if (iEncoding == 2)
    2253     {
    2254         pThis->aOperands[pThis->iRegOp].idxField = BS3CG1DST_XMM3_LO_ZX;
    2255         off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
    2256         off = Bs3Cfg1EncodeMemMod0Disp(pThis, false, off, 3 /*iReg*/, 8, 1 /*cbMisalign*/, BS3CG1OPLOC_MEM);
    2257     }
    2258     else
    2259         return 0;
     2238    switch (iEncoding)
     2239    {
     2240        case 0:
     2241            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;
     2246            break;
     2247        case 1:
     2248            pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem;
     2249            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
     2250            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, off, 2 /*iReg*/);
     2251            break;
     2252        case 2:
     2253            off = Bs3Cg1InsertOpcodes(pThis, Bs3Cg1InsertReqPrefix(pThis, 0));
     2254            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaultsMisaligned(pThis, off, 3 /*iReg*/, 1 /*cbMisalign*/);
     2255            break;
     2256        default:
     2257            return 0;
     2258    }
    22602259    pThis->cbCurInstr = off;
    22612260    return iEncoding + 1;
     
    22792278            pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 7;
    22802279            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 6;
    2281             break;
     2280            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 1 : 0;
     2281            break;
     2282        case 2:
     2283            off = Bs3Cg1InsertReqPrefix(pThis, 0);
     2284            pThis->abCurInstr[off++] = REX_WRBX;
     2285            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;
     2289            break;
     2290
    22822291        default:
    22832292            return 0;
     
    39563965        case BS3CG1ENC_MODRM_VssZx_WO_Wss:
    39573966            return Bs3Cg1EncodeNext_MODRM_VssZx_WO_Wss(pThis, iEncoding);
    3958         case BS3CG1ENC_MODRM_VsdZx_WO_Wsd:
    3959         case BS3CG1ENC_MODRM_VqZx_WO_Wq:
    3960             return Bs3Cg1EncodeNext_MODRM_VsdZx_WO_Wsd__OR__MODRM_VqZx_WO_Wq(pThis, iEncoding);
    39613967
    39623968        case BS3CG1ENC_FIXED:
     
    43084314        case BS3CG1ENC_MODRM_VsdZx_WO_Wsd:
    43094315        case BS3CG1ENC_MODRM_VqZx_WO_Wq:
     4316            pThis->pfnEncoder        = Bs3Cg1EncodeNext_MODRM_Vsomething_Wsomething_OR_ViceVersa;
     4317            pThis->iRegOp            = 0;
    43104318            pThis->iRmOp             = 1;
    4311             pThis->iRegOp            = 0;
    43124319            pThis->aOperands[0].cbOp = 8;
    43134320            pThis->aOperands[1].cbOp = 8;
    4314             pThis->aOperands[0].enmLocation = BS3CG1OPLOC_CTX;
    4315             pThis->aOperands[1].enmLocation = BS3CG1OPLOC_CTX;
     4321            pThis->aOperands[0].enmLocation     = BS3CG1OPLOC_CTX;
     4322            pThis->aOperands[1].enmLocation     = BS3CG1OPLOC_CTX;
     4323            pThis->aOperands[1].enmLocationReg  = BS3CG1OPLOC_CTX;
     4324            pThis->aOperands[1].enmLocationMem  = BS3CG1OPLOC_MEM;
     4325            pThis->aOperands[0].idxFieldBase    = BS3CG1DST_XMM0_LO_ZX;
     4326            pThis->aOperands[1].idxFieldBase    = BS3CG1DST_XMM0_LO;
    43164327            break;
    43174328
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