Which of the following must be true for the RFE (Return From Exception) instruction on a general purpose processor?
-
It must be a trap instruction
-
It must be a privileged instruction
-
An exception cannot be allowed to occur during execution of an RFE instruction
View worked solution
Answer: D
To determine which statements must be true for the RFE (Return From Exception) instruction, let us analyze each statement individually:
-
Statement I: It must be a trap instruction
A trap is a software-initiated control transfer to or from the operating system. The RFE instruction is a software instruction designed to return control from the exception handler back to the interrupted program. Since it explicitly alters the execution state and control flow under software control, it is classified as a trap-type instruction. -
Statement II: It must be a privileged instruction
The RFE instruction restores the processor state, which includes switching the CPU mode from privileged (kernel/supervisor) mode back to user mode and restoring the Program Status Word (PSW). If user-level programs were allowed to execute RFE, they could maliciously manipulate the processor's execution state and privilege levels. Therefore, RFE must be a privileged instruction that can only be executed in supervisor mode. -
Statement III: An exception cannot be allowed to occur during execution of an RFE instruction
The RFE instruction must execute atomically. During its execution, the processor is in a transition state, restoring the Program Counter (PC) and the Status Register. If an exception were permitted to occur midway through this process, the saved state would be corrupted or partially overwritten, leading to an inconsistent processor state and system instability. Thus, exceptions are disabled during its execution.
Since all three statements (I, II, and III) are true, the correct option is D.
Free practice · Your answers on this page are not saved.
