360 Assembly/360 Architecture

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

The 360 architecture is a 32-bit machine, in which the standard word size is 32 bits.

The 360 architecture has:-

16 general purpose 32-bit registers, 0 to 15 (usually Equated to the labels "R0" through "R15")
4 floating point 64-bit registers numbered 0, 2, 4 and 6, and
a Program Status Word (PSW). The program status word is composed of the privileged bit, the program counter, and the memory protection key.

The privileged bit indicates the state of the program that is currently executing.

There are two states, problem and supervisor.

Problem state is where all user software operates. Problem state applications 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.

The memory protection key is 4 bits and determines which memory areas the 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.

Certain registers on the 360 are "reserved" either by hardware requirements, or by convention.

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 no value (equivalent to low storage - address X'00000000' in memory - which is usually protected unless operating in supervisor state.)

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 instructions for additional parameters or return values.

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.

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, more typically, it will save this register (and others) immediately in the provided save area 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 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.