Index Index for
Section 3
Index Alphabetical
listing for E
Bottom of page Bottom of
page

exc_resume(3)

NAME

exc_resume, exc_longjmp, exc_capture_context, exc_continue, exc_unwind, RtlUnwindRfp - entry points that support resuming execution of user code

SYNOPSIS

#include <excpt.h> void exc_resume( PCONTEXT contextRecord ); void exc_longjmp( PCONTEXT contextRecord, long returnValue ); unsigned long exc_capture_context( PCONTEXT contextRecord ); void exc_continue( PCONTEXT contextRecord ); void exc_unwind( void TargetFrame, void TargetIp, system_exrec_type *exceptionRecord, long returnValue ); void RtlUnwindRfp( void *TargetRealFrame, void *TargetIp, system_exrec_type *exceptionRecord, long returnValue );

LIBRARY

Exception Handling Library (libexc.a)

PARAMETERS

contextRecord Pointer to a struct sigcontext (see signal(2)) used to represent a procedure's context. returnValue Value to be passed to the continuing code at the completion of the unwind. TargetFrame If nonzero, virtual frame pointer of the target procedure invocation to which the unwind is to be done; if zero, specifies that an exit unwind is to be initiated and causes the EXCEPTION_EXIT_UNWIND flag to be set in the exception record. TargetIP If TargetRealFrame is nonzero, address within the target invocation at which to continue execution; otherwise, this parameter is ignored. exceptionRecord Address of primary exception record. TargetRealFrame If nonzero, real frame pointer of the target procedure invocation to which the unwind is to be done; if zero, specifies that an exit unwind is to be initiated and causes the EXCEPTION_EXIT_UNWIND flag to be set in the exception record.

DESCRIPTION

The exc_resume() and exc_continue() functions perform essentially the same operation as longjmp(3). The exc_resume() function is a libexc entry point. The exc_capture_context() function saves the current procedure context in the struct sigcontext identified by contextRecord. The exc_longjmp() function restores the context that was saved by a previous call to exc_capture_context() and calls exc_unwind(), setting up its arguments from information taken from the contextRecord argument. If the returnValue argument is 0 (zero), it is set to 1 (one) before the call. The exc_unwind() function initiates an unwind of procedure call frames. It sets the EXCEPTION_UNWINDING flag in the exception flags of the exception record, which describes the machine state at the time of the exc_unwind() call. If the TargetFrame argument is zero, then exc_unwind() also sets the EXCEPTION_EXIT_UNWIND flag. It then scans the procedure call frames towards the base of the call stack to find the target of the unwind operation. The RtlUnwindRfp() function is similar to exc_unwind() except that its first argument is a real frame pointer instead of a virtual frame pointer. Real frame pointers point to the bottom of the statically allocated portion of a stack frame. Virtual frame pointers point to the top of the stack frame. As it encounters each frame, the unwind code determines the program counter where control left the corresponding function by looking at exception handler information in the run-time function table built by the linker. If the respective routine has an exception handler, then the unwind code calls it. This handler should perform cleanup code required for that activation. Programs written in the C programming language, which supports structured exception handling, usually contain a try...finally block that implements a termination handler that performs these chores (see c_excpt(4)). The unwind code also calls a handler when it reaches the TargetFrame so that any scope-oriented cleanup code or termination handler can execute. In this case, it sets the EXCEPTION_TARGET_FRAME flag in the ExceptionFlags field of the exception record. Once it finds the TargetFrame (if specified) and calls its handler (if available), exc_unwind(): · Sets the PC to the TargetIp · Sets the return value to be the returnValue argument, if the returnValue argument is nonzero, · Sets the return value to be the ExceptionCode of the exception record if the returnValue argument is zero · Calls exc_continue()

RETURN VALUES

The exc_capture_context() function returns a value of 0 (zero), unless the return is from a call to the exc_longjmp() function, in which case exc_capture_context() returns the nonzero value specified in the returnValue argument to exc_longjmp(). The exc_longjmp() function cannot return 0 (zero) to the previous context. The value 0 is reserved to indicate the actual return from the exc_capture_context() function when first called by the program. If the exc_longjmp function() is passed a returnValue parameter of 0, execution continues as if the corresponding call to the exc_capture_context() function had returned a value of 1.

FILES

/usr/ccs/lib/cmplrs/cc/libexc.a -- exception handling library /usr/include/excpt.h -- include file /usr/include/pdsc.h -- include file /usr/include/signal.h -- include file /usr/include/machine/fpu.h -- include file

SEE ALSO

Functions: exception_intro(3), exception_dispatcher(3), exc_lookup_function_entry(3), signal(2), sigaction(2), __exc_last_chance(3), ieee(3). Files: excpt(4), c_excpt(4), signal(4), pdsc(4). Assembly Language Programmer's Guide. Calling Standard for Alpha Systems.

Index Index for
Section 3
Index Alphabetical
listing for E
Top of page Top of
page