Program status word

The program status word (PSW) is a register  that performs the function of a status register and program counter, and sometimes more. The term is also applied to a copy of the PSW in storage. This article only discusses the PSW in the IBM System/360 and its successors, and follows the IBM convention of numbering bits starting with 0 as the leftmost (most significant) bit.

Although certain fields within the PSW may be tested or set by using non-privileged instructions, testing or setting the remaining fields may only be accomplished by using privileged instructions.

Contained within the PSW are the two bit condition code, representing zero, positive, negative, overflow, and similar flags of other architectures' status registers. Conditional branch instructions test this encoded as a four bit value, with each bit representing a test of one of the four condition code values, 23 + 22 + 21 + 20. (Since IBM uses big-endian bit numbering, mask value 8 selects code 0, mask value 4 selects code 1, mask value 2 selects code 2, and mask value 1 selects code 3.)

The 64-bit PSW describes (among other things)


 * Interrupt masks
 * Privilege states
 * Condition code
 * Instruction address

In the early instances of the architecture (System/360 and early System/370), the instruction address was 24 bits; in later instances (XA/370), the instruction address was 31 bits plus a mode bit (24 bit addressing mode if zero; 31 bit addressing mode if one) for a total of 32 bits.

In the present instances of the architecture (z/Architecture), the instruction address is 64 bits and the PSW itself is 128 bits.

The PSW may be loaded by the LOAD PSW instruction (LPSW or LPSWE). Its contents may be examined with the Extract PSW instruction (EPSW).

S/360
On all but 360/20, the PSW has the following formats. S/360 Extended PSW format only applies to the 360/67 with bit 8 of control register 6 set.

z/Architecture
{| class="wikitable" {| class="wikitable" style="font-size:75%" {| class="wikitable mw-collapsible autocollapse" ! style="width:10%; text-align:left;"| Bits ! style="width:10%; text-align:left;"| Field ! style="width:80%; text-align:left;"| Meaning 00=primary-space mode 01=Access-register mode 10=Secondary-space mode 11=Home-space mode
 * + IBM z/Architecture PSW formats
 * style="border-style: none;" |
 * style="border-style: none;" |
 * style="border-style: none;" |
 * style="border-style: none;" |
 * style="border-style: none;" |
 * style="border-style: none;" |
 * + z/Architecture short PSW
 * colspan=34 style="border-style: none;" |
 * style="width:.5%; text-align:left; border-style: none none none none;" |
 * 0
 * R
 * style="border-style: solid none solid solid" | 0
 * style="border-style: solid none solid | 0
 * style="border-style: solid solid solid none" | 0
 * T
 * I O
 * E X
 * colspan=4 | Key
 * 1
 * M
 * W
 * P
 * colspan=2 | AS
 * colspan=2 | CC
 * colspan=4 | Program Mask
 * R I
 * style="border-style: solid none solid solid;" | 0
 * style="border-style: solid none solid;" | 0
 * style="border-style: solid none solid;" | 0
 * style="border-style: solid none solid;" | 0
 * style="border-style: solid none solid;" | 0
 * style="border-style: solid solid solid none;" | 0
 * E A
 * style="width:.5%; text-align:left; border-style: none none none none;" |
 * style="width:.5%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" | 0
 * style="width:1%; text-align:left; border-style: none none none none;" | 1
 * style="width:1%; text-align:left; border-style: none none none none;" | 2
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:right; border-style: none none none none;" | 4
 * style="width:1%; text-align:left; border-style: none none none none;" | 5
 * style="width:1%; text-align:left; border-style: none none none none;" | 6
 * style="width:1%; text-align:left; border-style: none none none none;" | 7
 * style="width:1%; text-align:left; border-style: none none none none;" | 8
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:right; border-style: none none none none;" | 11
 * style="width:1%; text-align:left; border-style: none none none none;" | 12
 * style="width:1%; text-align:left; border-style: none none none none;" | 13
 * style="width:1%; text-align:left; border-style: none none none none;" | 14
 * style="width:1%; text-align:left; border-style: none none none none;" | 15
 * style="width:1%; text-align:left; border-style: none none none none;" | 16
 * style="width:1%; text-align:right; border-style: none none none none;" | 17
 * style="width:1%; text-align:left; border-style: none none none none;" | 18
 * style="width:1%; text-align:right; border-style: none none none none;" | 19
 * style="width:1%; text-align:left; border-style: none none none none;" | 20
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:right; border-style: none none none none;" | 23
 * style="width:1%; text-align:left; border-style: none none none none;" | 24
 * style="width:1%; text-align:left; border-style: none none none none;" | 25
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:left; border-style: none none none none;" |
 * style="width:1%; text-align:right; border-style: none none none none;" | 30
 * style="width:1%; text-align:left; border-style: none none none none;" | 31
 * style="width:.5%; text-align:left; border-style: none none none none;" |
 * style="border-style:none;" |
 * style="width:.5%; text-align:left; border-style: none none none none;" |
 * B A
 * colspan=31 | Instruction Address
 * style="width:.5%; text-align:left; border-style: none none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  | 32
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  | 33
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  | 63
 * style="width:.5%; text-align:left; border-style: none none  none  none;"  |
 * colspan="34" style="border-style: none;"|
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  |
 * style="width:1%; text-align:left; border-style: none  none  none  none;"  | 63
 * style="width:.5%; text-align:left; border-style: none none  none  none;"  |
 * colspan="34" style="border-style: none;"|
 * colspan="34" style="border-style: none;"|
 * + Short PSW abbreviations
 * 1
 * R
 * PER Mask
 * 5
 * T
 * DAT mode
 * 6
 * IO
 * I/O mask
 * 7
 * EX
 * External Mask
 * 8-11
 * Key
 * PSW key
 * 12
 * E=1
 * Must be one for LPSW
 * 13
 * M
 * Machine-check mask
 * 14
 * W
 * Wait state
 * 15
 * P
 * Problem state
 * 16-17
 * AS
 * Address-Space Control
 * W
 * Wait state
 * 15
 * P
 * Problem state
 * 16-17
 * AS
 * Address-Space Control
 * AS
 * Address-Space Control
 * 18-19
 * CC
 * Condition Code
 * 20-23
 * PM
 * 20-23
 * PM


 * 24
 * RI
 * Reserved for IBM
 * 31
 * EA
 * Extended Addressing mode 0=defined by BA below; 1=64-bit, BA must be zero
 * 32
 * BA
 * Basic Addressing mode 0=24 or 64; 1=31
 * 33-63
 * IA
 * Instruction Address
 * }
 * }
 * }
 * Instruction Address
 * }
 * }
 * }