csse 232 computer architecture i
play

CSSE 232 Computer Architecture I Exceptions 1 / 12 Class Status - PowerPoint PPT Presentation

CSSE 232 Computer Architecture I Exceptions 1 / 12 Class Status Reading for today B.7-8 2 / 12 Outline Definition Exception registers The process Special exception instructions Work on lab 3 / 12 Definition What is


  1. CSSE 232 Computer Architecture I Exceptions 1 / 12

  2. Class Status Reading for today • B.7-8 2 / 12

  3. Outline • Definition • Exception registers • The process • Special exception instructions • Work on lab 3 / 12

  4. Definition What is an exception? • Unexpected events that interrupt normal program flow • Exception and interrupt not the same! • Exception - event from within the processor • Interrupt - event from outside the processor • Are they necessary? • What are the disadvantages of exceptions? 4 / 12

  5. What Exceptions have you seen? Previous programming? • What did they look like? • When did they happen? • How did you solve them? MIPS and SPIM • What did they look like? • When did they happen? • How did you solve them? 5 / 12

  6. Example • Exception generated during program execution • What should happen? 6 / 12

  7. Example • Exception generated during program execution • What should happen? • Should OS continue? 6 / 12

  8. Example • Exception generated during program execution • What should happen? • Should OS continue? • Should program continue running? • Possible ways to handle running program? 6 / 12

  9. Example • Exception generated during program execution • What should happen? • Should OS continue? • Should program continue running? • Possible ways to handle running program? • OS terminates the program • Skip offending instruction, continue • Retry offending instruction, continue 6 / 12

  10. Example • Exception generated during program execution • What should happen? • Should OS continue? • Should program continue running? • Possible ways to handle running program? • OS terminates the program • Skip offending instruction, continue • Retry offending instruction, continue • What does the processor need to continue running the program? 6 / 12

  11. Important Exceptions registers • EPC • Stores address of bad instruction • Status Register • Stores the status of the exception • Exception being handled, ignore subsequent exceptions • Cause Register • Stores cause of exception 7 / 12

  12. Important Exceptions registers Status register $ 12 : Exception Interrupt enable mode User level 15 8 4 1 0 Interrupt mask Cause register $ 13 : 31 15 8 6 2 Branch Pending Exception delay interrupts code 8 / 12

  13. Process • In MIPS, exceptions managed by a System Control Coprocessor (CP0) - a special location on the CPU • Only helps the main processor start exception handling. • Main processor runs the actual handler • Save PC of offending (or interrupted) instruction • In MIPS: Exception Program Counter (EPC) • Save indication of the problem • In MIPS: Cause register • Jump to handler at 8000 00180 • Not the only way to do it. Book will talk about vectored interrupts 9 / 12

  14. Special Instructions • mfc0 • Move from coprocessor 0 • mtc0 • Move to coprocessor 0 • eret • Return from exception (goes to EPC) 10 / 12

  15. Exception Handler • Read cause, transfer to relevant handler • In Handler • Determine action required • If restartable • Take corrective action • use EPC to return to program • Otherwise • Terminate program • Report error using EPC, cause, ? 11 / 12

  16. Work on Lab • Posted on course site 12 / 12

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend