Lec15 - Pipeline: Exceptions Dr. Tao Xie Fall, 2009 These...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Pipeline: Exceptions Dr. Tao Xie Fall, 2009 These slides are adapted from notes by Dr. David Patterson (UCB) and Dr. Xiao Qin (Auburn)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Exceptions - “Stuff Happens” Exceptions definition: “ unexpected change in control flow Another form of control hazard. For example: add $1 , $2, $1; causing an arithmetic overflow sw $3, 400( $1 ); add $5, $1 , $2; Invalid $1 contaminates other registers or memory locations!
Background image of page 2
3 Two Types of Exceptions: Interrupts and Traps Interrupts Caused by external events : Network, Keyboard, Disk I/O, Timer Page fault - virtual memory System call - user request for OS action Asynchronous to program execution May be handled between instructions Simply suspend and resume user program Traps Caused by internal events Exceptional conditions (overflow) Undefined Instruction Hardware malfunction Usually Synchronous to program execution Condition must be remedied by the handler Instruction may be retried or simulated and program continued or program may be aborted
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4
Background image of page 4
5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6
Background image of page 6
7 Synchronous vs Asynchronous Definition : If the event occurs at the same place every time the program is executed with the same data and memory allocation, the event is synchronous . Otherwise asynchronous . Except for hardware malfunctions, asynchronous events are caused by devices external to the CPU and memory. Asynchronous events usually are easier to handled because asynchronous events can be handled after the completion of the current instruction.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Exceptions in Simple five-stage pipeline I nstruction F etch, & Mem ory stages Page fault on instruction/data fetch Misaligned memory access Memory-protection violation I nstruction D ecode stage Undefined/illegal opcode Ex ecution stage Arithmetic exception W rite- B ack stage No exceptions!
Background image of page 8
9 What happens during an exception? The Hardware Part The pipeline has to 1) stop executing the offending instruction in midstream, 2) let all prior instructions complete, 3) flush all following instructions , 4) set a register to show the cause of the exception, 5) save the address of the offending instruction, and 6) then jump to a prearranged address (the address of the exception handler code) The Software Part The software (OS) looks at the cause of the exception and “deals” with it Normally OS kills the program
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Exceptions Exception = unprogrammed control transfer
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/03/2009 for the course CS 20929 taught by Professor Taoxie during the Spring '09 term at San Diego State.

Page1 / 37

Lec15 - Pipeline: Exceptions Dr. Tao Xie Fall, 2009 These...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online