Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:13:19

0001 /*
0002    This file is part of Valgrind, a dynamic binary instrumentation
0003    framework.
0004 
0005    Copyright (C) 2000-2005 Julian Seward
0006       jseward@acm.org
0007    Copyright (C) 2018-2021 Paul Floyd
0008       pjfloyd@wanadoo.fr
0009 
0010    This program is free software; you can redistribute it and/or
0011    modify it under the terms of the GNU General Public License as
0012    published by the Free Software Foundation; either version 2 of the
0013    License, or (at your option) any later version.
0014 
0015    This program is distributed in the hope that it will be useful, but
0016    WITHOUT ANY WARRANTY; without even the implied warranty of
0017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0018    General Public License for more details.
0019 
0020    You should have received a copy of the GNU General Public License
0021    along with this program; if not, see <http://www.gnu.org/licenses/>.
0022 
0023    The GNU General Public License is contained in the file COPYING.
0024 */
0025 
0026 #ifndef VKI_AMD64_FREEBSD_H
0027 #define VKI_AMD64_FREEBSD_H
0028 
0029 /* PAGE_SHIFT determines the page size. */
0030 #define VKI_PAGE_SHIFT  12
0031 #define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
0032 #define VKI_MAX_PAGE_SHIFT      VKI_PAGE_SHIFT
0033 #define VKI_MAX_PAGE_SIZE       VKI_PAGE_SIZE
0034 
0035 #define  VKI_MINSIGSTKSZ   2048
0036 
0037 //----------------------------------------------------------------------
0038 // sys/_sigset.h
0039 //----------------------------------------------------------------------
0040 #define  _VKI_NSIG      128
0041 #define  _VKI_NSIG_WORDS      4
0042 #define  _VKI_NSIG_BPW     ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
0043 
0044 #include "vki-machine-types-amd64-freebsd.h"
0045 
0046 typedef struct {
0047    vki_uint32_t   sig[_VKI_NSIG_WORDS];
0048 } vki_sigset_t;
0049 
0050 struct _vki_fpstate {
0051    unsigned short    cwd;
0052    unsigned short swd;
0053    unsigned short twd;
0054    unsigned short fop;
0055    unsigned long  rip;
0056    unsigned long  rdp;
0057    unsigned int   mxcsr;
0058    unsigned int   mxcsr_mask;
0059    unsigned int   st_space[32];  /* 8*16 bytes for each FP-reg */
0060    unsigned int   xmm_space[64]; /* 16*16 bytes for each XMM-reg */
0061    unsigned int   reserved2[24];
0062 };
0063 
0064 struct vki_sigcontext {
0065    vki_sigset_t mask;
0066    long    onstack;
0067    long    rdi;
0068    long    rsi;
0069    long    rdx;
0070    long    rcx;
0071    long    r8;
0072    long    r9;
0073    long    rax;
0074    long    rbx;
0075    long    rbp;
0076    long    r10;
0077    long    r11;
0078    long    r12;
0079    long    r13;
0080    long    r14;
0081    long    r15;
0082    int     trapno;
0083    short   fs;
0084    short   gs;
0085    long    addr;
0086    int     flags;
0087    short   es;
0088    short   ds;
0089    long    err;
0090    long    rip;
0091    long    cs;
0092    long    rflags;
0093    long    rsp;
0094    long    ss;
0095    long    len;                 /* sizeof(mcontext_t) */
0096    long  fpformat;
0097    long  ownedfp;
0098    struct _vki_fpstate fpstate;
0099 
0100    long    fsbase;
0101    long    gsbase;
0102    long    xfpustate;
0103    long    xfpustate_len;
0104 
0105    long    spare[4];
0106 };
0107 
0108 /*
0109  * Retrieved from src/sys/amd64/include/reg.h
0110  * Note that on 8.x trapno and err are no-more meaningful, but we
0111  * don't set them anyway.
0112  */
0113 
0114 struct vki_user_regs_struct {
0115    vki_register_t r15;
0116    vki_register_t r14;
0117    vki_register_t r13;
0118    vki_register_t r12;
0119    vki_register_t r11;
0120    vki_register_t r10;
0121    vki_register_t r9;
0122    vki_register_t r8;
0123    vki_register_t rdi;
0124    vki_register_t rsi;
0125    vki_register_t rbp;
0126    vki_register_t rbx;
0127    vki_register_t rdx;
0128    vki_register_t rcx;
0129    vki_register_t rax;
0130    vki_uint32_t   trapno;
0131    vki_uint16_t   fs;
0132    vki_uint16_t   gs;
0133    vki_uint32_t   err;
0134    vki_uint16_t   es;
0135    vki_uint16_t   ds;
0136    vki_register_t rip;
0137    vki_register_t cs;
0138    vki_register_t rflags;
0139    vki_register_t rsp;
0140    vki_register_t ss;
0141 };
0142 
0143 struct vki_fpreg {
0144    unsigned long  fpr_env[4];
0145    unsigned char  fpr_acc[8][16];
0146    unsigned char  fpr_xacc[16][16];
0147    unsigned long  fpr_spare[12];
0148 };
0149 
0150 struct vki_dbreg {
0151    unsigned long  dr[16];
0152 };
0153 
0154 typedef vki_register_t vki_elf_greg_t;
0155 typedef struct _vki_fpstate vki_elf_fpregset_t;
0156 
0157 #define VKI_AT_SYSINFO     32
0158 #define  VKI_ELF_NGREG                    \
0159    (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
0160 
0161 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0162 
0163 struct vki_mcontext {
0164    vki_register_t onstack; /* XXX - sigcontext compat. */
0165    vki_register_t rdi;     /* machine state (struct trapframe) */
0166    vki_register_t rsi;
0167    vki_register_t rdx;
0168    vki_register_t rcx;
0169    vki_register_t r8;
0170    vki_register_t r9;
0171    vki_register_t rax;
0172    vki_register_t rbx;
0173    vki_register_t rbp;
0174    vki_register_t r10;
0175    vki_register_t r11;
0176    vki_register_t r12;
0177    vki_register_t r13;
0178    vki_register_t r14;
0179    vki_register_t r15;
0180    vki_uint32_t   trapno;
0181    vki_uint16_t   fs;
0182    vki_uint16_t   gs;
0183    vki_register_t addr;
0184    vki_uint32_t   flags;
0185    vki_uint16_t   es;
0186    vki_uint16_t   ds;
0187    vki_register_t err;
0188    vki_register_t rip;
0189    vki_register_t cs;
0190    vki_register_t rflags;
0191    vki_register_t rsp;
0192    vki_register_t ss;
0193 
0194    long     len;
0195    long     fpformat;
0196    long     ownedfp;
0197    struct _vki_fpstate  fpstate;// __attribute__((aligned(16)));
0198    vki_register_t fsbase;
0199    vki_register_t gsbase;
0200 
0201    vki_register_t xfpustate;
0202    vki_register_t xfpustate_len;
0203 
0204    long  spare2[4];
0205 };
0206 
0207 #define VKI_FPFMT_NODEV    0x10000
0208 #define VKI_FPFMT_XMM      0x10002
0209 
0210 #define VKI_FPOWNED_NONE   0x20000
0211 #define VKI_FPOWNED_FPU    0x20001
0212 #define VKI_FPOWNED_PCB    0x20002
0213 
0214 struct vki_sigaction_base {
0215    void    (*ksa_handler)(int);
0216    int          sa_flags;
0217    vki_sigset_t sa_mask;           /* mask last for extensibility */
0218 };
0219 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0220 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0221 
0222 //----------------------------------------------------------------------
0223 // sys/vdso.h
0224 //----------------------------------------------------------------------
0225 #define VKI_VDSO_TIMEHANDS_MD                       \
0226         vki_uint32_t        th_x86_shift;           \
0227         vki_uint32_t        th_x86_hpet_idx;        \
0228         vki_uint32_t        th_res[6];
0229 
0230 struct vki_bintime {
0231         vki_time_t  sec;
0232         vki_uint64_t frac;
0233 };
0234 
0235 struct vki_vdso_timehands {
0236         vki_uint32_t        th_algo;
0237         vki_uint32_t        th_gen;
0238         vki_uint64_t        th_scale;
0239         vki_uint32_t        th_offset_count;
0240         vki_uint32_t        th_counter_mask;
0241         struct vki_bintime  th_offset;
0242         struct vki_bintime  th_boottime;
0243         VKI_VDSO_TIMEHANDS_MD
0244 };
0245 
0246 
0247 #endif /* VKI_AMD64_FREEBSD_H */