LDPCTX Instruction

Purpose:To restore a processes context.
Format:opcode
Operation:
If PSL<CMD> NEQU kernel then
Reserved Instruction Fault
{Invalidate per-process translation buffer entries}
{Load process general registers from PCB}
{Load process IPR stack registers from PCB}
{Load process IPR page table registers from PCB}
{Load process ASTLVL and PME from PCB}
{Switch to kernel stack}
{Push PSL and PC on stack for REI}
Condition
Codes:
N <- N;
Z <- Z;
V <- V;
C <- C;
Exceptions:Reserved Instruction;
Reserved Operand
Opcodes:
06LDPCTXLoad Process Context
Description: The process control block (PCB) is specified by the internal processor register Process Control Block Base (PCBB). The general registers are loaded from the PCB. The Page Table registers describing the process address space are also loaded and the process entries in the translation buffer are cleared. Execution is switched to the kernel stack. The PC and PSL are copied from the PCB onto the stack, suitable for a subsequent REI instruction.
Notes:
1.
A reserved operand fault occurs if the contents of page table registers saved in the PCB were invalid.
2.
A reserved instruction fault occurs if the instruction is executed from any mode other than kernel mode.
3.
Some processors keep a copy of the process stack pointers in internal registers. In those processors, LDPCTX loads the internal registers from the PCB. Processors that do not keep a copy of all four stack pointers in internal registers keep only the current access mode register in an internal register. The contents of the internal register are switched with the PCB contents whenever the current access mode field changes. MacVAX does have internal copies of all stack registers.
4.
Between the SVPCTX instruction that saves the state for one process and the LDPCTX instruction that loads the state of another, the internal stack pointers may not be referenced by MFPR or MTPR instructions. This implies that interrupt service routines invoked at a priority higher than the lowest one used for context switching must not reference the process stack pointers.