Spring 2016 CSCI 320 Homework 7

Getting started

Download the ZIPed MPLAB X project DontEverDoThis and unzip it into your MPLABXProjects directory.

Task 0

Open up your favorite text editor and get ready to write some answers.

Task 1

Find the calls to the C functions setjmp and longjmp in this program. setjmp and longjmp are two of the most puzzling and despised function calls in computer science.

Look up some information about setjmp and longjmp and write an explanation about what they do in this program. You may want to talk to your fellow classmates about setjmp and longjmp, but write up your own answer!

Be sure to mention something about how the array oopsCause is being used.

Task 2 (no writing)

Build the program and then Debug it. Because the program ends in with an infinite while (1) loop, it will never stop. You need to Pause it.

Task 3

Once the program has stopped, open up the variables window of MPLABX and display the values within the oopsCause array. You can ignore oopsCause[0].

Either copy these into your document or do a screen capture and pasted it into your document.

Task 4

Look at pages 99–102 of the MIPS32® M4K™ Processor Core Software User’s Manual which describes the CP0 Cause registers. Use this information to descode the four values of oopsCause you found in the previous task. Explain how the crashAndBurn program managed to generate each of these values.

Submitting the assignment

Save your file in PDF. That’s the one format supported by Moodle’s commenter feature. Then upload it to the homework 7 moodle page.