System/360 | |
Designer: | IBM |
Bits: | 32-bit |
Design: | CISC |
Type: | Register-Register Register-Memory Memory-Memory |
Encoding: | Variable (2, 4 or 6 bytes long) |
Branching: | Condition code, indexing, counting |
Endianness: | Big |
Page Size: | N/A, except for 360/67 |
Open: | Yes |
Gpr: | 16× 32-bit |
Fpr: | 4× 64-bit |
See main article: IBM System/360.
The IBM System/360 architecture is the model independent architecture for the entire S/360 line of mainframe computers, including but not limited to the instruction set architecture. The elements of the architecture are documented in the IBM System/360 Principles of Operation and the IBM System/360 I/O Interface Channel to Control Unit Original Equipment Manufacturers' Information manuals.
+ align="center" | IBM S/360 registers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The System/360 architecture provides the following features:
Memory (storage) in System/360 is addressed in terms of 8-bit bytes. Various instructions operate on larger units called halfword (2 bytes), fullword (4 bytes), doubleword (8 bytes), quad word (16 bytes) and 2048 byte storage block, specifying the leftmost (lowest address) of the unit. Within a halfword, fullword, doubleword or quadword, low numbered bytes are more significant than high numbered bytes; this is sometimes referred to as big-endian. Many uses for these units require aligning them on the corresponding boundaries. Within this article the unqualified term word refers to a fullword.
The original architecture of System/360 provided for up to 224 = 16,777,216 bytes of memory. The later Model 67 extended the architecture to allow up to 232 = 4,294,967,296[2] bytes of virtual memory.
System/360 uses truncated addressing similar to that of the UNIVAC III. That means that instructions do not contain complete addresses, but rather specify a base register and a positive offset from the addresses in the base registers. In the case of System/360 the base address is contained in one of 15[3] general registers. In some instructions, for example shifts, the same computations are performed for 32-bit quantities that are not addresses.
The S/360 architecture defines formats for characters, integers, decimal integers and hexadecimal floating point numbers. Character and integer instructions are mandatory, but decimal and floating point instructions are part of the Decimal arithmetic and Floating-point arithmetic features.
Instructions in the S/360 are two, four or six bytes in length, with the opcode in byte 0. Instructions have one of the following formats:
Instructions must be on a two-byte boundary in memory; hence the low-order bit of the instruction address is always 0.
See main article: Program Status Word.
The Program Status Word (PSW) contains a variety of controls for the currently operating program. The 64-bit PSW describes (among other things) the address of the current instruction being executed, condition code and interrupt masks.
align=center valign=bottom | Bits | align=center valign=bottom | Contents | align=left valign=bottom | Explanation | |
---|---|---|---|---|---|---|
align=center valign=top | 0-7 | valign=top style="align:left;" | System Mask | valign=top | bits 0-5: enable channels 0-5, bit 6: enable all remaining channels, bit 7: enable External interruptions (timer, interrupt key, and external signal)PoOps | |
align=center valign=top | 8-11 | Protection key | CPU protection key to compare against storage protection keys | |||
align=center valign=top | 12 | valign=top | ASCII mode | enable ASCII mode for packed decimal instructions, never used by IBM software[4] | ||
align=center valign=top | 13 | valign=top | Machine checks | enable Machine check interruptions | ||
align=center valign=top | 14 | valign=top | Wait State | processor is halted, an interruption, if enabled, will cause the processor to resume executing instructions | ||
align=center valign=top | 15 | valign=top | Problem state | enable to prevent the use of instructions reserved for supervisor state | ||
align=center valign=top | 16-31 | valign=top | Interruption Code | code to indicate the type of interruption, inserted when the PSW is stored, during IPLoad, this is the address of the device from which the program was loadedPoOps | ||
align=center valign=top | 32-33 | Instruction Length Code | length in halfwords or 0 if unavailable | |||
align=center valign=top | 34-35 | Condition Code | see individual instructions for encoding | |||
align=center valign=top | 36-39 | valign=top | Program Mask | bit 36: enable fixed-point overflow, bit 37: decimal overflow, bit 38: exponent underflow, bit 39: significancePoOps | ||
align=center valign=top | 40-63 | valign=top | Instruction Address | valign=top | address of next instruction, except for a program interruptions with ILC 0 |
Load Program Status Word (LPSW) is a privileged instruction that loads the Program Status Word (PSW), including the program mode, protection key, and the address of the next instruction to be executed. LPSW is most often used to "return" from an interruption by loading the "old" PSW which is associated with the interruption class. Other privileged instructions (e.g., SSM, STNSM, STOSM, SPKA, etcetera) are available for manipulating subsets of the PSW without causing an interruption or loading a PSW; and one non-privileged instruction (SPM) is available for manipulating the program mask.
The architecture defines 5 classes of interruption. An interruption is a mechanism for automatically changing the program state; it is used for both synchronous[5] and asynchronous events.
Interruption class | Old PSW hex dec | New PSW hex dec | align=right valign=top | Priority | |
---|---|---|---|---|---|
38 56 | 78 120 | align=right | 4 | ||
28 40 | 68 104 | align=right | 2 | ||
20 32 | 60 96 | align=right | 2 | ||
18 24 | 58 88 | align=right | 3 | ||
30 48 | 70 112 | align=right | 1 |
There are two storage fields assigned to each class of interruption on the S/360; an old PSW double-word and a new PSW double-word. The processor stores the PSW, with an interruption code inserted, into the old PSW location and then loads the PSW from the new PSW location. This generally replaces the instruction address, thereby effecting a branch, and (optionally) sets and/or resets other fields within the PSW, thereby effecting a mode change.
The S/360 architecture defines a priority to each interruption class, but it is only relevant when two interruptions occur simultaneously; an interruption routine can be interrupted by any other enabled interruption, including another occurrence of the initial interruption. For this reason, it is normal practice to specify all of the mask bits, with the exception of machine-check mask bit, as 0 for the "first-level" interruption handlers. "Second-level" interruption handlers are generally designed for stacked interruptions (multiple occurrences of interruptions of the same interruption class).
An I/O interruptionPoOps occurs at the completion of a channel program, after fetching a CCW with the PCI bit set and also for asynchronous events detected by the device, control unit or channel, e.g., completion of a mechanical movement. The system stores the device address into the interruption code and stores channel status into the CSW at location 64 ('40'X).
A Program interruption occurs when an instruction encounters one of 15 exceptions; however, if the Program Mask bit corresponding to an exception is 0 then there is no interruption for that exception. On 360/65, 360/67 and 360/85 the Protection Exception and Addressing Exception interruptions can be imprecise, in which case they store an Instruction Length Code of 0.The Interruption code may be any of
hex bits 26-31 | Dec | Exception | |||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
align=right valign=top | 0 | align=right valign=top | 0 | Imprecise interruption on 360/91, 360/95 or 360/195
| |||||||||||||||||||||||||||
align=right | 1 | align=right | 1 | OperationPoOps | |||||||||||||||||||||||||||
align=right | 2 | align=right | 2 | Privileged operationPoOps | |||||||||||||||||||||||||||
align=right | 3 | align=right | 3 | ExecutePoOps | |||||||||||||||||||||||||||
align=right | 4 | align=right | 4 | ProtectionPoOps | |||||||||||||||||||||||||||
align=right | 5 | align=right | 5 | AddressingPoOps | |||||||||||||||||||||||||||
align=right | 6 | align=right | 6 | SpecificationPoOps | |||||||||||||||||||||||||||
align=right | 7 | align=right | 7 | DataPoOps | |||||||||||||||||||||||||||
align=right | 8 | align=right | 8 | Fixed-point overflowPoOps | |||||||||||||||||||||||||||
align=right | 9 | align=right | 9 | Fixed-point dividePoOps | |||||||||||||||||||||||||||
align=right | A | align=right | 10 | Decimal overflowPoOps | |||||||||||||||||||||||||||
align=right | B | align=right | 11 | Decimal dividePoOps | |||||||||||||||||||||||||||
align=right | C | align=right | 12 | Exponent overflowPoOps | |||||||||||||||||||||||||||
align=right | D | align=right | 13 | Exponent underflowPoOps | |||||||||||||||||||||||||||
align=right | E | align=right | 14 | SignificancePoOps | |||||||||||||||||||||||||||
align=right | F | align=right | 15 | Floating-point dividePoOps | |||||||||||||||||||||||||||
align=right | 10 | align=right | 16 | Segment Translation | |||||||||||||||||||||||||||
align=right | 11 | align=right | 17 | Page Translation | |||||||||||||||||||||||||||
align=right | 12 | align=right | 18 | SSM Exception |
A Supervisor Call interruptionPoOps occurs as the result of a Supervisor Call instruction; the system stores bits 8-15 of the SVC instruction as the Interruption Code.
An ExternalPoOps[9] interruption occurs as the result of certain asynchronous events. Bits 16-24 of the External Old PSW are set to 0 and one or more of bits 24-31 is set to 1
valign=top style="text-align:right;width:8em" | PSW bit | Type of external interruption | |
---|---|---|---|
align=right | 24 | Timer | |
align=right | 25 | Interrupt key | |
align=right valign=top | 26 | External signal 2 Malfunction alert on 360/65 in Multisystem mode | |
align=right valign=top | 27 | External signal 3 System Call on 360/65 in Multisystem mode | |
align=right | 28 | External signal 4 | |
align=right | 29 | External signal 5 | |
align=right | 30 | External signal 6 | |
align=right | 31 | External signal 7 |
A Machine Check interruptionPoOps occurs to report unusual conditions associated with the channel or CPU that cannot be reported by another class of interruption. The most important class of conditions causing a Machine Check is a hardware error such as a parity error found in registers or storage, but some models may use it to report less serious conditions. Both the interruption code and the data stored in the scanout area at '80'x (128 decimal) are model dependent.
This article describes I/O from the CPU perspective. It does not discuss the channel cable or connectors, which have a separate article; there is a summary elsewhere and details can be found in the IBM literature and in FIPS PUB 60-2.[10]
I/O is carried out by a conceptually separate processor called a channel. Channels have their own instruction set, and access memory independently of the program running on the CPU. On the smaller models (through 360/50) a single microcode engine runs both the CPU program and the channel program. On the larger models the channels are in separate cabinets and have their own interfaces to memory. A channel may contain multiple subchannels, each containing the status of an individual channel program. A subchannel associated with multiple devices that cannot concurrently have channel programs is referred to as shared; a subchannel representing a single device is referred to as unshared.
There are three types of channels on the S/360:
Conceptually peripheral equipment is attached to a S/360 through control units, which in turn are attached through channels. However, the architecture does not require that control units be physically distinct, and in practice they are sometimes integrated with the devices that they control. Similarly, the architecture does not require the channels to be physically distinct from the processor, and the smaller S/360 models (through 360/50) have integrated channels that steal cycles from the processor.
Peripheral devices are addressed with 16-bit[11] addresses., referred to as cua or cuu; this article will use the term cuu. The high 8 bits identify a channel, numbered from 0 to 6, while the low 8 bits identify a device on that channel. A device may have multiple cuu addresses.
Control units are assigned an address "capture" range. For example, a CU might be assigned range 20-2F or 40-7F. The purpose of this is to assist with the connection and prioritization of multiple control units to a channel. For example, a channel might have three disk control units at 20-2F, 50-5F, and 80-8F. Not all of the captured addresses need to have an assigned physical device. Each control unit is also marked as High or Low priority on the channel.
Device selection progresses from the channel to each control unit in the order they are physically attached to their channel. At the end of the chain the selection process continues in reverse back towards the channel. If the selection returns to the channel then no control unit accepted the command and SIO returns Condition Code 3. Control units marked as High Priority check the outbound CUU to be within their range. If so, then the I/O was processed. If not, then the selection was passed to the next outbound CU. Control units marked as Low Priority check for inbound (returning) CUU to be within their range. If so, then the I/O is processed. If not, then the selection is passed to the next inbound CU (or the channel). The connection of three controls unit to a channel might be physically -A-B-C and, if all are marked as High then the priority would be ABC. If all are marked low then the priority would be CBA. If B was marked High and AC low then the order would be BCA. Extending this line of reasoning then the first of N controllers would be priority 1 (High) or 2N-1 (Low), the second priority 2 or 2N-2, the third priority 3 or 2N-3, etc. The last physically attached would always be priority N.
There are three storage fields reserved for I/O; a double word I/O old PSW, a doubleword I/O new PSW and a fullword Channel Address Word (CAW). Performing an I/O normally requires the following:
A channel program consists of a sequence of Channel Control Words (CCWs) chained together (see below.) Normally the channel fetches CCWs from consecutive doublewords, but a control unit can direct the channel to skip a CCW and a Transfer In Channel (TIC) CCW can direct the channel to start fetching CCWs from a new location.
There are several defined ways for a channel command to complete. Some of these allow the channel to continue fetching CCWs, while others terminate the channel program. In general, if the CCW does not have the chain-command bit set and is not a TIC, then the channel will terminate the I/O operation and cause an I/O interruption when the command completes. Certain status bits from the control unit suppress chaining.
The most common ways for a command to complete are for the count to be exhausted when chain-data is not set and for the control unit to signal that no more data transfers should be made. If Suppress-Length-Indication (SLI) is not set and one of those occurs without the other, chaining is not allowed. The most common situations that suppress chaining are unit-exception and unit-check. However, the combination of unit-check and status-modifier does not suppress chaining; rather, it causes the channel to do a command retry, reprocessing the same CCW.
In addition to the interruption signal sent to the CPU when an I/O operation is complete, a channel can also send a Program-Controlled interruption (PCI) to the CPU while the channel program is running, without terminating the operation, and a delayed device-end interruption after the I/O completion interruption.
These conditions are detected by the channel and indicated in the CSW.PoOps
These conditions are presented to the channel by the control unit or device.PoOps In some cases they are handled by the channel and in other cases they are indicated in the CSW. There is no distinction between conditions detected by the control unit and conditions detected by the device.
A typical channel program where SM occurs is
... Search Id Equal TIC *-8 Read Data
where the TIC causes the channel to refetch the search until the device indicates a successful search by raising SM.
The fullword Channel Address Word (CAW) contains a 4-bit storage protection key and a 24-bit address of the channel program to be started.
A Channel Command Word is a doubleword containing the following:
The low order 2 or 4 bits determine the six types of operations that the channel performs;. The encoding is
bits | Command | |
---|---|---|
| Invalid in a CCW, simulated by the processor's Test I/O (TIO) instruction | |
MMMM 0100 | SensePoOps | |
| Transfer in Channel (TIC)PoOps | |
MMMM 1100 | Read BackwardPoOps | |
MMMM MM01 | WritePoOps | |
MMMM MM10 | ReadPoOps | |
MMMM MM11 | ControlPoOps |
The meaning of the high order six or four bits, the modifier bits, M in the table above, depends upon the type of I/O device attached, see e.g., DASD CKD CCWs. All eight bits are sent to and interpreted in the associated control unit (or its functional equivalent).
Control is used to cause a state change in a device or control unit, often associated with mechanical motion, e.g., rewind, seek.
Sense is used to read data describing the status of the device. The most important case is that when a command terminates with unit check, the specific cause can only be determined by doing a Sense and examining the data returned. A Sense command with the modifier bits all zero is always valid.
A noteworthy deviation from the architecture is that DASD use Sense command codes for Reserve and Release, instead of using Control.
The flags in a CCW affect how it executes and terminates.
align=right valign=top style="width:5em" | bit | flag | effect | ||||
---|---|---|---|---|---|---|---|
align=right valign=top | 32 | valign=top | CD | valign=top | Chain-Data | Continue operation using the storage area defined by the next CCW.PoOps | |
align=right valign=top | 33 | valign=top | CC | valign=top | Chain-Command | Continue with the Command in the next CCW.PoOps | |
align=right valign=top | 34 | valign=top | SLI[14] | valign=top | Suppress-Length-Indication | Continue channel program after count mis-match.PoOps | |
align=right valign=top | 35 | valign=top | SKIP | valign=top | Skip | Do not read from or write into storage. | Do not read from or write into storage.PoOps |
align=right valign=top | 36 | valign=top | PCI | valign=top | Program-Controlled-Interruption | Request interruption when fetching CCW.PoOps |
The Channel Status Word (CSW) provides data associated with an I/O interruption.
align=right valign=top style="width:5em" | bits | field | |
---|---|---|---|
align=right | 0-3 | KeyPoOps | |
align=right | 4-7 | 0000 | |
align=right | 8-31 | Command AddressPoOps | |
align=right | 32-47 | StatusPoOps | |
align=right valign=top | 32-39 | valign=top | Unit Status ConditionsPoOps Detected by the device or control unit |
align=right | 32 | AttentionPoOps | |
align=right | 33 | Status modifierPoOps | |
align=right | 34 | Control unit endPoOps | |
align=right | 35 | BusyPoOps | |
align=right | 36 | Channel endPoOps | |
align=right | 37 | Device endPoOps | |
align=right | 38 | Unit checkPoOps | |
align=right | 39 | Unit exceptionPoOps | |
align=right valign=top | 40-47 | valign=top | Channel Status ConditionsPoOps Detected by the channel. |
align=right | 40 | Program-controlled interruptionPoOps | |
align=right | 41 | Incorrect lengthPoOps | |
align=right | 42 | Program checkPoOps | |
align=right | 43 | Protection checkPoOps | |
align=right | 44 | Channel data checkPoOps | |
align=right | 45 | Channel control checkPoOps | |
align=right | 46 | Interface control checkPoOps | |
align=right | 47 | Chaining checkPoOps | |
align=right | 48-63 | CountPoOps |
The S/360 has four I/O instructions: Start I/O (SIO), Test I/O (TIO), Halt I/O (HIO) and Test Channel (TCH). All four are privileged and thus will cause a privileged operation program interruption if used in problem state. The B1 (base) and D1 (displacement) fields are used to calculate the cuu (channel and device number); bits 8-15 of the instructions are unused and should be zero for compatibility with the S/370.
SIO attempts to start the channel program pointed to by the CAW, using the storage protection key in the CAW.
TIO tests the status of a channel and device. It may also store a CSW, in which case it completes with condition code 1.
HIO attempt to terminate an active channel program. It may also store a CSW, in which case it completes with condition code 1.
TCH tests the status of a channel. It does not affect the status of an active channel program and does not store a CSW,
The architecture of System/360 specified the existence of several common functions, but did not specify their means of implementation. This allowed IBM to use different physical means, e.g., dial, keyboard, pushbutton, roller, image or text on a CRT, for selecting the functions and values on different processors. Any reference to key or switch should be read as applying to, e.g., a light-pen selection, an equivalent keyboard sequence.
As part of the IPL facility the operator has a means of specifying a 12-bit device address, typically with three dials as shown in the operator controls drawing. When the operator[15] selects the Load function, the system performs a System Reset, sends a Read IPL[16] channel command to the selected device in order to read 24 bytes into locations 0-23 and causes the channel to begin fetching CCWs at location 8; the effect is as if the channel had fetched a CCW with a length of 24, and address of 0 and the flags containing Command Chaining + Suppress Length Indication. At the completion of the operation, the system stores the I/O address in the halfword at location 2 and loads the PSW from location 0.
Initial program loading is typically done from a tape, a card reader, or a disk drive. Generally, the operating system was loaded from a disk drive; IPL from tape or cards was used only for diagnostics or for installing an operating system on a new computer.
On some models, e.g., the S/360-85, the alignment requirements for some problem-state instructions were relaxed. There is no mechanism to turn off this feature, and programs depending on receiving a program check type 6 (alignment) on those instructions must be modified.
The decimal arithmetic feature provides instructions that operate on packed decimal data. A packed decimal number has 1-31 decimal digits followed by a 4-bit sign. All of the decimal arithmetic instructions except PACK and UNPACK generate a Data exception if a digit is not in the range 0-9 or a sign is not in the range A-F.
The Direct ControlPoOps feature provides six external signal lines and an 8-bit data path to/from storage.
The floating-point arithmetic feature provides 4 64-bit floating point registers and instructions to operate on 32 and 64 bit hexadecimal floating point numbers. The 360/85 and 360/195 also support 128 bit extended precision floating point numbers.
If the interval timer feature is installed, the processor decrements the word at location 80 ('50'X) at regular intervals; the architecture does not specify the interval but does require that value subtracted make it appear as though 1 were subtracted from bit 23 300 times per second. The smaller models decremented at the same frequency (50 Hz or 60 Hz) as the AC power supply, but larger models had a high resolution timer feature. The processor causes an External interruption when the timer goes to zero.
Multi-system operationPoOps is a set of features to support multi-processor systems, e.g., Direct Control, direct address relocation (prefixing).
If the storage protection feature is installed, then there is a 4-bit storage key associated with every 2,048-byte block of storage and that key is checked when storing into any address in that block by either a CPU or an I/O channel. A CPU or channel key of 0 disables the check; a nonzero CPU or channel key allows data to be stored only in a block with the matching key.
Storage Protection was used to prevent a defective application from writing over storage belonging to the operating system or another application. This permitted testing to be performed along with production. Because the key was only four bits in length, the maximum number of different applications that could be run simultaneously was 15.
An additional option available on some models was fetch protection. It allowed the operating system to specify that blocks were protected from fetching as well as from storing.
The System/360 Model 20 is radically different and should not be considered to be a S/360.
The System/360 Model 44 is missing certain instructions, but a feature allowed the missing instructions to be simulated in hidden memory thus allowing the use of standard S/360 operating systems and applications.
Some models have features that extended the architecture, e.g., emulation instructions, paging, and some models make minor deviations from the architecture. Examples include:
Some deviations served as prototypes for features of the S/370 architecture.