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. Placing constant data in the $TEXT$ space decreases the size of the nonsharable part of your program and improves the overall efficiency of the operating system.
The particular space registers mentioned above play an important role in virtual addressing. While many of the branching instructions, such as BL, BLR, and BV, are capable of branching only within the currently executing code space (called
In contrast, the memory reference instructions, such as LDW and STW, allow a choice between two forms of addressing: long and short. With long addressing, you can choose any of the space registers 1 through 3 for the space identifier part of the virtual address. The space offset is formed as the sum of an immediate displacement and the contents of a general register. With short addressing, one of the space registers between 4 through 7 is chosen automatically, based on the
On
The identifier for shared memory segments, including shared library text, is placed into space register 6 (%sr6). Shared memory and shared library text are placed into quadrant two of the shared memory space (offsets 0x80000000 through 0xBFFFFFFF). The identifier for system
40 | Chapter 3 |