2 This file is part of Valgrind, a dynamic binary instrumentation
5 Copyright (C) 2000-2005 Julian Seward
7 Copyright (C) 2018-2021 Paul Floyd
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 //----------------------------------------------------------------------
39 //----------------------------------------------------------------------
41 #define _VKI_NSIG_WORDS 4
42 #define _VKI_NSIG_BPW ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
44 #include "vki-machine-types-amd64-freebsd.h"
47 vki_uint32_t sig
[_VKI_NSIG_WORDS
];
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
{
95 long len
; /* sizeof(mcontext_t) */
98 struct _vki_fpstate fpstate
;
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
{
138 vki_register_t rflags
;
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];
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) */
190 vki_register_t rflags
;
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
;
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);
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 //----------------------------------------------------------------------
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];
235 struct vki_vdso_timehands
{
236 vki_uint32_t th_algo
;
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 */