Пример #1
0
            private void CreateTwobyteDecoders(Decoder [] d)
            {
                var reservedNop = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);

                // 0F 00
                d[0x00] = new GroupDecoder(Grp6);
                d[0x01] = new GroupDecoder(Grp7);
                d[0x02] = Instr(Mnemonic.lar, InstrClass.System, Gv, Ew);
                d[0x03] = Instr(Mnemonic.lsl, InstrClass.System, Gv, Ew);
                d[0x04] = s_invalid;
                d[0x05] = Amd64Instr(
                    s_invalid,
                    Instr(Mnemonic.syscall, InstrClass.Transfer | InstrClass.Call));
                d[0x06] = Instr(Mnemonic.clts);
                d[0x07] = Amd64Instr(
                    s_invalid,
                    Instr(Mnemonic.sysret, InstrClass.Transfer));

                d[0x08] = Instr(Mnemonic.invd, InstrClass.System);
                d[0x09] = Instr(Mnemonic.wbinvd, InstrClass.System);
                d[0x0A] = s_invalid;
                d[0x0B] = Instr(Mnemonic.ud2, InstrClass.Invalid);
                d[0x0C] = s_invalid;
                d[0x0D] = Instr(Mnemonic.prefetchw, Ev);
                d[0x0E] = Instr(Mnemonic.femms); // AMD-specific
                d[0x0F] = s_invalid;             // nyi("AMD 3D-Now instructions"); //$TODO: this requires adding separate processor model for AMD

                // 0F 10
                d[0x10] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movups, Mnemonic.vmovups, Vps, Wps),
                    VexInstr(Mnemonic.movupd, Mnemonic.vmovupd, Vpd, Wpd),
                    VexInstr(Mnemonic.movss, Mnemonic.vmovss, Vx, Wss),
                    VexInstr(Mnemonic.movsd, Mnemonic.vmovsd, Vx, Wsd));
                d[0x11] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movups, Mnemonic.vmovups, Wps, Vps),
                    VexInstr(Mnemonic.movupd, Mnemonic.vmovupd, Wpd, Vpd),
                    VexInstr(Mnemonic.movss, Mnemonic.vmovss, Wss, Vss),
                    VexInstr(Mnemonic.movsd, Mnemonic.vmovsd, Wsd, Vsd));
                d[0x12] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movlps, Mnemonic.vmovlps, Vq, Hq, Mq),
                    VexInstr(Mnemonic.movlpd, Mnemonic.vmovlpd, Vq, Hq, Mq),
                    VexInstr(Mnemonic.movsldup, Mnemonic.vmovsldup, Vx, Wx),
                    VexInstr(Mnemonic.movddup, Mnemonic.vmovddup, Vx, Wx));
                d[0x13] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movlps, Mnemonic.vmovlps, Mq, Vq),
                    dec66: VexInstr(Mnemonic.movlpd, Mnemonic.vmovlpd, Mq, Vq));

                d[0x14] = new PrefixedDecoder(
                    VexInstr(Mnemonic.unpcklps, Mnemonic.vunpcklps, Vx, Hx, Wx),
                    VexInstr(Mnemonic.unpcklpd, Mnemonic.vunpcklpd, Vx, Hx, Wx));
                d[0x15] = new PrefixedDecoder(
                    VexInstr(Mnemonic.unpckhps, Mnemonic.vunpckhps, Vx, Hx, Wx),
                    VexInstr(Mnemonic.unpckhpd, Mnemonic.vunpckhpd, Vx, Hx, Wx));
                d[0x16] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movlhps, Mnemonic.vmovlhps, Vx, Wx),
                    VexInstr(Mnemonic.movhpd, Mnemonic.vmovhpd, Vx, Wx),
                    VexInstr(Mnemonic.movshdup, Mnemonic.vmovshdup, Vx, Wx));
                d[0x17] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movhps, Mnemonic.vmovhps, Mq, Vq),
                    VexInstr(Mnemonic.movhpd, Mnemonic.vmovhpd, Mq, Vq));

                d[0x18] = new GroupDecoder(Grp16);
                d[0x19] = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);
                d[0x1A] = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);
                d[0x1B] = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);

                d[0x1C] = Instr(Mnemonic.cldemote, Eb);
                d[0x1D] = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);
                d[0x1E] = new PrefixedDecoder(
                    dec: reservedNop,
                    dec66: reservedNop,
                    decF3: new ModRmOpcodeDecoder(
                        reservedNop,
                        (0xFA, Instr(Mnemonic.endbr64, InstrClass.Linear)),
                        (0xFB, Instr(Mnemonic.endbr32, InstrClass.Linear))),
                    decF2: reservedNop,
                    decWide: reservedNop,
                    dec66Wide: reservedNop);
                d[0x1F] = Instr(Mnemonic.nop, InstrClass.Linear | InstrClass.Padding, Ev);

                // 0F 20
                d[0x20] = Amd64Instr(
                    Instr(Mnemonic.mov, Rd, Cd),
                    Instr(Mnemonic.mov, Rq, Cd));
                d[0x21] = Amd64Instr(
                    Instr(Mnemonic.mov, Rd, Dd),
                    Instr(Mnemonic.mov, Rq, Dd));
                d[0x22] = Amd64Instr(
                    Instr(Mnemonic.mov, Cd, Rd),
                    Instr(Mnemonic.mov, Cd, Rq));
                d[0x23] = Amd64Instr(
                    Instr(Mnemonic.mov, Dd, Rd),
                    Instr(Mnemonic.mov, Dd, Rq));
                d[0x24] = s_invalid;
                d[0x25] = s_invalid;
                d[0x26] = s_invalid;
                d[0x27] = s_invalid;

                d[0x28] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.movaps, Mnemonic.vmovaps, Vps, Wps),
                    dec66: VexInstr(Mnemonic.movapd, Mnemonic.vmovapd, Vpd, Wpd));
                d[0x29] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.movaps, Mnemonic.vmovaps, Wps, Vps),
                    dec66: VexInstr(Mnemonic.movapd, Mnemonic.vmovapd, Wpd, Vpd));
                d[0x2A] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cvtpi2ps, Mnemonic.vcvtpi2ps, Vps, Qpi),
                    dec66: VexInstr(Mnemonic.cvtpi2pd, Mnemonic.vcvtpi2pd, Vpd, Qpi),
                    decF3: VexInstr(Mnemonic.cvtsi2ss, Mnemonic.vcvtsi2ss, Vss, Hss, Ey),
                    decF2: VexInstr(Mnemonic.cvtsi2sd, Mnemonic.vcvtsi2sd, Vsd, Hsd, Ey));
                d[0x2B] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.movntps, Mnemonic.vmovntps, Mps, Vps),
                    dec66: VexInstr(Mnemonic.movntpd, Mnemonic.vmovntpd, Mpd, Vpd));

                d[0x2C] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cvttps2pi, Mnemonic.vcvttps2pi, Ppi, Wps),
                    dec66: VexInstr(Mnemonic.cvttpd2pi, Mnemonic.vcvttpd2pi, Ppi, Wpd),
                    decF3: VexInstr(Mnemonic.cvttss2si, Mnemonic.vcvttss2si, Gd, Wss),
                    decF2: VexInstr(Mnemonic.cvttsd2si, Mnemonic.vcvttsd2si, Gd, Wsd));
                d[0x2D] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cvtps2pi, Mnemonic.vcvtps2pi, Ppi, Wps),
                    dec66: VexInstr(Mnemonic.cvtpd2si, Mnemonic.vcvtpd2si, Qpi, Wpd),
                    decF3: VexInstr(Mnemonic.cvtss2si, Mnemonic.vcvtss2si, Gy, Wss),
                    decF2: VexInstr(Mnemonic.cvtsd2si, Mnemonic.vcvtsd2si, Gy, Wsd));
                d[0x2E] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.ucomiss, Mnemonic.vucomiss, Vss, Wss),
                    dec66: VexInstr(Mnemonic.ucomisd, Mnemonic.vucomisd, Vsd, Wsd));
                d[0x2F] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.comiss, Mnemonic.vcomiss, Vss, Wss),
                    dec66: VexInstr(Mnemonic.comisd, Mnemonic.vcomisd, Vsd, Wsd));

                // 0F 30
                d[0x30] = Instr(Mnemonic.wrmsr, InstrClass.System);
                d[0x31] = Instr(Mnemonic.rdtsc);
                d[0x32] = Instr(Mnemonic.rdmsr, InstrClass.System);
                d[0x33] = Instr(Mnemonic.rdpmc);
                d[0x34] = Instr(Mnemonic.sysenter);
                d[0x35] = Instr(Mnemonic.sysexit, InstrClass.Transfer);
                d[0x36] = s_invalid;
                d[0x37] = Instr(Mnemonic.getsec, InstrClass.System);

                d[0x38] = new AdditionalByteDecoder(s_decoders0F38); // 0F 38
                d[0x39] = s_invalid;
                d[0x3A] = new AdditionalByteDecoder(s_decoders0F3A); // 0F 3A
                d[0x3B] = s_invalid;
                d[0x3C] = s_invalid;
                d[0x3D] = s_invalid;
                d[0x3E] = s_invalid;
                d[0x3F] = s_invalid;

                // 0F 40
                d[0x40] = Instr(Mnemonic.cmovo, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x41] = Instr(Mnemonic.cmovno, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x42] = Instr(Mnemonic.cmovc, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x43] = Instr(Mnemonic.cmovnc, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x44] = Instr(Mnemonic.cmovz, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x45] = Instr(Mnemonic.cmovnz, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x46] = Instr(Mnemonic.cmovbe, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x47] = Instr(Mnemonic.cmova, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);

                d[0x48] = Instr(Mnemonic.cmovs, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x49] = Instr(Mnemonic.cmovns, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4A] = Instr(Mnemonic.cmovpe, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4B] = Instr(Mnemonic.cmovpo, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4C] = Instr(Mnemonic.cmovl, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4D] = Instr(Mnemonic.cmovge, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4E] = Instr(Mnemonic.cmovle, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);
                d[0x4F] = Instr(Mnemonic.cmovg, InstrClass.Linear | InstrClass.Conditional, Gv, Ev);

                // 0F 50
                d[0x50] = new PrefixedDecoder(
                    VexInstr(Mnemonic.movmskps, Mnemonic.vmovmskps, Gy, Ups),
                    VexInstr(Mnemonic.movmskpd, Mnemonic.vmovmskpd, Gy, Upd));
                d[0x51] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.sqrtps, Mnemonic.vsqrtps, Vps, Wps),
                    dec66: VexInstr(Mnemonic.sqrtpd, Mnemonic.vsqrtpd, Vpd, Wpd),
                    decF3: VexInstr(Mnemonic.sqrtss, Mnemonic.vsqrtss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.sqrtsd, Mnemonic.vsqrtsd, Vsd, Hsd, Wsd));
                d[0x52] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.rsqrtps, Mnemonic.vrsqrtps, Vps, Wps),
                    dec66: s_invalid,
                    decF3: VexInstr(Mnemonic.rsqrtss, Mnemonic.vrsqrtss, Vss, Hss, Wss),
                    decF2: s_invalid);
                d[0x53] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.rcpps, Mnemonic.vrcpps, Vps, Wps),
                    dec66: s_invalid,
                    decF3: VexInstr(Mnemonic.rcpss, Mnemonic.vrcpss, Vss, Hss, Wss),
                    decF2: s_invalid);

                d[0x54] = new PrefixedDecoder(
                    dec: VexInstr(Mnemonic.andps, Mnemonic.vandps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.andpd, Mnemonic.vandpd, Vpd, Hpd, Wpd));
                d[0x55] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.andnps, Mnemonic.vandnps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.andnpd, Mnemonic.vandnpd, Vpd, Hpd, Wpd));
                d[0x56] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.orps, Mnemonic.vorps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.orpd, Mnemonic.vorpd, Vpd, Hpd, Wpd));
                d[0x57] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.xorps, Mnemonic.vxorps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.xorpd, Mnemonic.vxorpd, Vpd, Hpd, Wpd));

                d[0x58] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.addps, Mnemonic.vaddps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.addpd, Mnemonic.vaddpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.addss, Mnemonic.vaddss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.addsd, Mnemonic.vaddsd, Vsd, Hsd, Wsd));
                d[0x59] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.mulps, Mnemonic.vmulps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.mulpd, Mnemonic.vmulpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.mulss, Mnemonic.vmulss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.mulsd, Mnemonic.vmulsd, Vsd, Hsd, Wsd));
                d[0x5A] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cvtps2pd, Mnemonic.vcvtps2pd, Vpd, Wps),
                    dec66: VexInstr(Mnemonic.cvtpd2ps, Mnemonic.vcvtpd2ps, Vps, Wpd),
                    decF3: VexInstr(Mnemonic.cvtss2sd, Mnemonic.vcvtss2sd, Vsd, Hx, Wss),
                    decF2: VexInstr(Mnemonic.cvtsd2ss, Mnemonic.vcvtsd2ss, Vss, Hx, Wsd));
                d[0x5B] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cvtdq2ps, Mnemonic.vcvtdq2ps, Vps, Wdq),
                    dec66: VexInstr(Mnemonic.cvtps2dq, Mnemonic.vcvtps2dq, Vdq, Wps),
                    decF3: VexInstr(Mnemonic.cvttps2dq, Mnemonic.vcvttps2dq, Vdq, Wps),
                    decF2: s_invalid);
                d[0x5C] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.subps, Mnemonic.vsubps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.subpd, Mnemonic.vsubpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.subss, Mnemonic.vsubss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.subsd, Mnemonic.vsubsd, Vsd, Hsd, Wsd));
                d[0x5D] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.minps, Mnemonic.vminps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.minpd, Mnemonic.vminpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.minss, Mnemonic.vminss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.minsd, Mnemonic.vminsd, Vsd, Hsd, Wsd));
                d[0x5E] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.divps, Mnemonic.vdivps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.divpd, Mnemonic.vdivpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.divss, Mnemonic.vdivss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.divsd, Mnemonic.vdivsd, Vsd, Hsd, Wsd));
                d[0x5F] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.maxps, Mnemonic.vmaxps, Vps, Hps, Wps),
                    dec66: VexInstr(Mnemonic.maxpd, Mnemonic.vmaxpd, Vpd, Hpd, Wpd),
                    decF3: VexInstr(Mnemonic.maxss, Mnemonic.vmaxss, Vss, Hss, Wss),
                    decF2: VexInstr(Mnemonic.maxsd, Mnemonic.vmaxsd, Vsd, Hsd, Wsd));

                // 0F 60
                d[0x60] = new PrefixedDecoder(
                    Instr(Mnemonic.punpcklbw, Pq, Qd),
                    dec66: VexInstr(Mnemonic.punpcklbw, Mnemonic.vpunpcklbw, Vx, Wx));
                d[0x61] = new PrefixedDecoder(
                    Instr(Mnemonic.punpcklwd, Pq, Qd),
                    VexInstr(Mnemonic.punpcklwd, Mnemonic.vpunpcklwd, Vx, Wx));
                d[0x62] = new PrefixedDecoder(
                    Instr(Mnemonic.punpckldq, Pq, Qd),
                    VexInstr(Mnemonic.punpckldq, Mnemonic.vpunpckldq, Vx, Hx, Wx));
                d[0x63] = new PrefixedDecoder(
                    Instr(Mnemonic.packsswb, Pq, Qd),
                    VexInstr(Mnemonic.packsswb, Mnemonic.vpacksswb, Vx, Hx, Wx));

                d[0x64] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpgtb, Pq, Qd),
                    VexInstr(Mnemonic.pcmpgtb, Mnemonic.vpcmpgtb, Vx, Hx, Wx));
                d[0x65] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpgtw, Pq, Qd),
                    VexInstr(Mnemonic.pcmpgtw, Mnemonic.vpcmpgtw, Vx, Hx, Wx));
                d[0x66] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpgtd, Pq, Qd),
                    VexInstr(Mnemonic.pcmpgtd, Mnemonic.vpcmpgtd, Vx, Hx, Wx));
                d[0x67] = new PrefixedDecoder(
                    Instr(Mnemonic.packuswb, Pq, Qd),
                    VexInstr(Mnemonic.punpckhbw, Mnemonic.vpunpckhbw, Vx, Hx, Wx));

                d[0x68] = new PrefixedDecoder(
                    Instr(Mnemonic.punpckhbw, Pq, Qd),
                    VexInstr(Mnemonic.punpckhbw, Mnemonic.vpunpckhbw, Vx, Hx, Wx));
                d[0x69] = new PrefixedDecoder(
                    VexInstr(Mnemonic.punpckhwd, Mnemonic.vpunpckhwd, Pq, Qd),
                    VexInstr(Mnemonic.punpckhwd, Mnemonic.vpunpckhwd, Vx, Hx, Wx));
                d[0x6A] = new PrefixedDecoder(
                    VexInstr(Mnemonic.punpckhdq, Mnemonic.vpunpckhdq, Pq, Qd),
                    VexInstr(Mnemonic.punpckhdq, Mnemonic.vpunpckhdq, Vx, Hx, Wx));
                d[0x6B] = new PrefixedDecoder(
                    VexInstr(Mnemonic.packssdw, Mnemonic.vpackssdw, Pq, Qd),
                    VexInstr(Mnemonic.packssdw, Mnemonic.vpackssdw, Vx, Hx, Wx));

                d[0x6C] = new PrefixedDecoder(
                    s_invalid,
                    VexInstr(Mnemonic.punpcklqdq, Mnemonic.vpunpcklqdq, Vx, Hx, Wx));
                d[0x6D] = new PrefixedDecoder(
                    s_invalid,
                    VexInstr(Mnemonic.punpckhqdq, Mnemonic.vpunpckhqdq, Vx, Hx, Wx));
                d[0x6E] = new PrefixedDecoder(
                    Instr(Mnemonic.movd, Py, Ey),
                    dec66: VexInstr(Mnemonic.movd, Mnemonic.vmovd, Vy, Ey));
                d[0x6F] = new PrefixedDecoder(
                    Instr(Mnemonic.movq, Pq, Qq),
                    dec66: VexInstr(Mnemonic.movdqa, Mnemonic.vmovdqa, Vx, Wx),
                    decF3: VexInstr(Mnemonic.movdqu, Mnemonic.vmovdqu, Vx, Wx));

                // 0F 70
                d[0x70] = new PrefixedDecoder(
                    Instr(Mnemonic.pshufw, Pq, Qq, Ib),
                    dec66: VexInstr(Mnemonic.pshufd, Mnemonic.vpshufd, Vx, Wx, Ib),
                    decF3: VexInstr(Mnemonic.pshufhw, Mnemonic.vpshufhw, Vx, Wx, Ib),
                    decF2: VexInstr(Mnemonic.pshuflw, Mnemonic.vpshuflw, Vx, Wx, Ib));
                d[0x71] = new GroupDecoder(Grp12);
                d[0x72] = new GroupDecoder(Grp13);
                d[0x73] = new GroupDecoder(Grp14);

                d[0x74] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpeqb, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pcmpeqb, Mnemonic.vpcmpeqb, Vx, Wx));
                d[0x75] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpeqw, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pcmpeqw, Mnemonic.vpcmpeqw, Vx, Wx));
                d[0x76] = new PrefixedDecoder(
                    Instr(Mnemonic.pcmpeqd, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pcmpeqd, Mnemonic.vpcmpeqd, Vx, Wx));
                d[0x77] = VexInstr(
                    Instr(Mnemonic.emms, InstrClass.System),
                    VexLong(
                        Instr(Mnemonic.vzeroupper),
                        Instr(Mnemonic.vzeroall)));

                d[0x78] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.vmread, InstrClass.System, Ey, Gy));
                d[0x79] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.vmwrite, InstrClass.System, Gy, Ey));
                d[0x7A] = s_invalid;
                d[0x7B] = s_invalid;

                d[0x7C] = new PrefixedDecoder(
                    dec: s_invalid,
                    dec66: VexInstr(Mnemonic.haddpd, Mnemonic.vhaddpd, Vpd, Hpd, Wpd),
                    decF2: VexInstr(Mnemonic.haddps, Mnemonic.vhaddps, Vps, Hps, Wps));
                d[0x7D] = new PrefixedDecoder(
                    dec: s_invalid,
                    dec66: VexInstr(Mnemonic.hsubpd, Mnemonic.vhsubpd, Vpd, Hpd, Wpd),
                    decF2: VexInstr(Mnemonic.hsubps, Mnemonic.vhsubps, Vps, Hps, Wps));
                d[0x7E] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.movd, Ey, Pd),
                    decWide: Instr(Mnemonic.movq, Ey, Pd),
                    dec66: VexInstr(Mnemonic.movd, Mnemonic.vmovd, Ey, Vy),
                    dec66Wide: VexInstr(Mnemonic.movq, Mnemonic.vmovq, Ey, Vy),
                    decF3: VexInstr(Mnemonic.movq, Mnemonic.vmovq, Vy, Wy));
                d[0x7F] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.movq, Qq, Pq),
                    dec66: VexInstr(Mnemonic.movdqa, Mnemonic.vmovdqa, Wx, Vx),
                    decF3: VexInstr(Mnemonic.movdqu, Mnemonic.vmovdqu, Wx, Vx));

                // 0F 80
                d[0x80] = Instr(Mnemonic.jo, InstrClass.ConditionalTransfer, Jv);
                d[0x81] = Instr(Mnemonic.jno, InstrClass.ConditionalTransfer, Jv);
                d[0x82] = Instr(Mnemonic.jc, InstrClass.ConditionalTransfer, Jv);
                d[0x83] = Instr(Mnemonic.jnc, InstrClass.ConditionalTransfer, Jv);
                d[0x84] = Instr(Mnemonic.jz, InstrClass.ConditionalTransfer, Jv);
                d[0x85] = Instr(Mnemonic.jnz, InstrClass.ConditionalTransfer, Jv);
                d[0x86] = Instr(Mnemonic.jbe, InstrClass.ConditionalTransfer, Jv);
                d[0x87] = Instr(Mnemonic.ja, InstrClass.ConditionalTransfer, Jv);

                d[0x88] = Instr(Mnemonic.js, InstrClass.ConditionalTransfer, Jv);
                d[0x89] = Instr(Mnemonic.jns, InstrClass.ConditionalTransfer, Jv);
                d[0x8A] = Instr(Mnemonic.jpe, InstrClass.ConditionalTransfer, Jv);
                d[0x8B] = Instr(Mnemonic.jpo, InstrClass.ConditionalTransfer, Jv);
                d[0x8C] = Instr(Mnemonic.jl, InstrClass.ConditionalTransfer, Jv);
                d[0x8D] = Instr(Mnemonic.jge, InstrClass.ConditionalTransfer, Jv);
                d[0x8E] = Instr(Mnemonic.jle, InstrClass.ConditionalTransfer, Jv);
                d[0x8F] = Instr(Mnemonic.jg, InstrClass.ConditionalTransfer, Jv);

                // 0F 90
                d[0x90] = Instr(Mnemonic.seto, Eb);
                d[0x91] = Instr(Mnemonic.setno, Eb);
                d[0x92] = Instr(Mnemonic.setc, Eb);
                d[0x93] = Instr(Mnemonic.setnc, Eb);
                d[0x94] = Instr(Mnemonic.setz, Eb);
                d[0x95] = Instr(Mnemonic.setnz, Eb);
                d[0x96] = Instr(Mnemonic.setbe, Eb);
                d[0x97] = Instr(Mnemonic.seta, Eb);

                d[0x98] = Instr(Mnemonic.sets, Eb);
                d[0x99] = Instr(Mnemonic.setns, Eb);
                d[0x9A] = Instr(Mnemonic.setpe, Eb);
                d[0x9B] = Instr(Mnemonic.setpo, Eb);
                d[0x9C] = Instr(Mnemonic.setl, Eb);
                d[0x9D] = Instr(Mnemonic.setge, Eb);
                d[0x9E] = Instr(Mnemonic.setle, Eb);
                d[0x9F] = Instr(Mnemonic.setg, Eb);

                // 0F A0
                d[0xA0] = Instr(Mnemonic.push, s4);
                d[0xA1] = Instr(Mnemonic.pop, s4);
                d[0xA2] = Instr(Mnemonic.cpuid);
                d[0xA3] = Instr(Mnemonic.bt, Ev, Gv);
                d[0xA4] = Instr(Mnemonic.shld, Ev, Gv, Ib);
                d[0xA5] = Instr(Mnemonic.shld, Ev, Gv, c);
                d[0xA6] = s_invalid;
                d[0xA7] = s_invalid;

                d[0xA8] = Instr(Mnemonic.push, s5);
                d[0xA9] = Instr(Mnemonic.pop, s5);
                d[0xAA] = Instr(Mnemonic.rsm, InstrClass.System);
                d[0xAB] = Instr(Mnemonic.bts, Ev, Gv);
                d[0xAC] = Instr(Mnemonic.shrd, Ev, Gv, Ib);
                d[0xAD] = Instr(Mnemonic.shrd, Ev, Gv, c);
                d[0xAE] = new GroupDecoder(Grp15);
                d[0xAF] = Instr(Mnemonic.imul, Gv, Ev);

                // 0F B0
                d[0xB0] = Instr(Mnemonic.cmpxchg, Eb, Gb);
                d[0xB1] = Instr(Mnemonic.cmpxchg, Ev, Gv);
                d[0xB2] = Instr(Mnemonic.lss, Gv, Mp);
                d[0xB3] = Instr(Mnemonic.btr, Ev, Gv);
                d[0xB4] = Instr(Mnemonic.lfs, Gv, Mp);
                d[0xB5] = Instr(Mnemonic.lgs, Gv, Mp);
                d[0xB6] = Instr(Mnemonic.movzx, Gv, Eb);
                d[0xB7] = Instr(Mnemonic.movzx, Gv, Ew);

                d[0xB8] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.jmpe),
                    decF3: Instr(Mnemonic.popcnt, Gv, Ev));
                d[0xB9] = new GroupDecoder(Grp10, Gv, Ev);
                d[0xBA] = new GroupDecoder(Grp8, Ev, Ib);
                d[0xBB] = Instr(Mnemonic.btc, Gv, Ev);

                d[0xBC] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.bsf, Gv, Ev),
                    dec66: Instr(Mnemonic.bsf, Gw, Ew),
                    decF3: Instr(Mnemonic.tzcnt, Gv, Ev));
                d[0xBD] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.bsr, Gv, Ev),
                    dec66: Instr(Mnemonic.bsr, Gw, Ew),
                    decF3: Instr(Mnemonic.lzcnt, Gv, Ev));
                d[0xBE] = Instr(Mnemonic.movsx, Gv, Eb);
                d[0xBF] = Instr(Mnemonic.movsx, Gv, Ew);

                // 0F C0
                d[0xC0] = Instr(Mnemonic.xadd, Eb, Gb);
                d[0xC1] = Instr(Mnemonic.xadd, Ev, Gv);
                d[0xC2] = new PrefixedDecoder(
                    dec:  VexInstr(Mnemonic.cmpps, Mnemonic.vcmpps, Vps, Hps, Wps, Ib),
                    dec66: VexInstr(Mnemonic.cmppd, Mnemonic.vcmppd, Vpd, Hpd, Wpd, Ib),
                    decF3: VexInstr(Mnemonic.cmpss, Mnemonic.vcmpss, Vss, Hss, Wss, Ib),
                    decF2: VexInstr(Mnemonic.cmpsd, Mnemonic.vcmpsd, Vpd, Hpd, Wpd, Ib));
                d[0xC3] = new PrefixedDecoder(
                    Instr(Mnemonic.movnti, My, Gy),
                    s_invalid);
                d[0xC4] = new PrefixedDecoder(
                    VexInstr(Mnemonic.pinsrw, Mnemonic.vpinsrw, Pq, Ry),     //$TODO: encoding is weird.
                    VexInstr(Mnemonic.pinsrw, Mnemonic.vpinsrw, Vdq, Hdq, Ry));
                d[0xC5] = new PrefixedDecoder(
                    Instr(Mnemonic.pextrw, Gd, Nq, Ib),
                    VexInstr(Mnemonic.pextrw, Mnemonic.vpextrw, Gd, Udq, Ib));
                d[0xC6] = new PrefixedDecoder(
                    VexInstr(Mnemonic.shufps, Mnemonic.vshufps, Vps, Hps, Wps, Ib),
                    VexInstr(Mnemonic.shufpd, Mnemonic.vshufpd, Vpd, Hpd, Wpd, Ib));
                d[0xC7] = new GroupDecoder(Grp9);

                d[0xC8] = Instr(Mnemonic.bswap, rv);
                d[0xC9] = Instr(Mnemonic.bswap, rv);
                d[0xCA] = Instr(Mnemonic.bswap, rv);
                d[0xCB] = Instr(Mnemonic.bswap, rv);
                d[0xCC] = Instr(Mnemonic.bswap, rv);
                d[0xCD] = Instr(Mnemonic.bswap, rv);
                d[0xCE] = Instr(Mnemonic.bswap, rv);
                d[0xCF] = Instr(Mnemonic.bswap, rv);

                // 0F D0
                d[0xD0] = new PrefixedDecoder(
                    dec:  s_invalid,
                    dec66: VexInstr(Mnemonic.addsubpd, Mnemonic.vaddsubpd, Vpd, Hpd, Wpd),
                    decF3: s_invalid,
                    decF2: VexInstr(Mnemonic.addsubps, Mnemonic.vaddsubps, Vps, Hps, Wps));
                d[0xD1] = new PrefixedDecoder(
                    Instr(Mnemonic.psrlw, Pq, Qq),
                    VexInstr(Mnemonic.psrlw, Mnemonic.vpsrlw, Vx, Hx, Wx));
                d[0xD2] = new PrefixedDecoder(
                    Instr(Mnemonic.psrld, Pq, Qq),
                    VexInstr(Mnemonic.psrld, Mnemonic.vpsrld, Vx, Hx, Wx));
                d[0xD3] = new PrefixedDecoder(
                    Instr(Mnemonic.psrlq, Pq, Qq),
                    VexInstr(Mnemonic.psrlq, Mnemonic.vpsrlq, Vx, Hx, Wx));

                d[0xD4] = new PrefixedDecoder(
                    Instr(Mnemonic.paddq, Pq, Qq),
                    VexInstr(Mnemonic.paddq, Mnemonic.vpaddq, Vx, Hx, Wx));
                d[0xD5] = new PrefixedDecoder(
                    Instr(Mnemonic.pmullw, Pq, Qq),
                    VexInstr(Mnemonic.pmullw, Mnemonic.vpmullw, Vx, Hx, Wx));
                d[0xD6] = Instr(Mnemonic.movq, Wx, Vx);
                d[0xD7] = new PrefixedDecoder(
                    Instr(Mnemonic.pmovmskb, Gd, Nq),
                    VexInstr(Mnemonic.pmovmskb, Mnemonic.vpmovmskb, Gd, Ux));

                d[0xD8] = new PrefixedDecoder(
                    Instr(Mnemonic.psubusb, Pq, Qq),
                    VexInstr(Mnemonic.psubusb, Mnemonic.vpsubusb, Vx, Hx, Wx));
                d[0xD9] = new PrefixedDecoder(
                    Instr(Mnemonic.psubusw, Pq, Qq),
                    VexInstr(Mnemonic.psubusw, Mnemonic.vpsubusw, Vx, Hx, Wx));
                d[0xDA] = new PrefixedDecoder(
                    Instr(Mnemonic.pminub, Pq, Qq),
                    VexInstr(Mnemonic.pminub, Mnemonic.vpminub, Vx, Hx, Wx));
                d[0xDB] = new PrefixedDecoder(
                    Instr(Mnemonic.pand, Pq, Qq),
                    VexInstr(Mnemonic.pand, Mnemonic.vpand, Vx, Hx, Wx));
                d[0xDC] = new PrefixedDecoder(
                    Instr(Mnemonic.paddusb, Pq, Qq),
                    VexInstr(Mnemonic.paddusb, Mnemonic.vpaddusb, Vx, Hx, Wx));
                d[0xDD] = new PrefixedDecoder(
                    Instr(Mnemonic.paddusw, Pq, Qq),
                    VexInstr(Mnemonic.paddusw, Mnemonic.vpaddusw, Vx, Hx, Wx));
                d[0xDE] = new PrefixedDecoder(
                    Instr(Mnemonic.pmaxub, Pq, Qq),
                    VexInstr(Mnemonic.pmaxub, Mnemonic.vpmaxub, Vx, Hx, Wx));
                d[0xDF] = new PrefixedDecoder(
                    Instr(Mnemonic.pandn, Pq, Qq),
                    VexInstr(Mnemonic.pandn, Mnemonic.vpandn, Vx, Hx, Wx));

                // 0F E0
                d[0xE0] = new PrefixedDecoder(
                    Instr(Mnemonic.pavgb, Pq, Qq),
                    VexInstr(Mnemonic.pavgb, Mnemonic.vpavgb, Vx, Hx, Wx));
                d[0xE1] = new PrefixedDecoder(
                    Instr(Mnemonic.psraw, Pq, Qq),
                    VexInstr(Mnemonic.psraw, Mnemonic.vpsraw, Vx, Hx, Wx));
                d[0xE2] = new PrefixedDecoder(
                    Instr(Mnemonic.psrad, Pq, Qq),
                    VexInstr(Mnemonic.psrad, Mnemonic.vpsrad, Vx, Hx, Wx));
                d[0xE3] = new PrefixedDecoder(
                    Instr(Mnemonic.pavgw, Pq, Qq),
                    VexInstr(Mnemonic.pavgw, Mnemonic.vpavgw, Vx, Hx, Wx));

                d[0xE4] = new PrefixedDecoder(
                    Instr(Mnemonic.pmulhuw, Pq, Qq),
                    VexInstr(Mnemonic.pmulhuw, Mnemonic.vpmulhuw, Vx, Hx, Wx));
                d[0xE5] = new PrefixedDecoder(
                    Instr(Mnemonic.pmulhw, Pq, Qq),
                    VexInstr(Mnemonic.pmulhw, Mnemonic.vpmulhw, Vx, Hx, Wx));
                d[0xE6] = new PrefixedDecoder(
                    dec:  s_invalid,
                    dec66: VexInstr(Mnemonic.cvttpd2dq, Mnemonic.vcvttpd2dq, Vdq, Wpd),
                    decF3: VexInstr(Mnemonic.cvtdq2pd, Mnemonic.vcvtdq2pd, Vx, Wpd),
                    decF2: VexInstr(Mnemonic.cvtpd2dq, Mnemonic.vcvtpd2dq, Vdq, Wpd));
                d[0xE7] = new PrefixedDecoder(
                    Instr(Mnemonic.movntq, Mq, Pq),
                    VexInstr(Mnemonic.movntq, Mnemonic.vmovntq, Mx, Vx));

                d[0xE8] = new PrefixedDecoder(
                    Instr(Mnemonic.psubsb, Pq, Qq),
                    VexInstr(Mnemonic.psubsb, Mnemonic.vpsubsb, Vx, Hx, Wx));
                d[0xE9] = new PrefixedDecoder(
                    Instr(Mnemonic.psubsw, Pq, Qq),
                    VexInstr(Mnemonic.psubsw, Mnemonic.vpsubsw, Vx, Hx, Wx));
                d[0xEA] = new PrefixedDecoder(
                    Instr(Mnemonic.pminsw, Pq, Qq),
                    VexInstr(Mnemonic.pminsw, Mnemonic.vpminsw, Vx, Hx, Wx));
                d[0xEB] = new PrefixedDecoder(
                    Instr(Mnemonic.por, Pq, Qq),
                    VexInstr(Mnemonic.por, Mnemonic.vpor, Vx, Hx, Wx));

                d[0xEC] = new PrefixedDecoder(
                    Instr(Mnemonic.paddsb, Pq, Qq),
                    VexInstr(Mnemonic.paddsb, Mnemonic.vpaddsb, Vx, Hx, Wx));
                d[0xED] = new PrefixedDecoder(
                    Instr(Mnemonic.paddsw, Pq, Qq),
                    VexInstr(Mnemonic.paddsw, Mnemonic.vpaddsw, Vx, Hx, Wx));
                d[0xEE] = new PrefixedDecoder(
                    Instr(Mnemonic.pmaxsw, Pq, Qq),
                    VexInstr(Mnemonic.pmaxsw, Mnemonic.vpmaxsw, Vx, Hx, Wx));
                d[0xEF] = new PrefixedDecoder(
                    Instr(Mnemonic.pxor, Pq, Qq),
                    VexInstr(Mnemonic.pxor, Mnemonic.vpxor, Vx, Hx, Wx));

                // 0F F0
                d[0xF0] = new PrefixedDecoder(
                    s_invalid,
                    decF2: VexInstr(Mnemonic.lddqu, Mnemonic.vlddqu, Vx, Mx));
                d[0xF1] = new PrefixedDecoder(
                    Instr(Mnemonic.psllw, Pq, Qq),
                    dec66: VexInstr(Mnemonic.psllw, Mnemonic.vpsllw, Vx, Hx, Wx));
                d[0xF2] = new PrefixedDecoder(
                    Instr(Mnemonic.pslld, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pslld, Mnemonic.vpslld, Vx, Hx, Wx));
                d[0xF3] = new PrefixedDecoder(
                    Instr(Mnemonic.psllq, Pq, Qq),
                    dec66: VexInstr(Mnemonic.psllq, Mnemonic.vpsllq, Vx, Hx, Wx));
                d[0xF4] = new PrefixedDecoder(
                    Instr(Mnemonic.pmuludq, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pmuludq, Mnemonic.vpmuludq, Vx, Hx, Wx));
                d[0xF5] = new PrefixedDecoder(
                    Instr(Mnemonic.pmaddwd, Pq, Qq),
                    dec66: VexInstr(Mnemonic.pmaddwd, Mnemonic.vpmaddwd, Vx, Hx, Wx));
                d[0xF6] = new PrefixedDecoder(
                    Instr(Mnemonic.psadbw, Pq, Qq),
                    dec66: VexInstr(Mnemonic.psadbw, Mnemonic.vpsadbw, Vx, Hx, Wx));
                d[0xF7] = new PrefixedDecoder(
                    Instr(Mnemonic.maskmovq, Pq, Qq),
                    dec66: VexInstr(Mnemonic.maskmovdqu, Mnemonic.vmaskmovdqu, Vdq, Udq));

                d[0xF8] = new PrefixedDecoder(
                    Instr(Mnemonic.psubb, Pq, Qq),
                    VexInstr(Mnemonic.psubb, Mnemonic.vpsubb, Vx, Hx, Wx));
                d[0xF9] = new PrefixedDecoder(
                    Instr(Mnemonic.psubw, Pq, Qq),
                    VexInstr(Mnemonic.psubw, Mnemonic.vpsubw, Vx, Hx, Wx));
                d[0xFA] = new PrefixedDecoder(
                    Instr(Mnemonic.psubd, Pq, Qq),
                    VexInstr(Mnemonic.psubd, Mnemonic.vpsubd, Vx, Hx, Wx));
                d[0xFB] = new PrefixedDecoder(
                    Instr(Mnemonic.psubq, Pq, Qq),
                    VexInstr(Mnemonic.psubq, Mnemonic.vpsubq, Vx, Hx, Wx));
                d[0xFC] = new PrefixedDecoder(
                    Instr(Mnemonic.paddb, Pq, Qq),
                    VexInstr(Mnemonic.paddb, Mnemonic.vpaddb, Vx, Hx, Wx));
                d[0xFD] = new PrefixedDecoder(
                    Instr(Mnemonic.paddw, Pq, Qq),
                    VexInstr(Mnemonic.paddw, Mnemonic.vpaddw, Vx, Hx, Wx));
                d[0xFE] = new PrefixedDecoder(
                    Instr(Mnemonic.paddd, Pq, Qq),
                    VexInstr(Mnemonic.paddd, Mnemonic.vpaddd, Vx, Hx, Wx));
                d[0xFF] = Instr(Mnemonic.ud0, InstrClass.Invalid, Gv, Ev);
            }
Пример #2
0
            private void CreateOnebyteDecoders(Decoder[] decoders0F)
            {
                var d = this.rootDecoders;

                // 00
                d[0x00] = Instr(Mnemonic.add, InstrClass.Linear | InstrClass.Zero, Eb, Gb);
                d[0x01] = Instr(Mnemonic.add, Ev, Gv);
                d[0x02] = Instr(Mnemonic.add, Gb, Eb);
                d[0x03] = Instr(Mnemonic.add, Gv, Ev);
                d[0x04] = Instr(Mnemonic.add, AL, Ib);
                d[0x05] = Instr(Mnemonic.add, rAX, Iz);
                d[0x06] = Amd64Instr(
                    Instr(Mnemonic.push, s0),
                    s_invalid);
                d[0x07] = Amd64Instr(
                    Instr(Mnemonic.pop, s0),
                    s_invalid);

                d[0x08] = Instr(Mnemonic.or, Eb, Gb);
                d[0x09] = Instr(Mnemonic.or, Ev, Gv);
                d[0x0A] = Instr(Mnemonic.or, Gb, Eb);
                d[0x0B] = Instr(Mnemonic.or, Gv, Ev);
                d[0x0C] = Instr(Mnemonic.or, AL, Ib);
                d[0x0D] = Instr(Mnemonic.or, rAX, Iz);
                d[0x0E] = Amd64Instr(
                    Instr(Mnemonic.push, s1),
                    s_invalid);
                d[0x0F] = instr286(new AdditionalByteDecoder(decoders0F));

                // 10
                d[0x10] = Instr(Mnemonic.adc, Eb, Gb);
                d[0x11] = Instr(Mnemonic.adc, Ev, Gv);
                d[0x12] = Instr(Mnemonic.adc, Gb, Eb);
                d[0x13] = Instr(Mnemonic.adc, Gv, Ev);
                d[0x14] = Instr(Mnemonic.adc, AL, Ib);
                d[0x15] = Instr(Mnemonic.adc, rAX, Iz);
                d[0x16] = Amd64Instr(
                    Instr(Mnemonic.push, s2),
                    s_invalid);
                d[0x17] = Amd64Instr(
                    Instr(Mnemonic.pop, s2),
                    s_invalid);

                d[0x18] = Instr(Mnemonic.sbb, Eb, Gb);
                d[0x19] = Instr(Mnemonic.sbb, Ev, Gv);
                d[0x1A] = Instr(Mnemonic.sbb, Gb, Eb);
                d[0x1B] = Instr(Mnemonic.sbb, Gv, Ev);
                d[0x1C] = Instr(Mnemonic.sbb, AL, Ib);
                d[0x1D] = Instr(Mnemonic.sbb, rAX, Iz);
                d[0x1E] = Amd64Instr(
                    Instr(Mnemonic.push, s3),
                    s_invalid);
                d[0x1F] = Amd64Instr(
                    Instr(Mnemonic.pop, s3),
                    s_invalid);

                // 20
                d[0x20] = Instr(Mnemonic.and, Eb, Gb);
                d[0x21] = Instr(Mnemonic.and, Ev, Gv);
                d[0x22] = Instr(Mnemonic.and, Gb, Eb);
                d[0x23] = Instr(Mnemonic.and, Gv, Ev);
                d[0x24] = Instr(Mnemonic.and, AL, Ib);
                d[0x25] = Instr(Mnemonic.and, rAX, Iz);
                d[0x26] = new SegmentOverrideDecoder(0);
                d[0x27] = Amd64Instr(
                    Instr(Mnemonic.daa),
                    s_invalid);

                d[0x28] = Instr(Mnemonic.sub, Eb, Gb);
                d[0x29] = Instr(Mnemonic.sub, Ev, Gv);
                d[0x2A] = Instr(Mnemonic.sub, Gb, Eb);
                d[0x2B] = Instr(Mnemonic.sub, Gv, Ev);
                d[0x2C] = Instr(Mnemonic.sub, AL, Ib);
                d[0x2D] = Instr(Mnemonic.sub, rAX, Iz);
                d[0x2E] = new SegmentOverrideDecoder(1);
                d[0x2F] = Amd64Instr(
                    Instr(Mnemonic.das),
                    s_invalid);

                // 30
                d[0x30] = Instr(Mnemonic.xor, Eb, Gb);
                d[0x31] = Instr(Mnemonic.xor, Ev, Gv);
                d[0x32] = Instr(Mnemonic.xor, Gb, Eb);
                d[0x33] = Instr(Mnemonic.xor, Gv, Ev);
                d[0x34] = Instr(Mnemonic.xor, AL, Ib);
                d[0x35] = Instr(Mnemonic.xor, rAX, Iz);
                d[0x36] = new SegmentOverrideDecoder(2);
                d[0x37] = Amd64Instr(
                    Instr(Mnemonic.aaa),
                    s_invalid);

                d[0x38] = Instr(Mnemonic.cmp, Eb, Gb);
                d[0x39] = Instr(Mnemonic.cmp, Ev, Gv);
                d[0x3A] = Instr(Mnemonic.cmp, Gb, Eb);
                d[0x3B] = Instr(Mnemonic.cmp, Gv, Ev);
                d[0x3C] = Instr(Mnemonic.cmp, AL, Ib);
                d[0x3D] = Instr(Mnemonic.cmp, rAX, Iz);
                d[0x3E] = new SegmentOverrideDecoder(3);
                d[0x3F] = Amd64Instr(
                    Instr(Mnemonic.aas),
                    s_invalid);

                // 40
                d[0x40] = RexInstr(Mnemonic.inc, rv);
                d[0x41] = RexInstr(Mnemonic.inc, rv);
                d[0x42] = RexInstr(Mnemonic.inc, rv);
                d[0x43] = RexInstr(Mnemonic.inc, rv);
                d[0x44] = RexInstr(Mnemonic.inc, rv);
                d[0x45] = RexInstr(Mnemonic.inc, rv);
                d[0x46] = RexInstr(Mnemonic.inc, rv);
                d[0x47] = RexInstr(Mnemonic.inc, rv);

                d[0x48] = RexInstr(Mnemonic.dec, rv);
                d[0x49] = RexInstr(Mnemonic.dec, rv);
                d[0x4A] = RexInstr(Mnemonic.dec, rv);
                d[0x4B] = RexInstr(Mnemonic.dec, rv);
                d[0x4C] = RexInstr(Mnemonic.dec, rv);
                d[0x4D] = RexInstr(Mnemonic.dec, rv);
                d[0x4E] = RexInstr(Mnemonic.dec, rv);
                d[0x4F] = RexInstr(Mnemonic.dec, rv);

                // 50
                d[0x50] = Instr(Mnemonic.push, rV);
                d[0x51] = Instr(Mnemonic.push, rV);
                d[0x52] = Instr(Mnemonic.push, rV);
                d[0x53] = Instr(Mnemonic.push, rV);
                d[0x54] = Instr(Mnemonic.push, rV);
                d[0x55] = Instr(Mnemonic.push, rV);
                d[0x56] = Instr(Mnemonic.push, rV);
                d[0x57] = Instr(Mnemonic.push, rV);

                d[0x58] = Instr(Mnemonic.pop, rV);
                d[0x59] = Instr(Mnemonic.pop, rV);
                d[0x5A] = Instr(Mnemonic.pop, rV);
                d[0x5B] = Instr(Mnemonic.pop, rV);
                d[0x5C] = Instr(Mnemonic.pop, rV);
                d[0x5D] = Instr(Mnemonic.pop, rV);
                d[0x5E] = Instr(Mnemonic.pop, rV);
                d[0x5F] = Instr(Mnemonic.pop, rV);

                // 60
                d[0x60] = Amd64Instr(
                    Instr186(Mnemonic.pusha),
                    s_invalid);
                d[0x61] = Amd64Instr(
                    Instr186(Mnemonic.popa),
                    s_invalid);
                d[0x62] = Amd64Instr(
                    Instr186(Mnemonic.bound, Gv, Mv),
                    new EvexDecoder(this.s_decoders0F, s_decoders0F38, s_decoders0F3A));
                d[0x63] = Amd64Instr(
                    Instr286(Mnemonic.arpl, Ew, rw),
                    Instr(Mnemonic.movsxd, Gv, Ed));
                d[0x64] = Instr386(new SegmentOverrideDecoder(4));
                d[0x65] = Instr386(new SegmentOverrideDecoder(5));
                d[0x66] = Instr386(new ChangeDataWidth(this.rootDecoders));
                d[0x67] = Instr386(new ChangeAddressWidth(this.rootDecoders));

                d[0x68] = Instr186(Mnemonic.push, Iz);
                d[0x69] = Instr186(Mnemonic.imul, Gv, Ev, Iz);
                d[0x6A] = Instr186(Mnemonic.push, Ib);
                d[0x6B] = Instr186(Mnemonic.imul, Gv, Ev, Ib);
                d[0x6C] = Instr186(Mnemonic.insb, InstrClass.Linear | InstrClass.Privileged, b);
                d[0x6D] = Instr186(Mnemonic.ins, InstrClass.Linear | InstrClass.Privileged);
                d[0x6E] = Instr186(Mnemonic.outsb, InstrClass.Linear | InstrClass.Privileged, b);
                d[0x6F] = Instr186(Mnemonic.outs, InstrClass.Linear | InstrClass.Privileged);

                // 70
                d[0x70] = Instr(Mnemonic.jo, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x71] = Instr(Mnemonic.jno, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x72] = Instr(Mnemonic.jc, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x73] = Instr(Mnemonic.jnc, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x74] = Instr(Mnemonic.jz, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x75] = Instr(Mnemonic.jnz, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x76] = Instr(Mnemonic.jbe, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x77] = Instr(Mnemonic.ja, InstrClass.Transfer | InstrClass.Conditional, Jb);

                d[0x78] = Instr(Mnemonic.js, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x79] = Instr(Mnemonic.jns, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7A] = Instr(Mnemonic.jpe, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7B] = Instr(Mnemonic.jpo, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7C] = Instr(Mnemonic.jl, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7D] = Instr(Mnemonic.jge, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7E] = Instr(Mnemonic.jle, InstrClass.Transfer | InstrClass.Conditional, Jb);
                d[0x7F] = Instr(Mnemonic.jg, InstrClass.Transfer | InstrClass.Conditional, Jb);

                // 80
                d[0x80] = new GroupDecoder(Grp1, Eb, Ib);
                d[0x81] = new GroupDecoder(Grp1, Ev, Iz);
                d[0x82] = Amd64Instr(
                    new GroupDecoder(Grp1, Eb, Ib),
                    s_invalid);
                d[0x83] = new GroupDecoder(Grp1, Ev, Ib);
                d[0x84] = Instr(Mnemonic.test, Eb, Gb);
                d[0x85] = Instr(Mnemonic.test, Ev, Gv);
                d[0x86] = Instr(Mnemonic.xchg, Eb, Gb);
                d[0x87] = Instr(Mnemonic.xchg, Ev, Gv);

                d[0x88] = Instr(Mnemonic.mov, Eb, Gb);
                d[0x89] = Instr(Mnemonic.mov, Ev, Gv);
                d[0x8A] = Instr(Mnemonic.mov, Gb, Eb);
                d[0x8B] = Instr(Mnemonic.mov, Gv, Ev);
                d[0x8C] = Instr(Mnemonic.mov, Ewv, Sw);
                d[0x8D] = Instr(Mnemonic.lea, Gv, Mv);
                d[0x8E] = Instr(Mnemonic.mov, Sw, Ew);
                d[0x8F] = Amd64Instr(
                    Instr(Mnemonic.pop, Ev),
                    new GroupDecoder(Grp1A));

                // 90
                d[0x90] = new PrefixedDecoder(
                    iclass: InstrClass.Linear | InstrClass.Padding,
                    dec: Instr(Mnemonic.nop),
                    dec66: Instr386(Mnemonic.nop),
                    decF3: Instr(Mnemonic.pause));
                d[0x91] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x92] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x93] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x94] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x95] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x96] = Instr(Mnemonic.xchg, rv, rAX);
                d[0x97] = Instr(Mnemonic.xchg, rv, rAX);

                d[0x98] = DataWidthDependent(
                    bit16: Instr(Mnemonic.cbw),
                    bit32: Instr(Mnemonic.cwde),
                    bit64: Instr(Mnemonic.cdqe));
                d[0x99] = DataWidthDependent(
                    bit16: Instr(Mnemonic.cwd),
                    bit32: Instr(Mnemonic.cdq),
                    bit64: Instr(Mnemonic.cqo));
                d[0x9A] = Amd64Instr(
                    Instr(Mnemonic.call, InstrClass.Transfer | InstrClass.Call, Ap),
                    s_invalid);
                d[0x9B] = Instr(Mnemonic.wait);
                d[0x9C] = Instr(Mnemonic.pushf);
                d[0x9D] = Instr(Mnemonic.popf);
                d[0x9E] = Instr(Mnemonic.sahf);
                d[0x9F] = Instr(Mnemonic.lahf);

                // A0
                d[0xA0] = Instr(Mnemonic.mov, AL, Ob);
                d[0xA1] = Instr(Mnemonic.mov, rAX, Ov);
                d[0xA2] = Instr(Mnemonic.mov, Ob, AL);
                d[0xA3] = Instr(Mnemonic.mov, Ov, rAX);
                d[0xA4] = Instr(Mnemonic.movsb, b);
                d[0xA5] = Instr(Mnemonic.movs);
                d[0xA6] = Instr(Mnemonic.cmpsb, b);
                d[0xA7] = Instr(Mnemonic.cmps);

                d[0xA8] = Instr(Mnemonic.test, AL, Ib);
                d[0xA9] = Instr(Mnemonic.test, rAX, Iz);
                d[0xAA] = Instr(Mnemonic.stosb, b);
                d[0xAB] = Instr(Mnemonic.stos);
                d[0xAC] = Instr(Mnemonic.lodsb, b);
                d[0xAD] = Instr(Mnemonic.lods);
                d[0xAE] = Instr(Mnemonic.scasb, b);
                d[0xAF] = Instr(Mnemonic.scas);

                // B0
                d[0xB0] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB1] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB2] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB3] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB4] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB5] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB6] = Instr(Mnemonic.mov, rb, Ib);
                d[0xB7] = Instr(Mnemonic.mov, rb, Ib);

                d[0xB8] = Instr(Mnemonic.mov, rv, Iv);
                d[0xB9] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBA] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBB] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBC] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBD] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBE] = Instr(Mnemonic.mov, rv, Iv);
                d[0xBF] = Instr(Mnemonic.mov, rv, Iv);

                // C0
                d[0xC0] = Instr286(new GroupDecoder(Grp2, Eb, Ib));
                d[0xC1] = Instr286(new GroupDecoder(Grp2, Ev, Ib));
                d[0xC2] = Instr(Mnemonic.ret, InstrClass.Transfer | InstrClass.Return, Iw);
                d[0xC3] = Instr(Mnemonic.ret, InstrClass.Transfer | InstrClass.Return);
                d[0xC4] = Amd64Instr(
                    Instr(Mnemonic.les, Gv, Mp),
                    new VexDecoder3(decoders0F, s_decoders0F38, s_decoders0F3A));
                d[0xC5] = Amd64Instr(
                    Instr(Mnemonic.lds, Gv, Mp),
                    new VexDecoder2(decoders0F));
                d[0xC6] = Amd64Instr(
                    Instr(Mnemonic.mov, Eb, Ib),
                    new GroupDecoder(Grp11b));
                d[0xC7] = Amd64Instr(
                    Instr(Mnemonic.mov, Ev, Iz),
                    new GroupDecoder(Grp11z));

                d[0xC8] = Instr186(Mnemonic.enter, Iw, Ib);
                d[0xC9] = Instr186(Mnemonic.leave);
                d[0xCA] = Instr(Mnemonic.retf, InstrClass.Transfer | InstrClass.Return, Iw);
                d[0xCB] = Instr(Mnemonic.retf, InstrClass.Transfer | InstrClass.Return);
                d[0xCC] = Instr(Mnemonic.@int, InstrClass.Linear | InstrClass.Padding, n3);
                d[0xCD] = new InterruptDecoder(Mnemonic.@int, Ib);
                d[0xCE] = Amd64Instr(
                    Instr(Mnemonic.into),
                    s_invalid);
                d[0xCF] = Instr(Mnemonic.iret, InstrClass.Transfer | InstrClass.Return);

                // D0
                d[0xD0] = new GroupDecoder(Grp2, Eb, n1);
                d[0xD1] = new GroupDecoder(Grp2, Ev, n1);
                d[0xD2] = new GroupDecoder(Grp2, Eb, c);
                d[0xD3] = new GroupDecoder(Grp2, Ev, c);
                d[0xD4] = Amd64Instr(
                    Instr(Mnemonic.aam, Ib),
                    s_invalid);
                d[0xD5] = Amd64Instr(
                    Instr(Mnemonic.aad, Ib),
                    s_invalid);
                d[0xD6] = s_invalid;
                d[0xD7] = Instr(Mnemonic.xlat, b);

                d[0xD8] = X87Instr();
                d[0xD9] = X87Instr();
                d[0xDA] = X87Instr();
                d[0xDB] = X87Instr();
                d[0xDC] = X87Instr();
                d[0xDD] = X87Instr();
                d[0xDE] = X87Instr();
                d[0xDF] = X87Instr();

                // E0
                d[0xE0] = Instr(Mnemonic.loopne, InstrClass.ConditionalTransfer, Jb);
                d[0xE1] = Instr(Mnemonic.loope, InstrClass.ConditionalTransfer, Jb);
                d[0xE2] = Instr(Mnemonic.loop, InstrClass.ConditionalTransfer, Jb);
                d[0xE3] = AddrWidthDependent(
                    bit16: Instr(Mnemonic.jcxz, InstrClass.ConditionalTransfer, Jb),
                    bit32: Instr(Mnemonic.jecxz, InstrClass.ConditionalTransfer, Jb),
                    bit64: Instr(Mnemonic.jrcxz, InstrClass.ConditionalTransfer, Jb));
                d[0xE4] = Instr(Mnemonic.@in, InstrClass.Linear | InstrClass.Privileged, AL, Ib);
                d[0xE5] = Instr(Mnemonic.@in, InstrClass.Linear | InstrClass.Privileged, eAX, Ib);
                d[0xE6] = Instr(Mnemonic.@out, InstrClass.Linear | InstrClass.Privileged, Ib, AL);
                d[0xE7] = Instr(Mnemonic.@out, InstrClass.Linear | InstrClass.Privileged, Ib, eAX);

                d[0xE8] = Instr(Mnemonic.call, InstrClass.Transfer | InstrClass.Call, Jv);
                d[0xE9] = Instr(Mnemonic.jmp, InstrClass.Transfer, Jv);
                d[0xEA] = Amd64Instr(
                    Instr(Mnemonic.jmp, InstrClass.Transfer, Ap),
                    s_invalid);
                d[0xEB] = Instr(Mnemonic.jmp, InstrClass.Transfer, Jb);
                d[0xEC] = Instr(Mnemonic.@in, AL, DX);
                d[0xED] = Instr(Mnemonic.@in, eAX, DX);
                d[0xEE] = Instr(Mnemonic.@out, DX, AL);
                d[0xEF] = Instr(Mnemonic.@out, DX, eAX);

                // F0
                d[0xF0] = Instr(Mnemonic.@lock);
                d[0xF1] = Instr(Mnemonic.icebp, InstrClass.Invalid);
                d[0xF2] = new F2PrefixDecoder(rootDecoders);
                d[0xF3] = new F3PrefixDecoder(rootDecoders);
                d[0xF4] = Instr(Mnemonic.hlt, InstrClass.Terminates | InstrClass.Privileged);
                d[0xF5] = Instr(Mnemonic.cmc);
                d[0xF6] = new GroupDecoder(Grp3, Eb);
                d[0xF7] = new GroupDecoder(Grp3, Ev);

                d[0xF8] = Instr(Mnemonic.clc);
                d[0xF9] = Instr(Mnemonic.stc);
                d[0xFA] = Instr(Mnemonic.cli);
                d[0xFB] = Instr(Mnemonic.sti);
                d[0xFC] = Instr(Mnemonic.cld);
                d[0xFD] = Instr(Mnemonic.std);
                d[0xFE] = new GroupDecoder(Grp4);
                d[0xFF] = new GroupDecoder(Grp5);
            }
Пример #3
0
            private void Create0F38Decoders(Decoder[] d)
            {
                // 0F 38 00
                d[0x00] = new PrefixedDecoder(
                    Instr(Mnemonic.pshufb, Pq, Qq),
                    VexInstr(Mnemonic.pshufb, Mnemonic.vpshufb, Vx, Hx, Wx));
                d[0x01] = new PrefixedDecoder(
                    Instr(Mnemonic.phaddw, Pq, Qq),
                    Instr(Mnemonic.vphaddw, Vx, Hx, Wx));
                d[0x02] = new PrefixedDecoder(
                    Instr(Mnemonic.phaddd, Pq, Qq),
                    Instr(Mnemonic.vphaddd, Vx, Hx, Wx));
                d[0x03] = new PrefixedDecoder(
                    Instr(Mnemonic.phaddsw, Pq, Qq),
                    Instr(Mnemonic.vphaddsw, Vx, Hx, Wx));

                d[0x04] = new PrefixedDecoder(
                    Instr(Mnemonic.pmaddubsw, Pq, Qq),
                    Instr(Mnemonic.vpmaddubsw, Vx, Hx, Wx));
                d[0x05] = new PrefixedDecoder(
                    Instr(Mnemonic.phsubw, Pq, Qq),
                    Instr(Mnemonic.vphsubw, Vx, Hx, Wx));
                d[0x06] = new PrefixedDecoder(
                    Instr(Mnemonic.phsubd, Pq, Qq),
                    Instr(Mnemonic.vphsubd, Vx, Hx, Wx));
                d[0x07] = new PrefixedDecoder(
                    Instr(Mnemonic.phsubsw, Pq, Qq),
                    Instr(Mnemonic.vphsubsw, Vx, Hx, Wx));

                d[0x08] = new PrefixedDecoder(
                    Instr(Mnemonic.psignb, Pq, Qq),
                    Instr(Mnemonic.vpsignb, Vx, Hx, Wx));
                d[0x09] = new PrefixedDecoder(
                    Instr(Mnemonic.psignw, Pq, Qq),
                    Instr(Mnemonic.vpsignw, Vx, Hx, Wx));
                d[0x0A] = new PrefixedDecoder(
                    Instr(Mnemonic.psignd, Pq, Qq),
                    Instr(Mnemonic.vpsignd, Vx, Hx, Wx));
                d[0x0B] = new PrefixedDecoder(
                    Instr(Mnemonic.pmulhrsw, Pq, Qq),
                    Instr(Mnemonic.vpmulhrsw, Vx, Hx, Wx));

                d[0x0C] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vpermilps, Vx, Hx, Wx));
                d[0x0D] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vpermilpd, Vx, Hx, Wx));
                d[0x0E] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vtestps, Vx, Wx));
                d[0x0F] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vtestpd, Vx, Wx));

                // 0F 38 10
                d[0x10] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.pblendvb, Vdq, Wdq));
                d[0x11] = s_invalid;
                d[0x12] = s_invalid;
                d[0x13] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vcvtph2ps, Vx, Wx, Ib));

                d[0x14] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.blendvps, Vdq, Wdq));
                d[0x15] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.blendvpd, Vdq, Wdq));
                d[0x16] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vpermps, Vqq, Hqq, Wqq));
                d[0x17] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.vptest, Vx, Wx));

                d[0x18] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vbroadcastss, Vx, Wd));
                d[0x19] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vbroadcastsd, Vqq, Wq));
                d[0x1A] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vbroadcastf128, Vqq, Mdq));
                d[0x1B] = s_invalid;

                d[0x1C] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.pabsb, Pq, Qq),
                    dec66: Instr(Mnemonic.vpabsb, Vx, Wx));
                d[0x1D] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.pabsw, Pq, Qq),
                    dec66: Instr(Mnemonic.vpabsw, Vx, Wx));
                d[0x1E] = new PrefixedDecoder(
                    dec: Instr(Mnemonic.pabsd, Pq, Qq),
                    dec66: Instr(Mnemonic.vpabsd, Vx, Wx));
                d[0x1F] = s_invalid;

                // 0F 38 20
                d[0x20] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.pmovsxbw, Mnemonic.vpmovsxbw, Vx, Mq));
                d[0x21] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.pmovsxbd, Mnemonic.vpmovsxbd, Vx, Md));
                d[0x22] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.pmovsxbq, Mnemonic.vpmovsxbq, Vx, Mw));
                d[0x23] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.pmovsxwd, Mnemonic.vpmovsxwd, Vx, Mq));

                d[0x24] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmovsxwq, Vx, Mq));
                d[0x25] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmovsxdq, Vx, Mq));
                d[0x26] = s_invalid;
                d[0x27] = s_invalid;

                d[0x28] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmuldq, Vx, Hx, Wx));
                d[0x29] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpcmpeqq, Vx, Hx, Wx));
                d[0x2A] = new PrefixedDecoder(dec66: Instr(Mnemonic.vmovntdqa, Vx, Mx, Wx));
                d[0x2B] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpackusdw, Vx, Hx, Wx));

                d[0x2C] = new PrefixedDecoder(dec66: Instr(Mnemonic.vmaskmovps, Vx, Hx, Mx));
                d[0x2D] = new PrefixedDecoder(dec66: Instr(Mnemonic.vmaskmovpd, Vx, Hx, Mx));
                d[0x2E] = new PrefixedDecoder(dec66: Instr(Mnemonic.vmaskmovps, Mx, Hx, Vx));
                d[0x2F] = new PrefixedDecoder(dec66: Instr(Mnemonic.vmaskmovpd, Mx, Hx, Vx));

                // 30
                d[0x30] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmovzxbw, Vx, Mq));
                d[0x31] = new PrefixedDecoder(dec66: MemReg(
                                                  VexInstr(Mnemonic.pmovzxbd, Mnemonic.vpmovzxbd, Vx, Md),
                                                  VexInstr(Mnemonic.pmovzxbd, Mnemonic.vpmovzxbd, Vx, Ux)));
                d[0x32] = new PrefixedDecoder(dec66: MemReg(
                                                  VexInstr(Mnemonic.pmovzxbq, Mnemonic.vpmovzxbq, Vx, Mw),
                                                  VexInstr(Mnemonic.pmovzxbq, Mnemonic.vpmovzxbq, Vx, Ux)));
                d[0x33] = new PrefixedDecoder(dec66: MemReg(
                                                  VexInstr(Mnemonic.pmovzxwd, Mnemonic.vpmovzxwd, Vx, Mq),
                                                  VexInstr(Mnemonic.pmovzxwd, Mnemonic.vpmovzxwd, Vx, Ux)));

                d[0x34] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmovzxwq, Vx, Mq));
                d[0x35] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmovzxdq, Vx, Mq));
                d[0x36] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpermd, Vqq, Hqq, Wqq));
                d[0x37] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpcmpgtq, Vx, Hx, Wx));

                d[0x38] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpminsb, Vx, Hx, Wx));
                d[0x39] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpminsd, Vx, Hx, Wx));
                d[0x3A] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpminuw, Vx, Hx, Wx));
                d[0x3B] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpminud, Vx, Hx, Wx));

                d[0x3C] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmaxsb, Vx, Hx, Wx));
                d[0x3D] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmaxsd, Vx, Hx, Wx));
                d[0x3E] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmaxuw, Vx, Hx, Wx));
                d[0x3F] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmaxud, Vx, Hx, Wx));

                // 40
                d[0x40] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpmulld, Vx, Hx, Wx));
                d[0x41] = new PrefixedDecoder(dec66: Instr(Mnemonic.vphminposuw, Vdq, Wdq));
                d[0x42] = s_invalid;
                d[0x43] = s_invalid;
                d[0x44] = s_invalid;
                d[0x45] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vpsrlvd, Vx, Hx, Wx),
                    dec66Wide: Instr(Mnemonic.vpsrlvq, Vx, Hx, Wx));
                d[0x46] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpsravd, Vx, Hx, Wx));
                d[0x47] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vpsllvd, Vx, Hx, Wx),
                    dec66Wide: Instr(Mnemonic.vpsllvq, Vx, Hx, Wx));

                d[0x48] = s_invalid;
                d[0x49] = s_invalid;
                d[0x4A] = s_invalid;
                d[0x4B] = s_invalid;
                d[0x4C] = s_invalid;
                d[0x4D] = s_invalid;
                d[0x4E] = s_invalid;
                d[0x4F] = s_invalid;

                // 50
                d[0x50] = s_invalid;
                d[0x51] = s_invalid;
                d[0x52] = s_invalid;
                d[0x53] = s_invalid;
                d[0x54] = s_invalid;
                d[0x55] = s_invalid;
                d[0x56] = s_invalid;
                d[0x57] = s_invalid;

                d[0x58] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpbroadcastd, Vx, Wx));
                d[0x59] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpbroadcastq, Vx, Wx));
                d[0x5A] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpbroadcasti128, Vqq, Mdq));
                d[0x5B] = s_invalid;
                d[0x5C] = s_invalid;
                d[0x5D] = s_invalid;
                d[0x5E] = s_invalid;
                d[0x5F] = s_invalid;

                // 60
                d[0x60] = s_invalid;
                d[0x61] = s_invalid;
                d[0x62] = s_invalid;
                d[0x63] = s_invalid;
                d[0x64] = s_invalid;
                d[0x65] = s_invalid;
                d[0x66] = s_invalid;
                d[0x67] = s_invalid;

                d[0x68] = s_invalid;
                d[0x69] = s_invalid;
                d[0x6A] = s_invalid;
                d[0x6B] = s_invalid;
                d[0x6C] = s_invalid;
                d[0x6D] = s_invalid;
                d[0x6E] = s_invalid;
                d[0x6F] = s_invalid;

                // 70
                d[0x70] = s_invalid;
                d[0x71] = s_invalid;
                d[0x72] = s_invalid;
                d[0x73] = s_invalid;
                d[0x74] = s_invalid;
                d[0x75] = s_invalid;
                d[0x76] = s_invalid;
                d[0x77] = s_invalid;

                d[0x78] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpbroadcastb, Vx, Eb));
                d[0x79] = new PrefixedDecoder(dec66: Instr(Mnemonic.vpbroadcastw, Vx, Wx));
                d[0x7A] = s_invalid;
                d[0x7B] = s_invalid;
                d[0x7C] = s_invalid;
                d[0x7D] = s_invalid;
                d[0x7E] = s_invalid;
                d[0x7F] = s_invalid;

                // 0F 38 80
                d[0x80] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.invept, Gy, Mdq));
                d[0x81] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.invvpid, Gy, Mdq));
                d[0x82] = new PrefixedDecoder(
                    s_invalid,
                    Instr(Mnemonic.invpcid, Gy, Mdq));
                d[0x83] = s_invalid;
                d[0x84] = s_invalid;
                d[0x85] = s_invalid;
                d[0x86] = s_invalid;
                d[0x87] = s_invalid;

                d[0x88] = s_invalid;
                d[0x89] = s_invalid;
                d[0x8A] = s_invalid;
                d[0x8B] = s_invalid;
                d[0X8C] = s_nyi;
                d[0x8D] = s_invalid;
                d[0x8E] = s_nyi;
                d[0x8F] = s_invalid;

                // 90
                d[0x90] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vgatherdd, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vgatherdq, Vx, Hx, Wx));
                d[0x91] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vgatherqd, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vgatherqq, Vx, Hx, Wx));
                d[0x92] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vgatherdps, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vgatherdpd, Vx, Hx, Wx));
                d[0x93] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vgatherqps, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vgatherqpd, Vx, Hx, Wx));

                d[0x94] = s_invalid;
                d[0x95] = s_invalid;
                d[0x96] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vfmaddsub132ps, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vfmaddsub132pd, Vx, Hx, Wx));
                d[0x97] = new PrefixedDecoder(
                    dec66: VexInstr(Mnemonic.vfmsubadd132ps, Vx, Hx, Wx),
                    dec66Wide: VexInstr(Mnemonic.vfmsubadd132pd, Vx, Hx, Wx));

                d[0x98] = s_nyi;
                d[0x99] = s_nyi;
                d[0x9A] = s_nyi;
                d[0x9B] = s_nyi;
                d[0x9C] = s_invalid;
                d[0x9D] = s_invalid;
                d[0x9E] = new PrefixedDecoder(dec66: nyi("vfmaddsub132ps/dv"));
                d[0x9F] = new PrefixedDecoder(dec66: nyi("vfmsubadd132ps/dv"));

                // A0
                d[0xA0] = s_invalid;
                d[0xA1] = s_invalid;
                d[0xA2] = s_invalid;
                d[0xA3] = s_invalid;
                d[0xA4] = s_invalid;
                d[0xA5] = s_invalid;
                d[0xA6] = s_nyi;
                d[0xA7] = s_nyi;

                d[0xA8] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.vfmadd213ps, Vx, Hx, Wx),
                    dec66Wide: Instr(Mnemonic.vfmadd213pd, Vx, Hx, Wx));
                d[0xA9] = s_nyi;
                d[0xAA] = s_nyi;
                d[0xAB] = s_nyi;

                d[0xAC] = s_nyi;
                d[0xAD] = s_nyi;
                d[0xAE] = s_nyi;
                d[0xAF] = s_nyi;


                // B0
                d[0xB0] = s_invalid;
                d[0xB1] = s_invalid;
                d[0xB2] = s_invalid;
                d[0xB3] = s_invalid;
                d[0xB4] = s_invalid;
                d[0xB5] = s_invalid;
                d[0xB6] = s_nyi;
                d[0xB7] = s_nyi;

                d[0xB8] = s_nyi;
                d[0xB9] = s_nyi;
                d[0xBA] = s_nyi;
                d[0xBB] = s_nyi;

                d[0xBC] = s_nyi;
                d[0xBD] = s_nyi;
                d[0xBE] = new PrefixedDecoder(
                    s_invalid,
                    dec66: Instr(Mnemonic.vfnmsub231ps, Vx, Hx, Wx));
                d[0xBF] = new PrefixedDecoder(
                    s_invalid,
                    dec66: Instr(Mnemonic.vfnmsub231ss, Vx, Hx, Wx));

                // 0F 38 C0
                d[0xC0] = s_invalid;
                d[0xC1] = s_invalid;
                d[0xC2] = s_invalid;
                d[0xC3] = s_invalid;
                d[0xC4] = s_invalid;
                d[0xC5] = s_invalid;
                d[0xC6] = s_invalid;
                d[0xC7] = s_invalid;

                d[0xC8] = new PrefixedDecoder(Instr(Mnemonic.sha1nexte, Vdq, Wdq));
                d[0xC9] = new PrefixedDecoder(Instr(Mnemonic.sha1msg1, Vdq, Wdq));
                d[0xCA] = new PrefixedDecoder(Instr(Mnemonic.sha1msg2, Vdq, Wdq));
                d[0xCB] = new PrefixedDecoder(Instr(Mnemonic.sha256mds2, Vdq, Wdq));
                d[0xCC] = new PrefixedDecoder(Instr(Mnemonic.sha256msg1, Vdq, Wdq));
                d[0xCD] = new PrefixedDecoder(Instr(Mnemonic.sha256msg2, Vdq, Wdq));
                d[0xCE] = s_invalid;
                d[0xCF] = s_invalid;

                // 0F 38 D0
                d[0xD0] = s_invalid;
                d[0xD1] = s_invalid;
                d[0xD2] = s_invalid;
                d[0xD3] = s_invalid;
                d[0xD4] = s_invalid;
                d[0xD5] = s_invalid;
                d[0xD6] = s_invalid;
                d[0xD7] = s_invalid;

                d[0xD8] = s_invalid;
                d[0xD9] = s_invalid;
                d[0xDA] = s_invalid;
                d[0xDB] = new PrefixedDecoder(dec66: Instr(Mnemonic.aesimc, Vdq, Wdq));

                d[0xDC] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.aesenc, Mnemonic.vaesenc, Vdq, Hdq, Wdq));
                d[0xDD] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.aesenclast, Mnemonic.vaesenclast, Vdq, Hdq, Wdq));
                d[0xDE] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.aesdec, Mnemonic.vaesdec, Vdq, Hdq, Wdq));
                d[0xDF] = new PrefixedDecoder(dec66: VexInstr(Mnemonic.aesdeclast, Mnemonic.vaesdeclast, Vdq, Hdq, Wdq));

                // E0
                d[0xE0] = s_invalid;
                d[0xE1] = s_invalid;
                d[0xE2] = s_invalid;
                d[0xE3] = s_invalid;
                d[0xE4] = s_invalid;
                d[0xE5] = s_invalid;
                d[0xE6] = s_invalid;
                d[0xE7] = s_invalid;

                d[0xE8] = s_invalid;
                d[0xE9] = s_invalid;
                d[0xEA] = s_invalid;
                d[0xEB] = s_invalid;
                d[0xEC] = s_invalid;
                d[0xED] = s_invalid;
                d[0xEE] = s_invalid;
                d[0xEF] = s_invalid;

                // F0
                d[0xF0] = Instr(Mnemonic.movbe, Gv, Ev);
                d[0xF1] = Instr(Mnemonic.movbe, Ev, Gv);
                d[0xF2] = new PrefixedDecoder(
                    dec: VexInstr(Mnemonic.andn, Gy, By, Ey),
                    dec66: s_nyi);
                d[0xF3] = new GroupDecoder(Grp17);

                d[0xF4] = s_invalid;
                d[0xF5] = VexInstr(s_invalid, new PrefixedDecoder(
                                       dec:   Instr(Mnemonic.bzhi, Gy, Ey, By),
                                       decF3: Instr(Mnemonic.pext, Gy, By, Ey),
                                       decF2: Instr(Mnemonic.pdep, Gy, By, Ey)));
                d[0xF6] = new PrefixedDecoder(
                    dec66: Instr(Mnemonic.adcx, Gy, Ey),
                    decF3: Instr(Mnemonic.adox, Gy, Ey),
                    decF2: VexInstr(Mnemonic.mulx, Gy, By, rDX, Ey));
                d[0xF7] = VexInstr(s_invalid, new PrefixedDecoder(
                                       dec:   Instr(Mnemonic.bextr, Gy, Ey, By),
                                       dec66: Instr(Mnemonic.shlx, Gy, Ey, By),
                                       decF3: Instr(Mnemonic.sarx, Gy, Ey, By),
                                       decF2: Instr(Mnemonic.shrx, Gy, Ey, By)));

                d[0xF8] = s_invalid;
                d[0xF9] = s_invalid;
                d[0xFA] = s_invalid;
                d[0xFB] = s_invalid;
                d[0xFC] = s_invalid;
                d[0xFD] = s_invalid;
                d[0xFE] = s_invalid;
                d[0xFF] = s_invalid;
            }