Question
In MIPS machine code for MARS, Write your own exception handler that prints the address of the instruction that caused the exception, the exception code
In MIPS machine code for MARS,
Write your own exception handler that prints the address of the instruction that caused the exception, the exception code and an accompanying message.
Example outputs include:
Exception caused by instruction at Address: 0x0040000c Exception Code = 12 Ignore and continue program ...
-- program is finished running --
A few important points to keep in mind: The exception handler must start at the fixed address 0x80000180. This address is in the kernel text segment. An exception handler can be written in the same file as the regular program, or in a separate file. Write your exception handler solution in a separate .asm file.
Use this code to invoke your exception handler:
.text
.globl main
main: li $t1, 300
li $t0, 0
div $a0, $t1, $t0# Do $a0 = $t1 / $t0
li $v0, 1 # Print result as an integer
syscall
li $v0, 10 # and exit
syscall
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started