* SPARC Stack frame organization
@ 2002-05-06 2:56 Ryn
0 siblings, 0 replies; only message in thread
From: Ryn @ 2002-05-06 2:56 UTC (permalink / raw)
To: linux-assembly
I am trying to figure out main()s stack frame organization for the code in
[Exhibit 1]. I get the
following when I hit a breakpoint set at main():
Breakpoint 1, 0x10544 in main ()
1: x/i $pc 0x10544 <main+12>: mov 0x31, %o0
(gdb) x $sp
0xffffffffffbefb30: 0x0000000c
(gdb) x $fp
0xffffffffffbefbc0: 0x00000001
If I subtract the sp from the fp I get:
0xffffffffffbefbc0 (%fp) - 0xffffffffffbefb30 (%sp) = 144 bytes
Which comes out to 144 bytes. When I calculate the stack frame I get:
64 bytes for register window saving (%l0 - %l7 & %i0 - %i7)
+ 4 bytes ptr to struct
+ 24 bytes for 6 arguments
+ 28 7 integers @ 4 bytes each
--
120 bytes
I cannot seem to figure out why the stack frame is 144 bytes as opposed
to the 120 bytes calculated above. If you have any thoughts or insight I would
appreciate it.
Thanks a ton,
Ryan
[Exhibit 1]
#include <stdio.h>
int main(int argc, char **argv)
{
int buf1[6] = { '1' , '2' , '3' , '4' , '5',' '};
int i = 1;
myfunc1(i);
}
int myfunc1(int param)
{
char buf1[6] = "CCCCC";
int i = 1;
myfunc2(i);
}
int myfunc2(int param)
{
char buf1[5] = "EEEEE";
int i = 1;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-05-06 2:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-06 2:56 SPARC Stack frame organization Ryn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox