operating-systems hardware

Definition

Program Status Word

The Program Status Word (PSW) is a hardware register encapsulating the processor’s current state. It contains status information defining the execution context and CPU operating mode.

Essential part of the process’s context, saved in the PCB during a process switch to ensure correct resumption.

Components

Condition Codes (Flags)

Bits set by arithmetic/logic instructions: Zero, Negative, oVerflow, Carry. Used for conditional branching.

Interrupt Mask

Controls whether certain interrupts are enabled or disabled (masked).

Execution Mode

Bit(s) indicating User Mode or Kernel Mode. See Execution Mode.

Stack Pointer

Sometimes part of PSW. Points to current execution stack. See Stack Pointer.

OS Control

Hardware-Assisted Transition

When a Supervisor Call, Trap, or Interrupt occurs, hardware automatically saves the current PSW and loads a new one (pointing to kernel entry). This safely transitions from user space to protected kernel environment.