3

NOTE

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. Several Assembler directives are mentioned in this chapter to place them in a meaningful context. A full discussion of these directives is in Chapter 4, “Assembler Directives and Pseudo-Operations,” on page 53.

Spaces

Virtual addressing on PA-RISC is based on spaces. A virtual address is composed of a space identifier, which is either 16 or 32 bits long (depending on the hardware model), and a 32-bit offset within the space. Therefore, each space can contain up to 4 gigabytes, and there is a large supply of spaces.

In the 64-bit mode architecture each application is provided a flat virtual address space of 2** 64 bytes, which is divided into four quadrants. Each quadrant is mapped into this global virtual address space by means of four space registers, which are under the control of the operating system.

Every program on an HP-UX system is assigned two spaces when it is loaded for execution by the operating system: one for code, and one for data. The HP-UX operating system makes the code space read only, so that it can be shared whenever several processes are executing the same program. The data space is writable by the new process, and is private to that process; that is, every process has a unique data space.The actual space identifiers assigned to these two spaces can vary from one execution of the program to the next; these numbers cannot be determined at compile time or link time. Generally, programmers do not need to be concerned with the space identifiers, since the operating system places them in two reserved space registers, where they remain

39