This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

About "STARTING_FRAME_OFFSET" definition


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]