Virtual addressing

Main storage is viewed as a long sequence of bits. The sequence of bits is subdivided into units of 8 bits, called a byte. Each byte location in storage is identified by a unique integer starting with zero (0), called an address. Addresses are either 31-bit or 64-bit integer values.

Three basic types of addresses are recognized for addressing main storage: absolute, real, and virtual.
  • An absolute address is the physical address assigned to a main storage location. No transformation is performed on an absolute address.
  • A real address is identical to an absolute address with the exception of prefixing. Prefixing is used to assign a private 8-KB block of main storage to each I-stream engine in a z/Architecture® configuration.
  • A virtual address refers to a range of addresses that can appear to be much larger than the physical size of main storage. A z/Architecture configuration implements virtual addressing through a hardware facility called dynamic address translation (DAT) and its associated region, segment, and page tables.

    Region tables point to segment tables, each of which optionally points to 2048 page tables. If present, each page table points to 256 pages. A page is a block of sequential virtual addresses that spans 4 KB and begins on a 4 KB boundary.

A virtual address space, in effect, is a code that tells the z/TPF system how to look up the absolute address in system tables. For example, a program processes a branch instruction. This branch instruction has an address as its target. This virtual address (the target address in the branch instruction) is presented to the decoding process and the absolute address is returned. When a virtual address is used by a CPU to access main storage, it is first converted by dynamic address translation (DAT) to a real address and then by prefixing, to an absolute address.

An address space is a sequence of virtual addresses that is associated with virtual storage. The addresses are usually contiguous, but they do not need to be. A page is 4096 bytes and is the minimum size of an address space. A program of fewer than 4096 bytes fits into a single page. All the addresses used in a program are set up assuming the program is loaded into main storage starting at location 0. In reality, it is not, but this assumption makes decoding the virtual address somewhat easier. If the program size increases beyond 4096 bytes (the size of a single page), another page is allocated. It does not matter whether the newly allocated page is adjacent to the first page or a hundred pages away from it. The z/TPF system decodes the addresses in the same way.

There are multiple levels of virtual address tables, each of which covers successively larger sequential virtual address spaces. A segment is a block of sequential virtual addresses that spans 1 MB and begins on a 1-MB boundary.

A region is also a block of sequential virtual addresses; region tables are used to add storage above the 2 GB bar. There are three types of region tables (region-first, -second, and -third). The control program (CP) builds the appropriate number of region tables (0–3) that are required for full addressability to available real storage. The following table is a summary of these dynamic address translation tables.
Table 1. Dynamic address translation tables
Type Points to Maps Size
Page table Pages 1 MB each 2 KB each
Segment table Page tables 2 GB each 16 KB each
Region-third table Segment tables 4 TB each 16 KB each
Region-second table Region-third tables 8 PB each 16 KB each
Region-first table Region-second tables All 16 EB each

The translation of addresses is controlled by three bits in the program status word (PSW) called the dynamic address translation (DAT) mode bit (DAT-mode bit) and the address-space-control bits. When the DAT-mode bit is set to 1, the translation of virtual addresses to absolute addresses proceeds automatically. For programs running with dynamic address translation enabled, address references are interpreted automatically as virtual addresses during processing of the program. See z/Architecture Principles of Operation for more information about dynamic address translation.

The z/TPF system makes use of two types of address spaces provided by z/Architecture support: primary virtual address space and home virtual address space. The main architectural difference between these address spaces is the use of different DAT tables for address translation.

Use of these virtual address spaces permits the z/TPF system to support up to 16 exabytes of main storage and to provide a level of Entry protection for application programs. In the z/TPF system, primary virtual address space is called ECB virtual memory (EVM), and is the only view of storage available to an Entry; home virtual address space is called system virtual memory (SVM), and there is one SVM for each I-stream engine in a z/Architecture configuration.