Professional Documents
Culture Documents
argv
argc int a;
mfp − frame pointer (for main) int b[3];
auto variables for
main() /* no other auto variables */
auto variables for Assumes int = long = char * of
func()
stack pointer size 4 and assumes stack at high
(grows downward if func() address and descending down.
calls another function)
available for Expanded view of the stack
stack growth
Stack
global variables uninitialized data (bss) are referenced via offsets from the
frame pointer.
printf.o (lib*.a) (not usual case) is stored in a register. The stack pointer
file.o is move to the y location, the code
func(72,73) ra (return address) is jumped to the return address (ra),
main.o and the frame pointer is set to mfp
crt0.o (startup routine) (the stored value of the caller’s frame
Low memory pointer). The caller moves the return
value to the right place.