public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* About "STARTING_FRAME_OFFSET" definition
@ 2010-03-23 17:56 redriver jiang
  2010-03-23 19:21 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: redriver jiang @ 2010-03-23 17:56 UTC (permalink / raw)
  To: gcc

Hi all,

Can this "STARTING_FRAME_OFFSET" macro be defined to be a non-constant
value ( changes with the "current_function_args_size")?

As the target process has "FP+offset" with postive "offset"( stack
grows upward, and parameters in stack grows downward), for example,

call foo( arg1, arg2, arg3,arg4), after foo's prologue, the stack is like this:

                                             <---- low address
         |--------------------------------|
	 |     Incoming arg4       | <-------------FP
         |--------------------------------|
	 |      Incoming arg3      |
         |--------------------------------|
	 |     Incoming arg2       |
	 |--------------------------------|
	 |     Incoming arg1       | <---------------ARG
	 |--------------------------------|
	 |	return PC of foo   |
	 |--------------------------------|
	 |		saved regs  |
	 |--------------------------------|
	 |		old FP        |
	 |--------------------------------|
	 |         local var0         |
	 |--------------------------------|
			                    <---- high address

 "STARTING_FRAME_OFFSET" means the offset between FP and the first
local variable, in this situation,

STARTING_FRAME_OFFSE = current_function_args_size+ size(PC in stack) +
size(saved regs) + size(old FP).

so, "STARTING_FRAME_OFFSET" depends on the
"current_function_args_size", which is a GCC internal variable.

Is this stack layout suitable?

Thanks!

redriver

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-24 13:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-23 17:56 About "STARTING_FRAME_OFFSET" definition redriver jiang
2010-03-23 19:21 ` Richard Henderson
2010-03-24 18:33   ` redriver jiang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).