Question
MIPS use Mars to Write your own exception handler as per the discussion in 2.4 Task 3 : 2.4 Task 3 Write your own exception
MIPS use Mars to
Write your own exception handler as per the discussion in 2.4 Task 3:
2.4 Task 3 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: # w8overflow.asm 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 the supplied w8zerodivide.asm file to invoke your exception handler. Submit this run and result for your lab deliverable (i.e. include snapshots of the MARS Message window and the MARS Run I/O window). (Be sure to upload your exception handler solution into MARS for your test run demonstration).
1. Use the provided w8zerodivide.asm file for your test run.
2. Your handler should print the address of the instruction that causes the exception, the exception code and an accompanying message.
# Lab 7 CS10 w8zerodivide.asm
# Example program which causes an exception
# Use your lab8 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