xref: /minix3/sys/lib/libunwind/unwind.h (revision b029fb598aff7d169ad9d60ec6eafa774faef921)
1472758f3SLionel Sambuc //===------------------------------- unwind.h -----------------------------===//
2472758f3SLionel Sambuc //
3472758f3SLionel Sambuc //                     The LLVM Compiler Infrastructure
4472758f3SLionel Sambuc //
5472758f3SLionel Sambuc // This file is dual licensed under the MIT and the University of Illinois Open
6472758f3SLionel Sambuc // Source Licenses. See LICENSE.TXT for details.
7472758f3SLionel Sambuc //
8472758f3SLionel Sambuc //
9472758f3SLionel Sambuc // C++ ABI Level 1 ABI documented at:
10472758f3SLionel Sambuc //   http://mentorembedded.github.io/cxx-abi/abi-eh.html
11472758f3SLionel Sambuc //
12472758f3SLionel Sambuc //===----------------------------------------------------------------------===//
13472758f3SLionel Sambuc 
14472758f3SLionel Sambuc #ifndef _UNWIND_H
15472758f3SLionel Sambuc #define _UNWIND_H
16472758f3SLionel Sambuc 
17472758f3SLionel Sambuc #include <stdint.h>
18472758f3SLionel Sambuc #include <stddef.h>
19472758f3SLionel Sambuc 
20472758f3SLionel Sambuc typedef enum {
21472758f3SLionel Sambuc   _URC_NO_REASON = 0,
22472758f3SLionel Sambuc   _URC_FOREIGN_EXCEPTION_CAUGHT = 1,
23472758f3SLionel Sambuc   _URC_FATAL_PHASE2_ERROR = 2,
24472758f3SLionel Sambuc   _URC_FATAL_PHASE1_ERROR = 3,
25472758f3SLionel Sambuc   _URC_NORMAL_STOP = 4,
26472758f3SLionel Sambuc   _URC_END_OF_STACK = 5,
27472758f3SLionel Sambuc   _URC_HANDLER_FOUND = 6,
28472758f3SLionel Sambuc   _URC_INSTALL_CONTEXT = 7,
29472758f3SLionel Sambuc   _URC_CONTINUE_UNWIND = 8
30472758f3SLionel Sambuc } _Unwind_Reason_Code;
31472758f3SLionel Sambuc 
32472758f3SLionel Sambuc typedef enum {
33472758f3SLionel Sambuc   _UA_SEARCH_PHASE = 1,
34472758f3SLionel Sambuc   _UA_CLEANUP_PHASE = 2,
35472758f3SLionel Sambuc   _UA_HANDLER_FRAME = 4,
36472758f3SLionel Sambuc   _UA_FORCE_UNWIND = 8,
37472758f3SLionel Sambuc   _UA_END_OF_STACK = 16 /* GCC extension */
38472758f3SLionel Sambuc } _Unwind_Action;
39472758f3SLionel Sambuc 
40472758f3SLionel Sambuc struct _Unwind_Context;
41472758f3SLionel Sambuc 
42472758f3SLionel Sambuc struct _Unwind_Exception {
43472758f3SLionel Sambuc   uint64_t exception_class;
44472758f3SLionel Sambuc   void (*exception_cleanup)(_Unwind_Reason_Code, struct _Unwind_Exception *);
45472758f3SLionel Sambuc   uintptr_t private_1;
46472758f3SLionel Sambuc   uintptr_t private_2;
47472758f3SLionel Sambuc } __attribute__((__aligned__));
48472758f3SLionel Sambuc 
49472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn)(int, _Unwind_Action, uint64_t,
50472758f3SLionel Sambuc                                                struct _Unwind_Exception *,
51472758f3SLionel Sambuc                                                struct _Unwind_Context *,
52472758f3SLionel Sambuc                                                void *);
53472758f3SLionel Sambuc 
54472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*__personality_routine)(int, _Unwind_Action,
55472758f3SLionel Sambuc                                                      uint64_t,
56472758f3SLionel Sambuc                                                      struct _Unwind_Exception *,
57472758f3SLionel Sambuc                                                      struct _Unwind_Context *);
58472758f3SLionel Sambuc 
59472758f3SLionel Sambuc __BEGIN_DECLS
60472758f3SLionel Sambuc 
61472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_RaiseException(struct _Unwind_Exception *);
62472758f3SLionel Sambuc void _Unwind_Resume(struct _Unwind_Exception *) __dead;
63472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_Resume_or_Rethrow(struct _Unwind_Exception *);
64472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_ForcedUnwind(struct _Unwind_Exception *,
65472758f3SLionel Sambuc                                          _Unwind_Stop_Fn, void *);
66472758f3SLionel Sambuc void _Unwind_DeleteException(struct _Unwind_Exception *);
67472758f3SLionel Sambuc uintptr_t _Unwind_GetGR(struct _Unwind_Context *, int);
68472758f3SLionel Sambuc void _Unwind_SetGR(struct _Unwind_Context *, int, uintptr_t);
69472758f3SLionel Sambuc uintptr_t _Unwind_GetIP(struct _Unwind_Context *);
70*b029fb59SBen Gras uintptr_t _Unwind_GetIPInfo(struct _Unwind_Context *, int *);
71472758f3SLionel Sambuc uintptr_t _Unwind_GetCFA(struct _Unwind_Context *);
72472758f3SLionel Sambuc void _Unwind_SetIP(struct _Unwind_Context *, uintptr_t);
73472758f3SLionel Sambuc uintptr_t _Unwind_GetRegionStart(struct _Unwind_Context *);
74472758f3SLionel Sambuc uintptr_t _Unwind_GetLanguageSpecificData(struct _Unwind_Context *);
75472758f3SLionel Sambuc uintptr_t _Unwind_GetDataRelBase(struct _Unwind_Context *);
76472758f3SLionel Sambuc uintptr_t _Unwind_GetTextRelBase(struct _Unwind_Context *);
77472758f3SLionel Sambuc 
78472758f3SLionel Sambuc typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn)(struct _Unwind_Context *,
79472758f3SLionel Sambuc                                                 void *);
80472758f3SLionel Sambuc _Unwind_Reason_Code _Unwind_Backtrace(_Unwind_Trace_Fn, void *);
81472758f3SLionel Sambuc void *_Unwind_FindEnclosingFunction(void *);
82472758f3SLionel Sambuc 
83472758f3SLionel Sambuc void __register_frame(const void *);
84472758f3SLionel Sambuc void __register_frame_info(const void *, void *);
85472758f3SLionel Sambuc void __deregister_frame(const void *);
86472758f3SLionel Sambuc void *__deregister_frame_info(const void *);
87472758f3SLionel Sambuc 
88472758f3SLionel Sambuc __END_DECLS
89472758f3SLionel Sambuc 
90472758f3SLionel Sambuc #endif // _UNWIND_H
91