btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / libs / libunwind / libunwind-aarch64.h
blobcd01e5785f471388d551af90ce724cb1c3b850ed
1 /* libunwind - a platform-independent unwind library
2 Copyright (C) 2001-2004 Hewlett-Packard Co
3 Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
4 Copyright (C) 2013 Linaro Limited
6 This file is part of libunwind.
8 Permission is hereby granted, free of charge, to any person obtaining
9 a copy of this software and associated documentation files (the
10 "Software"), to deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense, and/or sell copies of the Software, and to
13 permit persons to whom the Software is furnished to do so, subject to
14 the following conditions:
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
27 #ifndef LIBUNWIND_H
28 #define LIBUNWIND_H
30 #if defined(__cplusplus) || defined(c_plusplus)
31 extern "C" {
32 #endif
34 #include <inttypes.h>
35 #include <stddef.h>
36 #include <ucontext.h>
38 #define UNW_TARGET aarch64
39 #define UNW_TARGET_AARCH64 1
41 #define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */
43 /* This needs to be big enough to accommodate "struct cursor", while
44 leaving some slack for future expansion. Changing this value will
45 require recompiling all users of this library. Stack allocation is
46 relatively cheap and unwind-state copying is relatively rare, so we
47 want to err on making it rather too big than too small. */
49 #define UNW_TDEP_CURSOR_LEN 4096
51 typedef uint64_t unw_word_t;
52 typedef int64_t unw_sword_t;
54 typedef long double unw_tdep_fpreg_t;
56 typedef struct
58 /* no aarch64-specific auxiliary proc-info */
60 unw_tdep_proc_info_t;
62 typedef enum
64 /* 64-bit general registers. */
65 UNW_AARCH64_X0,
66 UNW_AARCH64_X1,
67 UNW_AARCH64_X2,
68 UNW_AARCH64_X3,
69 UNW_AARCH64_X4,
70 UNW_AARCH64_X5,
71 UNW_AARCH64_X6,
72 UNW_AARCH64_X7,
73 UNW_AARCH64_X8,
75 /* Temporary registers. */
76 UNW_AARCH64_X9,
77 UNW_AARCH64_X10,
78 UNW_AARCH64_X11,
79 UNW_AARCH64_X12,
80 UNW_AARCH64_X13,
81 UNW_AARCH64_X14,
82 UNW_AARCH64_X15,
84 /* Intra-procedure-call temporary registers. */
85 UNW_AARCH64_X16,
86 UNW_AARCH64_X17,
88 /* Callee-saved registers. */
89 UNW_AARCH64_X18,
90 UNW_AARCH64_X19,
91 UNW_AARCH64_X20,
92 UNW_AARCH64_X21,
93 UNW_AARCH64_X22,
94 UNW_AARCH64_X23,
95 UNW_AARCH64_X24,
96 UNW_AARCH64_X25,
97 UNW_AARCH64_X26,
98 UNW_AARCH64_X27,
99 UNW_AARCH64_X28,
101 /* 64-bit frame pointer. */
102 UNW_AARCH64_X29,
104 /* 64-bit link register. */
105 UNW_AARCH64_X30,
107 /* 64-bit stack pointer. */
108 UNW_AARCH64_SP = 31,
109 UNW_AARCH64_PC,
110 UNW_AARCH64_PSTATE,
112 /* 128-bit FP/Advanced SIMD registers. */
113 UNW_AARCH64_V0 = 64,
114 UNW_AARCH64_V1,
115 UNW_AARCH64_V2,
116 UNW_AARCH64_V3,
117 UNW_AARCH64_V4,
118 UNW_AARCH64_V5,
119 UNW_AARCH64_V6,
120 UNW_AARCH64_V7,
121 UNW_AARCH64_V8,
122 UNW_AARCH64_V9,
123 UNW_AARCH64_V10,
124 UNW_AARCH64_V11,
125 UNW_AARCH64_V12,
126 UNW_AARCH64_V13,
127 UNW_AARCH64_V14,
128 UNW_AARCH64_V15,
129 UNW_AARCH64_V16,
130 UNW_AARCH64_V17,
131 UNW_AARCH64_V18,
132 UNW_AARCH64_V19,
133 UNW_AARCH64_V20,
134 UNW_AARCH64_V21,
135 UNW_AARCH64_V22,
136 UNW_AARCH64_V23,
137 UNW_AARCH64_V24,
138 UNW_AARCH64_V25,
139 UNW_AARCH64_V26,
140 UNW_AARCH64_V27,
141 UNW_AARCH64_V28,
142 UNW_AARCH64_V29,
143 UNW_AARCH64_V30,
144 UNW_AARCH64_V31,
146 UNW_AARCH64_FPSR,
147 UNW_AARCH64_FPCR,
149 /* For AArch64, the CFA is the value of SP (x31) at the call site of the
150 previous frame. */
151 UNW_AARCH64_CFA = UNW_AARCH64_SP,
153 UNW_TDEP_LAST_REG = UNW_AARCH64_FPCR,
155 UNW_TDEP_IP = UNW_AARCH64_X30,
156 UNW_TDEP_SP = UNW_AARCH64_SP,
157 UNW_TDEP_EH = UNW_AARCH64_X0,
160 aarch64_regnum_t;
162 /* Use R0 through R3 to pass exception handling information. */
163 #define UNW_TDEP_NUM_EH_REGS 4
165 typedef struct unw_tdep_save_loc
167 /* Additional target-dependent info on a save location. */
169 unw_tdep_save_loc_t;
172 /* On AArch64, we can directly use ucontext_t as the unwind context. */
173 typedef ucontext_t unw_tdep_context_t;
175 #include "libunwind-common.h"
176 #include "libunwind-dynamic.h"
178 #define unw_tdep_getcontext(uc) (getcontext (uc), 0)
179 #define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg)
181 extern int unw_tdep_is_fpreg (int);
183 #if defined(__cplusplus) || defined(c_plusplus)
185 #endif
187 #endif /* LIBUNWIND_H */