Example #1
0
        /// <summary>
        ///     Create X86 Operands.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="nativeInstructionDetail">
        ///     A native X86 instruction detail.
        /// </param>
        /// <returns>
        ///     An array of X86 operands.
        /// </returns>
        internal static X86Operand[] Create(CapstoneDisassembler disassembler, ref NativeX86InstructionDetail nativeInstructionDetail)
        {
            var operands = new X86Operand[nativeInstructionDetail.OperandCount];

            for (var i = 0; i < operands.Length; i++)
            {
                ref var nativeOperand = ref nativeInstructionDetail.Operands[i];
                operands[i] = new X86Operand(disassembler, ref nativeOperand);
            }
Example #2
0
        /// <summary>
        ///     Create an X86 Instruction Detail From a Native X86 Instruction Detail.
        /// </summary>
        /// <param name="this">
        ///     A native X86 instruction detail.
        /// </param>
        /// <returns>
        ///     An X86 instruction detail.
        /// </returns>
        public static X86InstructionDetail AsX86InstructionDetail(this NativeX86InstructionDetail @this)
        {
            var @object = new X86InstructionDetail();

            @object.AddressSize      = @this.AddressSize;
            @object.AvxCodeCondition = @this.ManagedAvxCodeCondition;
            @object.AvxRoundingMode  = @this.ManagedAvxRoundingMode;
            @object.Displacement     = @this.Displacement;
            @object.ModRm            = @this.ModRm;
            @object.Operands         = @this.ManagedOperands.Select(m => NativeX86InstructionOperandExtension.AsX86InstructionOperand(m)).ToArray();
            @object.OperationCode    = @this.ManagedOperationCode;
            @object.Prefix           = @this.ManagedPrefix.Select(m => (X86Prefix)Convert.ToInt32(m)).ToArray();
            @object.Rex                      = @this.Rex;
            @object.Sib                      = @this.Sib;
            @object.SibBaseRegister          = @this.ManagedSibBaseRegister;
            @object.SibIndexRegister         = @this.ManagedSibIndexRegister;
            @object.SibScale                 = @this.SibScale;
            @object.SseCodeCondition         = @this.ManagedSseCodeCondition;
            @object.SuppressAllAvxExceptions = @this.AvxSuppressAllExceptions;

            return(@object);
        }