Illumos regtest: x86 mdb diffs wrt Solaris
[valgrind.git] / include / vki / vki-arm64-freebsd.h
blobe535fe7feef23bbd4516fad3df32b1432c44bfe1
1 /*
2 This file is part of Valgrind, a dynamic binary instrumentation
3 framework.
5 Copyright (C) 2024 Paul Floyd
6 pjfloyd@wanadoo.fr
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2 of the
11 License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, see <http://www.gnu.org/licenses/>.
21 The GNU General Public License is contained in the file COPYING.
24 #ifndef VKI_ARM64_FREEBSD_H
25 #define VKI_ARM64_FREEBSD_H
27 //----------------------------------------------------------------------
28 // arm/param.h
29 //----------------------------------------------------------------------
31 /* PAGE_SHIFT determines the page size. */
32 #define VKI_PAGE_SHIFT 12UL
33 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
34 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
35 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
37 //----------------------------------------------------------------------
38 // machine/_limits.h
39 //----------------------------------------------------------------------
40 #define VKI_MINSIGSTKSZ (1024 * 4)
42 //----------------------------------------------------------------------
43 // sys/_sigset.h
44 //----------------------------------------------------------------------
45 #define _VKI_NSIG_WORDS 4
46 #define _VKI_NSIG 128
47 #define _VKI_NSIG_BPW ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
49 #include "vki-machine-types-arm64-freebsd.h"
51 typedef struct {
52 vki_uint32_t sig[_VKI_NSIG_WORDS];
53 } vki_sigset_t;
55 //----------------------------------------------------------------------
56 // machine/armreg.h
57 //----------------------------------------------------------------------
59 /* mainly for the carry flag, used to signifify syscall success/failure */
60 #define VKI_PSR_IL 0x00100000UL
61 #define VKI_PSR_SS 0x00200000UL
62 #define VKI_PSR_V 0x10000000UL
63 #define VKI_PSR_C 0x20000000UL
64 #define VKI_PSR_Z 0x40000000UL
65 #define VKI_PSR_N 0x80000000UL
66 #define VKI_PSR_FLAGS 0xf0000000UL
68 //----------------------------------------------------------------------
69 // machine/reg.h
70 // Used by PTRACE and coredump-elf.h */
71 //----------------------------------------------------------------------
73 struct vki_dbreg {
74 vki_uint8_t db_debug_ver;
75 vki_uint8_t db_nbkpts;
76 vki_uint8_t db_nwtpts;
77 vki_uint8_t db_pad[5];
79 struct {
80 vki_uint64_t dbr_addr;
81 vki_uint32_t dbr_ctrl;
82 vki_uint32_t dbr_pad;
83 } db_breakregs[16];
84 struct {
85 vki_uint64_t dbw_addr;
86 vki_uint32_t dbw_ctrl;
87 vki_uint32_t dbw_pad;
88 } db_watchregs[16];
91 //----------------------------------------------------------------------
92 // machine/ucontext.h
93 //----------------------------------------------------------------------
95 /* It's a bit stupid having the struct layout as reg.h struct reg */
96 struct vki_gpregs {
97 __vki_register_t gp_x[30];
98 __vki_register_t gp_lr;
99 __vki_register_t gp_sp;
100 __vki_register_t gp_elr;
101 vki_uint64_t gp_spsr;
104 /* coredump-elf.c compatibility */
105 #define vki_user_regs_struct vki_gpregs
107 /* Like Linux */
108 typedef unsigned long vki_elf_greg_t;
109 #define VKI_ELF_NGREG (sizeof(struct vki_gpregs) / sizeof(vki_elf_greg_t))
110 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
112 struct vki_fpregs {
113 __uint128_t fp_q[32];
114 vki_uint32_t fp_sr;
115 vki_uint32_t fp_cr;
116 int fp_flags;
117 int fp_pad;
120 /* amd64 compatibility */
121 #define vki_fpreg vki_fpregs
123 /* fpregs in FreeBSD headers fpreg */
124 // #define vki_fpreg vki_fpregs
126 // On Linux the equivalent of the above is smaller, without the fp_flags annd
127 // padding
128 typedef struct vki_fpregs vki_elf_fpregset_t;
130 struct vki_mcontext {
131 struct vki_gpregs mc_gpregs;
132 struct vki_fpregs mc_fpregs;
133 int mc_flags;
134 #define _MC_FP_VALID 0x1 /* Set when mc_fpregs has valid data */
135 int mc_pad; /* Padding */
136 vki_uint64_t mc_spare[8]; /* Space for expansion, set to zero */
139 struct vki_sigaction_base {
140 void (*ksa_handler)(int);
141 int sa_flags;
142 vki_sigset_t sa_mask; /* mask last for extensibility */
144 typedef struct vki_sigaction_base vki_sigaction_toK_t;
145 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
147 //----------------------------------------------------------------------
148 // sys/vdso.h and machine/vdso.h
149 //----------------------------------------------------------------------
150 #define VKI_VDSO_TIMEHANDS_MD \
151 uint32_t th_physical; \
152 uint32_t th_res[7];
154 struct vki_bintime {
155 vki_time_t sec;
156 vki_uint64_t frac;
159 struct vki_vdso_timehands {
160 vki_uint32_t th_algo;
161 vki_uint32_t th_gen;
162 vki_uint64_t th_scale;
163 vki_uint32_t th_offset_count;
164 vki_uint32_t th_counter_mask;
165 struct vki_bintime th_offset;
166 struct vki_bintime th_boottime;
167 VKI_VDSO_TIMEHANDS_MD
170 //----------------------------------------------------------------------
171 // machine/elf.h
172 //----------------------------------------------------------------------
174 #define VKI_HWCAP_FP 0x00000001
175 #define VKI_HWCAP_ASIMD 0x00000002
176 #define VKI_HWCAP_EVTSTRM 0x00000004
177 #define VKI_HWCAP_AES 0x00000008
178 #define VKI_HWCAP_PMULL 0x00000010
179 #define VKI_HWCAP_SHA1 0x00000020
180 #define VKI_HWCAP_SHA2 0x00000040
181 #define VKI_HWCAP_CRC32 0x00000080
182 #define VKI_HWCAP_ATOMICS 0x00000100
183 #define VKI_HWCAP_FPHP 0x00000200
184 #define VKI_HWCAP_ASIMDHP 0x00000400
185 #define VKI_HWCAP_CPUID 0x00000800
186 #define VKI_HWCAP_ASIMDRDM 0x00001000
187 #define VKI_HWCAP_JSCVT 0x00002000
188 #define VKI_HWCAP_FCMA 0x00004000
189 #define VKI_HWCAP_LRCPC 0x00008000
190 #define VKI_HWCAP_DCPOP 0x00010000
191 #define VKI_HWCAP_SHA3 0x00020000
192 #define VKI_HWCAP_SM3 0x00040000
193 #define VKI_HWCAP_SM4 0x00080000
194 #define VKI_HWCAP_ASIMDDP 0x00100000
195 #define VKI_HWCAP_SHA512 0x00200000
196 #define VKI_HWCAP_SVE 0x00400000
197 #define VKI_HWCAP_ASIMDFHM 0x00800000
198 #define VKI_HWCAP_DIT 0x01000000
199 #define VKI_HWCAP_USCAT 0x02000000
200 #define VKI_HWCAP_ILRCPC 0x04000000
201 #define VKI_HWCAP_FLAGM 0x08000000
202 #define VKI_HWCAP_SSBS 0x10000000
203 #define VKI_HWCAP_SB 0x20000000
204 #define VKI_HWCAP_PACA 0x40000000
205 #define VKI_HWCAP_PACG 0x80000000
207 #define VKI_HWCAP2_DCPODP 0x00000001
208 #define VKI_HWCAP2_SVE2 0x00000002
209 #define VKI_HWCAP2_SVEAES 0x00000004
210 #define VKI_HWCAP2_SVEPMULL 0x00000008
211 #define VKI_HWCAP2_SVEBITPERM 0x00000010
212 #define VKI_HWCAP2_SVESHA3 0x00000020
213 #define VKI_HWCAP2_SVESM4 0x00000040
214 #define VKI_HWCAP2_FLAGM2 0x00000080
215 #define VKI_HWCAP2_FRINT 0x00000100
216 #define VKI_HWCAP2_SVEI8MM 0x00000200
217 #define VKI_HWCAP2_SVEF32MM 0x00000400
218 #define VKI_HWCAP2_SVEF64MM 0x00000800
219 #define VKI_HWCAP2_SVEBF16 0x00001000
220 #define VKI_HWCAP2_I8MM 0x00002000
221 #define VKI_HWCAP2_BF16 0x00004000
222 #define VKI_HWCAP2_DGH 0x00008000
223 #define VKI_HWCAP2_RNG 0x00010000
224 #define VKI_HWCAP2_BTI 0x00020000
227 #endif /* VKI_ARM64_FREEBSD_H */