Exemple #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>
        ///     Create an ARM Instruction.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        /// <returns>
        ///     An ARM instruction.
        /// </returns>
        internal static ArmInstruction Create(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            var builder = new ArmInstructionBuilder();

            builder.Build(disassembler, hInstruction);

            return(builder.Create());
        }
Exemple #3
0
        /// <summary>
        ///     Create an Instruction.
        /// </summary>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        /// <returns>
        ///     An ARM instruction.
        /// </returns>
        private protected override ArmInstruction CreateInstruction(NativeInstructionHandle hInstruction)
        {
            // ...
            //
            // Throws an exception if the operation fails.
            var instruction = ArmInstruction.Create(this, hInstruction);

            return(instruction);
        }
        /// <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);
        }
        /// <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;
        }
Exemple #6
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;
        }
        /// <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;
        }
 /// <summary>
 ///     Create Instruction's Details.
 /// </summary>
 /// <param name="disassembler">
 ///     A disassembler.
 /// </param>
 /// <param name="hInstruction">
 ///     An instruction handle.
 /// </param>
 /// <returns>
 ///     The instruction's details.
 /// </returns>
 private protected override PowerPcInstructionDetail CreateDetails(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
 {
     return(PowerPcInstructionDetail.Create(disassembler, hInstruction));
 }
Exemple #9
0
        /// <summary>
        ///     Create a MIPS Instruction Detail.
        /// </summary>
        /// <param name="disassembler">
        ///     A disassembler.
        /// </param>
        /// <param name="hInstruction">
        ///     An instruction handle.
        /// </param>
        /// <returns>
        ///     A MIPS instruction detail.
        /// </returns>
        internal static MipsInstructionDetail Create(CapstoneDisassembler disassembler, NativeInstructionHandle hInstruction)
        {
            var builder = new MipsInstructionDetailBuilder();

            builder.Build(disassembler, hInstruction);

            return(builder.Create());
        }