Saturday, December 05, 2009 11:55 PM,



A student writes:



	 Prof. Patt,
	 
	 I have a question about interrupt. What push into stack first, PSR or 
	address of next instruction?
	 In the book, address of next instruction got pushed first, but in the final 
	exam 2008, if I don't misunderstand PSR got pushed first.
	 
	 Regards,
	
	 <<name withheld to protect the student who does not like 
	 inconsistencies>>



Thank you for the message.  Usually pushing and popping PC first or PSR first 
can be done either way, but at least the discussion of this should be 
consistent everywhere, and apparently it isn't.  Therefore, this message.

My intent is that first we push PSR, then we push PC.

If you look at the state machine n page 577 that deals with this, you note 
that on an interrupt we first push PSR, then we push PC.  And, same figure, on 
an RTI, we first pop PC, then we pop PSR.

If you look at page 537, the description of what the RTI does is pretty clear:
First pop PC, then pop PSR.

If you look at page 263, you note that the text and figure (Figure 10.7) got 
it wrong.  However, if you look at the errata page on the McGraw-Hill web 
site, you will note the correction.

So, everything is consistent.

By the way, if you have not checked out the errata page, you should.  Simplest 
way to get there for me is to click on the book from my home page, and a 
McGraw-Hill page will appear.  The very last entry in the column on the left 
is "errata."  Click on this and you get everything in the book that is 
incorrect that we have caught.  [If you find any other errors, let me know and 
we will post them also.]  If you scroll down the errata page to page 263, you 
will see text that agrees with what I have said above. 


Obviously, we will try to get it consistent in the 3rd edition, ...for all the 
good it will do you.

Good luck on the final exam.

Yale Patt