コード例 #1
0
ファイル: EncoderOpCodeHandler.cs プロジェクト: ra2003/iced
 public DeclareDataHandler(Code code)
     : base(0, -1, -1, OpCodeHandlerFlags.DeclareData, Encodable.Any, OperandSize.None, AddressSize.None, null, Array2.Empty <Op>())
 {
     elemLength = code switch {
         Code.DeclareByte => 1,
         Code.DeclareWord => 2,
         Code.DeclareDword => 4,
         Code.DeclareQword => 8,
         _ => throw new InvalidOperationException(),
     };
 }
コード例 #2
0
        public DeclareDataHandler(Code code)
            : base(code, 0, 0, OpCodeHandlerFlags.DeclareData, Encodable.Any, OperandSize.None, AddressSize.None, null, Array2.Empty <Op>())
        {
            switch (code)
            {
            case Code.DeclareByte:
                elemLength = 1;
                break;

            case Code.DeclareWord:
                elemLength = 2;
                break;

            case Code.DeclareDword:
                elemLength = 4;
                break;

            case Code.DeclareQword:
                elemLength = 8;
                break;

            default:
                throw new InvalidOperationException();
            }
        }
コード例 #3
0
ファイル: EncoderOpCodeHandler.cs プロジェクト: ra2003/iced
 public InvalidHandler() : base(0, -1, -1, OpCodeHandlerFlags.None, Encodable.Any, OperandSize.None, AddressSize.None, null, Array2.Empty <Op>())
 {
 }
コード例 #4
0
        static Info[] GetMemorySizes()
        {
            var ptr       = new FormatterString("ptr");
            var dword_ptr = new[] { new FormatterString("dword"), ptr };

            MemorySizes.dword_ptr = dword_ptr;
            var qword_ptr = new[] { new FormatterString("qword"), ptr };

            MemorySizes.qword_ptr = qword_ptr;
            var mmword_ptr = new[] { new FormatterString("mmword"), ptr };

            MemorySizes.mmword_ptr = mmword_ptr;
            var xmmword_ptr = new[] { new FormatterString("xmmword"), ptr };

            MemorySizes.xmmword_ptr = xmmword_ptr;
            var oword_ptr = new[] { new FormatterString("oword"), ptr };

            MemorySizes.oword_ptr = oword_ptr;

            var byte_ptr        = new[] { new FormatterString("byte"), ptr };
            var word_ptr        = new[] { new FormatterString("word"), ptr };
            var ymmword_ptr     = new[] { new FormatterString("ymmword"), ptr };
            var zmmword_ptr     = new[] { new FormatterString("zmmword"), ptr };
            var fword_ptr       = new[] { new FormatterString("fword"), ptr };
            var tbyte_ptr       = new[] { new FormatterString("tbyte"), ptr };
            var fpuenv14_ptr    = new[] { new FormatterString("fpuenv14"), ptr };
            var fpuenv28_ptr    = new[] { new FormatterString("fpuenv28"), ptr };
            var fpustate108_ptr = new[] { new FormatterString("fpustate108"), ptr };
            var fpustate94_ptr  = new[] { new FormatterString("fpustate94"), ptr };
            var dword_bcst      = new[] { new FormatterString("dword"), new FormatterString("bcst") };
            var qword_bcst      = new[] { new FormatterString("qword"), new FormatterString("bcst") };

            var       infos              = new Info[IcedConstants.NumberOfMemorySizes];
            const int SizeKindShift      = 5;
            const int MemoryKeywordsMask = 0x1F;
            var       data = new ushort[IcedConstants.NumberOfMemorySizes] {
                // GENERATOR-BEGIN: MemorySizes
                // ⚠️This was generated by GENERATOR!🦹‍♂️
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.byte_ptr | ((uint)Size.S1 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.byte_ptr | ((uint)Size.S1 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S6 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.oword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S6 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpuenv14_ptr | ((uint)Size.S14 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpuenv28_ptr | ((uint)Size.S28 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpustate94_ptr | ((uint)Size.S94 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpustate108_ptr | ((uint)Size.S108 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S512 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S512 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                // GENERATOR-END: MemorySizes
            };
            var sizes = new ushort[] {
                0,
                1,
                2,
                4,
                6,
                8,
                10,
                14,
                16,
                28,
                32,
                64,
                94,
                108,
                512,
            };

            for (int i = 0; i < infos.Length; i++)
            {
                var d        = data[i];
                var keywords = ((MemoryKeywords)(d & MemoryKeywordsMask)) switch {
                    MemoryKeywords.None => Array2.Empty <FormatterString>(),
                    MemoryKeywords.byte_ptr => byte_ptr,
                    MemoryKeywords.dword_bcst => dword_bcst,
                    MemoryKeywords.dword_ptr => dword_ptr,
                    MemoryKeywords.fpuenv14_ptr => fpuenv14_ptr,
                    MemoryKeywords.fpuenv28_ptr => fpuenv28_ptr,
                    MemoryKeywords.fpustate108_ptr => fpustate108_ptr,
                    MemoryKeywords.fpustate94_ptr => fpustate94_ptr,
                    MemoryKeywords.fword_ptr => fword_ptr,
                    MemoryKeywords.oword_ptr => oword_ptr,
                    MemoryKeywords.qword_bcst => qword_bcst,
                    MemoryKeywords.qword_ptr => qword_ptr,
                    MemoryKeywords.tbyte_ptr => tbyte_ptr,
                    MemoryKeywords.word_ptr => word_ptr,
                    MemoryKeywords.xmmword_ptr => xmmword_ptr,
                    MemoryKeywords.ymmword_ptr => ymmword_ptr,
                    MemoryKeywords.zmmword_ptr => zmmword_ptr,
                    _ => throw new InvalidOperationException(),
                };
                infos[i] = new Info(i >= (int)IcedConstants.FirstBroadcastMemorySize, sizes[d >> SizeKindShift], keywords);
            }

            return(infos);
        }
コード例 #5
0
        /// <summary>Converts an enumerable to an array using the same logic as List{T}.</summary>
        /// <param name="source">The enumerable to convert.</param>
        /// <param name="length">The number of items stored in the resulting array, 0-indexed.</param>
        /// <returns>
        /// The resulting array.  The length of the array may be greater than <paramref name="length"/>,
        /// which is the actual number of elements in the array.
        /// </returns>
        internal static T[] ToArray <T>(IEnumerable <T> source, out int length)
        {
            if (source is ICollection <T> ic)
            {
                int count = ic.Count;
                if (count != 0)
                {
                    // Allocate an array of the desired size, then copy the elements into it. Note that this has the same
                    // issue regarding concurrency as other existing collections like List<T>. If the collection size
                    // concurrently changes between the array allocation and the CopyTo, we could end up either getting an
                    // exception from overrunning the array (if the size went up) or we could end up not filling as many
                    // items as 'count' suggests (if the size went down).  This is only an issue for concurrent collections
                    // that implement ICollection<T>, which as of .NET 4.6 is just ConcurrentDictionary<TKey, TValue>.
                    T[] arr = new T[count];
                    ic.CopyTo(arr, 0);
                    length = count;
                    return(arr);
                }
            }
            else
            {
                using (var en = source.GetEnumerator())
                {
                    if (en.MoveNext())
                    {
                        const int DefaultCapacity = 4;
                        T[]       arr             = new T[DefaultCapacity];
                        arr[0] = en.Current;
                        int count = 1;

                        while (en.MoveNext())
                        {
                            if (count == arr.Length)
                            {
                                // MaxArrayLength is defined in Array.MaxArrayLength and in gchelpers in CoreCLR.
                                // It represents the maximum number of elements that can be in an array where
                                // the size of the element is greater than one byte; a separate, slightly larger constant,
                                // is used when the size of the element is one.
                                const int MaxArrayLength = 0x7FEFFFFF;

                                // This is the same growth logic as in List<T>:
                                // If the array is currently empty, we make it a default size.  Otherwise, we attempt to
                                // double the size of the array.  Doubling will overflow once the size of the array reaches
                                // 2^30, since doubling to 2^31 is 1 larger than Int32.MaxValue.  In that case, we instead
                                // constrain the length to be MaxArrayLength (this overflow check works because of the
                                // cast to uint).  Because a slightly larger constant is used when T is one byte in size, we
                                // could then end up in a situation where arr.Length is MaxArrayLength or slightly larger, such
                                // that we constrain newLength to be MaxArrayLength but the needed number of elements is actually
                                // larger than that.  For that case, we then ensure that the newLength is large enough to hold
                                // the desired capacity.  This does mean that in the very rare case where we've grown to such a
                                // large size, each new element added after MaxArrayLength will end up doing a resize.
                                int newLength = count << 1;
                                if ((uint)newLength > MaxArrayLength)
                                {
                                    newLength = MaxArrayLength <= count ? count + 1 : MaxArrayLength;
                                }

                                Array.Resize(ref arr, newLength);
                            }

                            arr[count++] = en.Current;
                        }

                        length = count;
                        return(arr);
                    }
                }
            }

            length = 0;
            return(Array2.Empty <T>());
        }
コード例 #6
0
        static Info[] GetMemorySizes()
        {
            var ptr             = new FormatterString("ptr");
            var byte_ptr        = new[] { new FormatterString("byte"), ptr };
            var word_ptr        = new[] { new FormatterString("word"), ptr };
            var dword_ptr       = new[] { new FormatterString("dword"), ptr };
            var qword_ptr       = new[] { new FormatterString("qword"), ptr };
            var xmmword_ptr     = new[] { new FormatterString("xmmword"), ptr };
            var ymmword_ptr     = new[] { new FormatterString("ymmword"), ptr };
            var zmmword_ptr     = new[] { new FormatterString("zmmword"), ptr };
            var fword_ptr       = new[] { new FormatterString("fword"), ptr };
            var tbyte_ptr       = new[] { new FormatterString("tbyte"), ptr };
            var fpuenv14_ptr    = new[] { new FormatterString("fpuenv14"), ptr };
            var fpuenv28_ptr    = new[] { new FormatterString("fpuenv28"), ptr };
            var fpustate108_ptr = new[] { new FormatterString("fpustate108"), ptr };
            var fpustate94_ptr  = new[] { new FormatterString("fpustate94"), ptr };

            var       infos = new Info[IcedConstants.NumberOfMemorySizes];
            const int BroadcastToKindShift = 5;
            const int MemoryKeywordsMask   = 0x1F;

#if HAS_SPAN
            ReadOnlySpan <byte>
#else
            byte[]
#endif
            data = new byte[IcedConstants.NumberOfMemorySizes] {
                // GENERATOR-BEGIN: MemorySizes
                // ⚠️This was generated by GENERATOR!🦹‍♂️
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.byte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.byte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpuenv14_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpuenv28_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpustate94_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpustate108_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                // GENERATOR-END: MemorySizes
            };

            var b1to2  = new FormatterString("1to2");
            var b1to4  = new FormatterString("1to4");
            var b1to8  = new FormatterString("1to8");
            var b1to16 = new FormatterString("1to16");
            for (int i = 0; i < infos.Length; i++)
            {
                var d        = data[i];
                var keywords = ((MemoryKeywords)(d & MemoryKeywordsMask)) switch {
                    MemoryKeywords.None => Array2.Empty <FormatterString>(),
                    MemoryKeywords.byte_ptr => byte_ptr,
                    MemoryKeywords.dword_ptr => dword_ptr,
                    MemoryKeywords.fpuenv14_ptr => fpuenv14_ptr,
                    MemoryKeywords.fpuenv28_ptr => fpuenv28_ptr,
                    MemoryKeywords.fpustate108_ptr => fpustate108_ptr,
                    MemoryKeywords.fpustate94_ptr => fpustate94_ptr,
                    MemoryKeywords.fword_ptr => fword_ptr,
                    MemoryKeywords.qword_ptr => qword_ptr,
                    MemoryKeywords.tbyte_ptr => tbyte_ptr,
                    MemoryKeywords.word_ptr => word_ptr,
                    MemoryKeywords.xmmword_ptr => xmmword_ptr,
                    MemoryKeywords.ymmword_ptr => ymmword_ptr,
                    MemoryKeywords.zmmword_ptr => zmmword_ptr,
                    _ => throw new InvalidOperationException(),
                };
                var bcstTo = ((BroadcastToKind)(d >> BroadcastToKindShift)) switch {
                    BroadcastToKind.None => default,
コード例 #7
0
 /// <summary>
 /// Computes the hash
 /// </summary>
 public byte[] ComputeHash()
 {
     hasher.TransformFinalBlock(Array2.Empty <byte>(), 0, 0);
     return(hasher.Hash);
 }
コード例 #8
0
        static Info[] GetMemorySizes()
        {
            // GENERATOR-BEGIN: ConstData
            // ⚠️This was generated by GENERATOR!🦹‍♂️
            const int BroadcastToKindShift = 5;
            const int MemoryKeywordsMask   = 31;
            var       @byte           = new FormatterString("byte");
            var       ptr             = new FormatterString("ptr");
            var       byte_ptr        = new[] { @byte, ptr };
            var       dword           = new FormatterString("dword");
            var       dword_ptr       = new[] { dword, ptr };
            var       fpuenv14        = new FormatterString("fpuenv14");
            var       fpuenv14_ptr    = new[] { fpuenv14, ptr };
            var       fpuenv28        = new FormatterString("fpuenv28");
            var       fpuenv28_ptr    = new[] { fpuenv28, ptr };
            var       fpustate108     = new FormatterString("fpustate108");
            var       fpustate108_ptr = new[] { fpustate108, ptr };
            var       fpustate94      = new FormatterString("fpustate94");
            var       fpustate94_ptr  = new[] { fpustate94, ptr };
            var       fword           = new FormatterString("fword");
            var       fword_ptr       = new[] { fword, ptr };
            var       qword           = new FormatterString("qword");
            var       qword_ptr       = new[] { qword, ptr };
            var       tbyte           = new FormatterString("tbyte");
            var       tbyte_ptr       = new[] { tbyte, ptr };
            var       word            = new FormatterString("word");
            var       word_ptr        = new[] { word, ptr };
            var       xmmword         = new FormatterString("xmmword");
            var       xmmword_ptr     = new[] { xmmword, ptr };
            var       ymmword         = new FormatterString("ymmword");
            var       ymmword_ptr     = new[] { ymmword, ptr };
            var       zmmword         = new FormatterString("zmmword");
            var       zmmword_ptr     = new[] { zmmword, ptr };
            var       mem384          = new FormatterString("mem384");
            var       mem384_ptr      = new[] { mem384, ptr };
            var       empty           = new FormatterString("");
            var       b1to2           = new FormatterString("1to2");
            var       b1to4           = new FormatterString("1to4");
            var       b1to8           = new FormatterString("1to8");
            var       b1to16          = new FormatterString("1to16");
            // GENERATOR-END: ConstData

            var infos = new Info[IcedConstants.NumberOfMemorySizes];

#if HAS_SPAN
            ReadOnlySpan <byte>
#else
            byte[]
#endif
            data = new byte[IcedConstants.NumberOfMemorySizes] {
                // GENERATOR-BEGIN: MemorySizes
                // ⚠️This was generated by GENERATOR!🦹‍♂️
                0x00,
                0x01,
                0x0A,
                0x02,
                0x08,
                0x08,
                0x0B,
                0x0C,
                0x0D,
                0x01,
                0x0A,
                0x02,
                0x08,
                0x0B,
                0x0C,
                0x0D,
                0x02,
                0x07,
                0x09,
                0x0A,
                0x02,
                0x08,
                0x02,
                0x08,
                0x08,
                0x0B,
                0x07,
                0x07,
                0x0A,
                0x02,
                0x08,
                0x09,
                0x0B,
                0x0A,
                0x03,
                0x04,
                0x06,
                0x05,
                0x00,
                0x00,
                0x00,
                0x00,
                0x09,
                0x00,
                0x00,
                0x09,
                0x0E,
                0x0B,
                0x0A,
                0x0A,
                0x02,
                0x02,
                0x02,
                0x02,
                0x02,
                0x08,
                0x08,
                0x08,
                0x08,
                0x08,
                0x08,
                0x08,
                0x08,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0B,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0C,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x0D,
                0x22,
                0x22,
                0x22,
                0x42,
                0x42,
                0x28,
                0x28,
                0x28,
                0x42,
                0x28,
                0x62,
                0x62,
                0x48,
                0x48,
                0x48,
                0x62,
                0x48,
                0x82,
                0x82,
                0x68,
                0x68,
                0x68,
                0x82,
                0x68,
                0x42,
                0x62,
                0x82,
                0x28,
                0x48,
                0x68,
                0x28,
                0x48,
                0x68,
                0x42,
                0x62,
                0x82,
                // GENERATOR-END: MemorySizes
            };

            for (int i = 0; i < infos.Length; i++)
            {
                var d        = data[i];
                var keywords = (d & MemoryKeywordsMask) switch {
                    // GENERATOR-BEGIN: MemoryKeywordsSwitch
                    // ⚠️This was generated by GENERATOR!🦹‍♂️
                    0x00 => Array2.Empty <FormatterString>(),
                    0x01 => byte_ptr,
                    0x02 => dword_ptr,
                    0x03 => fpuenv14_ptr,
                    0x04 => fpuenv28_ptr,
                    0x05 => fpustate108_ptr,
                    0x06 => fpustate94_ptr,
                    0x07 => fword_ptr,
                    0x08 => qword_ptr,
                    0x09 => tbyte_ptr,
                    0x0A => word_ptr,
                    0x0B => xmmword_ptr,
                    0x0C => ymmword_ptr,
                    0x0D => zmmword_ptr,
                    0x0E => mem384_ptr,
                    // GENERATOR-END: MemoryKeywordsSwitch
                    _ => throw new InvalidOperationException(),
                };
                var bcstTo = (d >> BroadcastToKindShift) switch {
                    // GENERATOR-BEGIN: BroadcastToKindSwitch
                    // ⚠️This was generated by GENERATOR!🦹‍♂️
                    0x00 => empty,
                    0x01 => b1to2,
                    0x02 => b1to4,
                    0x03 => b1to8,
                    0x04 => b1to16,
                    // GENERATOR-END: BroadcastToKindSwitch
                    _ => throw new InvalidOperationException(),
                };
                infos[i] = new Info(keywords, bcstTo);
            }

            return(infos);
        }
コード例 #9
0
        static Info[] GetMemorySizes()
        {
            var ptr             = "ptr";
            var byte_ptr        = new string[] { "byte", ptr };
            var word_ptr        = new string[] { "word", ptr };
            var dword_ptr       = new string[] { "dword", ptr };
            var qword_ptr       = new string[] { "qword", ptr };
            var xmmword_ptr     = new string[] { "xmmword", ptr };
            var ymmword_ptr     = new string[] { "ymmword", ptr };
            var zmmword_ptr     = new string[] { "zmmword", ptr };
            var fword_ptr       = new string[] { "fword", ptr };
            var tbyte_ptr       = new string[] { "tbyte", ptr };
            var fpuenv14_ptr    = new string[] { "fpuenv14", ptr };
            var fpuenv28_ptr    = new string[] { "fpuenv28", ptr };
            var fpustate108_ptr = new string[] { "fpustate108", ptr };
            var fpustate94_ptr  = new string[] { "fpustate94", ptr };

            var       infos = new Info[DecoderConstants.NumberOfMemorySizes];
            const int BroadcastToKindShift = 5;
            const int MemoryKeywordsMask   = 0x1F;
            var       data = new byte[DecoderConstants.NumberOfMemorySizes] {
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.byte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.byte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpuenv14_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpuenv28_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpustate94_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.fpustate108_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.None | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.tbyte_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.word_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.xmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.ymmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.zmmword_ptr | ((uint)BroadcastToKind.None << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to2 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.qword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to4 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to8 << BroadcastToKindShift)),
                (byte)((uint)MemoryKeywords.dword_ptr | ((uint)BroadcastToKind.b1to16 << BroadcastToKindShift)),
            };

            for (int i = 0; i < infos.Length; i++)
            {
                var d = data[i];

                string[] keywords;
                switch ((MemoryKeywords)(d & MemoryKeywordsMask))
                {
                case MemoryKeywords.None:                               keywords = Array2.Empty <string>(); break;

                case MemoryKeywords.byte_ptr:                   keywords = byte_ptr; break;

                case MemoryKeywords.dword_ptr:                  keywords = dword_ptr; break;

                case MemoryKeywords.fpuenv14_ptr:               keywords = fpuenv14_ptr; break;

                case MemoryKeywords.fpuenv28_ptr:               keywords = fpuenv28_ptr; break;

                case MemoryKeywords.fpustate108_ptr:    keywords = fpustate108_ptr; break;

                case MemoryKeywords.fpustate94_ptr:             keywords = fpustate94_ptr; break;

                case MemoryKeywords.fword_ptr:                  keywords = fword_ptr; break;

                case MemoryKeywords.qword_ptr:                  keywords = qword_ptr; break;

                case MemoryKeywords.tbyte_ptr:                  keywords = tbyte_ptr; break;

                case MemoryKeywords.word_ptr:                   keywords = word_ptr; break;

                case MemoryKeywords.xmmword_ptr:                keywords = xmmword_ptr; break;

                case MemoryKeywords.ymmword_ptr:                keywords = ymmword_ptr; break;

                case MemoryKeywords.zmmword_ptr:                keywords = zmmword_ptr; break;

                default:                                                                throw new InvalidOperationException();
                }

                string?bcstTo;
                switch ((BroadcastToKind)(d >> BroadcastToKindShift))
                {
                case BroadcastToKind.None:              bcstTo = null; break;

                case BroadcastToKind.b1to2:             bcstTo = "1to2"; break;

                case BroadcastToKind.b1to4:             bcstTo = "1to4"; break;

                case BroadcastToKind.b1to8:             bcstTo = "1to8"; break;

                case BroadcastToKind.b1to16:    bcstTo = "1to16"; break;

                default:                                                throw new InvalidOperationException();
                }

                infos[i] = new Info((MemorySize)i, keywords, bcstTo);
            }

            return(infos);
        }
コード例 #10
0
        SymbolScopeImpl ReadScope(uint methodRid, GenericParamContext gpContext)
        {
            var             scopesRidList   = pdbMetadata.GetLocalScopeRidList(methodRid);
            SymbolScopeImpl rootScopeOrNull = null;

            if (scopesRidList.Count != 0)
            {
                var custInfos = ListCache <PdbCustomDebugInfo> .AllocList();

                var stack = ListCache <SymbolScopeImpl> .AllocList();

                var importScopeBlobReader = new ImportScopeBlobReader(module, pdbMetadata.BlobStream);
                for (int i = 0; i < scopesRidList.Count; i++)
                {
                    var  rid   = scopesRidList[i];
                    int  token = new MDToken(Table.LocalScope, rid).ToInt32();
                    bool b     = pdbMetadata.TablesStream.TryReadLocalScopeRow(rid, out var row);
                    Debug.Assert(b);
                    uint startOffset = row.StartOffset;
                    uint endOffset   = startOffset + row.Length;

                    SymbolScopeImpl parent = null;
                    while (stack.Count > 0)
                    {
                        var nextParent = stack[stack.Count - 1];
                        if (startOffset >= nextParent.StartOffset && endOffset <= nextParent.EndOffset)
                        {
                            parent = nextParent;
                            break;
                        }
                        stack.RemoveAt(stack.Count - 1);
                    }

                    Debug.Assert(!(parent is null) || rootScopeOrNull is null);
                    custInfos.Clear();
                    GetCustomDebugInfos(token, gpContext, custInfos);
                    var customDebugInfos = custInfos.Count == 0 ? Array2.Empty <PdbCustomDebugInfo>() : custInfos.ToArray();
                    var scope            = new SymbolScopeImpl(this, parent, (int)startOffset, (int)endOffset, customDebugInfos);
                    if (rootScopeOrNull is null)
                    {
                        rootScopeOrNull = scope;
                    }
                    stack.Add(scope);
                    if (!(parent is null))
                    {
                        parent.childrenList.Add(scope);
                    }

                    scope.importScope = ReadPdbImportScope(ref importScopeBlobReader, row.ImportScope, gpContext);
                    GetEndOfLists(rid, out uint variableListEnd, out uint constantListEnd);
                    ReadVariables(scope, gpContext, row.VariableList, variableListEnd);
                    ReadConstants(scope, row.ConstantList, constantListEnd);
                }

                ListCache <SymbolScopeImpl> .Free(ref stack);

                ListCache <PdbCustomDebugInfo> .Free(ref custInfos);
            }
            return(rootScopeOrNull ?? new SymbolScopeImpl(this, null, 0, int.MaxValue, Array2.Empty <PdbCustomDebugInfo>()));
        }
コード例 #11
0
        static Info?GetInfo(TypeDef td)
        {
            if (td is null)
            {
                return(null);
            }
            if (td.IsWindowsRuntime)
            {
                return(null);
            }

            UTF8String scope = null, identifier = null;
            var        tia = td.CustomAttributes.Find("System.Runtime.InteropServices.TypeIdentifierAttribute");

            if (tia is not null)
            {
                if (tia.ConstructorArguments.Count >= 2)
                {
                    if (tia.ConstructorArguments[0].Type.GetElementType() != ElementType.String)
                    {
                        return(null);
                    }
                    if (tia.ConstructorArguments[1].Type.GetElementType() != ElementType.String)
                    {
                        return(null);
                    }
                    scope      = tia.ConstructorArguments[0].Value as UTF8String ?? tia.ConstructorArguments[0].Value as string;
                    identifier = tia.ConstructorArguments[1].Value as UTF8String ?? tia.ConstructorArguments[1].Value as string;
                }
            }
            else
            {
                var asm = td.Module?.Assembly;
                if (asm is null)
                {
                    return(null);
                }
                bool isTypeLib = asm.CustomAttributes.IsDefined("System.Runtime.InteropServices.ImportedFromTypeLibAttribute") ||
                                 asm.CustomAttributes.IsDefined("System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute");
                if (!isTypeLib)
                {
                    return(null);
                }
            }

            if (UTF8String.IsNull(identifier))
            {
                CustomAttribute gca;
                if (td.IsInterface && td.IsImport)
                {
                    gca = td.CustomAttributes.Find("System.Runtime.InteropServices.GuidAttribute");
                }
                else
                {
                    var asm = td.Module?.Assembly;
                    if (asm is null)
                    {
                        return(null);
                    }
                    gca = asm.CustomAttributes.Find("System.Runtime.InteropServices.GuidAttribute");
                }
                if (gca is null)
                {
                    return(null);
                }
                if (gca.ConstructorArguments.Count < 1)
                {
                    return(null);
                }
                if (gca.ConstructorArguments[0].Type.GetElementType() != ElementType.String)
                {
                    return(null);
                }
                scope = gca.ConstructorArguments[0].Value as UTF8String ?? gca.ConstructorArguments[0].Value as string;
                var ns   = td.Namespace;
                var name = td.Name;
                if (UTF8String.IsNullOrEmpty(ns))
                {
                    identifier = name;
                }
                else if (UTF8String.IsNullOrEmpty(name))
                {
                    identifier = new UTF8String(Concat(ns.Data, (byte)'.', Array2.Empty <byte>()));
                }
                else
                {
                    identifier = new UTF8String(Concat(ns.Data, (byte)'.', name.Data));
                }
            }
            return(new Info(scope, identifier));
        }
コード例 #12
0
ファイル: EncoderOpCodeHandler.cs プロジェクト: wtf3505/iced
 public DeclareDataHandler(Code code)
     : base(EncFlags2.None, EncFlags3.Bit16or32 | EncFlags3.Bit64, true, null, Array2.Empty <Op>())
 {
     elemLength = code switch {
         Code.DeclareByte => 1,
         Code.DeclareWord => 2,
         Code.DeclareDword => 4,
         Code.DeclareQword => 8,
         _ => throw new InvalidOperationException(),
     };
 }
コード例 #13
0
ファイル: EncoderOpCodeHandler.cs プロジェクト: wtf3505/iced
 public InvalidHandler() : base(EncFlags2.None, EncFlags3.Bit16or32 | EncFlags3.Bit64, false, null, Array2.Empty <Op>())
 {
 }
コード例 #14
0
        static Info[] GetMemorySizes()
        {
            var ptr       = "ptr";
            var dword_ptr = new string[] { "dword", ptr };

            MemorySizes.dword_ptr = dword_ptr;
            var qword_ptr = new string[] { "qword", ptr };

            MemorySizes.qword_ptr = qword_ptr;
            var mmword_ptr = new string[] { "mmword", ptr };

            MemorySizes.mmword_ptr = mmword_ptr;
            var xmmword_ptr = new string[] { "xmmword", ptr };

            MemorySizes.xmmword_ptr = xmmword_ptr;
            var oword_ptr = new string[] { "oword", ptr };

            MemorySizes.oword_ptr = oword_ptr;

            var byte_ptr        = new string[] { "byte", ptr };
            var word_ptr        = new string[] { "word", ptr };
            var ymmword_ptr     = new string[] { "ymmword", ptr };
            var zmmword_ptr     = new string[] { "zmmword", ptr };
            var fword_ptr       = new string[] { "fword", ptr };
            var tbyte_ptr       = new string[] { "tbyte", ptr };
            var fpuenv14_ptr    = new string[] { "fpuenv14", ptr };
            var fpuenv28_ptr    = new string[] { "fpuenv28", ptr };
            var fpustate108_ptr = new string[] { "fpustate108", ptr };
            var fpustate94_ptr  = new string[] { "fpustate94", ptr };
            var dword_bcst      = new string[] { "dword", "bcst" };
            var qword_bcst      = new string[] { "qword", "bcst" };

            var       infos              = new Info[DecoderConstants.NumberOfMemorySizes];
            const int SizeKindShift      = 5;
            const int MemoryKeywordsMask = 0x1F;
            var       data = new ushort[DecoderConstants.NumberOfMemorySizes] {
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.byte_ptr | ((uint)Size.S1 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.byte_ptr | ((uint)Size.S1 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S6 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.oword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S6 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fword_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpuenv14_ptr | ((uint)Size.S14 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpuenv28_ptr | ((uint)Size.S28 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpustate94_ptr | ((uint)Size.S94 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.fpustate108_ptr | ((uint)Size.S108 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S512 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S512 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.None | ((uint)Size.S0 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.tbyte_ptr | ((uint)Size.S10 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.word_ptr | ((uint)Size.S2 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_ptr | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_ptr | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.xmmword_ptr | ((uint)Size.S16 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.ymmword_ptr | ((uint)Size.S32 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.zmmword_ptr | ((uint)Size.S64 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.qword_bcst | ((uint)Size.S8 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
                (ushort)((uint)MemoryKeywords.dword_bcst | ((uint)Size.S4 << SizeKindShift)),
            };
            var sizes = new ushort[] {
                0,
                1,
                2,
                4,
                6,
                8,
                10,
                14,
                16,
                28,
                32,
                64,
                94,
                108,
                512,
            };

            for (int i = 0; i < infos.Length; i++)
            {
                var d = data[i];

                string[] keywords;
                switch ((MemoryKeywords)(d & MemoryKeywordsMask))
                {
                case MemoryKeywords.None:                               keywords = Array2.Empty <string>(); break;

                case MemoryKeywords.byte_ptr:                   keywords = byte_ptr; break;

                case MemoryKeywords.dword_bcst:                 keywords = dword_bcst; break;

                case MemoryKeywords.dword_ptr:                  keywords = dword_ptr; break;

                case MemoryKeywords.fpuenv14_ptr:               keywords = fpuenv14_ptr; break;

                case MemoryKeywords.fpuenv28_ptr:               keywords = fpuenv28_ptr; break;

                case MemoryKeywords.fpustate108_ptr:    keywords = fpustate108_ptr; break;

                case MemoryKeywords.fpustate94_ptr:             keywords = fpustate94_ptr; break;

                case MemoryKeywords.fword_ptr:                  keywords = fword_ptr; break;

                case MemoryKeywords.oword_ptr:                  keywords = oword_ptr; break;

                case MemoryKeywords.qword_bcst:                 keywords = qword_bcst; break;

                case MemoryKeywords.qword_ptr:                  keywords = qword_ptr; break;

                case MemoryKeywords.tbyte_ptr:                  keywords = tbyte_ptr; break;

                case MemoryKeywords.word_ptr:                   keywords = word_ptr; break;

                case MemoryKeywords.xmmword_ptr:                keywords = xmmword_ptr; break;

                case MemoryKeywords.ymmword_ptr:                keywords = ymmword_ptr; break;

                case MemoryKeywords.zmmword_ptr:                keywords = zmmword_ptr; break;

                default:                                                                throw new InvalidOperationException();
                }

                infos[i] = new Info((MemorySize)i, i >= (int)MemorySize.Broadcast64_UInt32, sizes[d >> SizeKindShift], keywords);
            }

            return(infos);
        }
コード例 #15
0
        static Type GetTypeUsingTypeBuilder(IntPtr address)
        {
            if (moduleBuilder == null)
            {
                return(null);
            }

            var tb = moduleBuilder.DefineType(GetNextTypeName());
            var mb = tb.DefineMethod(METHOD_NAME, SR.MethodAttributes.Static, typeof(void), Array2.Empty <Type>());

            try {
                if (setMethodBodyMethodInfo != null)
                {
                    return(GetTypeNET45(tb, mb, address));
                }
                else
                {
                    return(GetTypeNET40(tb, mb, address));
                }
            }
            catch {
                moduleBuilder = null;
                return(null);
            }
        }
コード例 #16
0
 /// <summary>
 /// Reads data just like <see cref="Read"/>, but returns an empty array if
 /// offset is invalid
 /// </summary>
 /// <param name="offset">Offset of data</param>
 /// <returns>The data</returns>
 public byte[] ReadNoNull(uint offset) => Read(offset) ?? Array2.Empty <byte>();
コード例 #17
0
ファイル: MemorySizes.cs プロジェクト: yamiM0NSTER/iced
        static Info[] GetMemorySizes()
        {
            // GENERATOR-BEGIN: ConstData
            // ⚠️This was generated by GENERATOR!🦹‍♂️
            const int SizeKindShift      = 5;
            const int MemoryKeywordsMask = 31;
            var       @byte           = new FormatterString("byte");
            var       ptr             = new FormatterString("ptr");
            var       byte_ptr        = new[] { @byte, ptr };
            var       dword           = new FormatterString("dword");
            var       bcst            = new FormatterString("bcst");
            var       dword_bcst      = new[] { dword, bcst };
            var       dword_ptr       = new[] { dword, ptr };
            var       fpuenv14        = new FormatterString("fpuenv14");
            var       fpuenv14_ptr    = new[] { fpuenv14, ptr };
            var       fpuenv28        = new FormatterString("fpuenv28");
            var       fpuenv28_ptr    = new[] { fpuenv28, ptr };
            var       fpustate108     = new FormatterString("fpustate108");
            var       fpustate108_ptr = new[] { fpustate108, ptr };
            var       fpustate94      = new FormatterString("fpustate94");
            var       fpustate94_ptr  = new[] { fpustate94, ptr };
            var       fword           = new FormatterString("fword");
            var       fword_ptr       = new[] { fword, ptr };
            var       oword           = new FormatterString("oword");
            var       oword_ptr       = new[] { oword, ptr };
            var       qword           = new FormatterString("qword");
            var       qword_bcst      = new[] { qword, bcst };
            var       qword_ptr       = new[] { qword, ptr };
            var       tbyte           = new FormatterString("tbyte");
            var       tbyte_ptr       = new[] { tbyte, ptr };
            var       word            = new FormatterString("word");
            var       word_ptr        = new[] { word, ptr };
            var       xmmword         = new FormatterString("xmmword");
            var       xmmword_ptr     = new[] { xmmword, ptr };
            var       ymmword         = new FormatterString("ymmword");
            var       ymmword_ptr     = new[] { ymmword, ptr };
            var       zmmword         = new FormatterString("zmmword");
            var       zmmword_ptr     = new[] { zmmword, ptr };
            var       mem384          = new FormatterString("mem384");
            var       mem384_ptr      = new[] { mem384, ptr };
            var       mmword          = new FormatterString("mmword");
            var       mmword_ptr      = new[] { mmword, ptr };
            var       sizes           = new ushort[] {
                0,
                1,
                2,
                4,
                6,
                8,
                10,
                14,
                16,
                28,
                32,
                48,
                64,
                94,
                108,
                512,
            };

            // GENERATOR-END: ConstData
            MemorySizes.mmword_ptr  = mmword_ptr;
            MemorySizes.dword_ptr   = dword_ptr;
            MemorySizes.oword_ptr   = oword_ptr;
            MemorySizes.qword_ptr   = qword_ptr;
            MemorySizes.xmmword_ptr = xmmword_ptr;

            var infos = new Info[IcedConstants.MemorySizeEnumCount];
            var data  = new ushort[IcedConstants.MemorySizeEnumCount] {
                // GENERATOR-BEGIN: MemorySizes
                // ⚠️This was generated by GENERATOR!🦹‍♂️
                0x0000,
                0x0021,
                0x004D,
                0x0063,
                0x00AB,
                0x00AB,
                0x010E,
                0x014F,
                0x0190,
                0x0021,
                0x004D,
                0x0063,
                0x00AB,
                0x010E,
                0x014F,
                0x0190,
                0x0063,
                0x0088,
                0x00CC,
                0x004D,
                0x0063,
                0x00AB,
                0x0063,
                0x00AB,
                0x00AB,
                0x0109,
                0x0088,
                0x00C8,
                0x004D,
                0x0063,
                0x00AB,
                0x00CC,
                0x010E,
                0x004D,
                0x00E4,
                0x0125,
                0x01A7,
                0x01C6,
                0x01E0,
                0x01E0,
                0x0000,
                0x0000,
                0x00CC,
                0x0190,
                0x0000,
                0x00CC,
                0x0171,
                0x0190,
                0x004D,
                0x004D,
                0x0063,
                0x0063,
                0x0063,
                0x0063,
                0x0063,
                0x00AB,
                0x00AB,
                0x00AB,
                0x00AB,
                0x00AB,
                0x00AB,
                0x00AB,
                0x00AB,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x010E,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x014F,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0190,
                0x0062,
                0x0062,
                0x0062,
                0x0062,
                0x0062,
                0x00AA,
                0x00AA,
                0x00AA,
                0x0062,
                0x00AA,
                0x0062,
                0x0062,
                0x00AA,
                0x00AA,
                0x00AA,
                0x0062,
                0x00AA,
                0x0062,
                0x0062,
                0x00AA,
                0x00AA,
                0x00AA,
                0x0062,
                0x00AA,
                0x0062,
                0x0062,
                0x0062,
                0x00AA,
                0x00AA,
                0x00AA,
                0x00AA,
                0x00AA,
                0x00AA,
                0x0062,
                0x0062,
                0x0062,
                // GENERATOR-END: MemorySizes
            };

            for (int i = 0; i < infos.Length; i++)
            {
                var d        = data[i];
                var keywords = (d & MemoryKeywordsMask) switch {
                    // GENERATOR-BEGIN: MemoryKeywordsSwitch
                    // ⚠️This was generated by GENERATOR!🦹‍♂️
                    0x00 => Array2.Empty <FormatterString>(),
                    0x01 => byte_ptr,
                    0x02 => dword_bcst,
                    0x03 => dword_ptr,
                    0x04 => fpuenv14_ptr,
                    0x05 => fpuenv28_ptr,
                    0x06 => fpustate108_ptr,
                    0x07 => fpustate94_ptr,
                    0x08 => fword_ptr,
                    0x09 => oword_ptr,
                    0x0A => qword_bcst,
                    0x0B => qword_ptr,
                    0x0C => tbyte_ptr,
                    0x0D => word_ptr,
                    0x0E => xmmword_ptr,
                    0x0F => ymmword_ptr,
                    0x10 => zmmword_ptr,
                    0x11 => mem384_ptr,
                    // GENERATOR-END: MemoryKeywordsSwitch
                    _ => throw new InvalidOperationException(),
                };
                infos[i] = new Info(i >= (int)IcedConstants.FirstBroadcastMemorySize, sizes[d >> SizeKindShift], keywords);
            }

            return(infos);
        }
コード例 #18
0
            public static bool TryGet_RuntimeInformation_Architecture(out Machine machine)
            {
                machine = 0;
                var processArchitectureMethod = System_Runtime_InteropServices_RuntimeInformation?.GetMethod("get_ProcessArchitecture", Array2.Empty <Type>());

                if (processArchitectureMethod is null)
                {
                    return(false);
                }

                var result = processArchitectureMethod.Invoke(null, Array2.Empty <object>());

                return(TryGetArchitecture((int)result, out machine));
            }