Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-15 09:14:17

0001 /*
0002    This file is part of Valgrind, a dynamic binary instrumentation
0003    framework.
0004 
0005    Copyright (C) 2024 Paul Floyd
0006       pjfloyd@wanadoo.fr
0007 
0008    This program is free software; you can redistribute it and/or
0009    modify it under the terms of the GNU General Public License as
0010    published by the Free Software Foundation; either version 2 of the
0011    License, or (at your option) any later version.
0012 
0013    This program is distributed in the hope that it will be useful, but
0014    WITHOUT ANY WARRANTY; without even the implied warranty of
0015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0016    General Public License for more details.
0017 
0018    You should have received a copy of the GNU General Public License
0019    along with this program; if not, see <http://www.gnu.org/licenses/>.
0020 
0021    The GNU General Public License is contained in the file COPYING.
0022 */
0023 
0024 #ifndef VKI_ARM64_FREEBSD_H
0025 #define VKI_ARM64_FREEBSD_H
0026 
0027 //----------------------------------------------------------------------
0028 // arm/param.h
0029 //----------------------------------------------------------------------
0030 
0031 /* PAGE_SHIFT determines the page size. */
0032 #define VKI_PAGE_SHIFT     12UL
0033 #define VKI_PAGE_SIZE      (1UL << VKI_PAGE_SHIFT)
0034 #define VKI_MAX_PAGE_SHIFT VKI_PAGE_SHIFT
0035 #define VKI_MAX_PAGE_SIZE  VKI_PAGE_SIZE
0036 
0037 //----------------------------------------------------------------------
0038 // machine/_limits.h
0039 //----------------------------------------------------------------------
0040 #define VKI_MINSIGSTKSZ (1024 * 4)
0041 
0042 //----------------------------------------------------------------------
0043 // sys/_sigset.h
0044 //----------------------------------------------------------------------
0045 #define _VKI_NSIG_WORDS 4
0046 #define _VKI_NSIG       128
0047 #define _VKI_NSIG_BPW   ((_VKI_NSIG) / (_VKI_NSIG_WORDS))
0048 
0049 #include "vki-machine-types-arm64-freebsd.h"
0050 
0051 typedef struct {
0052    vki_uint32_t sig[_VKI_NSIG_WORDS];
0053 } vki_sigset_t;
0054 
0055 //----------------------------------------------------------------------
0056 // machine/armreg.h
0057 //----------------------------------------------------------------------
0058 
0059 /* mainly for the carry flag, used to signifify syscall success/failure */
0060 #define VKI_PSR_IL    0x00100000UL
0061 #define VKI_PSR_SS    0x00200000UL
0062 #define VKI_PSR_V     0x10000000UL
0063 #define VKI_PSR_C     0x20000000UL
0064 #define VKI_PSR_Z     0x40000000UL
0065 #define VKI_PSR_N     0x80000000UL
0066 #define VKI_PSR_FLAGS 0xf0000000UL
0067 
0068 //----------------------------------------------------------------------
0069 // machine/reg.h
0070 // Used by PTRACE and coredump-elf.h */
0071 //----------------------------------------------------------------------
0072 
0073 struct vki_dbreg {
0074    vki_uint8_t db_debug_ver;
0075    vki_uint8_t db_nbkpts;
0076    vki_uint8_t db_nwtpts;
0077    vki_uint8_t db_pad[5];
0078 
0079    struct {
0080       vki_uint64_t dbr_addr;
0081       vki_uint32_t dbr_ctrl;
0082       vki_uint32_t dbr_pad;
0083    } db_breakregs[16];
0084    struct {
0085       vki_uint64_t dbw_addr;
0086       vki_uint32_t dbw_ctrl;
0087       vki_uint32_t dbw_pad;
0088    } db_watchregs[16];
0089 };
0090 
0091 //----------------------------------------------------------------------
0092 // machine/ucontext.h
0093 //----------------------------------------------------------------------
0094 
0095 /* It's a bit stupid having the struct layout as reg.h struct reg */
0096 struct vki_gpregs {
0097    __vki_register_t gp_x[30];
0098    __vki_register_t gp_lr;
0099    __vki_register_t gp_sp;
0100    __vki_register_t gp_elr;
0101    vki_uint64_t     gp_spsr;
0102 };
0103 
0104 /* coredump-elf.c compatibility */
0105 #define vki_user_regs_struct vki_gpregs
0106 
0107 /* Like Linux */
0108 typedef unsigned long vki_elf_greg_t;
0109 #define VKI_ELF_NGREG (sizeof(struct vki_gpregs) / sizeof(vki_elf_greg_t))
0110 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0111 
0112 struct vki_fpregs {
0113    __uint128_t  fp_q[32];
0114    vki_uint32_t fp_sr;
0115    vki_uint32_t fp_cr;
0116    int          fp_flags;
0117    int          fp_pad;
0118 };
0119 
0120 /* amd64 compatibility */
0121 #define vki_fpreg vki_fpregs
0122 
0123 /* fpregs in FreeBSD headers fpreg */
0124 // #define vki_fpreg vki_fpregs
0125 
0126 // On Linux the equivalent of the above is smaller, without the fp_flags annd
0127 // padding
0128 typedef struct vki_fpregs vki_elf_fpregset_t;
0129 
0130 struct vki_mcontext {
0131    struct vki_gpregs mc_gpregs;
0132    struct vki_fpregs mc_fpregs;
0133    int               mc_flags;
0134 #define _MC_FP_VALID 0x1     /* Set when mc_fpregs has valid data */
0135    int          mc_pad;      /* Padding */
0136    vki_uint64_t mc_spare[8]; /* Space for expansion, set to zero */
0137 };
0138 
0139 struct vki_sigaction_base {
0140    void (*ksa_handler)(int);
0141    int          sa_flags;
0142    vki_sigset_t sa_mask; /* mask last for extensibility */
0143 };
0144 typedef struct vki_sigaction_base vki_sigaction_toK_t;
0145 typedef struct vki_sigaction_base vki_sigaction_fromK_t;
0146 
0147 //----------------------------------------------------------------------
0148 // sys/vdso.h and machine/vdso.h
0149 //----------------------------------------------------------------------
0150 #define VKI_VDSO_TIMEHANDS_MD                                                  \
0151    uint32_t th_physical;                                                       \
0152    uint32_t th_res[7];
0153 
0154 struct vki_bintime {
0155    vki_time_t   sec;
0156    vki_uint64_t frac;
0157 };
0158 
0159 struct vki_vdso_timehands {
0160    vki_uint32_t       th_algo;
0161    vki_uint32_t       th_gen;
0162    vki_uint64_t       th_scale;
0163    vki_uint32_t       th_offset_count;
0164    vki_uint32_t       th_counter_mask;
0165    struct vki_bintime th_offset;
0166    struct vki_bintime th_boottime;
0167    VKI_VDSO_TIMEHANDS_MD
0168 };
0169 
0170 //----------------------------------------------------------------------
0171 // machine/elf.h
0172 //----------------------------------------------------------------------
0173 
0174 #define VKI_HWCAP_FP        0x00000001
0175 #define VKI_HWCAP_ASIMD     0x00000002
0176 #define VKI_HWCAP_EVTSTRM       0x00000004
0177 #define VKI_HWCAP_AES       0x00000008
0178 #define VKI_HWCAP_PMULL     0x00000010
0179 #define VKI_HWCAP_SHA1      0x00000020
0180 #define VKI_HWCAP_SHA2      0x00000040
0181 #define VKI_HWCAP_CRC32     0x00000080
0182 #define VKI_HWCAP_ATOMICS       0x00000100
0183 #define VKI_HWCAP_FPHP      0x00000200
0184 #define VKI_HWCAP_ASIMDHP       0x00000400
0185 #define VKI_HWCAP_CPUID     0x00000800
0186 #define VKI_HWCAP_ASIMDRDM      0x00001000
0187 #define VKI_HWCAP_JSCVT     0x00002000
0188 #define VKI_HWCAP_FCMA      0x00004000
0189 #define VKI_HWCAP_LRCPC     0x00008000
0190 #define VKI_HWCAP_DCPOP     0x00010000
0191 #define VKI_HWCAP_SHA3      0x00020000
0192 #define VKI_HWCAP_SM3       0x00040000
0193 #define VKI_HWCAP_SM4       0x00080000
0194 #define VKI_HWCAP_ASIMDDP       0x00100000
0195 #define VKI_HWCAP_SHA512        0x00200000
0196 #define VKI_HWCAP_SVE       0x00400000
0197 #define VKI_HWCAP_ASIMDFHM      0x00800000
0198 #define VKI_HWCAP_DIT       0x01000000
0199 #define VKI_HWCAP_USCAT     0x02000000
0200 #define VKI_HWCAP_ILRCPC        0x04000000
0201 #define VKI_HWCAP_FLAGM     0x08000000
0202 #define VKI_HWCAP_SSBS      0x10000000
0203 #define VKI_HWCAP_SB        0x20000000
0204 #define VKI_HWCAP_PACA      0x40000000
0205 #define VKI_HWCAP_PACG      0x80000000
0206 
0207 #define VKI_HWCAP2_DCPODP       0x00000001
0208 #define VKI_HWCAP2_SVE2     0x00000002
0209 #define VKI_HWCAP2_SVEAES       0x00000004
0210 #define VKI_HWCAP2_SVEPMULL     0x00000008
0211 #define VKI_HWCAP2_SVEBITPERM   0x00000010
0212 #define VKI_HWCAP2_SVESHA3      0x00000020
0213 #define VKI_HWCAP2_SVESM4       0x00000040
0214 #define VKI_HWCAP2_FLAGM2       0x00000080
0215 #define VKI_HWCAP2_FRINT        0x00000100
0216 #define VKI_HWCAP2_SVEI8MM      0x00000200
0217 #define VKI_HWCAP2_SVEF32MM     0x00000400
0218 #define VKI_HWCAP2_SVEF64MM     0x00000800
0219 #define VKI_HWCAP2_SVEBF16      0x00001000
0220 #define VKI_HWCAP2_I8MM     0x00002000
0221 #define VKI_HWCAP2_BF16     0x00004000
0222 #define VKI_HWCAP2_DGH      0x00008000
0223 #define VKI_HWCAP2_RNG      0x00010000
0224 #define VKI_HWCAP2_BTI      0x00020000
0225 
0226 
0227 #endif /* VKI_ARM64_FREEBSD_H */