2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
11 #pragma pack(push,_CRT_PACKING)
17 typedef enum _EXCEPTION_DISPOSITION
19 ExceptionContinueExecution
,
20 ExceptionContinueSearch
,
21 ExceptionNestedException
,
22 ExceptionCollidedUnwind
,
23 } EXCEPTION_DISPOSITION
;
25 #if (defined(_X86_) && !defined(__x86_64))
26 struct _EXCEPTION_RECORD
;
32 _In_
struct _EXCEPTION_RECORD
*_ExceptionRecord
,
33 _In_
void *_EstablisherFrame
,
34 _Inout_
struct _CONTEXT
*_ContextRecord
,
35 _Inout_
void *_DispatcherContext
);
37 #elif defined(__ia64__)
39 typedef struct _EXCEPTION_POINTERS
*Exception_info_ptr
;
40 struct _EXCEPTION_RECORD
;
42 struct _DISPATCHER_CONTEXT
;
49 _In_
struct _EXCEPTION_RECORD
*_ExceptionRecord
,
50 _In_
unsigned __int64 _MemoryStackFp
,
51 _In_
unsigned __int64 _BackingStoreFp
,
52 _Inout_
struct _CONTEXT
*_ContextRecord
,
53 _Inout_
struct _DISPATCHER_CONTEXT
*_DispatcherContext
,
54 _In_
unsigned __int64 _GlobalPointer
);
56 #elif defined(__x86_64) || defined(_M_ARM)
58 struct _EXCEPTION_RECORD
;
60 struct _DISPATCHER_CONTEXT
;
66 _In_
struct _EXCEPTION_RECORD
*_ExceptionRecord
,
67 _In_
void *_EstablisherFrame
,
68 _Inout_
struct _CONTEXT
*_ContextRecord
,
69 _Inout_
struct _DISPATCHER_CONTEXT
*_DispatcherContext
);
74 #define GetExceptionCode _exception_code
75 #define exception_code _exception_code
76 #define GetExceptionInformation (struct _EXCEPTION_POINTERS *)_exception_info
77 #define exception_info (struct _EXCEPTION_POINTERS *)_exception_info
78 #define AbnormalTermination _abnormal_termination
79 #define abnormal_termination _abnormal_termination
80 unsigned long __cdecl
_exception_code(void);
81 void *__cdecl
_exception_info(void);
82 int __cdecl
_abnormal_termination(void);
85 #define EXCEPTION_EXECUTE_HANDLER 1
86 #define EXCEPTION_CONTINUE_SEARCH 0
87 #define EXCEPTION_CONTINUE_EXECUTION -1
91 typedef void (__cdecl
* _PHNDLR
)(int);
94 unsigned long XcptNum
;
99 extern struct _XCPT_ACTION _XcptActTab
[];
100 extern int _XcptActTabCount
;
101 extern int _XcptActTabSize
;
102 extern int _First_FPE_Indx
;
105 int __cdecl
__CppXcptFilter(unsigned long _ExceptionNum
,struct _EXCEPTION_POINTERS
* _ExceptionPtr
);
106 int __cdecl
_XcptFilter(unsigned long _ExceptionNum
,struct _EXCEPTION_POINTERS
* _ExceptionPtr
);
109 * The type of function that is expected as an exception handler to be
110 * installed with _try1.
112 typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER
)(struct _EXCEPTION_RECORD
*, void*, struct _CONTEXT
*, void*);
116 * This is not entirely necessary, but it is the structure installed by
117 * the _try1 primitive below.
119 typedef struct _EXCEPTION_REGISTRATION
{
120 struct _EXCEPTION_REGISTRATION
*prev
;
121 EXCEPTION_DISPOSITION (*handler
)(struct _EXCEPTION_RECORD
*, void*, struct _CONTEXT
*, void*);
122 } EXCEPTION_REGISTRATION
, *PEXCEPTION_REGISTRATION
;
124 typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD
;
125 typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD
;
128 #if (defined(_X86_) && !defined(__x86_64))
129 #define __try1(pHandler) \
130 __asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
133 __asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
135 #elif defined(__x86_64)
136 #define __try1(pHandler) \
137 __asm__ ("pushq %0;pushq %%gs:0;movq %%rsp,%%gs:0;" : : "g" (pHandler));
140 __asm__ ("movq (%%rsp),%%rax;movq %%rax,%%gs:0;addq $16,%%rsp;" \
143 #define __try1(pHandler)