4. Assume that the operating system loads: - the floating point exceptions handl
ID: 3878596 • Letter: 4
Question
4. Assume that the operating system loads: - the floating point exceptions handling software routine starting at the memory address F080000hex - the illegal op-code exception handling software routine starting at the memory address FF084400hex, 2 the syscall exception handling software routine starting at the memory address FF088500hex, - the software routine for handling all other exceptions starting at the memory address FF088600hex. What else should be done that the right routine starts when a given exception occurs? Your solution must include instructions. You may use only integer registers $1, and $2, as temporary registers 1 5 9Explanation / Answer
Solution:-
As we know that, An exception is a term for an event that occurs during the execution of a program that disrupts the normal flow of the program execution.It can occur at many levels some of them are as follows:
There is different ways for handling these exceptions at different levels(mentioned above), But in the given question our exception belongs at operating system level.So we will handle this exception like that,which is given below:
As we know that MIPS uses C0 and C1 for additional help. C0 primarily helps with exception handling, and C1 helps with floating point arithmetic. Each coprocessor has a few registers.C0 has a cause register (Register 13) that contains a 4-bit code to identify the cause of an exception.
[Exception Code = 0 means I/O interrupt = 12 means arithmetic overflow etc] .
MIPS instructions that cause overflow (or some other violation) lead to an exception, which sets the exception code. It then switches to the kernel mode (designated by a bit in the status register of C0, register 12) and transfers control to a predefined address to invoke a routine (exception handler) for handling the exception.
Example :- L: add $0, $1, $2
The Exception Handler determines the cause of the exception by looking at the exception code bits. Then it jumps to the appropriate exception handling routine. Finally, it returns to the main program.
Hence these are the explanation and another way to start the right routine when we get these type of exceptions in program.I have taken the single example of add operation.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.