Program Structure

 

Expressions

 

 

Field

Meaning

Selector

 

 

 

NLD' or

Right-justified, high-order 21 bits after rounding to next

NLD%

multiple of 2048; allows a three-instruction sequence.

 

 

NLR' or

L% value with constant rounded to nearest multiple of

NLR%

8192; allows a three-instruction sequence.

 

 

NLS' or

High-order 21 bits after rounding to nearest multiple of

NLS%

2048; allows a three-instruction sequence.

 

 

On PA-RISC 1.0, the page size is 2048 bytes long; on PA-RISC 1.1, 2.0, and 2.0W the page size is 4096. The selectors L', LS', and LD' modulate by 2048, and the corresponding selectors R', RS', and RD' extract the offset relative to that address.

The distinction is whether the offset is always positive and between 0 and 0x7ff (L'-R'), always negative and between -0x800and -1(LD'-RD'), or between -0x400and 0x3ff (LS'-RS'). This distinction is only important when using short addressing near a quadrant boundary, because only the left part is used to select a space register. Each pair is designed to work together just as L' and R' do in the previous example. See “Spaces” on page 39. The LR' and RR' prefixes are used for accessing different fields of a structure, allowing the sharing of the LR' computation.

For shared libraries, the field selectors T', LT', RT', Q', LRQ', and RRQ' are used in conjunction with the position-independent code options +z or +Z.

The field selectors P', LP', and RP' are used to form plabels (procedure labels) for use in dynamic calls. With position-independent code, the use of plabel values, rather than simple code addresses, is required. Refer to the HP-UX Linker and Libraries Online User Guide and ELF 64 Object File Format, http://www.software.hp.com/STK/ for more information.

For example, to get a procedure label for foo, use the following code:

ADDIL

LTP'foo,%r27,%r1

;get

left portion of plabel pointer.

LDO

RTP'foo(%r1),%r4

;add

right portion to form a complete

;plabel pointer.

The field selectors in the above example can also be written LP% and RP%.

Chapter 2

33

Page 33
Image 33
HP UX Developer Tools manual Multiple of 2048 allows a three-instruction sequence