valgrind-monitor.py regular expressions should use raw strings
[valgrind.git] / include / vki / vki-x86-freebsd.h
blob60ca1040ba6bd1a82a5aa442b9a4f4a651edd3b5
2 /*--------------------------------------------------------------------*/
3 /*--- x86/FreeBSD-specific kernel interface. vki-x86-freebsd.h ---*/
4 /*--------------------------------------------------------------------*/
6 /*
7 This file is part of Valgrind, a dynamic binary instrumentation
8 framework.
10 Copyright (C) 2000-2005 Julian Seward
11 jseward@acm.org
12 Copyright (C) 2009 Stanislav Sedov
13 <stas@FreeBSD.org>
14 Copyright (C) 2018-2021 Paul Floyd
15 pjfloyd@wanadoo.fr
17 This program is free software; you can redistribute it and/or
18 modify it under the terms of the GNU General Public License as
19 published by the Free Software Foundation; either version 2 of the
20 License, or (at your option) any later version.
22 This program is distributed in the hope that it will be useful, but
23 WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 General Public License for more details.
27 You should have received a copy of the GNU General Public License
28 along with this program; if not, see <http://www.gnu.org/licenses/>.
30 The GNU General Public License is contained in the file COPYING.
33 #ifndef VKI_X86_FREEBSD_H
34 #define VKI_X86_FREEBSD_H
36 //----------------------------------------------------------------------
37 // From somewhere
38 //----------------------------------------------------------------------
40 /* PAGE_SHIFT determines the page size */
41 #define VKI_PAGE_SHIFT 12
42 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
43 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
44 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
46 //----------------------------------------------------------------------
47 // From sys/i386/include/_limits.h and sys/sys/_sigset.h
48 //----------------------------------------------------------------------
50 #define VKI_MINSIGSTKSZ (512 * 4)
52 #define _VKI_NSIG 128
53 #define _VKI_NSIG_WORDS 4
54 #define _VKI_NSIG_BPW ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
56 typedef struct {
57 vki_uint32_t sig[_VKI_NSIG_WORDS];
58 } vki_sigset_t;
61 //----------------------------------------------------------------------
62 // From sys/i386/include/npx.h
63 //----------------------------------------------------------------------
65 struct _vki_env87 {
66 long en_cw;
67 long en_sw;
68 long en_tw;
69 long en_fip;
70 unsigned short en_fcs;
71 unsigned short en_opcode;
72 long en_foo;
73 long en_fos;
76 struct _vki_fpacc87 {
77 unsigned char fp_bytes[10];
80 struct _vki_save87 {
81 struct _vki_env87 sv_env;
82 struct _vki_fpacc87 sv_ac[8];
83 unsigned char sv_pad0[4];
84 unsigned char sv_pad[64];
87 struct _vki_xmmacc {
88 unsigned char xmm_bytes[16];
91 struct _vki_envxmm {
92 unsigned short en_cw;
93 unsigned short en_sw;
94 unsigned short en_tw;
95 unsigned short en_opcode;
96 unsigned int en_fip;
97 unsigned short en_fcs;
98 unsigned short en_pad0;
99 unsigned int en_foo;
100 unsigned short en_fos;
101 unsigned short en_pad1;
102 unsigned int en_mxcsr;
103 unsigned int en_mxcsr_mask;
106 struct _vki_savexmm {
107 struct _vki_envxmm sv_env;
108 struct {
109 struct _vki_fpacc87 fp_acc;
110 unsigned char fp_pad[6];
111 } sv_fp[8];
112 struct _vki_xmmacc sv_xmm[8];
113 unsigned char sv_pad[224];
116 struct _vki_fpstate {
117 union {
118 struct _vki_save87 sv_87;
119 struct _vki_savexmm sv_xmm;
123 struct vki_sigcontext {
124 vki_sigset_t sc_mask;
125 int onstack;
126 int gs;
127 int fs;
128 int es;
129 int ds;
130 int edi;
131 int esi;
132 int ebp;
133 int isp;
134 int ebx;
135 int edx;
136 int ecx;
137 int eax;
138 int trapno;
139 int err;
140 int eip;
141 int cs;
142 int eflags;
143 int esp;
144 int ss;
145 int len;
146 int fpformat;
147 int ownedfp;
148 int spare1[1];
149 struct _vki_fpstate fpstate __attribute__((aligned(16)));
150 int fsbase;
151 int gsbase;
152 int spare2[6];
155 struct vki_user_regs_struct {
156 unsigned int fs;
157 unsigned int es;
158 unsigned int ds;
159 unsigned int edi;
160 unsigned int esi;
161 unsigned int ebp;
162 unsigned int isp;
163 unsigned int ebx;
164 unsigned int edx;
165 unsigned int ecx;
166 unsigned int eax;
167 unsigned int trapno;
168 unsigned int err;
169 unsigned int eip;
170 unsigned int cs;
171 unsigned int eflags;
172 unsigned int esp;
173 unsigned int ss;
174 unsigned int gs;
177 struct vki_fpreg {
178 unsigned long fpr_env[7];
179 unsigned char fpr_acc[8][10];
180 unsigned long fpr_ex_sw;
181 unsigned char fpr_pad[64];
184 struct vki_dbreg {
185 unsigned int dr[8];
188 typedef unsigned int vki_elf_greg_t;
189 typedef struct _vki_fpstate vki_elf_fpregset_t;
190 typedef struct _vki_fpstate vki_elf_fpxregset_t;
192 #define VKI_AT_SYSINFO 32
193 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
194 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
196 #define VKI_FPFMT_NODEV 0x10000
197 #define VKI_FPFMT_387 0x10001
198 #define VKI_FPFMT_XMM 0x10002
200 #define VKI_FPOWNED_NONE 0x20000
201 #define VKI_FPOWNED_FPU 0x20001
202 #define VKI_FPOWNED_PCB 0x20002
204 struct vki_mcontext {
205 int onstack;
206 int gs;
207 int fs;
208 int es;
209 int ds;
210 int edi;
211 int esi;
212 int ebp;
213 int isp;
214 int ebx;
215 int edx;
216 int ecx;
217 int eax;
218 int trapno;
219 int err;
220 int eip;
221 int cs;
222 int eflags;
223 int esp;
224 int ss;
226 int len;
227 int fpformat;
228 int ownedfp;
229 int flags;
230 struct _vki_fpstate fpstate __attribute__((aligned(16)));
231 int fsbase;
232 int gsbase;
233 int xfpustate;
234 int xfpustate_len;
235 int spare2[4];
238 struct vki_sigaction_base {
239 void (*ksa_handler)(int);
240 int sa_flags;
241 vki_sigset_t sa_mask; /* mask last for extensibility */
243 typedef struct vki_sigaction_base vki_sigaction_toK_t;
244 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
246 //----------------------------------------------------------------------
247 // sys/vdso.h
248 //----------------------------------------------------------------------
249 #define VKI_VDSO_TIMEHANDS_MD \
250 vki_uint32_t th_x86_shift; \
251 vki_uint32_t th_x86_hpet_idx; \
252 vki_uint32_t th_res[6];
254 struct vki_bintime32 {
255 #if defined(__amd64__)
256 vki_uint32_t sec;
257 #else
258 vki_uint64_t sec;
259 #endif
260 vki_uint32_t frac[2];
263 struct vki_vdso_timehands {
264 vki_uint32_t th_algo;
265 vki_uint32_t th_gen;
266 vki_uint32_t th_scale[2];
267 vki_uint32_t th_offset_count;
268 vki_uint32_t th_counter_mask;
269 struct vki_bintime32 th_offset;
270 struct vki_bintime32 th_boottime;
271 VKI_VDSO_TIMEHANDS_MD
276 #endif // VKI_X86_FREEBSD_H
278 /*--------------------------------------------------------------------*/
279 /*--- end ---*/
280 /*--------------------------------------------------------------------*/