11/23/04

A student asks three interesting questions. None super-critical to 306, but some of you may be interested:

     Hello Dr. Patt
     I was reading the book and I had a few questions

     1. Is an interrupt always priveliged and done
     by the operating system? 

Never say always, because someone will generally come up with a situation where for some reason I can not think of, it will be done otherwise. However, in my experience, yes, always privileged, and handled by the o/s.

     and if it is so does that mean the interrupt routine
     uses only the supervisor stack to
     save the state of the interrupted program?
     Is that always the case?

There was a time when there was one stack. Again, I am reluctant to ever say always since systems are person-made and some person may have a good reason for doing otherwise. But generally the computer has separate priv/unpriv stacks and uses the privileged stack to save state.

     2. At the end of an interrupt
     routine I know that the last instruction is RTI
     which pops the PC and PSR from the
     supervisor stack and load them back into
     their registers so the interrupted program can resume
     as if nothing happened but
     what instruction saves R6 into into Saved.
     SSP and reloads R6 into Saved.USP, is
     that part of RTI or is that part
     of all interrupts routines and it's done
     automatically by the operating system?

Automatically by the hardware in initiating the interrupt and in carrying out the work of RTI. The net result being that during the service routine, R6 is the SSP and during the normal application code, R6 is the USP.

      Also what exactly are Saved.SSP and
     Saved.USP, I know it says
     they're internal registers, but what does that mean?

That they are internal registers, like MAR and MDR, for example.

     Where is their memory location..is it
     in a the stack itself,is there a location
     in each stack reserved to save R6?

No memory location. Just internal registers that the hardware uses to save USP on an interrupt, and save SSP on a RTI.

     3.  On page 269, Figure 10
     .12, there is the subroutine RangeCheck to make sure
     the result of each of the 2 integers
     is not greater than 999 or less than -999.
     why those values.  I know on pg
     268 on the bottom paragraph you wrote "For our
     puposes, suppose we restrict values to integers
     in the range -999 to +999.  This
     will come in handy when we design our
     home-brew calculator."  So is it for
     convenience sake that you chose those values in
     this example so they'll work in
     the final calculator example or is there an
     important logical reason that I'm
     missing to why you choose those as your boundaries?

Strictly for convenience sake for our particular calculator.

     Thank you, sorry if any of the questions seem stupid

None of them were stupid. Thank you for the questions.

Yale Patt

      EE306 Student
     << name withheld to protect the self-deprecating student >>