[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

User-Mode Exception Handler for the uexadd Kernel Service

Purpose

Handles exceptions that occur while a kernel thread is executing in user mode.

Syntax

#include <sys/types.h>
#include <sys/errno.h>
#include <sys/except.h>


int func (exp, type, tid, mst)
struct excepth * exp;
int type;
tid_t tid;
struct mstsave * mst;

Parameters

exp Points to the excepth structure used to register this exception handler.
mst Points to the current mstsave area for the process. This pointer can be used to access the mstsave area to obtain additional information about the exception.

tid Specifies the thread ID of the kernel thread that was executing at the time of the exception.
type Denotes the type of exception that has occurred. This type value is platform-specific. Specific values are defined in the /usr/include/sys/except.h file.

Description

The user-mode exception handler (exp->func) is called for synchronous exceptions that are detected while a kernel thread is executing in user mode. The kernel exception handler saves exception information in the mstsave area of the structure. For user-mode exceptions, it calls the first exception handler found on the user exception handler list. The exception handler executes in an interrupt environment at the priority level of either INTPAGER or INTIODONE.

If the registered exception handler returns a return code indicating that the exception was handled, the kernel exits from the exception handler without calling additional exception handlers from the list. If the exception handler returns a return code indicating that the exception was not handled, the kernel invokes the next exception handler on the list. The last exception handler in the list is the default handler. This is typically signalling the thread.

The kernel exception handler must not page fault. It should also register an exception handler using the setjmpx kernel service if any exception-handling activity can result in an exception. This is important particularly if the exception handler is handling the I/O. If the exception handler did not handle the exception, the return code should be set to the EXCEPT_NOT_HANDLED value for user-mode exception handling.

Execution Environment

The user-mode exception handler for the uexadd kernel service is called in the interrupt environment at the INTPAGER or INTIODONE priority level.

Return Values

EXCEPT_HANDLED Indicates that the exception was successfully handled.
EXCEPT_NOT_HANDLED Indicates that the exception was not handled.

Related Information

The uexadd kernel service.

User-Mode Exception Handling and Kernel Extension and Device Driver Management Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]