CHM Instructions

Purpose:To request services of more priviledged software
Format:opcode code.rw
Operation:
If PSL<IS> EQLU 1 then
HALT; Illegal from Interrupt Stack.
if opcode-mode LSSU PSL<CMD> then
PSL<CMD>_SP <- SP;
SP <- opcode-mode_SP;
-(SP) <- PSL;
-(SP) <- PC;
-(SP) <- sign-extended code;
PSL<CM,TP,FPD,DV,FU,IV,T,N,Z,V,C> <- 0;
PSL<PMD> <- PSL<CMD>
if opcode-mode LSSU PSL<CMD> then
PSL<CMD>_SP <- opcode-mode;
PC <- {SCB vector for opcode-mode};
Condition
Codes:
N <- 0;
Z <- 0;
V <- 0;
C <- 0;
Exceptions:halt
Opcodes:
BCCHMKChange mode to Kernel
BDCHMEChange mode to Executive
BECHMSChange mode to Supervisor
BFCHMUChange mode to User
Description: Change mode instructions all processes to change their access mode in a controlled manner. The instruction only increases priviledge mode (i.e. decreases the access mode)

A change in mode also results in a change of stack pointers; the old stack pointer is saved, the new pointer is loaded. The PSL, PC and code operand are pushed onto the stack of the new mode. The saved PC addresses the instruction following the CHMx instruction. The code is sign-extended to a longword. After Execution the stack looks like:

Sign Extended Code:SP
PC of Instruction After CHMx
Old PSL

The destination mode selected by the opcode is used to select a location from the System Control Block. This location addresses the CHMx dispatcher for the specified mode.