360 Assembly/360 Architecture

< 360 Assembly

The 360 architecture is a 32-bit machine (64-bit for z/System), in which the standard word size is 32 bits. The 360 supports up to 16 megibytes (2^24 or 16*1024^3) of memory and 24-bit addressing. The 370 supports up to 2 gigibytes (2^31) of memory and 31-bit addressing. The z/System supports up to 16 exbibytes (2^64) of memory and 64-bit addressing.

Features

The 360 architecture has:-

Privileged and Problem States

The privileged bit (15) of the PSW indicates the state of the program that is currently executing. There are two states, problem (0) and supervisor (1). A program is said to be in "supervisor state" if the privileged bit is set, and "problem state" if it is clear.

Problem state is where all user software operates. Problem state applications ("problem programs") have restrictions including memory read and write restrictions, and cannot directly issue I/O instructions.
Supervisor state is reserved for the operating system and any of its components. Some operating systems have the capacity for a program to be marked as "authorized," in which case the program can run in supervisor state.

Memory Protection

The memory protection key (bits 8-11) is 4 bits and determines which memory areas a particular program has access to. Pages of the computer's memory are marked with certain protection keys, and only a program running with the same key (or key of zero) may write to a particular section of memory. Some versions of the hardware have read protection as well.

Virtual Memory

The 370 and above support "Dynamic Address Translation" in which a program can be loaded into a virtual address and the virtual address is translated automatically into a real address directly by the hardware. Multipl;e programs can be mapped into more virtual memory than the machine actually possesses, allowing more programs than can actually fit in memory to run simultaneously, or to allow programs larger than the actual amount of memory available to be run. The operating system can write pages to and read from disk space to store programs when not executing, or when not using all of their memory.

Exceptions

As programs do not always work correctly, or may require certain actions to be performed on their behalf by the operating system, the 360 series support various exceptions to indicate an event has occurred. Some exceptions indicate errors, possible attempts to violate security, ordinary system requests, or machine damage. Some of the more common of the many exceptions available are as follows:

Register Conventions

Certain registers on the 360 are "reserved" either by hardware requirements, or by convention (operating system usage or common practice). Note these are mere conventions or general practice, as technically no general register is reserved to any specific use at all.

Register 0 is generally used in a number of instructions as a placeholder to indicate a lack of action. Many (non-RR) instructions treat use of register 0 as having a presumed value of zero or equivalent to address X'00000000' in memory (X'0000000000000000' on 64-bit models). Depending on the operating system and whether address 0 is real address 0 or a virtual address, this area may be protected against reading, writing, or both (unless the current task is operating in supervisor state or storage key 0).

Register 1 is, by convention, used to point to the list of arguments (32 bit addresses) passed to a called subroutine, and for passing arguments for operating system calls (SVC's). It is also used by the Translate and Test instruction TRT specifically.

Register 2 may be used by some operating systems, or by certain instructions for additional parameters or return values, but is usually available for general use.

Register 3 thru Register 12 are available for general use (except on Linus where registers numbered below 7 may be used for arguments to Supervisor Calls).

Register 13 is, by convention, used to point to a save area for storing the passed registers by a called subroutine. It is the logical equivalent of a "stack pointer" on processors that have a stack. Programs running as standalone applications that call no subroutines may use this register for any purpose, but this is not recommended without placing warnings in the source code that this is being done, as it is non-standard and may be missed by anyone who later performs maintenance on that application.

Register 14 is, by convention, used to provide the address for a called subroutine to return to the caller.

Register 15 is, by convention, used to provide the entry point address of a called subroutine and to provide the initial base register for the subroutine. The subroutine may continue to use register 15 as its base register if it is short (and doesn't itself call a lower level subroutine or issue a Supervisor Call that changes Register 15) or, more typically, it will save this register (and others) immediately in the provided save area of Register 13 and use a different register (or set of registers) for the base. Also, register 15 may be used by some operating systems to provide some arguments for (or return values from) SVC's. Its use for this purpose bears some similarity to the Program Counter register on some mini and microcomputers. Register 15, by convention, is also frequently used as a return value from called subroutines, often set to an index value (0,4,8,12 etc.), suitable for direct use in a branch table immediately after return.

When a program runs on the Linux operating system, supervisor calls are passed up to 6 values in registers 1 through 6, respectively. When a program runs on OS/VS1 or z/OS, Supervisor Calls are passed values in register 0, 1, or if more than 2, in a list pointed to by register 1.

Program Status Word

The Program Status Word (PSW) is a 64-bit (on the IBM 360, 370, ESA/390, Univac and Fujitsu) or 128 bit (on the IBM z/System) privileged register which contains information about the current state of the machine (bit 12 determines if it is a 64-bit or 128 bit register). Unlike the general registers, the PSW is not directly accessible either to read or write. Privileged programs can change the contents of the entire PSW through the privileged LPSW (on 360/370/390 series) or LPSWE (on z/System) instructions. Non-privileged programs may change some bits in the PSW through execution of comparison instructions, test instructions and the SVC instruction, or through certain arithmetic and comparison instructions, as well as via branch instructions. Sections of the PSW which have fixed values are shown in the table below in green.

64-bit Func 0 R 000 T I
O
E
X
Key Type M W P AS CC Prog
Mask
00000000 A Instruction Address
Bit # 0 1 2-4 5 6 7 8-11 12 13 14 15 16-17 18-19 20-23 24-31 32 33-63
128-bit Func 0 R 000 T I
O
E
X
Key Type M W P A
S
CC Prog
Mask
R
I
000000 E
A
Bit # 0 1 2-4 5 6 7 8-11 12 13 14 15 16-17 18-19 20-23 24 25-30 31
Func B
A
0000000000000000000000000000000 Instruction Address
Bit # 32 33-63 (31 bits) 64-127 (64 bits)

An explanation of the fields in the PSW is as follows.

Bit
5
Bit
16
Bit
17
Address Handling
instructionlogical
0Any ValueReal Mode (however, if bits 16-17 are X'01' the access registers are used for addresses or values instead of the general purpose registers)
100PrimaryPrimary
01PrimaryAddress Register
10PrimarySecondary
11HomeHome
Condition Symbol Condition code in PSW
Result is zero or equal Z 0
Result is negative N 1
Result is positive P 2
Result overflows O 3


360 Assembly Language
360 Family Introduction · Basic FAQ · 360 Family · 360 Architecture
360 Instruction Set 360 Instructions · Branch Instructions · Data Transfer Instructions · Control Flow Instructions · Arithmetic Instructions · Logic Instructions · Shift and Rotate Instructions · Other Instructions
Syntaxes and Assemblers 360 Assemblers· Pseudo Instructions
Instruction Extensions Floating Point · High-Level Languages
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.