Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 10:25:34

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- x86/FreeBSD-specific kernel interface.     vki-x86-freebsd.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2000-2005 Julian Seward
0011       jseward@acm.org
0012    Copyright (C) 2009 Stanislav Sedov
0013       <stas@FreeBSD.org>
0014    Copyright (C) 2018-2021 Paul Floyd
0015       pjfloyd@wanadoo.fr
0016 
0017    This program is free software; you can redistribute it and/or
0018    modify it under the terms of the GNU General Public License as
0019    published by the Free Software Foundation; either version 2 of the
0020    License, or (at your option) any later version.
0021 
0022    This program is distributed in the hope that it will be useful, but
0023    WITHOUT ANY WARRANTY; without even the implied warranty of
0024    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0025    General Public License for more details.
0026 
0027    You should have received a copy of the GNU General Public License
0028    along with this program; if not, see <http://www.gnu.org/licenses/>.
0029 
0030    The GNU General Public License is contained in the file COPYING.
0031 */
0032 
0033 #ifndef VKI_X86_FREEBSD_H
0034 #define VKI_X86_FREEBSD_H
0035 
0036 //----------------------------------------------------------------------
0037 // From somewhere
0038 //----------------------------------------------------------------------
0039 
0040 /* PAGE_SHIFT determines the page size */
0041 #define VKI_PAGE_SHIFT  12
0042 #define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
0043 #define VKI_MAX_PAGE_SHIFT      VKI_PAGE_SHIFT
0044 #define VKI_MAX_PAGE_SIZE       VKI_PAGE_SIZE
0045 
0046 //----------------------------------------------------------------------
0047 // From sys/i386/include/_limits.h and sys/sys/_sigset.h
0048 //----------------------------------------------------------------------
0049 
0050 #define  VKI_MINSIGSTKSZ   (512 * 4)
0051 
0052 #define _VKI_NSIG       128
0053 #define _VKI_NSIG_WORDS 4
0054 #define _VKI_NSIG_BPW   ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
0055 
0056 typedef struct {
0057    vki_uint32_t   sig[_VKI_NSIG_WORDS];
0058 } vki_sigset_t;
0059 
0060 
0061 //----------------------------------------------------------------------
0062 // From sys/i386/include/npx.h
0063 //----------------------------------------------------------------------
0064 
0065 struct _vki_env87 {
0066    long  en_cw;
0067    long  en_sw;
0068    long  en_tw;
0069    long  en_fip;
0070    unsigned short en_fcs;
0071    unsigned short en_opcode;
0072    long  en_foo;
0073    long  en_fos;
0074 };
0075 
0076 struct _vki_fpacc87 {
0077    unsigned char fp_bytes[10];
0078 };
0079 
0080 struct _vki_save87 {
0081    struct _vki_env87 sv_env;
0082    struct _vki_fpacc87  sv_ac[8];
0083    unsigned char  sv_pad0[4];
0084    unsigned char  sv_pad[64];
0085 };
0086 
0087 struct _vki_xmmacc {
0088    unsigned char  xmm_bytes[16];
0089 };
0090 
0091 struct _vki_envxmm {
0092    unsigned short en_cw;
0093    unsigned short en_sw;
0094    unsigned short en_tw;
0095    unsigned short en_opcode;
0096    unsigned int   en_fip;
0097    unsigned short en_fcs;
0098    unsigned short en_pad0;
0099    unsigned int   en_foo;
0100    unsigned short en_fos;
0101    unsigned short en_pad1;
0102    unsigned int   en_mxcsr;
0103    unsigned int   en_mxcsr_mask;
0104 };
0105 
0106 struct _vki_savexmm {
0107    struct _vki_envxmm   sv_env;
0108    struct {
0109       struct _vki_fpacc87 fp_acc;
0110       unsigned char  fp_pad[6];
0111    } sv_fp[8];
0112    struct _vki_xmmacc   sv_xmm[8];
0113    unsigned char  sv_pad[224];
0114 };
0115 
0116 struct _vki_fpstate {
0117    union {
0118       struct _vki_save87 sv_87;
0119       struct _vki_savexmm sv_xmm;
0120    };
0121 };
0122 
0123 struct vki_sigcontext {
0124    vki_sigset_t sc_mask;
0125    int   onstack;
0126    int   gs;
0127    int   fs;
0128    int   es;
0129    int   ds;
0130    int   edi;
0131    int   esi;
0132    int   ebp;
0133    int   isp;
0134    int   ebx;
0135    int   edx;
0136    int   ecx;
0137    int   eax;
0138    int   trapno;
0139    int   err;
0140    int   eip;
0141    int   cs;
0142    int   eflags;
0143    int   esp;
0144    int   ss;
0145    int   len;
0146    int   fpformat;
0147    int   ownedfp;
0148    int   spare1[1];
0149    struct _vki_fpstate fpstate __attribute__((aligned(16)));
0150    int   fsbase;
0151    int   gsbase;
0152    int   spare2[6];
0153 };
0154 
0155 struct vki_user_regs_struct {
0156    unsigned int   fs;
0157    unsigned int   es;
0158    unsigned int   ds;
0159    unsigned int   edi;
0160    unsigned int   esi;
0161    unsigned int   ebp;
0162    unsigned int   isp;
0163    unsigned int   ebx;
0164    unsigned int   edx;
0165    unsigned int   ecx;
0166    unsigned int   eax;
0167    unsigned int   trapno;
0168    unsigned int   err;
0169    unsigned int   eip;
0170    unsigned int   cs;
0171    unsigned int   eflags;
0172    unsigned int   esp;
0173    unsigned int   ss;
0174    unsigned int   gs;
0175 };
0176 
0177 struct vki_fpreg {
0178    unsigned long  fpr_env[7];
0179    unsigned char  fpr_acc[8][10];
0180    unsigned long  fpr_ex_sw;
0181    unsigned char  fpr_pad[64];
0182 };
0183 
0184 struct vki_dbreg {
0185    unsigned int  dr[8];
0186 };
0187 
0188 typedef unsigned int vki_elf_greg_t;
0189 typedef struct _vki_fpstate vki_elf_fpregset_t;
0190 typedef struct _vki_fpstate vki_elf_fpxregset_t;
0191 
0192 #define VKI_AT_SYSINFO     32
0193 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
0194 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0195 
0196 #define VKI_FPFMT_NODEV    0x10000
0197 #define VKI_FPFMT_387      0x10001
0198 #define VKI_FPFMT_XMM      0x10002
0199 
0200 #define VKI_FPOWNED_NONE   0x20000
0201 #define VKI_FPOWNED_FPU    0x20001
0202 #define VKI_FPOWNED_PCB    0x20002
0203 
0204 struct vki_mcontext {
0205    int   onstack;
0206    int   gs;
0207    int   fs;
0208    int   es;
0209    int   ds;
0210    int   edi;
0211    int   esi;
0212    int   ebp;
0213    int   isp;
0214    int   ebx;
0215    int   edx;
0216    int   ecx;
0217    int   eax;
0218    int   trapno;
0219    int   err;
0220    int   eip;
0221    int   cs;
0222    int   eflags;
0223    int   esp;
0224    int   ss;
0225 
0226    int   len;
0227    int   fpformat;
0228    int   ownedfp;
0229    int   flags;
0230    struct _vki_fpstate fpstate __attribute__((aligned(16)));
0231    int   fsbase;
0232    int   gsbase;
0233    int xfpustate;
0234    int xfpustate_len;
0235    int   spare2[4];
0236 };
0237 
0238 struct vki_sigaction_base {
0239    void    (*ksa_handler)(int);
0240    int          sa_flags;
0241    vki_sigset_t sa_mask;           /* mask last for extensibility */
0242 };
0243 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0244 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0245 
0246 //----------------------------------------------------------------------
0247 // sys/vdso.h
0248 //----------------------------------------------------------------------
0249 #define VKI_VDSO_TIMEHANDS_MD                       \
0250         vki_uint32_t        th_x86_shift;           \
0251         vki_uint32_t        th_x86_hpet_idx;        \
0252         vki_uint32_t        th_res[6];
0253 
0254 struct vki_bintime32 {
0255 #if defined(__amd64__)
0256         vki_uint32_t        sec;
0257 #else
0258         vki_uint64_t        sec;
0259 #endif
0260         vki_uint32_t        frac[2];
0261 };
0262 
0263 struct vki_vdso_timehands {
0264         vki_uint32_t        th_algo;
0265         vki_uint32_t        th_gen;
0266         vki_uint32_t        th_scale[2];
0267         vki_uint32_t        th_offset_count;
0268         vki_uint32_t        th_counter_mask;
0269         struct vki_bintime32        th_offset;
0270         struct vki_bintime32        th_boottime;
0271         VKI_VDSO_TIMEHANDS_MD
0272 };
0273 
0274 
0275 
0276 #endif // VKI_X86_FREEBSD_H
0277 
0278 /*--------------------------------------------------------------------*/
0279 /*--- end                                                          ---*/
0280 /*--------------------------------------------------------------------*/