Ejemplo n.º 1
0
        /// <summary>
        /// Find the destination of a ARM PLT stub.
        /// </summary>
        public static Expression Arm32(IProcessorArchitecture arch, Address addrInstr, IEnumerable <RtlInstruction> instrs, IRewriterHost host)
        {
            var stubInstrs = instrs.Take(3).ToArray();

            if (stubInstrs.Length != 3)
            {
                return(null);
            }

            Constant offset;

            if (stubInstrs[0] is RtlAssignment ass &&
                ass.Src is MemoryAccess mem &&
                mem.EffectiveAddress is Address addrOffset &&
                mem.DataType is PrimitiveType dt &&
                dt.BitSize == 32)
            {
                if (!host.TryRead(arch, addrOffset, dt, out offset))
                {
                    return(null);
                }
            }