Assembler Directives and Pseudo-Operations

.CALLINFO Directive

Stack Frames

. . .

Variable Arguments

 

SP-64:

arg word 7

SP-60:

arg word 6

SP-56:

arg word 5

SP-52:

arg word 4

 

Fixed Arguments

SP-48:

arg word 3 / ARG3

SP-44:

arg word 2 / ARG2

SP-40:

arg word 1 / ARG1

SP-36:

arg word 0 / ARG0

 

Frame Marker

SP-32:

Saved %r19 for shared library calls.

SP-28:

Reserved

SP-24:

Saved RP for shared library calls.

SP-20:

Saved RP (or SAVED_MRP).

SP-16:

Static Link (or SAVED %sr0).

SP-12:

Clean Up.

SP-8:

Extension Pointer. Calling stub RP (RP").

SP-4:

Previous SP.

 

Top of Frame

SP:

Stack Pointer.

Example

This example uses the C printf() routine (see printf(3S) in HP-UX Reference). It illustrates most of the directives to be used when assembly language programmers follow the standard procedure calling conventions described in the documents under the topic PA-RISC Architecture at URL: http://www.software.hp.com/STK/.

.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

L’stringinit-$global$,%r27

;

point to data to be printed

LDO

R’stringinit-$global$(%r1),%r26 ;

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