The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+21 votes

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
asked in CO & Architecture by Veteran (59.9k points)
retagged by | 3.5k views
I am not sure, Why is it TRAP instruction ?

 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 

2 Answers

+19 votes
Best answer

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.


answered by Boss (13.6k points)
edited by
@ 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.
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.
+28 votes

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)

answered by (477 points)
edited by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
47,925 questions
52,325 answers
67,789 users