void mcf_exception_handler(void *framepointer) { volatile unsigned long exceptionStackFrame = (*(unsigned long *)(framepointer)); volatile unsigned short stackFrameSR = MCF5XXX_SF_SR(framepointer); volatile unsigned short stackFrameWord = (*(unsigned short *)(framepointer)); volatile unsigned long stackFrameFormat = (unsigned long)MCF5XXX_RD_SF_FORMAT(&stackFrameWord); volatile unsigned long stackFrameFS = (unsigned long)MCF5XXX_RD_SF_FS(&stackFrameWord); volatile unsigned long stackFrameVector = (unsigned long)MCF5XXX_RD_SF_VECTOR(&stackFrameWord); volatile unsigned long stackFramePC = MCF5XXX_SF_PC(framepointer); switch (stackFrameFormat) { case 4: case 5: case 6: case 7: break; default: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT,"Illegal stack type", stackFramePC); break; } switch (stackFrameVector) { case 2: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Access Error", stackFramePC); switch (stackFrameFS) { case 4: VECTORDISPLAY("Error on instruction fetch\n"); break; case 8: VECTORDISPLAY("Error on operand write\n"); break; case 9: VECTORDISPLAY("Attempted write to write-protected space\n"); break; case 12: VECTORDISPLAY("Error on operand read\n"); break; default: VECTORDISPLAY("Reserved Fault Status Encoding\n"); break; } break; case 3: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Address Error", stackFramePC); switch (stackFrameFS) { case 4: VECTORDISPLAY("Error on instruction fetch\n"); break; case 8: VECTORDISPLAY("Error on operand write\n"); break; case 9: VECTORDISPLAY("Attempted write to write-protected space\n"); break; case 12: VECTORDISPLAY("Error on operand read\n"); break; default: VECTORDISPLAY("Reserved Fault Status Encoding\n"); break; } break; case 4: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Illegal instruction", stackFramePC); break; case 8: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Privilege violation", stackFramePC); break; case 9: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Trace Exception", stackFramePC); break; case 10: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unimplemented A-Line Instruction", stackFramePC); break; case 11: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unimplemented F-Line Instruction", stackFramePC); break; case 12: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Debug Interrupt", stackFramePC); break; case 14: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Format Error", stackFramePC); break; case 15: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Unitialized Interrupt", stackFramePC); break; case 24: VECTORDISPLAY3(MCF5XXX_EXCEPTFMT, "Spurious Interrupt", stackFramePC); break; case 25: case 26: case 27: case 28: case 29: case 30: case 31: VECTORDISPLAY2("Autovector interrupt level %d\n", stackFrameVector - 24); break; case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: VECTORDISPLAY2("TRAP #%d\n", stackFrameVector - 32); break; case 5: case 6: case 7: case 13: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: case 60: case 61: case 62: case 63: VECTORDISPLAY2("Reserved: #%d\n", stackFrameVector); break; default: derivative_interrupt(stackFrameVector); break; } }
/* * This is the exception handler for all defined exceptions. Most * exceptions do nothing, but some of the more important ones are * handled to some extent. * * Called by asm_exception_handler */ void mcf5xxx_exception_handler (void *framep) { switch (MCF5XXX_RD_SF_FORMAT(framep)) { case 4: case 5: case 6: case 7: break; default: printf(EXCEPTFMT,"Illegal stack type", MCF5XXX_SF_PC(framep)); break; } switch (MCF5XXX_RD_SF_VECTOR(framep)) { case 2: printf(EXCEPTFMT, "Access Error", MCF5XXX_SF_PC(framep)); switch (MCF5XXX_RD_SF_FS(framep)) { case 4: printf("Error on instruction fetch\n"); break; case 8: printf("Error on operand write\n"); break; case 9: printf("Attempted write to write-protected space\n"); break; case 12: printf("Error on operand read\n"); break; default: printf("Reserved Fault Status Encoding\n"); break; } break; case 3: printf(EXCEPTFMT, "Address Error", MCF5XXX_SF_PC(framep)); switch (MCF5XXX_RD_SF_FS(framep)) { case 4: printf("Error on instruction fetch\n"); break; case 8: printf("Error on operand write\n"); break; case 9: printf("Attempted write to write-protected space\n"); break; case 12: printf("Error on operand read\n"); break; default: printf("Reserved Fault Status Encoding\n"); break; } break; case 4: printf(EXCEPTFMT, "Illegal instruction", MCF5XXX_SF_PC(framep)); break; case 8: printf(EXCEPTFMT, "Privilege violation", MCF5XXX_SF_PC(framep)); break; case 9: printf(EXCEPTFMT, "Trace Exception", MCF5XXX_SF_PC(framep)); break; case 10: printf(EXCEPTFMT, "Unimplemented A-Line Instruction", \ MCF5XXX_SF_PC(framep)); break; case 11: printf(EXCEPTFMT, "Unimplemented F-Line Instruction", \ MCF5XXX_SF_PC(framep)); break; case 12: printf(EXCEPTFMT, "Debug Interrupt", MCF5XXX_SF_PC(framep)); break; case 14: printf(EXCEPTFMT, "Format Error", MCF5XXX_SF_PC(framep)); break; case 15: printf(EXCEPTFMT, "Unitialized Interrupt", MCF5XXX_SF_PC(framep)); break; case 24: printf(EXCEPTFMT, "Spurious Interrupt", MCF5XXX_SF_PC(framep)); break; case 25: case 26: case 27: case 28: case 29: case 30: case 31: printf("Autovector interrupt level %d\n", MCF5XXX_RD_SF_VECTOR(framep) - 24); break; case 32: case 33: case 34: case 35: case 36: case 37: case 38: case 39: case 40: case 41: case 42: case 43: case 44: case 45: case 46: case 47: printf("TRAP #%d\n", MCF5XXX_RD_SF_VECTOR(framep) - 32); break; case 5: case 6: case 7: case 13: case 16: case 17: case 18: case 19: case 20: case 21: case 22: case 23: case 48: case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: case 58: case 59: case 60: case 61: case 62: case 63: printf("Reserved: #%d\n", MCF5XXX_RD_SF_VECTOR(framep)); break; default: cpu_handle_interrupt(MCF5XXX_RD_SF_VECTOR(framep)); break; } }