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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!