Peer review
- The code compiles and executes fine, the output is an endless loop of repeating characters A-Z.
- There is plenty of high level comments explaining the 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 like the way you isolated the bits 5:2
by baking in the bit shift into the load immediate call on line 135. Regarding andi $k0, 0x3c
on line 136, doesn't andi
expect three arguments? Target, source, and unsigned integer. I'm also curious why you're masking with 0x3c
and not 0xFF
considering you've shifted with two. Maybe I'm misunderstanding what you're doing, clarification would be nice!
Looking at the exception handling, your test code for the overflow works fine (the program enters an infinite loop) and so does the erroneous service code. You might want to comment the latter out of the code though!
li $v0, 0x101 # Load the (unsupported) service code 0x101 into v0
syscall
↓
#li $v0, 0x101 # Load the (unsupported) service code 0x101 into v0
#syscall
I also notice that the program runs fine with a repeating output of A-Z if the erroneous service code is loaded into v0
when the SYSCALL
instruction is called and if the correct service code is loaded into v0
later when an additional SYSCALL
instruction is called. Is this intended behaviour?
Overall, nicely done!