3.7k views

Which of the following must be true for the RFE (Return From Exception) instruction on a general purpose processor?

1. It must be a trap instruction

2. It must be a privileged instruction

3. An exception cannot be allowed to occur during execution of an RFE instruction

1. I only
2. II only
3. I and II only
4. I, II and III only
retagged | 3.7k views
0
I am not sure, Why is it TRAP instruction ?
0

Chhotu trap is an exception.. i think all the exception handling signals that are generated by the CPU control unit  can be called a TRAP SIGNAL..  correct me if i am wrong

0
0

1. why must it be a trap instruction? I find no reason that it has to be a trap. No referenced link in this post says it has to be a trap.

2. It has to be a privileged instruction because it accesses kernel stack in the newer OS. Although in older OS, there was no concept of kernel space and user space, it was one huge address space.

3. An exception cannot be allowed to occur? Aborts and faults (they are exceptions too) can occur during the execution of any instruction. It's like saying power failure is not allowed to happen when RFE is executing.

I think the answer should be II only

RFE (Return From Exception) is a privileged trap instruction that is executed when exception occurs, so an exception is not allowed to execute. (D) is the correct option.

edited
+5
@ Vikrant : could you please cite some reference for your answer. Or else give some explanation as Why RFE is a privileged instruction because it is executed in Kernel mode. Secondly TRAP are software interrupts generated by user programs(synchronous interrupt) in order to change the level to more privileged or to execute an instruction that only OS can execute.

Please offer some explanation for this.
+7
Transitions from kernel to user mode are performed explicitly by the
operating system, generally at the end of an interrupt handler or
kernel call, using a privileged RFE (return from exception) instruction.

0
Nowhere does the referenced link say that RFE is a trap instruction

As already told in other answers, RFE is a privileged trap instruction. The purpose of RFE is to switch from kernel mode to user mode once the system is done with handling an exception (any interrupt, trap or fault).

Now, let us approach this question through the points given.

1. It must be a trap instruction - Definitely it must be a trap instruction as RFE is an explicit privileged instruction causing a switch from kernel to user mode

2. It must be a privileged instruction - Yes, because RFE can be executed only in supervisor/kernel mode

3. An exception cannot be allowed to occur during execution of an RFE instruction - Yes, because as soon as a trap/interrupt starts being processed all other traps/interrupts are disabled until the current instruction execution is complete.

So, all three are true and answer is (D)

edited by

1
2