예제 #1
0
        public void StackReturn(DataType dt)
        {
            var stg = new StackArgumentStorage(stackOffset, dt);

            stackOffset += Align(dt.Size, stackAlignment);
            this.Return  = stg;
        }
예제 #2
0
        public void StackParam(DataType dt)
        {
            var stg = new StackArgumentStorage(stackOffset, dt);

            stackOffset += Align(dt.Size, stackAlignment);
            Parameters.Add(stg);
        }
예제 #3
0
        public override bool Equals(object obj)
        {
            StackArgumentStorage sas = obj as StackArgumentStorage;

            if (sas == null)
            {
                return(false);
            }
            return(StackOffset == sas.StackOffset);
        }
예제 #4
0
파일: Frame.cs 프로젝트: feelworld/reko
 public Identifier FindStackArgument(int offset, int size)
 {
     foreach (Identifier id in identifiers)
     {
         StackArgumentStorage s = id.Storage as StackArgumentStorage;
         if (s != null && s.StackOffset == offset && id.DataType.Size == size)
         {
             return(id);
         }
     }
     return(null);
 }
예제 #5
0
 public Expression VisitStackArgumentStorage(StackArgumentStorage stack)
 {
     if (ensureVariables)
     {
         return(frame.EnsureStackVariable(
                    stack.StackOffset - (site.StackDepthOnEntry + sigCallee.ReturnAddressOnStack),
                    stack.DataType));
     }
     else
     {
         return(arch.CreateStackAccess(frame, stack.StackOffset, stack.DataType));
     }
 }
예제 #6
0
        public override int OffsetOf(Storage stgSub)
        {
            StackArgumentStorage arg = stgSub as StackArgumentStorage;

            if (arg == null)
            {
                return(-1);
            }
            if (arg.StackOffset >= StackOffset && arg.StackOffset + arg.DataType.Size <= StackOffset + DataType.Size)
            {
                return((arg.StackOffset - StackOffset) * DataType.BitsPerByte);
            }
            return(-1);
        }
예제 #7
0
파일: Frame.cs 프로젝트: feelworld/reko
        /// <summary>
        /// Returns the number of bytes the stack arguments consume on the stack.
        /// </summary>
        /// <returns></returns>
        public int GetStackArgumentSpace()
        {
            int cbMax = 0;

            foreach (Identifier id in identifiers)
            {
                StackArgumentStorage sa = id.Storage as StackArgumentStorage;
                if (sa == null)
                {
                    continue;
                }
                cbMax = Math.Max(cbMax, sa.StackOffset + sa.DataType.Size);
            }
            return(cbMax);
        }
예제 #8
0
 public Expression VisitStackArgumentStorage(StackArgumentStorage stack)
 {
     if (ensureVariables)
     {
         return(binder.EnsureStackVariable(
                    stack.StackOffset - site.StackDepthOnEntry,
                    stack.DataType));
     }
     else
     {
         return(arch.CreateStackAccess(
                    binder,
                    stack.StackOffset - site.SizeOfReturnAddressOnStack,
                    stack.DataType));
     }
 }
예제 #9
0
파일: Frame.cs 프로젝트: feelworld/reko
        /// <summary>
        /// The offset of a variable from the return address, as seen from a caller.
        /// </summary>
        /// <param name="var"></param>
        /// <returns></returns>
        public int ExternalOffset(Identifier id)
        {
            if (id == null)
            {
                return(0);
            }
            StackArgumentStorage stVar = id.Storage as StackArgumentStorage;

            if (stVar != null)
            {
                return(stVar.StackOffset);
            }
            FpuStackStorage fstVar = id.Storage as FpuStackStorage;

            if (fstVar != null)
            {
                return(fstVar.FpuStackOffset);
            }

            throw new ArgumentOutOfRangeException("var", "Variable must be an argument.");
        }
예제 #10
0
 Identifier StorageVisitor <Identifier> .VisitStackArgumentStorage(StackArgumentStorage stack)
 {
     throw new NotImplementedException();
 }