Sun, 6 November 2016, 15:01

A student writes:

> Dear Dr. Patt and TAs,
> I just wanted to know if we are responsible for covering the case
> where an instruction such as JSRR or JMP changes the PC so that
> on the next fetch there is an unaligned access or protection
> exception.
> Thank you.
> Regards,
> <name withheld to protect the student who asks if he is responsible>

First, JMP and JSRR do not cause an exception, they simply load PC
with an address.  HOWEVER, if that address is in privileged memory,
and the program is executing in user mode, the next instruction will
cause an exception since the computer will be trying to fetch the
contents of a privileged memory location (i.e., the instruction) while
executing in user mode.  That is the essence of the protection
violation we are asking you to detect.

You should detect that exception when the computer attempts to access
memory that it has no business trying to access.

My TAs, being much nicer than me, have massaged our grading script
so that you will get full credit if you detect the protection error
during execution of the JMP/JSR instruction, that is, when the PC is
loaded with the address from privileged memory.  I am not happy about
that, but they feel you have enough to do without worrying about this
distinction so they are letting you slide on this one.  ...and I am
certainly sympathetic that you have plenty to deal with in Lab 4, so
you will get credit for detecting a protection fault when PC is loaded
even though it should be detected in the fetch phase of the next

Good luck finishing lab 4 tonight.  By the way, you do know I hope
that you get an extra hour tonight since the clocks got set back at
2am last night.

Yale Patt