# OS_SetUserExceptionHandler

## C Specification

      #include <nitro/os.h>

      void OS_SetUserExceptionHandler(
           OSExceptionHandler  handler
           void*           arg );

## Arguments

handler | Function to be called when an exception is generated
arg | Argument used when calling the user function

## Return Values

None.

## Description

This function 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 (`u32`) to the structure the holds the context for the generated exception. For the second argument, `arg`, which is specified by the second argument of `OS_SetUserExceptionHandler()`, is passed as-is.

Additionally, the following are stored at the destination specified by the first argument, in addition to the OSContext that is specified by OS_InitContext(), etc: coprocessor state (u32), SPSR (u32 - Non-SPSR modes not decided), reset or exception (u32 - 0 = exception, non-0 = reset).

## See Also

`OS_InitException, OS_InitContext
`

## Revision History

03/08/2005 Standardized the Japanese term for "interrupt"
02/19/2004 Initial version

CONFIDENTIAL