#include <nitro/os.h>
void OS_SetUserExceptionHandler(
OSExceptionHandler handler
void* arg );
handler | Function to be called when an exception is generated |
arg | Argument used when calling the user function |
None.
Sets the user function that will be called when an exception is generated.
The user function handler
is of the type OSExceptionHandler
.
typedef void (*OSExceptionHandler)( u32, void* );
This function is called when interrupts are prohibited.
When calling the user function, the first argument is a pointer address to the structure the stores the generated exception's context. The second argument, arg, is specified by the second argument of OS_SetUserExceptionHandler
, which is passed unchanged.
Contexts During Exceptions:
The context of the function specified in the first argument is a pointer to a structure of type OSExcpContext
.
typedef struct { OSContext context; u32 cp15; u32 spsr; u32 exinfo; } OSExcpContext;
context
represents the values in a OSContext
-type structure.cp15
is the status of the coprocessor.spsr
is the SPSR. It will be undefined in modes that do not have SPSR.exinfo
indicates whether it is a reset or an exception. In the case of an exception, it will hold 0. In the case of a reset, it will hold a nonzero value.Exceptions with IS-TWL-DEBUGGER
As described in Overview (Exceptions), you cannot call a user exception handler on IS-TWL-DEBUGGER. This cannot be done on IS-TWL-DEBUGGER, regardless of whether the application is running in TWL mode or NITRO mode.The debugger will stop the CPU at the point when an exception occurs, so you can find out information based on the context information displayed in the debugger or the Call Stack window in the debugger.
Overview (Exceptions)
OS_InitException
OS_InitContext
2009/07/01 Revised debugger display on IS-TWL-DEBUGGER.
2008/04/18 Added a description of the context during an exception.
2005/03/08 Standardized how the term "interrupt" is written in Japanese.
2004/02/19 Initial value.
CONFIDENTIAL