VirtualBox

Changeset 67074 in vbox for trunk/src/VBox


Ignore:
Timestamp:
May 25, 2017 8:43:50 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

    r67073 r67074  
    36793679{
    36803680    unsigned off;
     3681
    36813682    switch (iEncoding)
    36823683    {
    3683         /* 128-bit wide stuff goes first, then we'll update the operand widths afterwards. */
     3684        case 20: /* switch to 256-bit */
     3685            pThis->aOperands[pThis->iRmOp ].cbOp         = 32;
     3686            pThis->aOperands[pThis->iRmOp ].idxFieldBase = BS3CG1DST_YMM0;
     3687            pThis->aOperands[pThis->iRegOp].cbOp         = 32;
     3688            pThis->aOperands[pThis->iRegOp].idxFieldBase = BS3CG1DST_YMM0;
     3689            /* fall thru */
    36843690        case 0:
    3685             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
     3691            pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
     3692            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/);
    36863693            off = Bs3Cg1InsertOpcodes(pThis, off);
    36873694            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3688             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    36893695            pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    36903696            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
     
    36923698
    36933699        case 1:
    3694             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3700        case 21:
     3701            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    36953702            off = Bs3Cg1InsertOpcodes(pThis, off);
    36963703            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    36993706            break;
    37003707        case 2:
    3701             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored*/);
     3708        case 22:
     3709            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored*/);
    37023710            off = Bs3Cg1InsertOpcodes(pThis, off);
    37033711            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 5, 4);
     
    37063714            break;
    37073715        case 3:
     3716        case 23:
    37083717            pThis->aOperands[pThis->iRmOp].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem;
    3709             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
     3718            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/);
    37103719            off = Bs3Cg1InsertOpcodes(pThis, off);
    37113720            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 2 /*iReg*/, 0);
    37123721            break;
    37133722        case 4:
    3714             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3723        case 24:
     3724            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37153725            off = Bs3Cg1InsertOpcodes(pThis, off);
    37163726            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 0);
    37173727            break;
    37183728        case 5:
    3719             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored */);
     3729        case 25:
     3730            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored */);
    37203731            off = Bs3Cg1InsertOpcodes(pThis, off);
    37213732            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 0);
    37223733            break;
    37233734        case 6:
    3724             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/);
     3735        case 26:
     3736            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/);
    37253737            off = Bs3Cg1InsertOpcodes(pThis, off);
    37263738            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 1 /*cbMisalign*/);
     
    37293741            break;
    37303742        case 7:
    3731             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3743        case 27:
     3744            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37323745            off = Bs3Cg1InsertOpcodes(pThis, off);
    37333746            off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 1 /*cbMisalign*/);
     
    37353748                pThis->bAlignmentXcpt = X86_XCPT_GP;
    37363749            break;
    3737         /* 128-bit invalid encodings: */
     3750        /* invalid encodings: */
    37383751        case 8:
    3739             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xe /*~V*/, 0 /*L*/, 1 /*~R*/); /* Bad V value */
     3752        case 28:
     3753            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xe /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/); /* Bad V value */
    37403754            off = Bs3Cg1InsertOpcodes(pThis, off);
    37413755            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
     
    37463760            break;
    37473761        case 9:
    3748             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, 0 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3762        case 29:
     3763            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    37493764            off = Bs3Cg1InsertOpcodes(pThis, off);
    37503765            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    37523767            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
    37533768            pThis->fInvalidEncoding = true;
    3754             iEncoding = 20-1;
    3755             break;
    3756 
    3757         case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: case 18: case 19:
    3758             /* fall thru */
    3759 
    3760             /* 256-bit encodings: */
    3761         case 20:
    3762             iEncoding = 20;
    3763             pThis->aOperands[pThis->iRmOp ].cbOp         = 32;
    3764             pThis->aOperands[pThis->iRmOp ].idxFieldBase = BS3CG1DST_YMM0;
    3765             pThis->aOperands[pThis->iRmOp ].enmLocation  = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    3766             pThis->aOperands[pThis->iRegOp].cbOp         = 32;
    3767             pThis->aOperands[pThis->iRegOp].idxFieldBase = BS3CG1DST_YMM0;
    3768 
    3769             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/);
    3770             off = Bs3Cg1InsertOpcodes(pThis, off);
    3771             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3772             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3773             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
    3774             break;
    3775         case 21:
    3776             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    3777             off = Bs3Cg1InsertOpcodes(pThis, off);
    3778             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3779             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3780             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
    3781             break;
    3782         case 22:
    3783             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored*/);
    3784             off = Bs3Cg1InsertOpcodes(pThis, off);
    3785             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 5, 4);
    3786             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 4;
    3787             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 5;
    3788             break;
    3789         case 23:
    3790             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/);
    3791             off = Bs3Cg1InsertOpcodes(pThis, off);
    3792             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationMem;
    3793             off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 2 /*iReg*/, 0);
    3794             break;
    3795         case 24:
    3796             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    3797             off = Bs3Cg1InsertOpcodes(pThis, off);
    3798             off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 0);
    3799             break;
    3800         case 25:
    3801             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 1 /*W - ignored */);
    3802             off = Bs3Cg1InsertOpcodes(pThis, off);
    3803             off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 0);
    3804             break;
    3805         case 26:
    3806             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/);
    3807             off = Bs3Cg1InsertOpcodes(pThis, off);
    3808             off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 1 /*cbMisalign*/);
    3809             if (!Bs3Cg1XcptTypeIsVexUnaligned(pThis->enmXcptType))
    3810                 pThis->bAlignmentXcpt = X86_XCPT_GP;
    3811             break;
    3812         case 27:
    3813             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    3814             off = Bs3Cg1InsertOpcodes(pThis, off);
    3815             off = Bs3Cfg1EncodeMemMod0DispWithRegFieldAndDefaults(pThis, false, off, 3 /*iReg*/, 1 /*cbMisalign*/);
    3816             if (!Bs3Cg1XcptTypeIsVexUnaligned(pThis->enmXcptType))
    3817                 pThis->bAlignmentXcpt = X86_XCPT_GP;
    3818             break;
    3819         /* 256-bit invalid encodings: */
    3820         case 28:
    3821             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xe /*~V - invalid */, 1 /*L*/, 1 /*~R*/); /* Bad V value */
    3822             off = Bs3Cg1InsertOpcodes(pThis, off);
    3823             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 0);
    3824             pThis->aOperands[pThis->iRmOp ].enmLocation = pThis->aOperands[pThis->iRmOp].enmLocationReg;
    3825             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 0;
    3826             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 1;
    3827             pThis->fInvalidEncoding = true;
    3828             break;
    3829         case 29:
    3830             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0 /*~V - invalid */, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3769            break;
     3770
     3771        case 10:
     3772        case 30:
     3773            pThis->abCurInstr[0] = P_RN;
     3774            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    38313775            off = Bs3Cg1InsertOpcodes(pThis, off);
    38323776            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    38353779            pThis->fInvalidEncoding = true;
    38363780            break;
    3837         case 30:
    3838             pThis->abCurInstr[0] = P_RN;
    3839             off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3781        case 11:
     3782        case 31:
     3783            pThis->abCurInstr[0] = P_RZ;
     3784            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    38403785            off = Bs3Cg1InsertOpcodes(pThis, off);
    38413786            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    38443789            pThis->fInvalidEncoding = true;
    38453790            break;
    3846         case 31:
    3847             pThis->abCurInstr[0] = P_RZ;
    3848             off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3791        case 12:
     3792        case 32:
     3793            pThis->abCurInstr[0] = P_OZ;
     3794            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    38493795            off = Bs3Cg1InsertOpcodes(pThis, off);
    38503796            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    38533799            pThis->fInvalidEncoding = true;
    38543800            break;
    3855         case 32:
    3856             pThis->abCurInstr[0] = P_OZ;
    3857             off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
     3801        case 13:
     3802        case 33:
     3803            pThis->abCurInstr[0] = P_LK;
     3804            off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    38583805            off = Bs3Cg1InsertOpcodes(pThis, off);
    38593806            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
     
    38613808            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
    38623809            pThis->fInvalidEncoding = true;
    3863             break;
    3864         case 33:
    3865             pThis->abCurInstr[0] = P_LK;
    3866             off = Bs3Cg1InsertVex3bPrefix(pThis, 1 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 1 /*~R*/, 1 /*~X*/, 1 /*~B*/, 0 /*W*/);
    3867             off = Bs3Cg1InsertOpcodes(pThis, off);
    3868             pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 4, 5);
    3869             pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 5;
    3870             pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 4;
    3871             pThis->fInvalidEncoding = true;
    3872             iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 2 : 0;
     3810            iEncoding += !BS3CG1_IS_64BIT_TARGET(pThis) ? 2 + 4 : 0;
    38733811            break;
    38743812
    38753813#if ARCH_BITS == 64
    38763814        /* 64-bit mode registers */
     3815        case 14:
    38773816        case 34:
    3878             off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 0 /*~R*/);
     3817            off = Bs3Cg1InsertVex2bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 0 /*~R*/);
    38793818            off = Bs3Cg1InsertOpcodes(pThis, off);
    38803819            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 3, 4);
     
    38823821            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 11;
    38833822            break;
     3823        case 15:
    38843824        case 35:
    3885             off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, 1 /*L*/, 0 /*~R*/, 1 /*~X*/, 0 /*~B*/, 0 /*W*/);
     3825            off = Bs3Cg1InsertVex3bPrefix(pThis, 0 /*offDst*/, 0xf /*~V*/, iEncoding >= 20 /*L*/, 0 /*~R*/, 1 /*~X*/, 0 /*~B*/, 0 /*W*/);
    38863826            off = Bs3Cg1InsertOpcodes(pThis, off);
    38873827            pThis->abCurInstr[off++] = X86_MODRM_MAKE(3, 1, 4);
    38883828            pThis->aOperands[pThis->iRmOp ].idxField = pThis->aOperands[pThis->iRmOp ].idxFieldBase + 12;
    38893829            pThis->aOperands[pThis->iRegOp].idxField = pThis->aOperands[pThis->iRegOp].idxFieldBase + 9;
     3830            iEncoding += 4;
    38903831            break;
    38913832#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