17.4.2 General Exception

A general exception is any non-interrupt exception which occurs during program execution outside of bootstrap code (StatusBEV=0). General exceptions are vectored to offset 0x180 from EBase.

At this location, the 32-bit toolchain places a branch instruction targeting a function named _general_exception_context(). The provided implementation of this function saves context, calls an application handler function, restores context and performs a return from the exception instruction. The context saved is the hi and lo registers, and all General Purpose Registers except s0-s8, which are defined to be preserved by all called functions and so are not necessary to actively save here again.

void _general_exception_handler (void);

A weak default implementation of _general_exception_handler() is provided in the standard library which merely causes a software Reset. When compiling for in-circuit debugging or emulation, the default implementation of _general_exception_handler will first cause a software breakpoint and then a software Reset. If the user application provides an implementation of _general_exception_handler(), that implementation will be used instead.