When a privileged instruction is about to be executed, the processor hardware checks the mode bit in the PS register to ensure that the processor is in "kernel" mode. If the processor is only in "user" mode, the processor hardware does not execute the instruction.
Yes. This instruction should be privileged. A primary protection need is to prevent user code from being executed in kernel mode in order to prevent user code from corrupting kernel data structures and/or interferring with other user programs. However if the load PS instruction were not privileged, a user mode program could execute this instruction and replace the processor status register with an arbitrary value. A value could easily be determined that would have the mode bit set to kernel. This would allow the user mode program to change to kernel mode and continue executing the user code.
In "step 4" of the cpu cycle, the cpu checks the interrupt line in the control bus to see if any device has asserted this line, thereby signaling an interrupt request from the device.
First the cpu asserts a signal in the control bus acknowledging the interrupt signal. The interrupt controller chip responds to the cpu by placing an integer value on the data bus identifying the (highest priority) interrupting device. The cpu uses this value as the index (possibly multiplied by a scale factor) into an array of PC/PS pairs. These pairs are located in consecutive memory locations as an array known as the "interrupt vector".
1. A hardware interrupt is initiated by a hardware device; a software interrupt is initiated by executing a special instruction.
2. A hardware interrupt is noticed and handled by the processor in step 4 of the processor cycle; a software interrupt is handled when the special instruction is executed - step 3 of the processor cycle.
Calling a routine involves changing the program counter, PC. However, a system call in addition to changing the PC to address kernel routine code must change the PS register as well. The PS register must be set to indicate kernel mode. Furthermore, it should not be possible to change only the PS register without changing the PC register since this would allow the PC to continue to be set to user code, but with the PS register set so the cpu is in kernel mode. This is precisely what a software interrupt does. It is an instruction that simultaneously changes both the PC and the PS registers. Furthermore the instruction doesn't allow the user to directly specify the new PC and PS values. The new values are determined only indirectly by specifying a number that corresponds to a system routine. This means the software interrupt cannot be used either inadvertently or maliciously to set the PS register to kernel mode while keeping the PC pointing to user code.