From: "Ryn" <mattyml@daemons.net>
To: linux-assembly@vger.kernel.org
Subject: SPARC Stack frame organization
Date: Sun, 5 May 2002 22:56:57 -0400 [thread overview]
Message-ID: <001901c1f4a9$afbc7b20$0201a8c0@pooh> (raw)
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;
}
reply other threads:[~2002-05-06 2:56 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001901c1f4a9$afbc7b20$0201a8c0@pooh' \
--to=mattyml@daemons.net \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox