The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+20 votes
2.8k 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
asked in CO & Architecture by Veteran (59.6k points)
retagged by | 2.8k 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 

2 Answers

+16 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.

Reference: http://www.cs.rochester.edu/courses/252/spring2014/notes/08_exceptions

answered by Boss (13.6k points)
edited by
+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.
+4
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.
+21 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
Answer:

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

40,861 questions
47,532 answers
145,982 comments
62,293 users