Example #1
0
        /// <summary>
        ///     Build an Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        internal override void Build(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            base.Build(disassembler, hInstruction);
            var nativeInstructionDetail = NativeCapstone.GetInstructionDetail <NativeX86InstructionDetail>(hInstruction).GetValueOrDefault();

            this.AddressSize              = nativeInstructionDetail.AddressSize;
            this.AvxConditionCode         = nativeInstructionDetail.AvxConditionCode;
            this.AvxRoundingMode          = nativeInstructionDetail.AvxRoundingMode;
            this.AvxSuppressAllExceptions = nativeInstructionDetail.AvxSuppressAllExceptions;
            this.Displacement             = nativeInstructionDetail.Displacement;
            this.EFlags           = nativeInstructionDetail.Flag.EFlags;
            this.Encoding         = new X86Encoding(ref nativeInstructionDetail.Encoding);
            this.FpuFlags         = nativeInstructionDetail.Flag.FpuFlags;
            this.ModRm            = nativeInstructionDetail.ModRm;
            this.Opcode           = nativeInstructionDetail.Opcode;
            this.Operands         = X86Operand.Create(disassembler, ref nativeInstructionDetail);
            this.Prefix           = nativeInstructionDetail.Prefix;
            this.Rex              = nativeInstructionDetail.Rex;
            this.Sib              = nativeInstructionDetail.Sib;
            this.SibBase          = X86Register.TryCreate(disassembler, nativeInstructionDetail.SibBase);
            this.SibIndex         = X86Register.TryCreate(disassembler, nativeInstructionDetail.SibIndex);
            this.SibScale         = nativeInstructionDetail.SibScale;
            this.SseConditionCode = nativeInstructionDetail.SseConditionCode;
            this.XopConditionCode = nativeInstructionDetail.XopConditionCode;
        }
        /// <summary>
        ///     Build an Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        internal override void Build(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            base.Build(disassembler, hInstruction);
            var nativeInstructionDetail = NativeCapstone.GetInstructionDetail <NativeXCoreInstructionDetail>(hInstruction).GetValueOrDefault();

            this.Operands = XCoreOperand.Create(disassembler, ref nativeInstructionDetail);
        }
Example #3
0
        /// <summary>
        ///     Create an XCore Instruction Group.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="id">
        ///     The instruction group's unique identifier.
        /// </param>
        /// <returns>
        ///     An XCore instruction group.
        /// </returns>
        internal static XCoreInstructionGroup Create(CapstoneDisassembler disassembler, XCoreInstructionGroupId id)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            var name = NativeCapstone.GetInstructionGroupName(disassembler.Handle, (int)id);

            var @object = new XCoreInstructionGroup(id, name);

            return(@object);
        }
        /// <summary>
        ///     Build an Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        internal override void Build(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            base.Build(disassembler, hInstruction);
            var nativeInstructionDetail = NativeCapstone.GetInstructionDetail <NativePowerPcInstructionDetail>(hInstruction).GetValueOrDefault();

            this.BranchCode = nativeInstructionDetail.BranchCode;
            this.BranchHint = nativeInstructionDetail.BranchHint;
            this.Operands   = PowerPcOperand.Create(disassembler, ref nativeInstructionDetail);
            this.UpdateCr0  = nativeInstructionDetail.UpdateCr0;
        }
Example #5
0
        /// <summary>
        ///     Build an Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        internal override void Build(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            base.Build(disassembler, hInstruction);
            var nativeInstruction       = NativeCapstone.GetInstruction(hInstruction);
            var nativeInstructionDetail = NativeCapstone.GetInstructionDetail <NativeArm64InstructionDetail>(hInstruction).GetValueOrDefault();

            this.ConditionCode = nativeInstructionDetail.ConditionCode;
            this.Operands      = Arm64Operand.Create(disassembler, (Arm64InstructionId)nativeInstruction.Id, ref nativeInstructionDetail);
            this.UpdateFlags   = nativeInstructionDetail.UpdateFlags;
            this.WriteBack     = nativeInstructionDetail.WriteBack;
        }
Example #6
0
        /// <summary>
        ///     Create a PowerPC Register.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="id">
        ///     The register's unique identifier.
        /// </param>
        /// <returns>
        ///     A PowerPC register. A null reference if the register's unique identifier is equal to
        ///     <see cref="PowerPcRegisterId.Invalid" />.
        /// </returns>
        /// <exception cref="System.ObjectDisposedException">
        ///     Thrown if the disassembler is disposed.
        /// </exception>
        internal static PowerPcRegister TryCreate(CapstoneDisassembler disassembler, PowerPcRegisterId id)
        {
            PowerPcRegister @object = null;

            if (id != PowerPcRegisterId.Invalid)
            {
                // ...
                //
                // Throws an exception if the operation fails.
                var name = NativeCapstone.GetRegisterName(disassembler.Handle, (int)id);

                @object = new PowerPcRegister(id, name);
            }

            return(@object);
        }
        /// <summary>
        ///     Build an Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        internal override void Build(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            base.Build(disassembler, hInstruction);
            var nativeInstructionDetail = NativeCapstone.GetInstructionDetail <NativeArmInstructionDetail>(hInstruction).GetValueOrDefault();

            this.ConditionCode          = nativeInstructionDetail.ConditionCode;
            this.CpsFlag                = nativeInstructionDetail.CpsFlag;
            this.CpsMode                = nativeInstructionDetail.CpsMode;
            this.IsUserMode             = nativeInstructionDetail.IsUserMode;
            this.MemoryBarrierOperation = nativeInstructionDetail.MemoryBarrierOperation;
            this.Operands               = ArmOperand.Create(disassembler, ref nativeInstructionDetail);
            this.UpdateFlags            = nativeInstructionDetail.UpdateFlags;
            this.VectorDataType         = nativeInstructionDetail.VectorDataType;
            this.VectorSize             = nativeInstructionDetail.VectorSize;
            this.WriteBack              = nativeInstructionDetail.WriteBack;
        }