Unix Stack Frame Questions
Not Marc Spencer
goehring at gnu.ai.mit.edu
Tue Mar 26 02:37:09 AEST 1991
In article <125 at epic.epic.com> tan at epic.epic.com (Andy Tan) writes:
1. Is it right to assume that the address of the last automatic
variable is the bottom of stack frame ?
it is not right to assume that there is a stack frame, and some
compilers aren't going to put autos in the frame even if a frame
exists since they can be more cheaply handled with registers.
2. How come save_state[2], which stores the Stack Pointer for
SunOS 4.x, is far away from the assumed stack bottom ?
Note: save_state[14], which stores the SP for SunOS 3.x, is
very close to the assumed stack bottom.
on a risc system with register windows some or all of your context
might not even be in memory (if i understand some risc systems' usage
of register windows correctly). every cpu is going to have varying
stack frame format(s), assuming the cpu enforces one at all, and OS
and compiler vendors are more than happy to create oddball parameter
passing and stack frame conventions.
what you appear to be doing is horribly non-portable and might as well
be written in assembly; at least then it will be obvious that it's
non-portable. :-)
--
Help stamp out vi in our lifetime!
Scott Goehring goehring at gnu.ai.mit.edu
On exile in Indianapolis, IN
More information about the Comp.unix.questions
mailing list