ReactOS 0.4.16-dev-1946-g52006dd
pseh3.h File Reference
#include <excpt.h>
#include <intrin.h>
Include dependency graph for pseh3.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _SEH3$_SCOPE_TABLE
 
struct  _SEH3$_EXCEPTION_POINTERS
 
struct  _SEH3$_REGISTRATION_FRAME
 
struct  __SEH3$FILTER_RESULT
 

Macros

#define _PSEH3_H_
 
#define _SEH3   $_except_handler _SEH3$_C_except_handler
 
#define _SEH3   $_AutoCleanup _SEH3$_C_AutoCleanup
 
#define _SEH3   $_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup)))
 
#define _SEH3   $_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(0)) : "%esp", "memory")
 
#define _SEH3   $_ASM_GOTO(...) asm goto ("#\n" : : : "memory" : __VA_ARGS__)
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3   $_FINALLY(_Finally) (_Finally)
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3
 
#define _SEH3_TRY
 
#define _SEH3_EXCEPT(...)
 
#define _SEH3_FINALLY
 
#define _SEH3_END
 
#define _SEH3_LEAVE   goto _SEH3$_l_Leave
 
#define _SEH3_VOLATILE   volatile
 
#define setjmp(env)    _setjmp3(env, 2, (const void*)_SEH3$_longjmp_unwind, _SEH3$_TryLevel)
 
#define _INC_SETJMPEX
 

Typedefs

typedef struct _SEH3$_SCOPE_TABLE SEH3$_SCOPE_TABLE
 
typedef struct _SEH3$_SCOPE_TABLEPSEH3$_SCOPE_TABLE
 
typedef struct _SEH3$_EXCEPTION_POINTERS SEH3$_EXCEPTION_POINTERS
 
typedef struct _SEH3$_EXCEPTION_POINTERSPSEH3$_EXCEPTION_POINTERS
 
typedef struct _SEH3$_REGISTRATION_FRAME SEH3$_REGISTRATION_FRAME
 
typedef struct _SEH3$_REGISTRATION_FRAMEPSEH3$_REGISTRATION_FRAME
 
typedef struct __SEH3$FILTER_RESULT _SEH3$FILTER_RESULT
 

Enumerations

enum  { _SEH3$_TryLevel = -1 , _SEH3$_InnerTryLevel = -1 }
 

Functions

int __cdecl _SEH3$_except_handler (struct _EXCEPTION_RECORD *ExceptionRecord, PSEH3$_REGISTRATION_FRAME EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
 
static __attribute__ ((always_inline)) __attribute__((returns_twice)) void _SEH3$_PreventInlining()
 
 __attribute__ ((always_inline, gnu_inline)) void _SEH3$_UnregisterFrame(volatile SEH3$_REGISTRATION_FRAME *RegistrationFrame)
 
int __cdecl __attribute__ ((error("Can only be used inside a __finally block."))) _abnormal_termination(void)
 
unsigned long __cdecl __attribute__ ((error("Can only be used inside an exception filter or __except block."))) _exception_code(void)
 
void *__cdecl __attribute__ ((error("Can only be used inside an exception filter."))) _exception_info(void)
 
int __attribute__ ((regparm(3))) __attribute__((returns_twice)) _SEH3$_RegisterFrameWithNonVolatiles(volatile SEH3$_REGISTRATION_FRAME *RegistrationFrame
 
int _setjmp3 (jmp_buf env, int count,...)
 
void __stdcall _SEH3$_longjmp_unwind (_JUMP_BUFFER *_Buf)
 

Variables

int const SEH3$_SCOPE_TABLEScopeTable
 
int const SEH3$_SCOPE_TABLE voidAllocaFrame
 

Macro Definition Documentation

◆ _INC_SETJMPEX

#define _INC_SETJMPEX

Definition at line 512 of file pseh3.h.

◆ _PSEH3_H_

#define _PSEH3_H_

Definition at line 11 of file pseh3.h.

◆ _SEH3 [1/19]

#define _SEH3   $_except_handler _SEH3$_C_except_handler

Definition at line 344 of file pseh3.h.

◆ _SEH3 [2/19]

#define _SEH3   $_AutoCleanup _SEH3$_C_AutoCleanup

Definition at line 344 of file pseh3.h.

◆ _SEH3 [3/19]

#define _SEH3   $_AUTO_CLEANUP __attribute__((cleanup(_SEH3$_AutoCleanup)))

Definition at line 344 of file pseh3.h.

◆ _SEH3 [4/19]

#define _SEH3   $_EnforceFramePointer() asm volatile ("#\n" : : "m"(*(char*)__builtin_alloca(0)) : "%esp", "memory")

Definition at line 344 of file pseh3.h.

◆ _SEH3 [5/19]

#define _SEH3   $_ASM_GOTO(...) asm goto ("#\n" : : : "memory" : __VA_ARGS__)

Definition at line 344 of file pseh3.h.

◆ _SEH3 [6/19]

#define _SEH3
Value:
$_CALL_WRAPPER(_Function, _TrylevelFrame, _DataTable) \
asm goto ("leal %0, %%eax\n\t" \
"leal %1, %%edx\n\t" \
"call " #_Function \
: \
: "m" (*(_TrylevelFrame)), "m" (*(_DataTable)), "p" (_SEH3$_RegisterFrameWithNonVolatiles) \
: "eax", "edx", "ecx", "memory" \
: _SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally)

Definition at line 344 of file pseh3.h.

◆ _SEH3 [7/19]

#define _SEH3
Value:
$_RegisterFrame_(_TrylevelFrame, _DataTable) \
do { \
(_TrylevelFrame)->Handler = (void*)_SEH3$_except_handler; \
(_TrylevelFrame)->TryLevel = 0; \
_SEH3$_CALL_WRAPPER(__SEH3$_RegisterFrame, _TrylevelFrame, _DataTable); \
} while (0)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
int __cdecl _SEH3$_except_handler(struct _EXCEPTION_RECORD *ExceptionRecord, PSEH3$_REGISTRATION_FRAME EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)

Definition at line 344 of file pseh3.h.

◆ _SEH3 [8/19]

#define _SEH3
Value:
$_RegisterTryLevel_(_TrylevelFrame, _DataTable) \
do { \
(_TrylevelFrame)->TryLevel = _SEH3$_TryLevel; \
_SEH3$_CALL_WRAPPER(__SEH3$_RegisterTryLevel, _TrylevelFrame, _DataTable); \
} while (0)
@ _SEH3$_TryLevel
Definition: pseh3.h:114

Definition at line 344 of file pseh3.h.

◆ _SEH3 [9/19]

#define _SEH3
Value:
$_SCARE_GCC() \
void *plabel; \
_SEH3$_ASM_GOTO(_SEH3$_l_BeforeTry, _SEH3$_l_HandlerTarget, _SEH3$_l_OnException, _SEH3$_l_BeforeFilterOrFinally, _SEH3$_l_FilterOrFinally); \
asm volatile ("#" : "=a"(plabel) : "p"(&&_SEH3$_l_BeforeTry), "p"(&&_SEH3$_l_HandlerTarget), "p"(&&_SEH3$_l_OnException), "p"(&&_SEH3$_l_FilterOrFinally) \
: "ebx", "ecx", "edx", "esi", "edi", "flags", "memory" ); \
goto _SEH3$_l_OnException;

Definition at line 344 of file pseh3.h.

◆ _SEH3 [10/19]

#define _SEH3
Value:
$_DECLARE_EXCEPT_INTRINSICS() \
inline __attribute__((always_inline, gnu_inline)) \
unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; }
#define __attribute__(x)
Definition: wpp_private.h:207
#define _exception_code()
Definition: pseh2_64.h:194

Definition at line 344 of file pseh3.h.

◆ _SEH3 [11/19]

#define _SEH3
Value:
$_DECLARE_FILTER_FUNC(_Name) \
#define __fastcall
Definition: sync.c:38
_In_ WDFIOTARGET _In_ _Strict_type_match_ WDF_IO_TARGET_SENT_IO_ACTION Action
Definition: wdfiotarget.h:510

Definition at line 344 of file pseh3.h.

◆ _SEH3 [12/19]

#define _SEH3
Value:
$_NESTED_FUNC_OPEN(_Name) \
{ \
/* This is a fancy way to get information about the frame layout */ \
if (Action == 0) { _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (int)&_SEH3$_TrylevelFrame; return seh3$result; }
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Definition at line 344 of file pseh3.h.

◆ _SEH3 [13/19]

#define _SEH3
Value:
$_DEFINE_FILTER_FUNC(_Name, expression) \
_SEH3$_NESTED_FUNC_OPEN(_Name) \
/* Declare the intrinsics for exception filters */ \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wshadow\"") \
inline __attribute__((always_inline, gnu_inline)) \
unsigned long _exception_code() { return _SEH3$_TrylevelFrame.ExceptionCode; } \
inline __attribute__((always_inline, gnu_inline)) \
void * _exception_info() { return _SEH3$_TrylevelFrame.ExceptionPointers; } \
_Pragma("GCC diagnostic pop") \
\
/* Now handle the actual filter expression */ \
{ _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = (expression); return seh3$result; } \
}
#define _exception_info()
Definition: pseh2_64.h:193

Definition at line 344 of file pseh3.h.

◆ _SEH3 [14/19]

#define _SEH3
Value:
$_FINALLY_FUNC_OPEN(_Name) \
_SEH3$_NESTED_FUNC_OPEN(_Name) \
/* Declare the intrinsics for the finally function */ \
inline __attribute__((always_inline, gnu_inline)) \
int _abnormal_termination() { return (_SEH3$_TrylevelFrame.ExceptionPointers != 0); } \
\
/* This construct makes sure that the finally function returns */ \
/* a proper value at the end */ \
for (; ; (void)({ _SEH3$FILTER_RESULT seh3$result; seh3$result.Value = 0; return seh3$result; 0;}))
#define _abnormal_termination()
Definition: pseh2_64.h:195

Definition at line 344 of file pseh3.h.

◆ _SEH3 [15/19]

#define _SEH3
Value:
$_FILTER(_Filter, _FilterExpression) \
(__builtin_constant_p(_FilterExpression) ? (void*)(unsigned long)(unsigned char)(unsigned long)(_FilterExpression) : _Filter)
unsigned char
Definition: typeof.h:29

Definition at line 344 of file pseh3.h.

◆ _SEH3 [16/19]

#define _SEH3   $_FINALLY(_Finally) (_Finally)

Definition at line 344 of file pseh3.h.

◆ _SEH3 [17/19]

#define _SEH3
Value:
$_DEFINE_DUMMY_FINALLY(_Name) \
auto inline __attribute__((always_inline,gnu_inline)) int _Name(int Action) { (void)Action; return 0; }

Definition at line 344 of file pseh3.h.

◆ _SEH3 [18/19]

#define _SEH3
Value:
$_DECLARE_CLEANUP_FUNC(_Name) \
auto inline __attribute__((always_inline,gnu_inline)) void _Name(volatile SEH3$_REGISTRATION_FRAME *p)
GLfloat GLfloat p
Definition: glext.h:8902

Definition at line 344 of file pseh3.h.

◆ _SEH3 [19/19]

#define _SEH3
Value:
$_DEFINE_CLEANUP_FUNC(_Name) \
_SEH3$_DECLARE_CLEANUP_FUNC(_Name) \
{ \
(void)p; \
/* Unregister the frame */ \
if (_SEH3$_TryLevel == 0) _SEH3$_UnregisterFrame(&_SEH3$_TrylevelFrame); \
else _SEH3$_UnregisterTryLevel(&_SEH3$_TrylevelFrame); \
\
/* Invoke the finally function (an inline dummy in the __except case) */ \
_SEH3$_FinallyFunction(1); \
}
else
Definition: tritemp.h:161

Definition at line 344 of file pseh3.h.

◆ _SEH3_END

#define _SEH3_END
Value:
}; \
goto _SEH3$_l_EndTry; \
\
_SEH3$_l_OnException: (void)0; \
/* Force GCC to create proper code pathes */ \
_SEH3$_SCARE_GCC(); \
\
_SEH3$_l_EndTry:(void)0; \
_SEH3$_ASM_GOTO(_SEH3$_l_OnException); \
\
/* Implementation of the auto cleanup function */ \
_SEH3$_DEFINE_CLEANUP_FUNC(_SEH3$_AutoCleanup); \
\
/* Close the outer scope */ \
}

Definition at line 484 of file pseh3.h.

◆ _SEH3_EXCEPT

#define _SEH3_EXCEPT (   ...)

Definition at line 405 of file pseh3.h.

◆ _SEH3_FINALLY

#define _SEH3_FINALLY

Definition at line 450 of file pseh3.h.

◆ _SEH3_LEAVE

#define _SEH3_LEAVE   goto _SEH3$_l_Leave

Definition at line 501 of file pseh3.h.

◆ _SEH3_TRY

#define _SEH3_TRY

Definition at line 360 of file pseh3.h.

◆ _SEH3_VOLATILE

#define _SEH3_VOLATILE   volatile

Definition at line 503 of file pseh3.h.

◆ setjmp

Definition at line 509 of file pseh3.h.

Typedef Documentation

◆ _SEH3$FILTER_RESULT

◆ PSEH3$_EXCEPTION_POINTERS

◆ PSEH3$_REGISTRATION_FRAME

◆ PSEH3$_SCOPE_TABLE

◆ SEH3$_EXCEPTION_POINTERS

◆ SEH3$_REGISTRATION_FRAME

◆ SEH3$_SCOPE_TABLE

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
_SEH3$_TryLevel 
_SEH3$_InnerTryLevel 

Definition at line 112 of file pseh3.h.

113{
114 _SEH3$_TryLevel = -1,
116};
@ _SEH3$_InnerTryLevel
Definition: pseh3.h:115

Function Documentation

◆ __attribute__() [1/6]

static __attribute__ ( (always_inline)  )
inlinestatic

Definition at line 91 of file pseh3.h.

91{}

◆ __attribute__() [2/6]

__attribute__ ( (always_inline, gnu_inline)  ) volatile
inline

Definition at line 94 of file pseh3.h.

96{
97 asm volatile ("movl %k[NewHead], %%fs:0"
98 : : [NewHead] "ir" (RegistrationFrame->Next) : "memory");
99}

◆ __attribute__() [3/6]

int __cdecl __attribute__ ( (error("Can only be used inside a __finally block."))  )

◆ __attribute__() [4/6]

unsigned long __cdecl __attribute__ ( (error("Can only be used inside an exception filter or __except block."))  )

◆ __attribute__() [5/6]

void *__cdecl __attribute__ ( (error("Can only be used inside an exception filter."))  )

◆ __attribute__() [6/6]

int __attribute__ ( (regparm(3))  ) volatile

◆ _SEH3$_except_handler()

int __cdecl _SEH3$_except_handler ( struct _EXCEPTION_RECORD ExceptionRecord,
PSEH3$_REGISTRATION_FRAME  EstablisherFrame,
struct _CONTEXT ContextRecord,
void DispatcherContext 
)

◆ _SEH3$_longjmp_unwind()

void __stdcall _SEH3$_longjmp_unwind ( _JUMP_BUFFER *  _Buf)

Definition at line 453 of file pseh3.c.

454{
455 PSEH3$_REGISTRATION_FRAME RegisteredFrame = (PSEH3$_REGISTRATION_FRAME)_Buf->Registration;
456 PSEH3$_REGISTRATION_FRAME CurrentFrame;
457
458 /* Native SEH registers the EH frame at the start of the function, so a call to
459 _setjmp(3) will always save that EH frame. PSEH only registers the frame
460 when entering a try block, so a call to _setjmp outside of a try block
461 would save a previously installed EH frame, which can be of a different
462 type (e.g. native EH3/EH4). We need to check whether the frame is ours
463 by comparing its address to the saved ebp value, which marks the boundary
464 of the stack frame for the caller of _setjmp. */
465 if (_Buf->Registration > _Buf->Ebp)
466 {
467 /* The registration frame is not ours, we don't need to do anything */
468 return;
469 }
470
471 /* Loop all frames for this registration */
472 for (CurrentFrame = RegisteredFrame->EndOfChain;
473 CurrentFrame->TryLevel != _Buf->TryLevel;
474 CurrentFrame = CurrentFrame->Next)
475 {
476 /* Check if this is a termination handler */
477 if (CurrentFrame->ScopeTable->Target == NULL)
478 {
479 /* Call the termination handler */
480 if (RegisteredFrame->Handler == _SEH3$_C_except_handler)
481 {
482#ifdef __clang__
484#else
486#endif
487 }
488 else
489 {
490 ASSERT(CurrentFrame->Handler == _SEH3$_CPP_except_handler);
492 }
493 }
494 }
495}
#define NULL
Definition: types.h:112
HRESULT Next([in] ULONG celt, [out, size_is(celt), length_is(*pceltFetched)] STATPROPSETSTG *rgelt, [out] ULONG *pceltFetched)
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(exp)
Definition: pseh3.c:40
int __cdecl _SEH3$_C_except_handler(struct _EXCEPTION_RECORD *ExceptionRecord, PSEH3$_REGISTRATION_FRAME EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
Definition: pseh3.c:427
int __cdecl _SEH3$_CPP_except_handler(struct _EXCEPTION_RECORD *ExceptionRecord, PSEH3$_REGISTRATION_FRAME EstablisherFrame, struct _CONTEXT *ContextRecord, void *DispatcherContext)
Definition: pseh3.c:442
static VOID _SEH3$_CallFinally(PSEH3$_REGISTRATION_FRAME Record, int HandlerType)
Definition: pseh3.c:259
@ _SEH3$_CLANG_HANDLER
Definition: pseh3.c:71
@ _SEH3$_CPP_HANDLER
Definition: pseh3.c:70
@ _SEH3$_NESTED_HANDLER
Definition: pseh3.c:69
struct _SEH3$_REGISTRATION_FRAME * PSEH3$_REGISTRATION_FRAME
struct _SEH3$_REGISTRATION_FRAME * EndOfChain
Definition: pseh3.h:51

◆ _setjmp3()

int _setjmp3 ( jmp_buf  env,
int  count,
  ... 
)

Variable Documentation

◆ AllocaFrame

Definition at line 134 of file pseh3.h.

◆ ScopeTable

int const SEH3$_SCOPE_TABLE * ScopeTable

Definition at line 133 of file pseh3.h.

Referenced by __C_specific_handler().