示例#1
0
        static InstrInfo[] ReadInfos()
        {
            var reader  = new DataReader(GetSerializedInstrInfos());
            var infos   = new InstrInfo[DecoderConstants.NumberOfCodeValues];
            var strings = FormatterStringsTable.GetStringsTable();

            var    ca = new char[1];
            string s;
            uint   v, v2;
            int    prevIndex = -1;

            for (int i = 0; i < infos.Length; i++)
            {
                var  code     = (Code)i;
                byte f        = reader.ReadByte();
                var  ctorKind = (CtorKind)(f & 0x7F);
                int  currentIndex;
                if (ctorKind == CtorKind.Previous)
                {
                    currentIndex = reader.Index;
                    reader.Index = prevIndex;
                    ctorKind     = (CtorKind)(reader.ReadByte() & 0x7F);
                }
                else
                {
                    currentIndex = -1;
                    prevIndex    = reader.Index - 1;
                }
                s = strings[reader.ReadCompressedUInt32()];
                if ((f & 0x80) != 0)
                {
                    ca[0] = 'v';
                    s     = AddPrefix(s, ca);
                }
                InstrInfo instrInfo;
                switch (ctorKind)
                {
                case CtorKind.Normal_1:
                    instrInfo = new SimpleInstrInfo(code, s);
                    break;

                case CtorKind.Normal_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo(code, s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.asz:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_as(code, (int)v, s);
                    break;

                case CtorKind.AX:
                    instrInfo = new SimpleInstrInfo_AX(code, s);
                    break;

                case CtorKind.AY:
                    instrInfo = new SimpleInstrInfo_AY(code, s);
                    break;

                case CtorKind.bcst:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_bcst(code, s, (InstrOpInfoFlags)v, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.bnd_1:
                    instrInfo = new SimpleInstrInfo_bnd(code, s);
                    break;

                case CtorKind.bnd_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_bnd(code, s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.DeclareData:
                    instrInfo = new SimpleInstrInfo_DeclareData(code, s);
                    break;

                case CtorKind.fpu_ST_STi:
                    instrInfo = new SimpleInstrInfo_fpu_ST_STi(code, s);
                    break;

                case CtorKind.fpu_STi_ST:
                    instrInfo = new SimpleInstrInfo_fpu_STi_ST(code, s);
                    break;

                case CtorKind.imul:
                    instrInfo = new SimpleInstrInfo_imul(code, s);
                    break;

                case CtorKind.k1:
                    instrInfo = new SimpleInstrInfo_k1(code, s);
                    break;

                case CtorKind.k2:
                    instrInfo = new SimpleInstrInfo_k2(code, s);
                    break;

                case CtorKind.maskmovq:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_maskmovq(code, s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.memsize:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_memsize(code, (int)v, s);
                    break;

                case CtorKind.movabs:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_movabs(code, (int)v, s);
                    break;

                case CtorKind.nop:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_nop(code, (int)v, s, (Register)v2);
                    break;

                case CtorKind.nop0F1F:
                    v         = reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_nop0F1F(code, (Register)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os(code, (int)v, s);
                    break;

                case CtorKind.os3:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os(code, (int)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_bnd:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_bnd(code, (int)v, s);
                    break;

                case CtorKind.os_jcc_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc(code, (int)v, s);
                    break;

                case CtorKind.os_jcc_3:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc(code, (int)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_loop:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_os_loop(code, (int)v, (Register)v2, s);
                    break;

                case CtorKind.os_mem:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_mem(code, (int)v, s);
                    break;

                case CtorKind.pclmulqdq:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pclmulqdq(code, s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.pops:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pops(code, s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.reg:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_reg(code, s, (Register)v);
                    break;

                case CtorKind.Reg16:
                    instrInfo = new SimpleInstrInfo_Reg16(code, s);
                    break;

                case CtorKind.ST_STi:
                    instrInfo = new SimpleInstrInfo_ST_STi(code, s);
                    break;

                case CtorKind.ST1_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_ST1(code, s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.ST1_3:
                    v  = reader.ReadCompressedUInt32();
                    v2 = reader.ReadByte();
                    if (v2 > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_ST1(code, s, (InstrOpInfoFlags)v, v2 != 0);
                    break;

                case CtorKind.ST2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_ST2(code, s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.STi_ST:
                    instrInfo = new SimpleInstrInfo_STi_ST(code, s);
                    break;

                case CtorKind.xbegin:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_xbegin(code, (int)v, s);
                    break;

                case CtorKind.YA:
                    instrInfo = new SimpleInstrInfo_YA(code, s);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                infos[i] = instrInfo;
                if (currentIndex >= 0)
                {
                    reader.Index = currentIndex;
                }
            }
            if (reader.CanRead)
            {
                throw new InvalidOperationException();
            }

            return(infos);
        }
示例#2
0
        static InstrInfo[] ReadInfos()
        {
            var reader  = new DataReader(GetSerializedInstrInfos());
            var infos   = new InstrInfo[IcedConstants.NumberOfCodeValues];
            var strings = FormatterStringsTable.GetStringsTable();

            var    ca = new char[1];
            string s, s2, s3, s4;
            uint   v, v2, v3, v4;
            int    prevIndex = -1;

            for (int i = 0; i < infos.Length; i++)
            {
                byte f        = reader.ReadByte();
                var  ctorKind = (CtorKind)(f & 0x7F);
                int  currentIndex;
                if (ctorKind == CtorKind.Previous)
                {
                    currentIndex = reader.Index;
                    reader.Index = prevIndex;
                    ctorKind     = (CtorKind)(reader.ReadByte() & 0x7F);
                }
                else
                {
                    currentIndex = -1;
                    prevIndex    = reader.Index - 1;
                }
                s = strings[reader.ReadCompressedUInt32()];
                if ((f & 0x80) != 0)
                {
                    ca[0] = 'v';
                    s     = AddPrefix(s, ca);
                }
                InstrInfo instrInfo;
                switch (ctorKind)
                {
                case CtorKind.Normal_1:
                    instrInfo = new SimpleInstrInfo(s);
                    break;

                case CtorKind.Normal_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.AamAad:
                    instrInfo = new SimpleInstrInfo_AamAad(s);
                    break;

                case CtorKind.asz:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_as((int)v, s);
                    break;

                case CtorKind.AX:
                    instrInfo = new SimpleInstrInfo_AX(s);
                    break;

                case CtorKind.AY:
                    instrInfo = new SimpleInstrInfo_AY(s);
                    break;

                case CtorKind.bcst:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_bcst(s, (InstrOpInfoFlags)v, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.bnd_1:
                    instrInfo = new SimpleInstrInfo_bnd(s);
                    break;

                case CtorKind.bnd_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_bnd(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.DeclareData:
                    instrInfo = new SimpleInstrInfo_DeclareData((Code)i, s);
                    break;

                case CtorKind.DX:
                    instrInfo = new SimpleInstrInfo_DX(s);
                    break;

                case CtorKind.er_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_er((int)v, s);
                    break;

                case CtorKind.er_3:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_er((int)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.far:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_far((int)v, s);
                    break;

                case CtorKind.far_mem:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_far_mem((int)v, s);
                    break;

                case CtorKind.invlpga:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_invlpga((int)v, s);
                    break;

                case CtorKind.maskmovq:
                    instrInfo = new SimpleInstrInfo_maskmovq(s);
                    break;

                case CtorKind.mmxmem_1:
                    instrInfo = new SimpleInstrInfo_mmxmem(s);
                    break;

                case CtorKind.mmxmem_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_mmxmem(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.mmxmem_3:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_mmxmem(s, (InstrOpInfoFlags)v, (MemorySize)v2);
                    break;

                case CtorKind.movabs:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_movabs((int)v, s);
                    break;

                case CtorKind.ms_pops:
                    v2        = reader.ReadByte();
                    v3        = reader.ReadCompressedUInt32();
                    v4        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_ms_pops(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v2), (InstrOpInfoFlags)v3, (MemorySize)v4);
                    break;

                case CtorKind.nop:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_nop((int)v, s, (Register)v2);
                    break;

                case CtorKind.OpSize:
                    v         = reader.ReadByte();
                    ca[0]     = 'w';
                    s2        = AddSuffix(s, ca);
                    ca[0]     = 'd';
                    s3        = AddSuffix(s, ca);
                    ca[0]     = 'q';
                    s4        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_OpSize((CodeSize)v, s, s2, s3, s4);
                    break;

                case CtorKind.OpSize2_bnd:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    s4        = strings[reader.ReadCompressedUInt32()];
                    instrInfo = new SimpleInstrInfo_OpSize2_bnd(s, s2, s3, s4);
                    break;

                case CtorKind.OpSize3:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_OpSize3((int)v, s, s2);
                    break;

                case CtorKind.os_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os((int)v, s);
                    break;

                case CtorKind.os_3:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os((int)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_call_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_call((int)v, s);
                    break;

                case CtorKind.os_call_3:
                    v  = reader.ReadCompressedUInt32();
                    v2 = reader.ReadByte();
                    if (v2 > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_os_call((int)v, s, v2 != 0);
                    break;

                case CtorKind.CC_1:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s });
                    break;

                case CtorKind.CC_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s, s2 });
                    break;

                case CtorKind.CC_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s, s2, s3 });
                    break;

                case CtorKind.os_jcc_a_1:
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v2, new[] { s });
                    break;

                case CtorKind.os_jcc_a_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v2, new[] { s, s2 });
                    break;

                case CtorKind.os_jcc_a_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v2, new[] { s, s2, s3 });
                    break;

                case CtorKind.os_jcc_b_1:
                    v3        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v3, new[] { s }, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_jcc_b_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v3        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v3, new[] { s, s2 }, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_jcc_b_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v3        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_jcc((int)v, (int)v3, new[] { s, s2, s3 }, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.os_loopcc:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v3        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_os_loop((int)v, (int)v3, (Register)v2, new[] { s, s2 });
                    break;

                case CtorKind.os_loop:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_os_loop((int)v, -1, (Register)v2, new[] { s });
                    break;

                case CtorKind.os_mem:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_mem((int)v, s);
                    break;

                case CtorKind.os_mem_reg16:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_mem_reg16((int)v, s);
                    break;

                case CtorKind.os_mem2:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_os_mem2((int)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.pblendvb_1:
                    instrInfo = new SimpleInstrInfo_pblendvb(s);
                    break;

                case CtorKind.pblendvb_2:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pblendvb(s, (MemorySize)v);
                    break;

                case CtorKind.pclmulqdq:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pclmulqdq(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.pops_2:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pops(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.pops_3:
                    v         = reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_pops(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v), (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.Reg16:
                    instrInfo = new SimpleInstrInfo_Reg16(s);
                    break;

                case CtorKind.reverse2:
                    instrInfo = new SimpleInstrInfo_reverse2(s);
                    break;

                case CtorKind.sae:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_sae((int)v, s);
                    break;

                case CtorKind.sae_pops:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_sae_pops((int)v, s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v2));
                    break;

                case CtorKind.SEX1:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_SEX1((int)v, (SignExtendInfo)v2, s);
                    break;

                case CtorKind.SEX1a:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_SEX1a((int)v, (SignExtendInfo)v2, s);
                    break;

                case CtorKind.SEX2_2:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_SEX2((SignExtendInfo)v, s);
                    break;

                case CtorKind.SEX2_3:
                    v         = reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_SEX2((SignExtendInfo)v, s, (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.SEX2_4:
                    v         = reader.ReadByte();
                    v2        = reader.ReadByte();
                    v3        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_SEX2((SignExtendInfo)v, (SignExtendInfo)v2, s, (InstrOpInfoFlags)v3);
                    break;

                case CtorKind.SEX3:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_SEX3((SignExtendInfo)v, s);
                    break;

                case CtorKind.STIG1_1:
                    instrInfo = new SimpleInstrInfo_STIG1(s);
                    break;

                case CtorKind.STIG1_2:
                    v = reader.ReadByte();
                    if (v > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_STIG1(s, v != 0);
                    break;

                case CtorKind.STIG2_2a:
                    v = reader.ReadByte();
                    if (v > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_STIG2(s, v != 0);
                    break;

                case CtorKind.STIG2_2b:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_STIG2(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.xbegin:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_xbegin((int)v, s);
                    break;

                case CtorKind.XLAT:
                    instrInfo = new SimpleInstrInfo_XLAT(s);
                    break;

                case CtorKind.XY:
                    instrInfo = new SimpleInstrInfo_XY(s);
                    break;

                case CtorKind.YA:
                    instrInfo = new SimpleInstrInfo_YA(s);
                    break;

                case CtorKind.YD:
                    instrInfo = new SimpleInstrInfo_YD(s);
                    break;

                case CtorKind.YX:
                    instrInfo = new SimpleInstrInfo_YX(s);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                infos[i] = instrInfo;
                if (currentIndex >= 0)
                {
                    reader.Index = currentIndex;
                }
            }
            if (reader.CanRead)
            {
                throw new InvalidOperationException();
            }

            return(infos);
        }
示例#3
0
        static InstrInfo[] ReadInfos()
        {
            var reader  = new DataReader(GetSerializedInstrInfos());
            var infos   = new InstrInfo[IcedConstants.NumberOfCodeValues];
            var strings = FormatterStringsTable.GetStringsTable();

            var    ca = new char[1];
            string s, s2, s3, s4;
            uint   v, v2, v3;
            int    prevIndex = -1;

            for (int i = 0; i < infos.Length; i++)
            {
                byte f        = reader.ReadByte();
                var  ctorKind = (CtorKind)(f & 0x7F);
                int  currentIndex;
                if (ctorKind == CtorKind.Previous)
                {
                    currentIndex = reader.Index;
                    reader.Index = prevIndex;
                    ctorKind     = (CtorKind)(reader.ReadByte() & 0x7F);
                }
                else
                {
                    currentIndex = -1;
                    prevIndex    = reader.Index - 1;
                }
                s = strings[reader.ReadCompressedUInt32()];
                if ((f & 0x80) != 0)
                {
                    ca[0] = 'v';
                    s     = AddPrefix(s, ca);
                }
                InstrInfo instrInfo;
                switch (ctorKind)
                {
                case CtorKind.Normal_1:
                    instrInfo = new SimpleInstrInfo(s);
                    break;

                case CtorKind.Normal_2:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.AamAad:
                    instrInfo = new SimpleInstrInfo_AamAad(s);
                    break;

                case CtorKind.AX:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_AX(s, s2);
                    break;

                case CtorKind.AY:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_AY(s, s2);
                    break;

                case CtorKind.bnd:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_bnd(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.DeclareData:
                    instrInfo = new SimpleInstrInfo_DeclareData((Code)i, s);
                    break;

                case CtorKind.DX:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_DX(s, s2);
                    break;

                case CtorKind.fword:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    v         = reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_fword((CodeSize)v, (InstrOpInfoFlags)v2, s, s2);
                    break;

                case CtorKind.Int3:
                    instrInfo = new SimpleInstrInfo_Int3(s);
                    break;

                case CtorKind.imul:
                    instrInfo = new SimpleInstrInfo_imul(s);
                    break;

                case CtorKind.invlpga:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_invlpga((int)v, s);
                    break;

                case CtorKind.CCa_1:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s });
                    break;

                case CtorKind.CCa_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s, s2 });
                    break;

                case CtorKind.CCa_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s, s2, s3 });
                    break;

                case CtorKind.CCb_1:
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v2, new[] { s }, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.CCb_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v2, new[] { s, s2 }, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.CCb_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v2        = reader.ReadCompressedUInt32();
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v2, new[] { s, s2, s3 }, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.jcc_1:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_jcc((int)v, new[] { s });
                    break;

                case CtorKind.jcc_2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_jcc((int)v, new[] { s, s2 });
                    break;

                case CtorKind.jcc_3:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    s3        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_jcc((int)v, new[] { s, s2, s3 });
                    break;

                case CtorKind.Loopcc1:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_cc((int)v, new[] { s, s2 });
                    break;

                case CtorKind.Loopcc2:
                    s2        = strings[reader.ReadCompressedUInt32()];
                    ca[0]     = (char)reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    s3        = AddSuffix(s, ca);
                    s4        = AddSuffix(s2, ca);
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_OpSize_cc((CodeSize)v, (int)v2, new[] { s, s2 }, new[] { s3, s4 });
                    break;

                case CtorKind.maskmovq:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_maskmovq(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.memsize:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_memsize((int)v, s);
                    break;

                case CtorKind.monitor:
                    v         = reader.ReadByte();
                    v2        = reader.ReadByte();
                    v3        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_monitor(s, (Register)v, (Register)v2, (Register)v3);
                    break;

                case CtorKind.mwait:
                    instrInfo = new SimpleInstrInfo_mwait(s);
                    break;

                case CtorKind.mwaitx:
                    instrInfo = new SimpleInstrInfo_mwaitx(s);
                    break;

                case CtorKind.nop:
                    v         = reader.ReadCompressedUInt32();
                    v2        = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_nop((int)v, s, (Register)v2);
                    break;

                case CtorKind.OpSize_1:
                    v         = reader.ReadByte();
                    ca[0]     = 'w';
                    s2        = AddSuffix(s, ca);
                    ca[0]     = 'd';
                    s3        = AddSuffix(s, ca);
                    ca[0]     = 'q';
                    s4        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_OpSize((CodeSize)v, s, s2, s3, s4);
                    break;

                case CtorKind.OpSize_2:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_OpSize((CodeSize)v, s, s2, s2, s2);
                    break;

                case CtorKind.OpSize2:
                    s2 = strings[reader.ReadCompressedUInt32()];
                    s3 = strings[reader.ReadCompressedUInt32()];
                    s4 = strings[reader.ReadCompressedUInt32()];
                    v  = reader.ReadByte();
                    if (v > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_OpSize2(s, s2, s3, s4, v != 0);
                    break;

                case CtorKind.pblendvb:
                    instrInfo = new SimpleInstrInfo_pblendvb(s);
                    break;

                case CtorKind.pclmulqdq:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pclmulqdq(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.pops_2:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_pops(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v));
                    break;

                case CtorKind.pops_3:
                    v         = reader.ReadByte();
                    v2        = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_pops(s, FormatterConstants.GetPseudoOps((PseudoOpsKind)v), (InstrOpInfoFlags)v2);
                    break;

                case CtorKind.reg:
                    v         = reader.ReadByte();
                    instrInfo = new SimpleInstrInfo_reg(s, (Register)v);
                    break;

                case CtorKind.Reg16:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_Reg16(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.Reg32:
                    v         = reader.ReadCompressedUInt32();
                    instrInfo = new SimpleInstrInfo_Reg32(s, (InstrOpInfoFlags)v);
                    break;

                case CtorKind.reverse:
                    instrInfo = new SimpleInstrInfo_reverse(s);
                    break;

                case CtorKind.ST_STi:
                    instrInfo = new SimpleInstrInfo_ST_STi(s);
                    break;

                case CtorKind.STi_ST:
                    v = reader.ReadByte();
                    if (v > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_STi_ST(s, v != 0);
                    break;

                case CtorKind.STIG1:
                    v = reader.ReadByte();
                    if (v > 1)
                    {
                        throw new InvalidOperationException();
                    }
                    instrInfo = new SimpleInstrInfo_STIG1(s, v != 0);
                    break;

                case CtorKind.XLAT:
                    ca[0]     = 'b';
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_XLAT(s, s2);
                    break;

                case CtorKind.XY:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_XY(s, s2);
                    break;

                case CtorKind.YA:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_YA(s, s2);
                    break;

                case CtorKind.YD:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_YD(s, s2);
                    break;

                case CtorKind.YX:
                    ca[0]     = (char)reader.ReadByte();
                    s2        = AddSuffix(s, ca);
                    instrInfo = new SimpleInstrInfo_YX(s, s2);
                    break;

                default:
                    throw new InvalidOperationException();
                }
                infos[i] = instrInfo;
                if (currentIndex >= 0)
                {
                    reader.Index = currentIndex;
                }
            }
            if (reader.CanRead)
            {
                throw new InvalidOperationException();
            }

            return(infos);
        }