Assembler Directives and
.CALLINFO Directive
Stack Frames
. . . | Variable Arguments |
| |
arg word 7 | |
arg word 6 | |
arg word 5 | |
arg word 4 | |
| Fixed Arguments |
arg word 3 / ARG3 | |
arg word 2 / ARG2 | |
arg word 1 / ARG1 | |
arg word 0 / ARG0 | |
| Frame Marker |
Saved %r19 for shared library calls. | |
Reserved | |
Saved RP for shared library calls. | |
Saved RP (or SAVED_MRP). | |
Static Link (or SAVED %sr0). | |
Clean Up. | |
Extension Pointer. Calling stub RP (RP"). | |
Previous SP. | |
| Top of Frame |
SP: | Stack Pointer. |
Example
This example uses the C printf() routine (see printf(3S) in
.CODE |
| ; declare space and subspace | ||
main |
|
|
|
|
.PROC |
| ; | delimit | procedure entry |
.CALLINFO CALLER,FRAME=0,SAVE_RP | ; no | local variables, need return | ||
.ENTER |
| ; | insert entry code sequence | |
ADDIL | ; | point to data to be printed | ||
LDO | place argument to printf | |||
.CALL |
| ; | set up for procedure call | |
BL | printf,%r2 | ; | call printf, remembering from where | |
NOP |
|
|
|
|
.LEAVE |
| ; | insert exit code sequence | |
.PROCEND | ; | delimit | procedure end | |
.DATA |
| ; | declare | space and subspace |
stringinit |
| ; | mark use of global data subspace | |
.IMPORT | $global$,DATA | ; | get data reference point |
72 | Chapter 4 |