In: Computer Science
When an interrupt occurs while operating in User mode, present the rWhen an interrupt occurs while operating in User mode,
present the return instruction of the exception handler and describe the reason for such a 3 stage pipeline structure
In three stage pipeline structure , there are three main cycle performed :
Fetch – In this process instruction is fetched from memory and placed in the instruction pipeline
Decode – At this level, instruction is decoded and the datapath control signals prepared for the next cycle
Execute – At this final stage register bank is read, an operand shifted, the ALU generated result is written back into destination register.
Now with this process there are lots of interrupt mainly because of following reasons:
1. Due to misaligned memory access, protection violation and page fault
2. Illegal opcode
3. Arithmetic overflow is also considered as cause of interrupts
To overcome the interrupts we required a precise interrupt, which undo all instructions once interrupting instruction occurs and restart the process from the faulting instruction. if not then the interrupt becomes imprecise.
Example:
Let there be two instructions name first instruct and second instruct. If second instruct interrupts first? If the second instruct is restarted first, and then the first instruct is restarted, then second instruct is executed twice.
So to solve this we will let hardware post a interrupt for each instruction and when we reach W stage it will check the interrupt flags and then follow the instruction order as per the flags.