Computer Organization - PowerPoint PPT Presentation

1 / 4
About This Presentation
Title:

Computer Organization

Description:

Computer Organization - Project 1 - Extra. 1. Computer Organization. Project 1 - Extra ... Computer Organization - Project 1 - Extra. 2. What You Will Do In This Lab. ... – PowerPoint PPT presentation

Number of Views:97
Avg rating:3.0/5.0
Slides: 5
Provided by: jb20
Category:

less

Transcript and Presenter's Notes

Title: Computer Organization


1
Computer Organization
  • Project 1 - Extra
  • Prof. Jerry Breecher
  • CSCI 140
  • Spring 2002

2
What You Will Do In This Lab.
  • The purpose of this lab is to write an exception
    handler to be used to determine if your
    calculator might return incorrect results.
  • You will work VERY INDEPENDENTLY I wont give
    you a lot of guidance other than what you get in
    this document.

3
What You Will Do In This Lab.
  • You will work VERY INDEPENDENTLY I wont give
    you a lot of guidance other than what you get in
    this document.
  • Write an exception handler to assure that your
    calculator correctly handles overflows and
    underflows.
  • As a starting point, you have the handler
    currently used by SPIM. It is found at
    /usr/lib/spim/trap_handler. A copy of this code
    is reproduced later in this document.
  • Section A.7 in the text gives some information.
    The code referenced above actually contains more
    information than what is given in the text.
  • The general concept of what you need to do is
    this
  • jal enable_my_trap_handler Override the
    existing trap handler
  • add s3,s2,s1 This add MAY cause an
    exception
  • jal disable_my_trap_handler Restore the
    original trap handler
  • lw t0,did_trap_occur Get flag showing trap
    occurred
  • Analyze trap flag

4
What You Will Do In This Lab.
  • A vital piece of information
  • When an exception occurs, SPIM jumps to, and
    starts executing, the code at location 0x80000080
    note that the sample handler starts its
    .ktext at this location.
  • So you will need THREE pieces of code
  • enable_my_trap_handler a subroutine that
    removes and stashes away the original
    instruction, currently at 0x80000080, and
    replaces it with a jump to the address where YOUR
    new trap handler, my_trap_handler, is located.
  • disable_my_trap_handler a subroutine that
    stores back into location 0x80000080 the
    instruction that was originally there. In effect
    it restores the original trap handler so that any
    surprising traps can be handled.
  • my_trap_handler A piece of code you write that
    determines if an exception has occurred. If a
    trap did occur, it sets the word at
    did_trap_occur. Note the location
    did_trap_occur and the routines described on this
    page, all live in code your write. I believe
    they must all live in user space, not in .ktext.
Write a Comment
User Comments (0)
About PowerShow.com