HP Assembler Reference Manual HP 9000 Computers 9th Edition 92432-90012 June 1998 Printed in: U.S.A. © Copyright 1998 Hewlett-Packard Company. All rights reserved.
Legal Notices The information contained in this document is subject to change without notice. Hewlett-Packard makes no warranty of any kind with regard to this material, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance, or use of this material.
Contents Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Printing History. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11 Audience. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12 Typographical Conventions. . . . . . . . . . . . . . . . . . . . . .
Contents Directives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Sections in 64-bit Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Location Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 Compiler Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Shared Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents .CALL Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .64 .CALLINFO Directive . . . . . . . . . . . . . . . . . . . . . . . .
Contents Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 .ENDM Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89 .IMPORT Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 101 101 101 .PROC and .PROCEND Directives . . . . . . . . . . . . . . . . . . . . .
Contents Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 .SUBSPA Directive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .111 Discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents 7. Programming Examples 1. Binary Search for Highest Bit Position. . . . . . . . . . . . . . . . . . . . . . . 130 2. Copying a String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 3. Dividing a Double-Word Dividend. . . . . . . . . . . . . . . . . . . . . . . . . . . 134 4. Demonstrating the Procedure Calling Convention . . . . . . . . . . . . . 136 C Program Listing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Preface This manual describes the use of the Precision Architecture RISC (PA-RISC) Assembler on HP 9000 computers. You need to be familiar with the machine instructions to use the Assembler. For a complete description of the machine instruction set, refer to PA-RISC 1.1 Architecture and Instruction Set Reference Manual and PA-RISC 2.0 Architecture. Note that, throughout this manual, there are references to PA-RISC 1.0, 1.1, and 2.0. Each version of the architecture is a superset of the preceding version.
Edition Date Software Version Second Edition January 1988 92432-03A.00.03 Third Edition November 1988 92432-03A.00.04 Fourth Edition January 1991 92432-03A.08.06 Fifth Edition January 1995 92432-03A.10.00 Sixth Edition June 1996 92432-03A.10.20 Seventh Edition May 1997 92432-03A.10.30 Eighth Edition November 1997 92453-03A.11.00 Ninth Edition June 1998 92453-03A.11.
• HP-UX Linker and Libraries Online User Guide, (ld +help) • 64-bit Runtime Architecture for PA-RISC 2.0. URL: http://www.software.hp.com/STK/ • ELF 64 Object File Format. URL: http://www.software.hp.com/STK/ Typographical Conventions Unless otherwise noted in the text, this manual uses the following symbolic conventions. computer font Computer font indicates commands, keywords, options, literals, source code, system output, and path names.
Chapter 3 Explains programming in Assembler for HP-UX. Chapter 4 Describes the PA-RISC Assembler directives and pseudo-operations. Chapter 5 Summarizes the pseudo-instructions for the PA-RISC machine instructions. Chapter 6 Describes the assembly (as) command and the ways to invoke the PA-RISC Assembler under the HP-UX operating system. Chapter 7 Contains several sample assembly language programs. Chapter 8 Lists the diagnostic messages that the PA-RISC Assembler can generate.
1 Introduction to PA-RISC Assembly Language The HP 9000 Assembly Language represents machine language instructions symbolically, and permits declaration of addresses symbolically as well. The Assembler's function is to translate an assembly language program, stored in a source file, into machine language. The result of this translation resides in a relocatable object file. The object file is relocatable because it can still be combined with other relocatable object files and libraries.
Introduction to PA-RISC Assembly Language Assembler Features • Expressions. Arithmetic expressions can be formed from symbolic addresses and constants, integer constants, and arithmetic operators. Expressions involving only symbolic and integer constants, or the difference between two relocatable symbols, defined in the current module, are called absolute expressions. They can be used wherever an integer constant can be used.
Introduction to PA-RISC Assembly Language Summary of Changes for PA-RISC 2.0 Summary of Changes for PA-RISC 2.0 The following features have changed in PA-RISC 2.0 architecture. These changes are explained in more detail in the appropriate locations in this manual. • A new .DWORD directive reserves 64 bits (a double word) of storage and initializes it to the given value. • A .LEVEL 2.0 directive should be used as the first directive in the source file to assemble it for a PA-RISC 2.0 system. • New +DA2.
Introduction to PA-RISC Assembly Language Summary of Changes for PA-RISC 2.0W (Wide Mode, 64-bit) You can explicitly use space registers, however, the Assembler issues a warning if it is other than sr0. • Some of the completers on ADDB and ADDIB instructions are not valid for PA2.0W. In addition, new completers are available. For example: ZNV, SV, and OD are not valid whereas *=, *<, and *<= are additional completers. Please refer to the PA-RISC 2.0 Architecture guide for details.
2 Program Structure An assembly language program is a sequence of statements. There are three classes of statements: • Instructions • Pseudo-operations • Directives Instructions represent a single machine instruction in symbolic form. Pseudo-operations cause the Assembler to initialize or reserve one or more words of storage for data, rather than machine instructions.
Program Structure The machine instruction mnemonics and completers are described in the PA-RISC 1.1 Architecture and Instruction Set Reference Manual and PA-RISC 2.0 Architecture. The operands field follows the opcode field, separated by a blank or tab. Operands are separated by commas. The meaning of the operands depends on the specific statement type, determined by the opcode. The number of operands permitted or required depends upon the specific instruction.
Program Structure Symbols and Constants Symbols and Constants Both addresses and constants can be represented symbolically. Labels represent a symbolic address except when the label is on an .EQU, .REG, or .MACRO directive. If the label is on an .EQU or .REG directive, the label represents a symbolic constant. If the label is the .MACRO directive, the label represents a macro name. Symbols are composed of uppercase and lowercase letters (A-Z and a-z), decimal digits (0-9), dollar signs ($), periods (.
Program Structure Symbols and Constants Table 2-1 Integer Constants Signed Unsigned Decimal -2147483648 through 2147483647 0 through 4294967295 Octal 020000000000 through 017777777777 0 through 037777777777 Hexadecimal 0x80000000 through 0x7FFFFFFF 0 through 0xFFFFFFFF The period (.) is a special symbol reserved to denote the current offset of the location counter. It is useful in address expressions to refer to a location relative to the current instruction or data word.
Program Structure Registers and Register Mnemonics Registers and Register Mnemonics PA-RISC processors have four sets of registers: • General • Floating-point • Space • Control Data is loaded from memory into general or floating-point registers and stored into memory from general or floating-point registers. Arithmetic and logical operations are performed on the contents of the general registers. On PA-RISC 1.0 or 1.1 each general register is 32 bits wide. On PA-RISC 2.
Program Structure Registers and Register Mnemonics In addition, on PA-RISC 1.1, 2.0. and 2.0W the left and right halves of the floating-point registers can be accessed as separate single-precision registers by using an L or R suffix. For example, %fr8R accesses the right-most 32 bits of %fr8 as a single-precision number. The L or R suffixes can only be used on the predefined floating-point registers in the form %frnn, where nn is the register number. It is not legal to use L or R with an integer value.
Program Structure Registers and Register Mnemonics This warning can be suppressed with the -w41 command-line option. Future versions of the Assembler may not always allow an absolute expression where a register is expected. The following example demonstrates the correct usage of the .REG directive: tblptr aka_tbl .REG .REG %r20 tblptr Predefined registers are shown in the following tables. All of the mnemonics begin with the % character, so they do not conflict with any programmer-defined symbols.
Program Structure Registers and Register Mnemonics Table 2-3 Single-Precision Floating-Point Registers %fr0L %fr8L %fr16L %fr24L %fr1L %fr9L %fr17L %fr25L %fr2L %fr10L %fr18L %fr26L %fr3L %fr11L %fr19L %fr27L %fr4L %fr12L %fr20L %fr28L %fr5L %fr13L %fr21L %fr29L %fr6L %fr14L %fr22L %fr30L %fr7L %fr15L %fr23L %fr31L %fr0R %fr8R %fr16R %fr24R %fr1R %fr9R %fr17R %fr25R %fr2R %fr10R %fr18R %fr26R %fr3R %fr11R %fr19R %fr27R %fr4R %fr12R %fr20R %fr28R %fr5R %fr13R %fr21R %fr29R %fr6R %fr14R %fr22R %fr30R %fr7R
Program Structure Registers and Register Mnemonics Table 2-4 Double-Precision Floating-Point Registers %fr0 %fr8 %fr16 %fr24 %fr1 %fr9 %fr17 %fr25 %fr2 %fr10 %fr18 %fr26 %fr3 %fr11 %fr19 %fr27 %fr4 %fr12 %fr20 %fr28 %fr5 %fr13 %fr21 %fr29 %fr6 %fr14 %fr22 %fr30 %fr7 %fr15 %fr23 %fr31 Registers %fr16 through %fr31 are available only on PA-RISC 1.1 or later architectures.
Program Structure Registers and Register Mnemonics Some additional predefined register mnemonics are provided in “Register Procedure Calling Conventions” on page 28 to match the standard procedure-calling convention. This is discussed briefly in “HP-UX Architecture Conventions” on page 39. You can find detailed information on both 32-bit and 64-bit calling conventions under the topic PA-RISC Architecture at URL: http://www.software.hp.com/STK/.
Program Structure Expressions frame (that is, .CALLINFO specified FRAME > 8191) or .CALLINFO specified .ALLOCA_FRAME. In those two cases, %previous_sp is the same as %r3, and %r3 is set up by the .ENTER pseudo-operation. Expressions Arithmetic expressions are often valuable in writing assembly code. The Assembler allows expressions involving integer constants, symbolic constants, and symbolic addresses.
Program Structure Expressions Expressions produce either an absolute or a relocatable result. Any operation involving only absolute terms yields an absolute result. Relocatable terms are allowed only for the + and - operators. The legal combinations involving relocatable terms are shown in “Legal Combinations For Relocatable Terms” on page 30.
Program Structure Expressions base register, needs only 11 bits for the remainder of the address. The Assembler provides special operators, called field selectors, that extract the appropriate bits from the result of an expression. With the field selectors L' and R', the previous example can be recoded as follows: LDIL LDW L'START,%r1 R'START(%r1),%r2 ;put left part into r1 ;add r1 and right part The field selectors are always applied to the final result of the expression.
Program Structure Expressions Field Selector Meaning LT' or LT% LR% value offset of data linkage table slots from linkage table pointer. In 32-bit mode, the linkage table pointer is %r19. In 64-bit mode, the linkage table pointer is %r27. RT' or RT% RR% value offset of data linkage table slots from linkage table pointer. In 32-bit mode, the linkage table pointer is %r19. In 64-bit mode, the linkage table pointer is %r27.
Program Structure Expressions Field Selector Meaning NLD' or NLD% Right-justified, high-order 21 bits after rounding to next multiple of 2048; allows a three-instruction sequence. NLR' or NLR% L% value with constant rounded to nearest multiple of 8192; allows a three-instruction sequence. NLS' or NLS% High-order 21 bits after rounding to nearest multiple of 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.
Program Structure Expressions Parenthesized Subexpressions The constant term of an expression may contain parenthesized subexpressions that alter the order of evaluation from the precedence normally associated with arithmetic operators. For example: LABEL1-LABEL2+((6765+(2048-1))/2048)*2048 contains a parenthesized subexpression that rounds a value up to a multiple of 2048.
Program Structure Operands and Completers Operands and Completers Machine instructions usually require one or more operands. These operands tell the processor what data to use and where to store the result. Operands can identify a register, a location in memory, or an immediate constant (that is, data that is coded into the instruction itself). The operation code determines how many and what kinds of operands are required.
Program Structure Operands and Completers is required. Relocatable expressions are meaningful when the base register is %r0, or when the base register contains the left part of a 32-bit address as illustrated in the following example: LDIL STW L%glob,%r1 %r9,R%glob(%r1) ;set up %r1 for STW Immediate operands provide data for the machine language instruction directly from the bits of the instruction word itself.
Program Structure Macro Processing Macro Processing A macro is a user-defined word that is replaced by a sequence of instructions. Including a macro in a source program causes the sequence of instructions to be inserted into the program wherever the macro appears. A user may define a word as a macro by using the .MACRO directive.
Program Structure Macro Processing value, low-order bits are used until the value of the assigned-from bit field becomes the same as the width of the assigned-to bit field. The assigned-to bit field must always be specified. No sign extension is provided by the macro assembler when bit fields are generated. The following macro definition defines the macro PACK with four formal parameters. PACK .MACRO BASE,GREG,SREG,OFFSET {0..5}=0x3E{26..31} {6..10}=BASE{27..31} {11..15}=GREG{27..31} {16..17}=SREG{30..
3 HP-UX Architecture Conventions The Assembler is a flexible tool for writing programs, but every operating system imposes certain conventions and restrictions on the programs that are intended to run on that system. This chapter discusses the conventions that must be understood in order to write assembly language programs and procedures for the PA-RISC instruction set on the HP 9000 Series 700 and 800 HP-UX operating system.
HP-UX Architecture Conventions Spaces for the duration of program execution. The identifier of the code space is placed in space register 4 (%sr4) and the identifier of the data space is placed in space register 5 (%sr5). When writing an assembly language program, declare a space named $TEXT$ for executable code, and a space named $PRIVATE$ for modifiable data. Constant data or literals that you do not plan to modify during program execution, can be placed in either space.
HP-UX Architecture Conventions Spaces code is placed into space register 7 (%sr7). System code is placed into quadrant three of the system space (offsets 0xC0000000 through 0xFFFFFFFF). Table 3-1 on page 41 shows the memory layout on HP-UX.
HP-UX Architecture Conventions Subspaces Subspaces While a space is a fundamental concept of the architecture, a subspace is just a logical subdivision of a space. The Assembler places the program's code and data into subspaces within spaces. Each subspace belongs to the space that was current when the subspace was first declared. The linker groups subspaces into spaces as it builds an executable program file. For more details see the ld(1) entry in the HP-UX Reference.
HP-UX Architecture Conventions Subspaces Directives The .SUBSPA directive is used to declare a subspace and its attributes. As with spaces, the assembly language programmer can switch from one subspace to another, and the Assembler will fill each subspace independently as if the source code had been presented one complete subspace at a time. When the .SPACE directive is used to switch spaces, the Assembler remembers the current subspace in each space.
HP-UX Architecture Conventions Sections in 64-bit Mode Space Subspace Sort Key Use $GLOBAL$ 40 Global variable base address. $PLT 6 Procedure linkage table. $SHLIB_DATA$ 12 Shared library data. $SHORTBSS$ 80 Uninitialized data and common. $SHORTDATA$ 24 Global scalar variables. 16 $THREAD_SPECIFIC$ $TBSS$ 40 Thread local storage Sections in 64-bit Mode In 64-bit mode, the Executable and Linking Format (ELF) uses segments and sections rather than spaces and subspaces.
HP-UX Architecture Conventions Sections in 64-bit Mode SUBSPACE NAME SECTION NAME $INIT$ .init $LIT$ .rodata $MILLICODE$ .text $PREINIT$ .preinit $SHORTBSS$ .sbss $SHORTDATA$ .sdata $TBSS$ .tbss • The assembler translates access rights into a set of read, write or execute permissions for the section. • The assembler ignores the sort key and quadrant attributes. • The alignment attribute maps directly to the section alignment. • The COMMON and DUP_COMM attributes map to a COMDAT section.
HP-UX Architecture Conventions Location Counters Location Counters Just as spaces can be divided into subspaces, subspaces can be further divided by using location counters. You can use up to four location counters in each subspace, and the Assembler fills a separate area for each location counter. When the assembly is complete, the subspace is formed by concatenating each of these areas. All references relative to a location counter are relocated so that they are relative to the complete subspace.
HP-UX Architecture Conventions Compiler Conventions Compiler Conventions In order to write assembly language procedures that can both call to and be called from high-level language procedures, it is necessary to understand the standard procedure-calling convention and other compiler conventions. On many computer systems, each high-level language has its own calling convention. Consequently, calls from one language to another are sometimes difficult to arrange, except through assembly code.
HP-UX Architecture Conventions Compiler Conventions the return link either in a register or on the stack. Also, it can determine the previous stack pointer by subtracting the current procedure's stack frame size. The Assembler requires that you follow programming conventions to generate unwind descriptors. The beginning and end of each procedure must be noted with the .PROC and .PROCEND directives. The .CALLINFO directive supplies additional information about the procedure, including the stack frame size.
HP-UX Architecture Conventions Compiler Conventions possible to declare a procedure that cannot conflict with HP Pascal/HP-UX procedure names by using uppercase letters. However, there is an aliasing mechanism in some compilers that allows you to declare a case-sensitive name for external use. See the appropriate language reference manual for more information. Conversely, the .
HP-UX Architecture Conventions Compiler Conventions For convenience, the $SHORTDATA$ and $SHORTBSS$ subspaces can be used for small scalar variables. Most scalar variables are close enough to $GLOBAL$ so that the shorter form can be used. Arrays and large structures should be defined in $DATA$ and the long form used.
HP-UX Architecture Conventions Shared Libraries Shared Libraries The field selectors T', LT', and RT' are used to write position-independent code in assembly language. When you use these selectors and invoke the Assembler with the as command, you must use the +z or +Z compiler option on the command line.
HP-UX Architecture Conventions Assembly Listing The choice of line number 16 is arbitrary here. At the end of the assembly listing, a symbol table is printed showing the name and value of each symbol in the file. A type field for each symbol, indicating either absolute or relocatable, is included. Certain types of source lines generate multiple instructions. Macro calls often expand to several instructions. The .ENTER and .LEAVE pseudo-operations can each generate more than one instruction.
4 Assembler Directives and Pseudo-Operations Assembler directives and pseudo-operations allow you to take special programming actions during the assembly process. The directive and pseudo-operation names begin with a period (.) to distinguish them from machine instruction opcodes or extended opcodes. Introduction Table 4-1 lists the Assembler directives. Table 4-2 on page 55 lists the pseudo-operations.
Assembler Directives and Pseudo-Operations Directive Function .CALLINFO Provides information for generating Entry/Exit code sequences and for creating stack unwind descriptors. .COMM Requests common storage for a specified number of bytes. .COPYRIGHT Inserts a string into the object module as a copyright notice. .END Terminates an assembly language program. .ENDM Marks the end of a macro definition. .ENTRY Marks the entry point of the current procedure. .
Assembler Directives and Pseudo-Operations Directive Table 4-2 Function .PROC Marks the first statement in a procedure. .PROCEND Marks the last statement in a procedure. .REG Attaches a type and number to a user-defined register name. .SHLIB_VERSION Inserts a date string into the object module as a shared-library version identifier. .SPACE Declares a new space or switches back to a previous space. .SUBSPA Declares a new subspace or switches back to a previous subspace. .
Assembler Directives and Pseudo-Operations Directive Function .HALF Reserves 16 bits (a half word) of storage and initializes it to the given value. .LEAVE Marks a procedure's exit point and generates standard exit code. .SPNUM Reserves and initializes a word of storage. .STRING Reserves the appropriate amount of storage and initializes it to the given string. .STRINGZ Reserves the appropriate amount of storage and initializes it to the given string. .
Assembler Directives and Pseudo-Operations .ALIGN Directive .ALIGN Directive The .ALIGN directive advances the current location counter to the next specified “boundary.” Syntax .ALIGN [ boundary] Parameters boundary An integer value for the byte boundary to which you want to advance the location counter. The Assembler advances the location counter to that boundary. Permissible values must be a power of 2 and can range from one to 4096. The default value is 8 (double word aligned).
Assembler Directives and Pseudo-Operations .ALLOW Directive .ALLOW Directive The .ALLOW directive tells the Assembler to temporarily allow PA-RISC features from a higher version level of the PA-RISC architecture. The .ALLOW directive also tells the Assembler to temporarily allow implementation-specific features in the assembly source file. Syntax .ALLOW 1.1 Lines of source code .ALLOW Parameters 1.1 Allows PA-RISC 1.1 features. 2.0 Allows PA-RISC 2.0 features. Discussion Use the .
Assembler Directives and Pseudo-Operations .ALLOW Directive When using the .ALLOW directive, a run-time check must be inserted into the assembly source code. This run-time check should insure that the code is executing on a PA-RISC processor that supports the feature or features being used after the .ALLOW directive. See the example below. An .ALLOW directive without a parameter signals the end of the region that the previous .ALLOW directive was controlling. Control is returned to the .
Assembler Directives and Pseudo-Operations .BLOCK and .BLOCKZ Pseudo-Operations .BLOCK and .BLOCKZ Pseudo-Operations The .BLOCK and .BLOCKZ pseudo-operations reserve a block of storage. Syntax .BLOCK [ num_bytes] .BLOCKZ [ num_bytes] Parameters num_bytes An integer value for the number of bytes you want to reserve. Permissible values range from zero to 0x3FFFFFFF. The default value is zero. Discussion The .BLOCK pseudo-operation reserves a data storage area but does not perform any initialization.
Assembler Directives and Pseudo-Operations .BLOCK and .BLOCKZ Pseudo-Operations Example The first example requests the Assembler to reserve 64 bytes of memory in the $CODE$ subspace. This area is then followed by a “Load Word” and “Store Word” instruction. swap .SPACE $TEXT$ .SUBSPA $CODE$ .BLOCK 64 LDW 0(%r2)%r1 STW %r1,4(%r2) .END The second example reserves 32 bytes of memory in the $DATA$ subspace followed by one word intended as an end marker. word0 word8 .DATA .BLOCK .
Assembler Directives and Pseudo-Operations .BYTE Pseudo-Operation .BYTE Pseudo-Operation The .BYTE pseudo-operation reserves storage and initializes it to the given value. Syntax .BYTE [ init_value[ , init_value] ...] Parameters init_value Either a decimal, octal, or hexadecimal number or a sequence of ASCII characters, surrounded by quotation marks. If you omit the initializing value, the Assembler initializes the area to zero. Discussion The .BYTE pseudo-operation requests 8 bits of storage.
Assembler Directives and Pseudo-Operations .CALL Directive .CALL Directive The .CALL directive marks the next branch statement as a procedure call, and permits you to describe the location of arguments and the function return result. Syntax .CALL [ argument_description[ argument_description] ...] Parameters argument_ description Allows you to communicate to the linker the types of registers used to pass floating point arguments and receive floating point return results in the succeeding procedure call.
Assembler Directives and Pseudo-Operations .CALL Directive parameters in both the corresponding general registers and corresponding floating-point registers. See the documents under the topic PA-RISC Architecture at URL: http://www.software.hp.com/STK/. The form of argument-description is: arg=location where arg can be: ARGWO The first word in the argument list. ARGW1 The second word in the argument list. ARGW2 The third word in the argument list. ARGW3 The fourth word in the argument list.
Assembler Directives and Pseudo-Operations .CALL Directive ; ; ; ; ; ; ; ; ; This program calls printf() with four arguments whose register locations are described in the .CALL directive. The format string goes into arg0, not to be relocated. The string “message” goes into arg1, specified as a general register. The floating-point value 57005.57005 goes into farg2, specified as a floating-point register. The hexadecimal number 0xf00d goes into arg3, specified as a general register.
Assembler Directives and Pseudo-Operations .CALL Directive .PROCEND .EXPORT main,ENTRY .IMPORT printf,CODE .DATA string_area .ALIGN 8 .STRINGZ “message” .STRINGZ “ARGS = %s,%f,%x\n” .
Assembler Directives and Pseudo-Operations .CALLINFO Directive .CALLINFO Directive .CALLINFO is a required directive that describes the environment of the current procedure. The information it provides is available to the .ENTER and .LEAVE pseudo-operations to control the entry and exit code sequences that they generate. Additional information is used by the Assembler to direct the creation of stack unwind descriptors. Syntax .CALLINFO [ parameter[ , parameter] ...
Assembler Directives and Pseudo-Operations .CALLINFO Directive CALLER or CALLS Indicates that this procedure calls other routines, so it requires space in the stack for a frame marker and a fixed argument list. (When a program is assembled using the -f option, this becomes the default case.) The Assembler allocates stack space when it encounters an .ENTER pseudo-operation and deallocates this space when it encounters a .LEAVE pseudo-operation.
Assembler Directives and Pseudo-Operations .CALLINFO Directive When a procedure uses these registers, the Assembler saves their values when it encounters an .ENTER pseudo-operation and restores these values when it encounters a .LEAVE pseudo-operation. The called routine saves these registers upon entry and restores them upon exit, so values in Entry/Save registers are preserved across a procedure call. Note: See the description of the FRAME parameter regarding the use of %r3.
Assembler Directives and Pseudo-Operations .CALLINFO Directive For PA-RISC 32-bit mode, the frame area is offset from the Stack Pointer by 48 bytes because the frame marker contains 32 bytes and the fixed argument list contains 16 bytes, when both of these areas are present. For PA-RISC 2.0W (64-bit mode), the frame area is offset from the Stack Pointer by 80 bytes because the frame marker contains 16 bytes and the fixed argument list contains 64 bytes.
Assembler Directives and Pseudo-Operations .CALLINFO Directive it restores the RP value when it encounters a .LEAVE pseudo-operation. Generally, any procedure that calls other routines should save the RP value. SAVE_SP Specifies that the current routine saves the value of Previous_SP in its frame marker at SP-4. Because the Assembler does not automatically save the Stack Pointer when it generates Entry/Exit code sequences, you must explicitly save this value in your program when using this key word.
Assembler Directives and Pseudo-Operations .CALLINFO Directive Stack Frames Variable Arguments . . . SP-64: SP-60: SP-56: SP-52: arg arg arg arg word word word word 7 6 5 4 Fixed Arguments SP-48: SP-44: SP-40: SP-36: arg arg arg arg word word word word 3 2 1 0 / / / / ARG3 ARG2 ARG1 ARG0 Frame Marker SP-32: SP-28: SP-24: Saved %r19 for shared library calls. Reserved Saved RP for shared library calls. SP-20: Saved RP (or SAVED_MRP). SP-16: SP-12: SP-8: SP-4: Static Link (or SAVED %sr0).
Assembler Directives and Pseudo-Operations .CALLINFO Directive .CODE .EXPORT main,ENTRY .IMPORT printf,CODE .
Assembler Directives and Pseudo-Operations .COMM Directive .COMM Directive The .COMM directive makes a storage request for a specified number of bytes. Syntax label .COMM [ num_bytes] Parameters label Labels the location of the reserved storage. num_bytes An integer value for the number of bytes you want to reserve. The Assembler uses a default value of 4 if the .COMM directive lacks a num_bytes parameter. Permissible values range from one to 0x3FFFFFFF. Discussion The .
Assembler Directives and Pseudo-Operations .COPYRIGHT Directive .COPYRIGHT Directive The .COPYRIGHT directive inserts a company name and date into the object module as a copyright notice. Syntax .COPYRIGHT "company-name [ , date] " Parameters company-name, date A sequence of ASCII characters, surrounded by quotation marks. The string can contain up to 256 characters. When a comma follows the company name, the next text is expected to be the date.
Assembler Directives and Pseudo-Operations .COPYRIGHT Directive Example This program places a copyright notice in the object file. Once the copyright notice is in the object file, the HP-UX utility strings can be used to access it. See strings(1) in HP-UX Reference. .COPYRIGHT "My Company Name, 8 Nov 1994" .CODE .EXPORT main,ENTRY main .PROC .CALLINFO .ENTER LDI 2,%r5 ADDI 2,%r5,%r6 .LEAVE .
Assembler Directives and Pseudo-Operations .DOUBLE Pseudo-Operation .DOUBLE Pseudo-Operation The .DOUBLE pseudo-operation initializes a double-word to a floating-point value, calculated from the parameters provided. If the location counter, is not aligned on a double-word boundary, it is forced to the next multiple of eight. If the statement is labeled, the label refers to the first byte of the storage area. Syntax .DOUBLE integer [ .fraction] [ E [ -] power] .DOUBLE .
Assembler Directives and Pseudo-Operations .DWORD Pseudo-Operation .DWORD Pseudo-Operation The .DWORD pseudo-operation reserves storage and initializes it to the given value. Syntax .DWORD [ init_value[ , init_value] ...] Parameters init_value An absolute expression, a decimal, octal, or hexadecimal number, or a sequence of ASCII characters surrounded by quotation marks. If you omit the initializing value, the Assembler initializes the area to zero. Discussion The .
Assembler Directives and Pseudo-Operations .END Directive .END Directive The .END directive terminates an assembly language program. Syntax .END Discussion This directive is the last statement in an assembly language program. If a source file lacks an .END directive, the Assembler terminates the program when it encounters the end of the file. Example A file that omitted the last line of this sample program would produce identical results. .CODE .EXPORT double,ENTRY .PROC double .CALLINFO .
Assembler Directives and Pseudo-Operations .ENDM Directive .ENDM Directive The .ENDM directive marks the end of a macro definition. The macro definition is entered into the macro table and the remaining source lines are read in and assembled. An .ENDM directive must always accompany a .MACRO directive. Syntax .ENDM Example This example defines the macro QUADL; it aligns the data specified in the macro parameters on quad word boundaries. The .ENDM directive delimits the end of the definition of QUADL.
Assembler Directives and Pseudo-Operations .ENTER and .LEAVE Pseudo-Operations .ENTER and .LEAVE Pseudo-Operations The .ENTER and .LEAVE pseudo-operations mark a procedure's entry and exit points. They instruct the Assembler to generate procedure entry and exit code sequences based on the information provided in the .CALLINFO directive. Syntax .ENTER Lines of code .LEAVE Discussion The .ENTER pseudo-operation marks an entry point for the current procedure.
Assembler Directives and Pseudo-Operations .ENTER and .LEAVE Pseudo-Operations Example This example shows the placement of the .ENTER and .LEAVE pseudo-operations. .SPACE $TEXT$ .SUBSPA $CODE$ entrypt .PROC .CALLINFO .ENTER SH1ADD %arg0,%arg1,%ret0 .LEAVE .PROCEND .EXPORT entrypt,ENTRY .
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.
Assembler Directives and Pseudo-Operations .EQU Directive .EQU Directive The .EQU directive assigns an expression value to an identifier. Syntax symbolic_name .EQU value Parameters NOTE symbolic_name The name of the identifier to which the Assembler assigns the expression. value An integer expression. The Assembler evaluates the expression, which must be absolute, and assigns this value to symbolic_name. If the expression references other identifiers, each identifier must be defined before the .
Assembler Directives and Pseudo-Operations .EXPORT Directive .EXPORT Directive The .EXPORT directive allows symbols to be defined in one program and used in other programs. Syntax .EXPORT symbol [ , type] [ , argument-description] ... Parameters symbol The name of an identifier whose definition is being exported or imported. type A linker symbol type that can take one of the following values: ABSOLUTE Designates an absolute symbol. In PA-RISC 2.
Assembler Directives and Pseudo-Operations .EXPORT Directive MILLI_EXT Locates code for the entry point of an external millicode routine. PLABEL Locates a pointer to a procedure. PRI_PROG Designates the primary program entry point. The outer block of HP Pascal/HP-UX and the main program in HP FORTRAN 77/HP-UX are type PRI_PROG. In PA-RISC 2.0W (64-bit mode) PRI_PROG symbols map to STT_FUNC. SEC_PROG Designates a secondary program entry point. In PA-RISC 2.
Assembler Directives and Pseudo-Operations .EXPORT Directive Discussion The .EXPORT directive uses a series of keywords to define a symbol to the linker. These keywords declare the symbol's type, and its argument relocation information if the symbol is the name of a procedure. Example This example makes the symbol proc available to the linker as an entry point. It also specifies that the first argument is expected in a general register. .
Assembler Directives and Pseudo-Operations .FLOAT Pseudo-Operation .FLOAT Pseudo-Operation The .FLOAT pseudo-operation initializes a single-word of storage to a floating-point value calculated from the parameters provided. If the location counter is not aligned on a word boundary, it is forced to the next multiple of four. If the statement is labeled, the label refers to the first byte of the storage area. Syntax .FLOAT integer [ .fraction] [ E [ -] power] .FLOAT .
Assembler Directives and Pseudo-Operations .HALF Pseudo-Operation .HALF Pseudo-Operation The .HALF pseudo-operation reserves storage and initializes it to the given value. Syntax .HALF [ init_value [ , init_value] ...] Parameters init_value Either a decimal, octal, or hexadecimal number or a sequence of ASCII characters, surrounded by quotation marks. If you omit the initializing value, the Assembler initializes the area to zero. Discussion The .HALF pseudo-operation requests 16 bits of storage.
Assembler Directives and Pseudo-Operations .IMPORT Directive .IMPORT Directive The .IMPORT directive allows symbols to be defined in one program but used in other programs. Syntax .IMPORT symbol [ , type] [ , TSPECIFIC] Parameters symbol The name of an identifier whose definition is being imported. type A linker symbol type that can take one of the following values: 90 ABSOLUTE Designates an absolute symbol. DATA Designates a data symbol. CODE Designates a code location.
Assembler Directives and Pseudo-Operations .IMPORT Directive TSPECIFIC The TSPECIFIC keyword indicates that this is a thread local storage symbol. Discussion The .IMPORT directive uses a series of keywords to define a symbol to the linker. These keywords declare the symbol's type. Because the .IMPORT directive specifies that another object module contains this symbol's formal definition, the Assembler does not associate an imported symbol with any particular subspace. When an .
Assembler Directives and Pseudo-Operations .LABEL Directive .LABEL Directive The .LABEL directive permits a label definition to appear within a sequence of instructions that occur on a single line. Syntax .LABEL label_id Parameters label_id NOTE Names the label identifier. The .LABEL directive is especially useful when using the M4 macro processor or the C preprocessor (cpp). You would normally use this directive in a DEFINE macro that includes multiple instructions.
Assembler Directives and Pseudo-Operations .LEVEL Directive .LEVEL Directive The .LEVEL directive tells the Assembler which version level of the PA-RISC architecture to accept while assembling the source file. The .LEVEL directive also tells the Assembler which implementationsspecific features are used in the assembly source file. Syntax 1.0 1.1 .LEVEL 2.0 2.0W Parameters 1.0 Enables PA-RISC 1.0 features. This is the default. 1.1 Enables PA-RISC 1.1 features. 2.
Assembler Directives and Pseudo-Operations .LEVEL Directive In the source file, the Assembler emits warning messages whenever a feature is used that is not appropriate for the specified .LEVEL directive. The default is to produce a PA-RISC 1.0 relocatable object file. If the default is used, any use of PA-RISC 1.1 or 2.0 features in the assembly source file generates a warning messages. If the code is expected to run on more than one level of PA-RISC architecture, a run-time check should be used with a .
Assembler Directives and Pseudo-Operations .LISTOFF and .LISTON Directives .LISTOFF and .LISTON Directives The .LISTOFF and .LISTON directives control the expansion of instructions for all macro invocations, all predefined subspace declarations, and the .ENTER and .LEAVE pseudo-operations. .LISTOFF causes the Assembler to cease listing expanded instructions until a .LISTON directive is encountered. .LISTON causes the Assembler to list expanded instructions until a .LISTOFF directive is encountered.
Assembler Directives and Pseudo-Operations .LISTOFF and .LISTON Directives If .LISTOFF had been used in the above example, the macro invocation DECR, and the directives .CODE, .DATA, .ENTER, and .LEAVE, would not have been expanded in the assembly listing. line offset 1 2 hexcode 3 4 5 6 label 7 8 9 opcode .LISTON .CODE .SPACE $TEXT$, .SUBSPA $CODE$, .PROC call_DECR 00000000 00000004 00000008 0000000C .CALLINFO .
Assembler Directives and Pseudo-Operations .LOCCT Directive .LOCCT Directive The .LOCCT directive specifies where subsequent code should occur in one of the four location counters of the current subspace. Syntax .LOCCT [ loc_number] Parameters loc_number NOTE A location-counter number of the current subspace. The permissible values are 0, 1, 2, and 3. The default is zero. The .LOCCT directive is not permitted within a procedure and cannot be used to produce unwindable code.
Assembler Directives and Pseudo-Operations .MACRO Directive .MACRO Directive The .MACRO directive marks the beginning of a macro definition. An .ENDM directive must be used to end the macro definition. Syntax label .MACRO [ formal_parameter[,formal_parameter]...] Parameters label The name of the macro. formal_parameter Specifies a string of characters treated as a positional parameter.
Assembler Directives and Pseudo-Operations .MACRO Directive NOTE Although there is no upper limit on the number of parameters or arguments in a macro definition, no single macro parameter may exceed 200 characters. Macro definitions may appear wherever and as often as necessary within source code. Macro definitions may occur inside or outside of spaces, subspaces, and procedures. Because the Assembler always uses the most recently encountered definition, macros may be redefined as often as desired.
Assembler Directives and Pseudo-Operations .MACRO Directive and prevents the label from being referenced from outside the body of the macro definition. This suffix also contains a number that is used as a counter by the Assembler. The following example defines the macro PRINT, which calls the printf() function (see printf(3S) in HP-UX Reference). The macro parameter DATA_ADDR is used to set up the argument to be passed to printf(). PRINT .MACRO ADDIL .CALL BL LDO .
Assembler Directives and Pseudo-Operations .ORIGIN Directive .ORIGIN Directive The .ORIGIN directive advances the location counter to the specified location. Syntax .ORIGIN [ location] Parameters location The integer value used to advance the location counter to that absolute location. The location counter value may not decrease during this process; that is, the value specified cannot be less than the value of the current location counter. The default value is zero.
Assembler Directives and Pseudo-Operations .PROC and .PROCEND Directives .PROC and .PROCEND Directives The .PROC and .PROCEND directives bracket the instructions within a procedure. Syntax .PROC Lines of Code .PROCEND Discussion The .PROC directive signifies that the next instruction is the first instruction of a procedure. The .PROCEND directive signifies that the previous instruction was the last instruction of the procedure. Switching spaces or subspaces within a procedure is not permitted.
Assembler Directives and Pseudo-Operations .PROC and .PROCEND Directives Example This template shows a procedure that follows the procedure-calling convention. .CODE test .PROC .CALLINFO .ENTER COMCLR,= %arg0,%arg1,%ret0 LDI 1,%ret0 .LEAVE .PROCEND .
Assembler Directives and Pseudo-Operations .REG Directive .REG Directive The .REG directive assigns a predefined or user-defined typed-register to a symbol, which becomes a synonym for the typed-register. Syntax label .REG [ typed_register] Parameters label A user-defined register name. typed_register Must be one of the predefined Assembler registers or a previously defined user-defined register name All predefined Assembler registers begin with %.
Assembler Directives and Pseudo-Operations .SHLIB_VERSION Directive .SHLIB_VERSION Directive The .SHLIB_VERSION directive marks the object file with a version string that the shared library understands. Syntax .SHLIB_VERSION " mm/yyyy" Parameters mm The one- or two-digit number of the month. yyyy The four-digit number of the year. Example The following pseudo-operation places the date September 1994 in the object file. .
Assembler Directives and Pseudo-Operations .SPACE Directive .SPACE Directive The .SPACE directive starts a new space or switches back to an old space. The Assembler ignores the .SPACE directive for 64-bit assembly programs. For more information, see “Sections in 64-bit Mode” on page 44. Syntax ,NOTDEFINED ,PRIVATE ,SORT=value .SPACE name ... ,SPNUM=value ,TSPECIFIC ,UNLOADABLE Parameters name An identifier that names the new space.
Assembler Directives and Pseudo-Operations .SPACE Directive TSPECIFIC Indicates that this space contains thread local storage data. UNLOADABLE Specifies that the space resides on disk and is not loadable into main memory. Debugger data is a typical example of an unloadable space. Discussion The first time the Assembler encounters a .SPACE directive with a new name, it uses that name to declare a new space.
Assembler Directives and Pseudo-Operations .SPNUM Pseudo-Operation .SPNUM Pseudo-Operation The .SPNUM pseudo-operation reserves a word of storage and initializes it with the space number of the space named by the operand. Only one operand is allowed and any label present is offset at the first byte of the storage just initialized. Syntax .SPNUM name Parameters name NOTE Specifies the name of a space whose space number is used to initialize a word of storage. Space numbers are ignored by the linker.
Assembler Directives and Pseudo-Operations .STRING and .STRINGZ Pseudo-Operations .STRING and .STRINGZ Pseudo-Operations The .STRING pseudo-operation reserves storage for a data area and initializes it to ASCII values. The .STRINGZ pseudo-operation reserves storage the same as .STRING, but appends a zero byte to the data. This creates a C-language-type string. If the statement is labeled, the label refers to the first byte of the storage area. Syntax .STRING "init_value" .
Assembler Directives and Pseudo-Operations .STRING and .STRINGZ Pseudo-Operations Discussion The .STRING pseudo-operation requests the required number of bytes to store the string (where each character is stored in a byte). The .STRINGZ pseudo-operation also requests the required storage for the quoted string but then appends a zero byte for compatibility with C language strings. When you label one of these pseudo-operations, the label refers to the first byte of the storage area.
Assembler Directives and Pseudo-Operations .SUBSPA Directive .SUBSPA Directive The .SUBSPA directive declares a new subspace or switches back to an old subspace. In 64-bit assembly programs subspaces map directly to the ELF concept of sections, so the .SUBSPA directive switches to or creates a new section. For more information, see “Sections in 64-bit Mode” on page 44. Syntax ,ACCESS=value ,ALIGN=value ,CODE_ONLY , COMMON ,DUP_COMM ,FIRST .SUBSPA name , FROZEN ...
Assembler Directives and Pseudo-Operations .SUBSPA Directive CODE_ONLY Specifies that this subspace contains only code. COMMON Specifies that this subspace is a common block. DUP_COMM Specifies that the initialized data symbols within this subspace can have duplicate names. When you include this parameter, multiple occurrences of a universal data symbol can exist and the linker does not report a “Duplicate Definition” error.
Assembler Directives and Pseudo-Operations .SUBSPA Directive Discussion The first time the Assembler encounters a .SUBSPA directive with a new name, it uses that name to declare a new subspace. As this is the defining occurrence of that subspace, optional keywords describe attributes of that subspace. When the Assembler encounters additional .SUBSPA directives with that name, it continues that subspace. In this case, the .
Assembler Directives and Pseudo-Operations .VERSION Directive .VERSION Directive The .VERSION directive places the designated string in the current object module for version identification. Syntax .VERSION "info_string" Parameters info_string A sequence of ASCII characters, surrounded by quotation marks. The string can contain up to 256 characters. Discussion The Assembler places this string in the current object module. A program can contain multiple .VERSION directives.
Assembler Directives and Pseudo-Operations .WORD Pseudo-Operation .WORD Pseudo-Operation The .WORD pseudo-operation reserves storage and initializes it to the given value. Syntax .WORD [ init_value[ , init_value] ...] Parameters init_value A relocatable or absolute expression, a decimal, octal, or hexadecimal number, or a sequence of ASCII characters surrounded by quotation marks. If you omit the initializing value, the Assembler initializes the area to zero. Discussion The .
Assembler Directives and Pseudo-Operations Programming Aids Programming Aids The Assembler provides a series of standard space and subspace definitions that you can use to simplify the writing of an assembly program. These definitions are duplicated in the system file /usr/lib/pcc_prefix.s. Because this file is relatively large and may change with new releases of the Assembler, you can view the most recent version of the file on your terminal screen by typing the command: more /usr/lib/pcc_prefix.
Assembler Directives and Pseudo-Operations Programming Aids Directive Space Name Default Parameters .LNTT .space $DEBUG$,'' .subspa $LNTT$, SPNUM=2,PRIVATE,UNLOADABLE,SORT=80 ALIGN=4,ACCESS=0,UNLOADABLE .MILLICODE .space $TEXT$,'' .subspa $MILLICODE$, SPNUM=0,SORT=8 QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=8 .PCB .space $PRIVATE$,'' .subspa $PCB$, PRIVATE,SPNUM=1,SORT=16 QUAD=1,ALIGN=8,ACCESS=0x10,SORT=82 .REAL .space $TEXT$,'' .
Assembler Directives and Pseudo-Operations Programming Aids 118 Chapter 4
5 Pseudo-Instruction Set In addition to the PA-RISC instruction set, which is described in PA-RISC 1.1 Architecture and Instruction Set Reference Manual and PA-RISC 2.0 Architecture, the Assembler provides a number of pseudo-instructions that perform commonly used forms of the basic instructions. These pseudo-instructions are listed with their standard-instruction format in Table 5-1 on page 120.
Pseudo-Instruction Set Table 5-1 Pseudo-Instructions Pseudo-Instruction Format Standard Instruction Format ADDB,cond,n1, 2 r1,r2,target ADDBT,cond,n ADDBF,cond,n r1,r2,target r1,r2,target ADDIB,cond,n1, 2 r1,r2,target ADDIBT,cond,n ADDIBF,cond,n r1,r2,target r1,r2,target B w BL w, %r0 COMB,cond,n1, 2 r1,r2,target COMBF,cond,n COMBT,cond,n r1,r2,target r1,r2,target COMIB,cond,n1, 2 r1,r2,target COMIBF,cond,n COMIBT,cond,n r1,r2,target r1,r2,target COPY r,t LDO 0(r),t LDI i,t LDO
Pseudo-Instruction Set Table 5-2 Compare and Branch Conditions (COMB and COMIB) cond Description never = opd1 is equal to opd2 < opd1 is less than opd2 (signed) <= opd1 is less than or equal to opd2 (signed) << opd1 is less than opd2 (unsigned) <<= opd1 is less than or equal to opd2 (unsigned) SV opd1 minus opd2 results in overflow (signed) OD result of opd1 minus opd2 is odd TR always <> opd1 is less than or greater than opd2 >= opd1 is greater than or equal to opd2 (signed) > opd1
Pseudo-Instruction Set Table 5-3 Add and Branch Conditions (ADDB and ADDIB) cond Description never = opd1 is equal to -opd2 < opd1 is less than -opd2 (signed) <= opd1 is less than or equal to -opd2 (signed) NUV opd1 + opd2 < 232 (no unsigned overflow) ZNV opd1 + opd2 < 232 or opd1 + opd2 = 0 SV opd1 plus opd2 results in overflow (signed) OD result of opd1 plus opd2 is odd TR always <> opd1 is not equal to -opd2 >= opd1 is greater than or equal to -opd2 (signed) > opd1 is greater tha
6 Assembling Your Program This chapter describes two different ways you can invoke the Assembler and the various command line options controlling its behavior. It also contains a brief description of the interface between the Assembler and linker, and things you should remember to facilitate the running of an assembly program. Invoking the Assembler You can invoke the Assembler directly by using the as command.
Assembling Your Program Using the as Command Using the as Command The as command is the standard command for invoking the Assembler on PA-RISC systems running on HP-UX. See as(1) in HP-UX Reference for complete details. If no files are specified, the Assembler reads source text from standard input, which must be a command-line pipe or a FIFO. It cannot be a device file, such as a terminal. The Assembler produces a single output file (see the -o option).
Assembling Your Program Using the as Command specified. The use of this option is discouraged. The preferred method for selecting the architecture is to use a .LEVEL directive in the assembly source file. The target architecture specified with the .LEVEL directive takes precedence over the architecture specified with the +DA option. Chapter 6 -e Specify that the Assembler should tolerate one million errors before terminating the assembly process.
Assembling Your Program Using the as Command -u Prevent the Assembler from creating stack unwind descriptors. This option precludes the use of the .ENTER and .LEAVE directives within a program. -v filename Name a file to which the Assembler writes cross-reference information; this includes the source file and the line number for each appearance of all symbols. -V Print the version number of the Assembler program to standard error before assembling the source text.
Assembling Your Program Using the cc Command Using the cc Command You can also use the cc command to run the Assembler on files that have a .s suffix. See cc(1) man page for the HP C/HP-UX ANSI C compiler, if installed. The cc command inserts the system file /usr/lib/pcc_prefix.s in front of the .s file and pipes the file through the C preprocessor (see cpp(1) in HP-UX Reference) before passing the file to the Assembler. pcc_prefix.
Assembling Your Program Using the cc Command cpp Preprocessor You can use the C preprocessor (cpp) with assembly language programs to include C-type macros, including directives. You can use an exclamation point (!) as a statement terminator to include multiple statements in the body of one macro definition. Furthermore, you can use the .LABEL directive to declare labels within a macro definition. NOTE If you use cpp, C-style comments should only be used on separate lines.
7 Programming Examples This chapter consists of five programming examples in assembly language. The first three examples show typical assembly language code sequences; the last two examples show the correspondence between C, a higher-level programming language, and assembly language. Example 1 Calculates the highest bit position set in a passed parameter. A binary search is used to enhance performance. Example 2 Copies bytes from a source location to a destination location.
Programming Examples 1. Binary Search for Highest Bit Position 1. Binary Search for Highest Bit Position The Shift Double and Extract Unsigned instructions are used to implement a binary search. Bits shifted into general register 0 are effectively discarded. .CODE .EXPORT post ; ; ; ; ; ; ; ; ; ; This procedure calculates the highest bit position set in the word passed in as the first argument. If passed parameter is non-zero, the algorithm starts by assuming it is one.
Programming Examples 1. Binary Search for Highest Bit Position ; ; if extracted bit is zero, fall thru and keep assumption ; else make conclusion ; EXTRU,= %arg0,0,1,%r0 ; check next bit ADDI -1,%ret0,%ret0 ; next higher power of 2 B,N tally all_zeros LDI -1,%ret0 tally .LEAVE .
Programming Examples 2. Copying a String 2. Copying a String This example contains a section of assembly code that moves a byte string of arbitrary length to an arbitrary byte address. ; ; ; ; ; ; ; ; ; ; The routine reflect copies bytes from the source location to the destination location. The first parameter is the source address and the second parameter is the destination address. The third parameter is the number of bytes to copy. For performance, larger chunks of bytes are handled differently. .
Programming Examples 2. Copying a String B COPY exeunt %r0,%ret0 ; all done ; clear rtnval 1(%arg0),%r6 ; temp1 < -byte,bump src pointer STBS,MA ADDIBF,=,N %r6,1(%arg1) -1,%arg2,onemore LDBS,MA 1(%arg0),%r6 ; ; ; ; ; onebyte LDBS,MA onemore dest<-temp1,bump dest pointer decrement count compare for 0. delay slot temp1 <-byte,bump src pointer fallout B COPY exeunt %r0,%ret0 LDI 14,%ret0 choke exeunt .LEAVE .
Programming Examples 3. Dividing a Double-Word Dividend 3. Dividing a Double-Word Dividend This example contains the code sequence to divide a 64-bit signed dividend by a 32-bit signed divisor using the DS (Divide Step) instruction. Table 7-1 on page 135 lists the registers that this program uses.
Programming Examples 3. Dividing a Double-Word Dividend Table 7-1 Register Designations Register Designations Chapter 7 Purpose dvr Register holding divisor. dvdu dvd1 Pair of registers holding dividend. tp Temporary register. quo Register holding quotient. rem Register holding remainder.
Programming Examples 4. Demonstrating the Procedure Calling Convention 4. Demonstrating the Procedure Calling Convention A C program calls an assembly language program to test if .ENTER and .LEAVE are working correctly. The assembly language program checks to see if the C program has passed the value zero in arg0. The assembly language program then returns the value -9 in ret0 to the calling program. You need to compile this assembly listing using cc.
Programming Examples 4. Demonstrating the Procedure Calling Convention Assembly Program Listing ; Assembler Module that passes results back to C driver module myfeat .EQU 000 success .EQU -9 .CODE .IMPORT errorcount,DATA .SUBSPA $CODE$ .EXPORT feat000,ENTRY .PROC .CALLINFO feat000 .ENTER LDI 0,ret0 COMIB,<> myfeat,arg0,exit NOP LDI success,ret0 exit .LEAVE .PROCEND .
Programming Examples 5. Output of the cc -S Command 5. Output of the cc -S Command This example shows how a simple C program generates assembly language code. The program calls the printf() routine. To run the assembled code, you need to link the file /usr/ccs/lib/crt0.o and the C library file. Remember that the ld command requires that you link the crt0.o file first in 32-bit mode only. You do not need to link /usr/ccs/lib/crt0.o in 64-bit mode..
Programming Examples 5. Output of the cc -S Command $THIS_SHORTDATA$ .SUBSPA $BSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=82 $THIS_BSS$ .SUBSPA $SHORTBSS$,QUAD=1,ALIGN=8,ACCESS=31,ZERO,SORT=80 $THIS_SHORTBSS$ .SUBSPA $STATICDATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=16 $STATIC_DATA$ .SUBSPA $SHORTSTATICDATA$,QUAD=1,ALIGN=8,ACCESS=31,SORT=24 $SHORT_STATIC_DATA$ .IMPORT .SPACE .SUBSPA .EXPORT .IMPORT .
Programming Examples 5.
8 Diagnostic Messages This appendix lists all error messages that originate from the PA-RISC Assembler. The Assembler error messages are divided into the following categories: Warning Messages Conditions that cause errors in program execution. Error Messages Conditions that cause the Assembler to terminate abnormally. Panic Messages Conditions that cause the Assembler to abort immediately.
Diagnostic Messages Warning Messages Warning Messages The following messages describe compiler warnings that prevent the Assembler from creating an object file. You must correct these errors to assemble your program. 1 2 3 4 5 142 MESSAGE Use of old style opcode, “%s” CAUSE Attempt to use an opcode that has been renamed for PA2.0. ACTION Consult the PA-RISC Architecture manual for the new form of the opcode. MESSAGE Unknown option “%s” ignored.
Diagnostic Messages Warning Messages 7 8 10 11 12 Chapter 8 MESSAGE Space characteristics may not be changed after first declaration CAUSE Attempt to change the values assigned to keywords for a space previously declared with a .SPACE directive. The first declaration of the space may be in the file pcc_prefix.s. ACTION Use desired values for keywords on first declaration of space. Specify keyword values on first declaration of space only.
Diagnostic Messages Warning Messages 13 CAUSE Missing argument for .COMM directive. ACTION Specify the actual number of bytes to reserve. MESSAGE Modification of %r3 with a frame size larger than 8191 bytes violates .ENTER/.LEAVE convention CAUSE General register 3 used as a temporary register within a procedure where the frame size was set by the FRAME keyword to a size larger than 8191 bytes. Note: %r3 is predefined as a frame pointer for procedures with large frames.
Diagnostic Messages Warning Messages 17 18 19 20 21 Chapter 8 ACTION Use a different name in the label part to avoid overwriting the previous definition. MESSAGE Existing register name, number, and type are being overwritten CAUSE Name (label) used with .REG was previously defined. ACTION Use a different name in the label part to avoid overwriting previous definition. MESSAGE The "%s" error message catalog cannot be located CAUSE Error message catalog for LANG cannot be accessed.
Diagnostic Messages Warning Messages 22 23 25 26 27 28 146 CAUSE Wrong register type used. ACTION Use a space register. MESSAGE Control register expected in this field - %s CAUSE Wrong register type used. ACTION Use a control register. MESSAGE Floating point register expected in this field - %s CAUSE Wrong register type used. ACTION Use a floating-point register. MESSAGE This subspace should have no initialized data in it CAUSE Use of a directive, such as .
Diagnostic Messages Warning Messages 29 30 31 32 33 Chapter 8 CAUSE More than one .COPYRIGHT directive encountered. ACTION Remove the extra .COPYRIGHT directive(s). MESSAGE A procedure may not be empty CAUSE Procedure with no code encountered. ACTION Add at least one instruction to procedure or delete the procedure from the source file. MESSAGE Procedure does not have .CALLINFO CAUSE Procedure requires a .CALLINFO due to use of .ENTER/.LEAVE or if there are no unwind space requirements.
Diagnostic Messages Warning Messages 34 35 36 148 ACTION Avoid using loads to %r0 if you want your code to execute correctly on all PA-RISC machines. MESSAGE Missing .LEVEL directive; A .LEVEL 1.0 was inserted before .ALLOW CAUSE A .ALLOW directive was encountered without first seeing a .LEVEL directive. ACTION Insert a .LEVEL directive at the start of the source file. MESSAGE Use of .ALLOW %s not meaningful for file assembled at .LEVEL %s CAUSE The .
Diagnostic Messages Warning Messages 37 38 39 40 Chapter 8 MESSAGE Use of %s requires key bit %s to be enabled with a .LEVEL or .ALLOW CAUSE Use of a feature that requires a key bit to be set. ACTION Add key bit to the .LEVEL or .ALLOW directive. MESSAGE Encoding for %s requires a format that is incorrect for the current %s of %s CAUSE The instruction requires an encoding format that is not available on the hardware that the assembler is targeting.
Diagnostic Messages Warning Messages the operand. The new assembler will also accept these poorly formed operands and also add the trailing (%r0) to the operand, but it additionally flags this as a potential problem by issuing this warning. 41 ACTION Add a trailing (%r0) to the operand or otherwise correct the poorly formed operand.
Diagnostic Messages Warning Messages for it to be able to disambiguate between immediates and registers for certain opcodes. Thus in future versions of the assembler this message may be a non-suppressible error instead of a warning. 42 44 MESSAGE Use of %s is incorrect for the current %s of %s CAUSE Use of a cbit in a FTEST or FCMP instruction, with a .LEVEL of 1.1 or 1.0. The cbit feature of FCMP and FTEST is only available for .LEVEL 2.0. ACTION Insert a .LEVEL or .
Diagnostic Messages Warning Messages The value ACCESS=0x2c should be used for all code or read-only subspaces and the value ACCESS=0x1f should be used for all data or read-write subspaces. 45 46 47 152 MESSAGE Previous value for .SHLIB is being changed to this value CAUSE More than one .SHLIB directive was encountered. ACTION Remove the extra .SHLIB directive(s). MESSAGE The +DA option conflicts with the .LEVEL directive, using .LEVEL %s. CAUSE The assembly source file contained a .
Diagnostic Messages Warning Messages 48 49 Chapter 8 MESSAGE Expression encountered while expecting a register; Register %s substituted for expression. CAUSE An expression was encountered in a location where a predefined register (starting with a % or a register name that was previously defined by the .REG directive was expected. (Also see warning 41). ACTION Replace expression with a predefined register or a register name that was previously defined by the .REG directive.
Diagnostic Messages Error Messages Error Messages The following messages describe compilation errors that prevent the Assembler from creating an object file. You must correct these errors to assemble your program. 1000 1001 1002 1003 1004 154 MESSAGE Unterminated quoted string CAUSE String specified was missing the trailing double quote. Strings literals can not span multiple lines. ACTION Add trailing double quote to string.
Diagnostic Messages Error Messages 1005 1007 1008 1009 1010 Chapter 8 ACTION Consult the PA-RISC Architecture and Instruction Set Reference Manual, for the list of valid completer combinations for this instruction. MESSAGE Unable to open xref file: %s CAUSE Assembler could not create or access the file specified with the -v command-line option. ACTION Insure that the directory is writable. MESSAGE Label not allowed here in this expr CAUSE Assembler will not allow a label here.
Diagnostic Messages Error Messages 1011 1012 1013 1014 1015 156 ACTION Replace with an expression beginning with a label or “.” MESSAGE "." allowed in pc_rel expression only CAUSE A period (.) used as an operand in a non-branch context, or used as a target in external branch or vectored branch. ACTION Use “.” only for pc-relative branches, not in branch external or branch vectored. MESSAGE PC-relative expression must begin with . or label CAUSE Branch target is poorly formed.
Diagnostic Messages Error Messages 1016 1017 1018 1019 1020 1021 Chapter 8 MESSAGE General register %s is out of range CAUSE Register number specified greater than 31 or less than 0. ACTION Use a valid general register number between 0 and 31. MESSAGE Value of %s for space register not in %sr0..%sr3 CAUSE Space register specified was not in the legal range. ACTION Use a space register in the valid range 0 to 3. MESSAGE Value of %s for space register not in %sr0..
Diagnostic Messages Error Messages 1022 1023 1024 1025 1026 158 CAUSE Illegal assignment for ARGW or RTNVAL keyword in .CALL or .EXPORT directive ACTION Use NO, GR, FR, or FU as appropriate. MESSAGE This directive must occur within a declared subspace: .%s CAUSE The directive used must appear inside of a .SUBSPA. The directive was place outside of a subspace. ACTION Insert a .SUBSPA before issuing this directive. MESSAGE Directive .
Diagnostic Messages Error Messages 1027 1028 1029 1030 Chapter 8 CAUSE The name being defined already has a definition. Each identifier can only have one legal meaning. You can't define both a space and a subspace with the same name. ACTION Change the name used by one of the definitions to a unique name. MESSAGE This item must be declared within a space CAUSE A directive such as .SUBSPA, is used before the first .SPACE directive. ACTION Insert a valid .
Diagnostic Messages Error Messages 1031 1032 1033 1034 160 ACTION Remove the duplicate .CALLINFO directive or correct the location of the .PROC and .PROCEND directives for this procedure. MESSAGE Value for %s must be >=0 CAUSE 1. In a .CALLINFO directive the parameter FRAME is assigned a negative value. 2. In .BLOCK or .BLOCKZ directive the parameter is a negative value. ACTION Supply a non-negative value. MESSAGE Value for %s must be in range %r3..%r18 CAUSE In a .
Diagnostic Messages Error Messages 1035 1036 1037 1038 Chapter 8 ACTION Only %sr3 is saved using the PA-RISC calling convention. Either specify %sr3 or omit the ENTRY_SR keyword. MESSAGE Instructions must occur within a declared subspace: %s CAUSE Instructions present before .SUBSPA directive ACTION Use .
Diagnostic Messages Error Messages 1039 1041 1044 1045 1046 1047 162 MESSAGE Missing string constant CAUSE Directive, such as .STRING, .STRINGZ, .VERSION, or .COPYRIGHT is present without a string operand. ACTION Add missing quoted string after directive. MESSAGE Name required for %s CAUSE Directive, such as .IMPORT, .EXPORT, .SPACE or .SUBSPA is not followed by an valid identifier. ACTION Follow directive with a legal identifier. MESSAGE Name required for label definition CAUSE .
Diagnostic Messages Error Messages 1048 1050 1051 1052 1053 Chapter 8 CAUSE Two .PROCEND directives were encountered without a .PROC directive in between. ACTION Each procedure should begin with a single .PROC and end with a single .PROCEND. MESSAGE Comma expected CAUSE A directive which expects two or more operands was missing a comma between it's operands. ACTION Insert comma between operands.
Diagnostic Messages Error Messages 1054 1055 1056 1057 164 CAUSE The displacement for this instruction must be a constant expression. ACTION Rewrite the instruction so that it uses a constant expression. MESSAGE Unexpected items at end of line CAUSE Legal operands are followed by trailing characters or operators. ACTION Examine entire sequence of operations for syntactic integrity. Possibly insert a “;” to denote a comment after legal operands.
Diagnostic Messages Error Messages 1059 1060 1061 1062 1063 1064 Chapter 8 MESSAGE Divide by zero CAUSE Attempt to perform division with a zero divisor. ACTION Examine definition of divisor, ensure that it is not zero. MESSAGE Argument 0 or 2 in FARG upper CAUSE Using the FU value with ARGW0 or ARGW2 keywords. ACTION Only use the FU value with ARGW0 or ARGW2 keywords. MESSAGE Closing parenthesis is missing in expression CAUSE Mismatched parenthesis.
Diagnostic Messages Error Messages 1065 1066 1067 1068 1069 166 MESSAGE Poorly formed .FLOAT or .DOUBLE argument CAUSE The floating-point number that was used as the argument to .FLOAT or .DOUBLE is not in the right format. ACTION Use a properly formatted floating-point constant for the argument. MESSAGE Poorly formed bit field specifier CAUSE Bit field is not specified in the form {x..y} where x and y are non-negative integers. ACTION Specify bit fields in the correct format.
Diagnostic Messages Error Messages 1070 1071 1072 1073 1074 Chapter 8 CAUSE Missing assignment operator = for assigning one bit field to another. ACTION Insert assignment operator = for bit field assignment. MESSAGE Bit range must be within {0..31} CAUSE Range specified in bit field is not in the legal range. ACTION Ensure bit field range is within the range 0 to 31.
Diagnostic Messages Error Messages 1075 1076 1077 1078 1079 168 ACTION Use only one label in a plabel expression. MESSAGE Undefined field selector CAUSE Illegal field selector is being used. ACTION Use correct field selector. MESSAGE Recursive macro expansion for %s CAUSE Recursive macro expansion not permitted. ACTION Change macro definition to not be recursive. MESSAGE A .CALLINFO may specify either CALLS or NO_CALLS but not both CAUSE A .
Diagnostic Messages Error Messages 1080 1081 1082 Chapter 8 ACTION Supply the missing value to be associated with the keyword using the format keyword=value. MESSAGE Missing integer for parameter %s CAUSE An operand to a directive is expecting a value to be supplied. For example, the FRAME keyword to the .CALLINFO directive expects an argument to be associated like this: FRAME=32 ACTION Supply the missing value to be associated with the keyword using the format keyword=integer.
Diagnostic Messages Error Messages 1083 1084 1085 1086 1087 170 MESSAGE Floating point register %s is out of range CAUSE The value supplied does not correspond to a legal floating-point register number. ACTION Supply a valid floating-point register number. MESSAGE Control register %s is out of range CAUSE The value supplied does not correspond to a legal control register number. ACTION Supply a valid control register number.
Diagnostic Messages Error Messages value for the month, (Jan=1,…Dec=12) and yyyy is the year. 1088 1089 1090 Chapter 8 ACTION Change the parameter to .SHLIB to a valid value. MESSAGE Floating point register %s is out of range for %s,SGL CAUSE The floating-point register used is not valid for this opcode. The multiops FMPYADD,SGL and FMPYSUB,SGL require that the operands be single precision floating-point registers in the range %fr16L,%fr16R .. %fr31L,%fr31R.
Diagnostic Messages Error Messages 1091 1094 1095 1096 172 MESSAGE Incorrect register %s used with %s optional target register must be %s. CAUSE This opcode takes an optional register operand as specified. The register you used for this operand was incorrect. ACTION Use either the correct operand or no operand. MESSAGE Value for %s must be in range 0..3 CAUSE The value supplied for the privilege level was outside the legal range of 0 to 3.
Diagnostic Messages Error Messages 1097 1098 1099 1100 Chapter 8 MESSAGE A "(" was expected while parsing the operands of instruction %s CAUSE The operands for the current instruction do not have a “(“ in the correct location. ACTION Inspect the current instruction and change the operands to the instruction so that the are valid. MESSAGE A ")" was expected while parsing the operands of instruction %s CAUSE The operands for the current instruction do not have a “)” in the correct location.
Diagnostic Messages Error Messages 1101 1102 1103 1104 174 MESSAGE Standard input must be a pipe or FIFO, not a TTY or device file. CAUSE The assembler was invoked without any input files on the command-line. For this situation the assembler will then attempt to use the standard input of a UNIX pipe command. The object file will be written to standard output for this case.
Diagnostic Messages Error Messages 1105 Chapter 8 ACTION Use a non-zero displacement. MESSAGE Displacement of %s must be multiple of eight CAUSE The displacement in this instruction must be a multiple of eight. ACTION Use a displacement that is a multiple of eight.
Diagnostic Messages Panic Messages Panic Messages The following messages describe panic errors that cause the Assembler to terminate immediately and prevent it from creating an object file. You must correct these errors to assemble your program. 2000 2002 2003 2004 176 MESSAGE Exceeded maximum error count CAUSE More than 100 errors were detected and the -e option was not used. ACTION Use the -e option to permit up to a million errors.
Diagnostic Messages Panic Messages 2005 2006 2007 2008 Chapter 8 ACTION Break up the program into smaller modules. If this does not work contact your HP-UX system administrator. MESSAGE Internal instruction parsing error on %s CAUSE Assembler has an internal defect. ACTION Have your HP-UX system administrator contact HP Technical Support. MESSAGE Unable to regain access to source file for listing CAUSE Not able to access source file for reading, while formatting the assembly listing file.
Diagnostic Messages User Warning Messages User Warning Messages The following messages are user warnings. The Assembler will proceed, and produce an object file, in some cases taking the corrective action described. 7000 7001 7002 178 MESSAGE Model number is unknown; will default to arch-rev code generation. CAUSE The model number given on a +DA option is not known to the compiler. ACTION The default code generation is as specified in the warning.
Diagnostic Messages User Warning Messages ACTION Check protections on /opt/langtools/lib/sched.models and /usr/lib/sched.models. If neither file exists, contact your HP Service Representative. 7003 MESSAGE Improper argument to +DA option. (7003) CAUSE An improper argument was given to the +DA or +DS option. ACTION The +DAmodel is either a model number (such as 877 or I50, or one of the PA-RISC architecture designations 1.0 or 1.1.
Diagnostic Messages User Warning Messages 7100 7101 7102 7103 7104 180 CAUSE The completer specified in an inline assembly call was invalid for the opcode given. ACTION Check the architecture instruction set specification to determine valid completers. MESSAGE code subspace has no unwind subspace (7100) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Improper completer ,completer given for opcode opcode CAUSE Internal compiler error.
Diagnostic Messages User Warning Messages 7105 7106 7107 7108 7109 7110 Chapter 8 MESSAGE Immediate value of value for opcode is greater than 15 (set to 15) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE DSR value of %1s for %2s not in [0..3] - truncated (7106) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE CSR value of value for opcode not in [0..7] - truncated CAUSE Internal compiler error.
Diagnostic Messages User Warning Messages 7111 7112 182 MESSAGE Bad annotation (7111) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Mandatory completer missing for opcode %1s (7112) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative.
Diagnostic Messages Limit Error Messages Limit Error Messages The following messages describe limit errors that cause the Assembler to terminate immediately and prevent it from creating an object file. you may be able to work around these errors. They involve running into Assembler limits or running out of memory. 7200 MESSAGE start/new_pool: out of memory. (7200) CAUSE The compiler attempted to allocate some dynamic memory, and the system was unable to provide the memory.
Diagnostic Messages Limit Error Messages Increase the system swap area. 7202 MESSAGE init_link: out of memory. (7202) CAUSE Compiler ran out of virtual memory. The compiler attempted to allocate some dynamic memory, and the system was unable to provide the memory. ACTION See message 7200. Check the system limits because other processes might be running that also allocate dynamic memory. Break up your compilation module into smaller pieces, and compile them separately. Increase the system swap area.
Diagnostic Messages Limit Error Messages 7205 7206 7207 7208 7209 7210 Chapter 8 ACTION Check for full file system (HPUX-MPE/iX) or too small object file (MPE/iX). MESSAGE unable to allocate space for object in RL. (7205) CAUSE I/O error writing to RL. ACTION Check for too small RL file (MPE/iX). MESSAGE unable to add object to RL. (7206) CAUSE I/O error writing to RL. ACTION Check for too small RL file or write permission (MPE/iX). MESSAGE object is too big to fit into RL.
Diagnostic Messages Limit Error Messages 7211 7212 7213 7214 186 CAUSE An error condition was returned while attempting to open or write data from an object file. ACTION Check file permissions and the status of object files being written by the compiler. MESSAGE Out of memory while writing %1s (7211) CAUSE Compiler ran out of virtual memory while writing ISOM file. ACTION See message 7200. MESSAGE get_m_heap: out of memory. (7212) CAUSE Compiler ran out of virtual memory.
Diagnostic Messages Branching Error Messages Branching Error Messages The following messages describe branching errors that prevent the Assembler from creating an object file. You must correct these errors to assemble your program. 7400 7401 7402 7403 7404 Chapter 8 MESSAGE Procedure number %1s has no label known to linker (7400) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Attempt to set location counter backward with .
Diagnostic Messages Branching Error Messages 7405 7406 7407 7408 7800 7801 188 MESSAGE branch target %1s unresolvable, instruction number %2s (7405) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative MESSAGE label known to linker deleted (7406) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Corrupt or unrecognized intermediate code in %1s (7407) CAUSE The ucode in the ISOM file is not recognizable.
Diagnostic Messages Branching Error Messages 7802 7203 7804 7805 7806 7807 Chapter 8 CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE attempt to insert non-existent inst. (7802) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE attempt to insert labeled instruction (7803) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative.
Diagnostic Messages Branching Error Messages 7808 7809 7810 7811 7812 7813 190 ACTION Report error to your HP Service Representative. MESSAGE re_init_sllic : file position out of alignment (7808) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Data size not equal to subspace length. (7809) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE push_mappings: Stack overflow.
Diagnostic Messages Branching Error Messages 7814 7815 7816 7817 7818 7819 7820 Chapter 8 MESSAGE fixup_DNTT_entry: can’t find procedure end for symbol %1s. (7814) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Malloc: underflow detected in free(). (7815) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE Malloc: overflow detected in free(). (7816) CAUSE Internal compiler error.
Diagnostic Messages Branching Error Messages 7821 7822 7823 7824 7825 7826 192 CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE after: only one graph entry allowed for repeated inits. (7821) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE newfixup: invalid fixup. (7822) CAUSE Internal compiler error. ACTION Report error to your HP Service Representative. MESSAGE xdb_sup: XT entry out of order.
Diagnostic Messages Branching Error Messages CAUSE Contents of the file sched.models were unexpected. This file should contain current mappings between machine model numbers and architecture revisions. ACTION Check that /opt/langtools/lib/sched.models or /usr/lib/sched.models were installed or updated along with your current version of the operating system. 7827 7828 7834 7835 Chapter 8 MESSAGE Invalid architecture version. (7827) CAUSE The architecture revision provided in the file sched.
Diagnostic Messages Branching Error Messages 7836 CAUSE Internal compiler error. ACTION Report error to your HP Service Representative MESSAGE Files with executable code must have at least one exported code symbol. (7836) 7837 194 CAUSE Your assembly file contains executable code but does not have any exported entry points. ACTION Use the .EXPORT directive for one of your entry points or code symbols. MESSAGE .WORD pseudo-op cannot hold a 64-bit address. Use .DWORD instead.
Index Symbols # label field, 19 $BSS$ 64-bit mode, 44 $BSS$ subspace, 43, 74 $CODE$ 64-bit mode, 44 $CODE$ subspace, 43, 61, 91 $DATA$ subspace, 43, 61, 91 $DEBUG$ space, 41 $DLT$ subspace, 43 $GLOBAL$ subspace, 43, 49 $LIT$ subspace, 43 $MILLICODE$ subspace, 43 $PLT$ subspace, 43 $PRIVATE$ space, 40, 41, 43, 49, 74 $SHLIB_DATA$ subspace, 43 $SHLIB_INFO$ subspace, 43 $SHORTBSS$ subspace, 43, 50 $SHORTDATA$ subspace, 43, 50 $TBSS$ subspace, 50 $TEXT$ space, 40, 41, 43 $UNWIND$ subspace, 43 (MRP) Millicode R
Index Numerics 64-bit environment, 16, 17, 23, 24, 33, 39, 44 See Also PA-RISC 2.0W .ALLOW directive, 58 .CALL directive, 63 .CALLINFO directive, 71 .EXPORT Directive, 85 .EXPORT directive, 85, 86 .LEVEL directive, 93 .
Index symbols, 85 COMB pseudo-instruction, 120 COMIB pseudo-instruction, 120 command as, 124 cc, 127 comments field, 19, 20 compare and branch conditions, 121 compiler conventions, 47 completers, 35 macros, 37 condition add and branch, 122 compare and branch, 121 constants, 21 integer, 21 parenthesized subexpressions, 34 register-type, 25 control registers, 24 COPY pseudo-instruction, 120 counter, location, 97, 101 cpp (C preprocessor), 128 creating entry/exit code sequences, 67 stack unwind descriptors, 6
Index F feature implementation-specific, 58, 93 field selectors, 30, 51 shared libraries, 33 fields comments, 19, 20 label, 19 opcode, 19 operands, 19, 20 fixed argument list, 68 floating-point registers, 23 floating-point value initializing a double-word to, 77 initializing a single-word to, 88 following instruction delay slot, 119 frame marker, 68 G general registers, 23, 35, 48 generating entry/exit code sequences, 67 stack unwind descriptors, 67 global symbol, 49 H hard_reg.
Index 64-bit environment, 44 See also storage unable to allocate, 183 message catalog, 141 messages branching, 187 limit, 183 out of memory, 183 user warnings, 178 warning warnings, 187 MFCTL thread local storage, 50 millicode, 70 Millicode Return Pointer (MRP), 70 mnemonic instructions, 15 register, 23 moving location counter to next alignment boundary, 57 MTSAR pseudo-instruction, 120 N new instructions creating with macros, 37 subspaces, 106, 111 NOP pseudo-instruction, 120 O object file specifying vers
Index C program generating assembly code, 138 copying a string, 132 dividing a double-word dividend, 134 programs file, 15 structure, 19 pseudo-instruction, 120 ADDB, 120 ADDIB, 120 B, 120 COMB, 120 COMIB, 120 COPY, 120 LDI, 120 MTSAR, 120 NOP, 120 pseudo-instruction set, 119 pseudo-operation, 53 .BLOCK, 60, 101 .BLOCKZ, 60 .BYTE, 62 .DOUBLE, 77 .DWORD, 78 .ENTER, 28, 48, 52, 67, 81, 83, 95, 102 .FLOAT, 88 .HALF, 89 .LEAVE, 28, 48, 52, 67, 81, 83, 95, 102 .SPNUM, 108 .STRING, 109 .STRINGZ, 109 .
Index registers, 24, 27, 39 returning to, 106 shared libraries, 40 shared memory, 40 sort key, 41 unloadable, 41 special symbol period (.
Index options, 124 V valid symbols, 21 version .