Reference Guide

Chapter 4 83
Assembler Directives and Pseudo-Operations
.ENTRY and .EXIT Directives
.ENTRY and .EXIT Directives
.ENTRY and .EXIT are compiler generated directives that mark the
entry point and return point of the current procedure.
Syntax
.ENTRY
Lines of Code
.EXIT
Discussion
The .ENTRY directive signifies that the next instruction is the beginning
of an entry point for the current procedure. The .EXIT directive signifies
that the next instruction initiates a return from the current procedure.
These directives must be used when .ENTER and .LEAVE are not
present. .ENTRY and .EXIT are optional if the unwind region does not
have a corresponding entry or exit. See the documents under the topic
PA-RISC Architecture at URL: http://www.software.hp.com/STK/.
Example
This example shows a sequence of compiler-generated assembly code.
.PROC
.CALLINFO CALLER
.ENTRY ; proc entry code follows
STW %r2,-20(%sp) ; stack the return pointer
LDO 48(%sp),%sp ; set up user stack pointer
ADDIL L’$THISMODULE$-$global$,%r27 ; point to printf data
.CALL ; set up for printf call
BL printf,2 ; call printf thru RP
LDO R’$THISMODULE$-$global$(%r1),%r26 ; insert argument to
printf L$exit1 ; hide from linker
LDW -68(%sp),%r2 ; get callee RP
BV 0(%r2) ; exit thru RP
.EXIT ; end of exit sequence
LDO -48(%sp),%sp ; delete stack frame
.PROCEND