STACK ------------------- ( higher addresses ) | previous bp |<-- up here ------ |-------------------| | |-------------------| | |-------------------| | | parameter | | |-------------------| | | parameter | | |-------------------| | | return | | |-------------------| | bp ---> | caller's bp | ( caller's bp points) |-------------------| | local data | |-------------------| | local data | |-------------------| sp ---> | local data | ( lower addresses ) -------------------
Note: A stack grows downward ( expand down ).
When this convention is followed the stack can be viewed as a series of 'stack frames'. Each stack frame has parameters and local data for some routine and linkage to the 'stack frames' used by the caller of that routine, etc... The saved BP values create a linked list in the stack segment which has all the information about each call including the return address. The process of following the chain back is referred to as 'unwinding the stack' and is an important aid to diagnosis when working on a problem.