Mark Smotherman. Last updated October 2009
Two execution modes: user, supervisor. Mode is recorded in PSW bit 15.
+--------+----+-+-+-+-+----------------+--+--+----+------------------------+
|sys mask|mkey|a|m|w|p| interrupt code |il|cc|pmsk| instruction address |
+--------+----+-+-+-+-+----------------+--+--+----+------------------------+
0 8 12 16 32 34 36 40
0: 7 system mask (channels 0-6, timer + interrupt key + external signal)
8:11 memory protection key
12 ASCII/EBCDIC
13 machine check mask (enable/disable machine check interrupts)
14 running/wait state
15 problem/supervisor state
16:31 interruption code (program error encoding: 1 = invalid operation, etc.)
32:33 ILC (instruction length code)
34:35 CC (condition code)
36:39 program mask (fixed-point, decimal, and exponent overflow; significance)
40:63 instruction address (24 bits on S/360)
Interruption priority order is listed as:
_...__ ________________________
0x18 | | external old PSW \
0x20 | old | supervisor call old PSW |<-- saved on interrupt -.
0x28 | PSWs | program error old PSW | (int. code stored) .
0x30 | | machine check old PSW | |
0x38 |______| I/O old PSW_____________/ \ restored |
0x40 | | channel status word \ by LPSW +-------------+
0x48 | | channel address word `-------------> | current PSW |
0x50 |______| __timer status word_____ +-------------+
0x58 | | external new PSW \ ^
0x60 | new | supervisor call new PSW | |
0x68 | PSWs | program error new PSW |-- loaded by interrupt --'
0x70 | | machine check new PSW |
0x78 |______| I/O new PSW_____________/
...
Memory protection was provided by having a five-bit key assigned to each 2 KB block of main memory. The four high bits of this key must match the protection key in bits 8-11 of the current PSW. (A protection key of zero in the PSW is a special case for OS access - all blocks can be accessed. Thus there can be at most 15 problem state programs in main memory at any one time.) The low bit in the memory block key indicates whether only stores are checked (value = 0) or both fetches and stores are checked (value = 1).
Can only execute in supervisor mode.
LPSW - load PSW
SSM - set system mask (channel I/O, timer, and external)
SSK - set storage mask (protection key in PSW)
ISK - insert storage mask (memory block key)
RDD - read direct
WRD - write direct
SIO - start I/O
HIO - halt I/O
TIO - test I/O
TCH - test channel
diagnose
S/370 added privileged instructions such as SPT (set CPU timer), etc.
SVC - supervisor call, includes an 8-bit interruption code field which is stored in the old supervisor call PSW at address 0x20
user program:
BALR __
| <-----------------.
| |
V |
library routine: (e.g., wait) |
... |
SVC __ // PSW switch -------------.
.--> ... | |
| BR __ -----------------------' |
| |
| |
| (problem state) |
| |
| ------------------------------------- | ------------
| |
| (supervisor state) |
| |
| |
| |
| SVC FLIH: <-------------------------'
| ...
| BR __
| |
| | (may be routed through a SLIH)
| |
| V
| specific SVC routine: (e.g., getmain, freemain, post, wait)
| ...
| BR __
| |
| |
| V
| exit routine:
| ...
| BR __
| |
| |
| V
| dispatcher:
| ...
`---- LPSW old_svc_psw_location
My thanks to Chris Cheney for catching an error in the privileged instruction list.
[History of system calls page] [Mark's homepage] [CPSC homepage] [Clemson Univ. homepage]
mark@cs.clemson.edu