Peer review
- The code compiles properly and produces the expected output (A-Z in an infinite loop).
- There is plenty of high level comments explaining your code.
- You're correctly preserving all registers except for
$k0
and$k1
in the kernel code. - You're correctly setting user mode and interrupt enabled in the status register.
I can't see any test codes to test for overflows and erroneous service codes, however I can confirm that your program correctly handles overflows with the following code snippet.
LI $t0, 0x7FFFFFFF # Loads the maximum value of a 32 bit integer
ADDI $t0, $t0, 1 # Adds 1 to cause an overflow
Please update your code with a test code for an erroneous service code so I can confirm your program manages that properly. I think it's part the assignment:
If the exception code is not
SYSCALL
, you should branch to an infinite loop in the kernel code (kernel_loop
). If the service requested by the application is not "output", you should return control to the user process. (You can test these requirements, by some code in proc1; that a) generates an overflow, and b) sets an erroneous service code. Once you have tested these cases separately, comment out the test code but leave it in your repo for later review. We don't have a proper unit testing framework, so this is a best effort work-around.)
Other than that, it looks good. Nice job!