FreeBSD syscall: fix syscall name used in kcmp traces.
[valgrind.git] / include / vki / vki-amd64-freebsd.h
blob44f4ce8c958121e9f0f9cd13706ba0831d39a59e
1 /*
2 This file is part of Valgrind, a dynamic binary instrumentation
3 framework.
5 Copyright (C) 2000-2005 Julian Seward
6 jseward@acm.org
7 Copyright (C) 2018-2021 Paul Floyd
8 pjfloyd@wanadoo.fr
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2 of the
13 License, or (at your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, see <http://www.gnu.org/licenses/>.
23 The GNU General Public License is contained in the file COPYING.
26 #ifndef VKI_AMD64_FREEBSD_H
27 #define VKI_AMD64_FREEBSD_H
29 /* PAGE_SHIFT determines the page size. */
30 #define VKI_PAGE_SHIFT 12UL
31 #define VKI_PAGE_SIZE (1UL << VKI_PAGE_SHIFT)
32 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
33 #define VKI_MAX_PAGE_SIZE VKI_PAGE_SIZE
35 #define VKI_MINSIGSTKSZ 2048
37 //----------------------------------------------------------------------
38 // sys/_sigset.h
39 //----------------------------------------------------------------------
40 #define _VKI_NSIG 128
41 #define _VKI_NSIG_WORDS 4
42 #define _VKI_NSIG_BPW ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
44 #include "vki-machine-types-amd64-freebsd.h"
46 typedef struct {
47 vki_uint32_t sig[_VKI_NSIG_WORDS];
48 } vki_sigset_t;
50 struct _vki_fpstate {
51 unsigned short cwd;
52 unsigned short swd;
53 unsigned short twd;
54 unsigned short fop;
55 unsigned long rip;
56 unsigned long rdp;
57 unsigned int mxcsr;
58 unsigned int mxcsr_mask;
59 unsigned int st_space[32]; /* 8*16 bytes for each FP-reg */
60 unsigned int xmm_space[64]; /* 16*16 bytes for each XMM-reg */
61 unsigned int reserved2[24];
64 struct vki_sigcontext {
65 vki_sigset_t mask;
66 long onstack;
67 long rdi;
68 long rsi;
69 long rdx;
70 long rcx;
71 long r8;
72 long r9;
73 long rax;
74 long rbx;
75 long rbp;
76 long r10;
77 long r11;
78 long r12;
79 long r13;
80 long r14;
81 long r15;
82 int trapno;
83 short fs;
84 short gs;
85 long addr;
86 int flags;
87 short es;
88 short ds;
89 long err;
90 long rip;
91 long cs;
92 long rflags;
93 long rsp;
94 long ss;
95 long len; /* sizeof(mcontext_t) */
96 long fpformat;
97 long ownedfp;
98 struct _vki_fpstate fpstate;
100 long fsbase;
101 long gsbase;
102 long xfpustate;
103 long xfpustate_len;
105 long spare[4];
109 * Retrieved from src/sys/amd64/include/reg.h
110 * Note that on 8.x trapno and err are no-more meaningful, but we
111 * don't set them anyway.
114 struct vki_user_regs_struct {
115 vki_register_t r15;
116 vki_register_t r14;
117 vki_register_t r13;
118 vki_register_t r12;
119 vki_register_t r11;
120 vki_register_t r10;
121 vki_register_t r9;
122 vki_register_t r8;
123 vki_register_t rdi;
124 vki_register_t rsi;
125 vki_register_t rbp;
126 vki_register_t rbx;
127 vki_register_t rdx;
128 vki_register_t rcx;
129 vki_register_t rax;
130 vki_uint32_t trapno;
131 vki_uint16_t fs;
132 vki_uint16_t gs;
133 vki_uint32_t err;
134 vki_uint16_t es;
135 vki_uint16_t ds;
136 vki_register_t rip;
137 vki_register_t cs;
138 vki_register_t rflags;
139 vki_register_t rsp;
140 vki_register_t ss;
143 struct vki_fpreg {
144 unsigned long fpr_env[4];
145 unsigned char fpr_acc[8][16];
146 unsigned char fpr_xacc[16][16];
147 unsigned long fpr_spare[12];
150 struct vki_dbreg {
151 unsigned long dr[16];
154 typedef vki_register_t vki_elf_greg_t;
155 typedef struct _vki_fpstate vki_elf_fpregset_t;
157 #define VKI_AT_SYSINFO 32
158 #define VKI_ELF_NGREG \
159 (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
161 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
163 struct vki_mcontext {
164 vki_register_t onstack; /* XXX - sigcontext compat. */
165 vki_register_t rdi; /* machine state (struct trapframe) */
166 vki_register_t rsi;
167 vki_register_t rdx;
168 vki_register_t rcx;
169 vki_register_t r8;
170 vki_register_t r9;
171 vki_register_t rax;
172 vki_register_t rbx;
173 vki_register_t rbp;
174 vki_register_t r10;
175 vki_register_t r11;
176 vki_register_t r12;
177 vki_register_t r13;
178 vki_register_t r14;
179 vki_register_t r15;
180 vki_uint32_t trapno;
181 vki_uint16_t fs;
182 vki_uint16_t gs;
183 vki_register_t addr;
184 vki_uint32_t flags;
185 vki_uint16_t es;
186 vki_uint16_t ds;
187 vki_register_t err;
188 vki_register_t rip;
189 vki_register_t cs;
190 vki_register_t rflags;
191 vki_register_t rsp;
192 vki_register_t ss;
194 long len;
195 long fpformat;
196 long ownedfp;
197 struct _vki_fpstate fpstate;// __attribute__((aligned(16)));
198 vki_register_t fsbase;
199 vki_register_t gsbase;
201 vki_register_t xfpustate;
202 vki_register_t xfpustate_len;
204 long spare2[4];
207 #define VKI_FPFMT_NODEV 0x10000
208 #define VKI_FPFMT_XMM 0x10002
210 #define VKI_FPOWNED_NONE 0x20000
211 #define VKI_FPOWNED_FPU 0x20001
212 #define VKI_FPOWNED_PCB 0x20002
214 struct vki_sigaction_base {
215 void (*ksa_handler)(int);
216 int sa_flags;
217 vki_sigset_t sa_mask; /* mask last for extensibility */
219 typedef struct vki_sigaction_base vki_sigaction_toK_t;
220 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
222 //----------------------------------------------------------------------
223 // sys/vdso.h
224 //----------------------------------------------------------------------
225 #define VKI_VDSO_TIMEHANDS_MD \
226 vki_uint32_t th_x86_shift; \
227 vki_uint32_t th_x86_hpet_idx; \
228 vki_uint32_t th_res[6];
230 struct vki_bintime {
231 vki_time_t sec;
232 vki_uint64_t frac;
235 struct vki_vdso_timehands {
236 vki_uint32_t th_algo;
237 vki_uint32_t th_gen;
238 vki_uint64_t th_scale;
239 vki_uint32_t th_offset_count;
240 vki_uint32_t th_counter_mask;
241 struct vki_bintime th_offset;
242 struct vki_bintime th_boottime;
243 VKI_VDSO_TIMEHANDS_MD
247 #endif /* VKI_AMD64_FREEBSD_H */