Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- ARM64/Linux-specific kernel interface.     vki-arm64-linux.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2013-2017 OpenWorks
0011       info@open-works.net
0012 
0013    This program is free software; you can redistribute it and/or
0014    modify it under the terms of the GNU General Public License as
0015    published by the Free Software Foundation; either version 2 of the
0016    License, or (at your option) any later version.
0017 
0018    This program is distributed in the hope that it will be useful, but
0019    WITHOUT ANY WARRANTY; without even the implied warranty of
0020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0021    General Public License for more details.
0022 
0023    You should have received a copy of the GNU General Public License
0024    along with this program; if not, see <http://www.gnu.org/licenses/>.
0025 
0026    The GNU General Public License is contained in the file COPYING.
0027 */
0028 
0029 #ifndef __VKI_ARM64_LINUX_H
0030 #define __VKI_ARM64_LINUX_H
0031 
0032 // ARM64 is little-endian.
0033 #define VKI_LITTLE_ENDIAN  1
0034 
0035 //----------------------------------------------------------------------
0036 // From linux-3.9.9/include/uapi/asm-generic/int-ll64.h
0037 //----------------------------------------------------------------------
0038 
0039 typedef unsigned char __vki_u8;
0040 
0041 typedef __signed__ short __vki_s16;
0042 typedef unsigned short __vki_u16;
0043 
0044 typedef __signed__ int __vki_s32;
0045 typedef unsigned int __vki_u32;
0046 
0047 typedef __signed__ long long __vki_s64;
0048 typedef unsigned long long __vki_u64;
0049 
0050 typedef unsigned short vki_u16;
0051 
0052 typedef unsigned int vki_u32;
0053 
0054 //----------------------------------------------------------------------
0055 // From linux-3.9.9/arch/arm64/include/asm/page.h
0056 //----------------------------------------------------------------------
0057 
0058 /* Looks like arm64 can do both 4k and 64k pages, so we
0059    use the at-startup detection scheme that ppc32/64 do. */
0060 extern UWord VKI_PAGE_SHIFT;
0061 extern UWord VKI_PAGE_SIZE;
0062 #define VKI_MAX_PAGE_SHIFT  16
0063 #define VKI_MAX_PAGE_SIZE   (1UL << VKI_MAX_PAGE_SHIFT)
0064 
0065 //----------------------------------------------------------------------
0066 // From linux-3.10.5/arch/arm64/include/asm/shmparam.h
0067 //----------------------------------------------------------------------
0068 
0069 // Trying to make sense of this .. it seems as if, for doing
0070 // shared memory with 64 bit processes, VKI_PAGE_SIZE is good
0071 // enough.  But if sharing with a 32 bit process then we need
0072 // the old-style 16k value (4 * VKI_PAGE_SIZE) to be safe.
0073 // (From reading between the lines of arch/arm64/include/asm/shmparam.h)
0074 #define VKI_SHMLBA  (4 * VKI_PAGE_SIZE)
0075 
0076 //----------------------------------------------------------------------
0077 // From linux-3.10.5/include/uapi/asm-generic/signal.h
0078 //----------------------------------------------------------------------
0079 
0080 #define _VKI_NSIG   64
0081 #define _VKI_NSIG_BPW   64
0082 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
0083 
0084 typedef unsigned long vki_old_sigset_t;
0085 
0086 typedef struct {
0087     unsigned long sig[_VKI_NSIG_WORDS];
0088 } vki_sigset_t;
0089 
0090 #define VKI_SIGHUP       1
0091 #define VKI_SIGINT       2
0092 #define VKI_SIGQUIT      3
0093 #define VKI_SIGILL       4
0094 #define VKI_SIGTRAP      5
0095 #define VKI_SIGABRT      6
0096 #define VKI_SIGBUS       7
0097 #define VKI_SIGFPE       8
0098 #define VKI_SIGKILL      9
0099 #define VKI_SIGUSR1     10
0100 #define VKI_SIGSEGV     11
0101 #define VKI_SIGUSR2     12
0102 #define VKI_SIGPIPE     13
0103 #define VKI_SIGALRM     14
0104 #define VKI_SIGTERM     15
0105 #define VKI_SIGSTKFLT       16
0106 #define VKI_SIGCHLD     17
0107 #define VKI_SIGCONT     18
0108 #define VKI_SIGSTOP     19
0109 #define VKI_SIGTSTP     20
0110 #define VKI_SIGTTIN     21
0111 #define VKI_SIGTTOU     22
0112 #define VKI_SIGURG      23
0113 #define VKI_SIGXCPU     24
0114 #define VKI_SIGXFSZ     25
0115 #define VKI_SIGVTALRM       26
0116 #define VKI_SIGPROF     27
0117 #define VKI_SIGWINCH        28
0118 #define VKI_SIGIO       29
0119 #define VKI_SIGPWR      30
0120 #define VKI_SIGSYS      31
0121 #define VKI_SIGUNUSED       31
0122 
0123 #define VKI_SIGRTMIN        32
0124 #define VKI_SIGRTMAX        _VKI_NSIG
0125 
0126 #define VKI_SA_NOCLDSTOP    0x00000001
0127 #define VKI_SA_NOCLDWAIT    0x00000002
0128 #define VKI_SA_SIGINFO      0x00000004
0129 #define VKI_SA_ONSTACK      0x08000000
0130 #define VKI_SA_RESTART      0x10000000
0131 #define VKI_SA_NODEFER      0x40000000
0132 #define VKI_SA_RESETHAND    0x80000000
0133 
0134 #define VKI_SA_NOMASK   VKI_SA_NODEFER
0135 #define VKI_SA_ONESHOT  VKI_SA_RESETHAND
0136 
0137 // This is obsolete and should not be defined for new archs
0138 #define VKI_SA_RESTORER 0x04000000
0139 
0140 #define VKI_SS_ONSTACK  1
0141 #define VKI_SS_DISABLE  2
0142 
0143 #define VKI_MINSIGSTKSZ 2048
0144 
0145 #define VKI_SIG_BLOCK          0    /* for blocking signals */
0146 #define VKI_SIG_UNBLOCK        1    /* for unblocking signals */
0147 #define VKI_SIG_SETMASK        2    /* for setting the signal mask */
0148 
0149 typedef void __vki_signalfn_t(int);
0150 typedef __vki_signalfn_t __user *__vki_sighandler_t;
0151 
0152 typedef void __vki_restorefn_t(void);
0153 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
0154 
0155 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
0156 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
0157 
0158 struct vki_sigaction_base {
0159         // [[Nb: a 'k' prefix is added to "sa_handler" because
0160         // bits/sigaction.h (which gets dragged in somehow via signal.h)
0161         // #defines it as something else.  Since that is done for glibc's
0162         // purposes, which we don't care about here, we use our own name.]]
0163     __vki_sighandler_t ksa_handler;
0164     unsigned long sa_flags;
0165         __vki_sigrestore_t sa_restorer; // I don't think arm64 has this
0166     vki_sigset_t sa_mask;       /* mask last for extensibility */
0167 };
0168 
0169 /* On Linux we use the same type for passing sigactions to
0170    and from the kernel.  Hence: */
0171 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0172 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0173 
0174 
0175 typedef struct vki_sigaltstack {
0176     void __user *ss_sp;
0177     int ss_flags;
0178     vki_size_t ss_size;
0179 } vki_stack_t;
0180 
0181 //----------------------------------------------------------------------
0182 // From linux-3.10.5/arch/arm64/include/uapi/asm/sigcontext.h
0183 //----------------------------------------------------------------------
0184 
0185 struct vki_sigcontext {
0186         __vki_u64 fault_address;
0187         /* AArch64 registers */
0188         __vki_u64 regs[31];
0189         __vki_u64 sp;
0190         __vki_u64 pc;
0191         __vki_u64 pstate;
0192         /* 4K reserved for FP/SIMD state and future expansion */
0193         __vki_u8 __reserved[4096] __attribute__((__aligned__(16)));
0194 };
0195 
0196 //----------------------------------------------------------------------
0197 // From linux-5.0.0/arch/arm64/include/uapi/asm/siginfo.h
0198 //----------------------------------------------------------------------
0199 
0200 #define __VKI_ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
0201 
0202 //----------------------------------------------------------------------
0203 // From linux-3.10.5/uapi/include/asm-generic/mman-common.h
0204 //----------------------------------------------------------------------
0205 
0206 #define VKI_PROT_READ   0x1     /* page can be read */
0207 #define VKI_PROT_WRITE  0x2     /* page can be written */
0208 #define VKI_PROT_EXEC   0x4     /* page can be executed */
0209 #define VKI_PROT_NONE   0x0     /* page can not be accessed */
0210 #define VKI_PROT_GROWSDOWN  0x01000000  /* mprotect flag: extend change to start of growsdown vma */
0211 #define VKI_PROT_GROWSUP    0x02000000  /* mprotect flag: extend change to end of growsup vma */
0212 
0213 #define VKI_MAP_SHARED  0x01        /* Share changes */
0214 #define VKI_MAP_PRIVATE 0x02        /* Changes are private */
0215 #define VKI_MAP_FIXED   0x10        /* Interpret addr exactly */
0216 #define VKI_MAP_ANONYMOUS   0x20    /* don't use a file */
0217 #define VKI_MAP_NORESERVE       0x4000  /* don't check for reservations */
0218 
0219 //----------------------------------------------------------------------
0220 // From linux-3.10.5/uapi/include/asm-generic/fcntl.h
0221 //----------------------------------------------------------------------
0222 
0223 #define VKI_O_ACCMODE        03
0224 #define VKI_O_RDONLY         00
0225 #define VKI_O_WRONLY         01
0226 #define VKI_O_RDWR       02
0227 #define VKI_O_CREAT    0100 /* not fcntl */
0228 #define VKI_O_EXCL     0200 /* not fcntl */
0229 #define VKI_O_TRUNC   01000 /* not fcntl */
0230 #define VKI_O_APPEND      02000
0231 #define VKI_O_NONBLOCK    04000
0232 #define VKI_O_LARGEFILE 0100000
0233 
0234 #define VKI_AT_FDCWD            -100
0235 
0236 #define VKI_F_DUPFD     0   /* dup */
0237 #define VKI_F_GETFD     1   /* get close_on_exec */
0238 #define VKI_F_SETFD     2   /* set/clear close_on_exec */
0239 #define VKI_F_GETFL     3   /* get file->f_flags */
0240 #define VKI_F_SETFL     4   /* set file->f_flags */
0241 #define VKI_F_GETLK     5
0242 #define VKI_F_SETLK     6
0243 #define VKI_F_SETLKW        7
0244 
0245 #define VKI_F_SETOWN        8   /*  for sockets. */
0246 #define VKI_F_GETOWN        9   /*  for sockets. */
0247 #define VKI_F_SETSIG        10  /*  for sockets. */
0248 #define VKI_F_GETSIG        11  /*  for sockets. */
0249 
0250 #define VKI_F_SETOWN_EX     15
0251 #define VKI_F_GETOWN_EX     16
0252 
0253 #define VKI_F_OFD_GETLK     36
0254 #define VKI_F_OFD_SETLK     37
0255 #define VKI_F_OFD_SETLKW    38
0256 
0257 #define VKI_F_OWNER_TID     0
0258 #define VKI_F_OWNER_PID     1
0259 #define VKI_F_OWNER_PGRP    2
0260 
0261 struct vki_f_owner_ex {
0262     int type;
0263     __vki_kernel_pid_t  pid;
0264 };
0265 
0266 #define VKI_FD_CLOEXEC  1   /* actually anything with low bit set goes */
0267 
0268 #define VKI_F_LINUX_SPECIFIC_BASE   1024
0269 
0270 //----------------------------------------------------------------------
0271 // From linux-3.10.5/include/uapi/asm-generic/resource.h
0272 //----------------------------------------------------------------------
0273 
0274 #define VKI_RLIMIT_DATA     2   /* max data size */
0275 #define VKI_RLIMIT_STACK    3   /* max stack size */
0276 #define VKI_RLIMIT_CORE     4   /* max core file size */
0277 #define VKI_RLIMIT_NOFILE   7   /* max number of open files */
0278 
0279 //----------------------------------------------------------------------
0280 // From linux-3.10.5/include/uapi/asm-generic/socket.h
0281 //----------------------------------------------------------------------
0282 
0283 #define VKI_SOL_SOCKET  1
0284 
0285 #define VKI_SO_TYPE 3
0286 
0287 #define VKI_SO_ATTACH_FILTER    26
0288 
0289 //----------------------------------------------------------------------
0290 // From linux-3.10.5/include/uapi/asm-generic/sockios.h
0291 //----------------------------------------------------------------------
0292 
0293 #define VKI_SIOCSPGRP       0x8902
0294 #define VKI_SIOCGPGRP       0x8904
0295 #define VKI_SIOCATMARK      0x8905
0296 #define VKI_SIOCGSTAMP      0x8906      /* Get stamp (timeval) */
0297 #define VKI_SIOCGSTAMPNS    0x8907      /* Get stamp (timespec) */
0298 
0299 //----------------------------------------------------------------------
0300 // From linux-3.10.5/include/uapi/asm-generic/stat.h
0301 //----------------------------------------------------------------------
0302 
0303 struct vki_stat {
0304         unsigned long   st_dev;
0305         unsigned long   st_ino;
0306         unsigned int    st_mode;
0307         unsigned int    st_nlink;
0308         unsigned int    st_uid;
0309         unsigned int    st_gid;
0310         unsigned long   st_rdev;
0311         unsigned long   __pad1;
0312         long            st_size;
0313         int             st_blksize;
0314         int             __pad2;
0315         long            st_blocks;
0316         long            st_atime;
0317         unsigned long   st_atime_nsec;
0318         long            st_mtime;
0319         unsigned long   st_mtime_nsec;
0320         long            st_ctime;
0321         unsigned long   st_ctime_nsec;
0322         unsigned int    __unused4;
0323         unsigned int    __unused5;
0324 };
0325 
0326 //----------------------------------------------------------------------
0327 // From linux-3.10.5/include/uapi/asm-generic/statfs.h
0328 //----------------------------------------------------------------------
0329 
0330 struct vki_statfs {
0331     long f_type;
0332     long f_bsize;
0333     long f_blocks;
0334     long f_bfree;
0335     long f_bavail;
0336     long f_files;
0337     long f_ffree;
0338     __vki_kernel_fsid_t f_fsid;
0339     long f_namelen;
0340     long f_frsize;
0341     long f_flags;
0342     long f_spare[4];
0343 };
0344 
0345 //----------------------------------------------------------------------
0346 // From linux-3.10.5/include/uapi/asm-generic/termios.h
0347 //----------------------------------------------------------------------
0348 
0349 struct vki_winsize {
0350     unsigned short ws_row;
0351     unsigned short ws_col;
0352     unsigned short ws_xpixel;
0353     unsigned short ws_ypixel;
0354 };
0355 
0356 #define VKI_NCC 8
0357 struct vki_termio {
0358     unsigned short c_iflag;     /* input mode flags */
0359     unsigned short c_oflag;     /* output mode flags */
0360     unsigned short c_cflag;     /* control mode flags */
0361     unsigned short c_lflag;     /* local mode flags */
0362     unsigned char c_line;       /* line discipline */
0363     unsigned char c_cc[VKI_NCC];    /* control characters */
0364 };
0365 
0366 //----------------------------------------------------------------------
0367 // From linux-3.10.5/include/uapi/asm-generic/termbits.h
0368 //----------------------------------------------------------------------
0369 
0370 typedef unsigned char   vki_cc_t;
0371 typedef unsigned int    vki_tcflag_t;
0372 
0373 #define VKI_NCCS 19
0374 struct vki_termios {
0375     vki_tcflag_t c_iflag;       /* input mode flags */
0376     vki_tcflag_t c_oflag;       /* output mode flags */
0377     vki_tcflag_t c_cflag;       /* control mode flags */
0378     vki_tcflag_t c_lflag;       /* local mode flags */
0379     vki_cc_t c_line;        /* line discipline */
0380     vki_cc_t c_cc[VKI_NCCS];    /* control characters */
0381 };
0382 
0383 //----------------------------------------------------------------------
0384 // From linux-3.9.9/include/uapi/asm-generic/ioctl.h
0385 //----------------------------------------------------------------------
0386 
0387 #define _VKI_IOC_NRBITS     8
0388 #define _VKI_IOC_TYPEBITS   8
0389 #define _VKI_IOC_SIZEBITS   14
0390 #define _VKI_IOC_DIRBITS    2
0391 
0392 #define _VKI_IOC_SIZEMASK   ((1 << _VKI_IOC_SIZEBITS)-1)
0393 #define _VKI_IOC_DIRMASK    ((1 << _VKI_IOC_DIRBITS)-1)
0394 
0395 #define _VKI_IOC_NRSHIFT    0
0396 #define _VKI_IOC_TYPESHIFT  (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0397 #define _VKI_IOC_SIZESHIFT  (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0398 #define _VKI_IOC_DIRSHIFT   (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0399 
0400 #define _VKI_IOC_NONE   0U
0401 #define _VKI_IOC_WRITE  1U
0402 #define _VKI_IOC_READ   2U
0403 
0404 #define _VKI_IOC(dir,type,nr,size) \
0405     (((dir)  << _VKI_IOC_DIRSHIFT) | \
0406      ((type) << _VKI_IOC_TYPESHIFT) | \
0407      ((nr)   << _VKI_IOC_NRSHIFT) | \
0408      ((size) << _VKI_IOC_SIZESHIFT))
0409 
0410 #define _VKI_IO(type,nr)    _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0411 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr),sizeof(size))
0412 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),sizeof(size))
0413 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),sizeof(size))
0414 
0415 #define _VKI_IOC_DIR(nr)        (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0416 #define _VKI_IOC_SIZE(nr)       (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0417 
0418 //----------------------------------------------------------------------
0419 // From linux-3.10.5/include/uapi/asm-generic/ioctls.h
0420 //----------------------------------------------------------------------
0421 
0422 #define VKI_TCGETS  0x5401
0423 #define VKI_TCSETS  0x5402
0424 #define VKI_TCSETSW 0x5403
0425 #define VKI_TCSETSF 0x5404
0426 #define VKI_TCGETA  0x5405
0427 #define VKI_TCSETA  0x5406
0428 #define VKI_TCSETAW 0x5407
0429 #define VKI_TCSETAF 0x5408
0430 #define VKI_TCSBRK  0x5409
0431 #define VKI_TCXONC  0x540A
0432 #define VKI_TCFLSH  0x540B
0433 #define VKI_TIOCSCTTY   0x540E
0434 #define VKI_TIOCGPGRP   0x540F
0435 #define VKI_TIOCSPGRP   0x5410
0436 #define VKI_TIOCOUTQ    0x5411
0437 #define VKI_TIOCGWINSZ  0x5413
0438 #define VKI_TIOCSWINSZ  0x5414
0439 #define VKI_TIOCMGET    0x5415
0440 #define VKI_TIOCMBIS    0x5416
0441 #define VKI_TIOCMBIC    0x5417
0442 #define VKI_TIOCMSET    0x5418
0443 #define VKI_FIONREAD    0x541B
0444 #define VKI_TIOCLINUX   0x541C
0445 #define VKI_FIONBIO 0x5421
0446 #define VKI_TIOCNOTTY   0x5422
0447 #define VKI_TCSBRKP 0x5425
0448 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int)
0449 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)
0450 
0451 #define VKI_FIONCLEX    0x5450
0452 #define VKI_FIOCLEX     0x5451
0453 #define VKI_FIOASYNC    0x5452
0454 #define VKI_TIOCSERGETLSR   0x5459
0455 
0456 #define VKI_TIOCGICOUNT 0x545D
0457 
0458 //----------------------------------------------------------------------
0459 // From linux-3.9.9/include/uapi/asm-generic/poll.h
0460 //----------------------------------------------------------------------
0461 
0462 #define VKI_POLLIN      0x0001
0463 
0464 struct vki_pollfd {
0465     int fd;
0466     short events;
0467     short revents;
0468 };
0469 
0470 //----------------------------------------------------------------------
0471 // From linux-3.10.5/arch/arm64/include/uapi/asm/ptrace.h
0472 //----------------------------------------------------------------------
0473 
0474 //ZZ struct vki_user_i387_struct {
0475 //ZZ    unsigned short  cwd;
0476 //ZZ    unsigned short  swd;
0477 //ZZ    unsigned short  twd; /* Note this is not the same as the 32bit/x87/FSAVE twd */
0478 //ZZ    unsigned short  fop;
0479 //ZZ    __vki_u64   rip;
0480 //ZZ    __vki_u64   rdp;
0481 //ZZ    __vki_u32   mxcsr;
0482 //ZZ    __vki_u32   mxcsr_mask;
0483 //ZZ    __vki_u32   st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
0484 //ZZ    __vki_u32   xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */
0485 //ZZ    __vki_u32   padding[24];
0486 //ZZ };
0487 //ZZ 
0488 //ZZ struct vki_user_regs_struct {
0489 //ZZ    unsigned long r15,r14,r13,r12,rbp,rbx,r11,r10;
0490 //ZZ    unsigned long r9,r8,rax,rcx,rdx,rsi,rdi,orig_rax;
0491 //ZZ    unsigned long rip,cs,eflags;
0492 //ZZ    unsigned long rsp,ss;
0493 //ZZ    unsigned long fs_base, gs_base;
0494 //ZZ    unsigned long ds,es,fs,gs; 
0495 //ZZ }; 
0496 
0497 struct vki_user_pt_regs {
0498         __vki_u64           regs[31];
0499         __vki_u64           sp;
0500         __vki_u64           pc;
0501         __vki_u64           pstate;
0502 };
0503 
0504 /* I think that the new name in the kernel for these is "user_pt_regs"
0505    and the old name is "user_regs_struct".  Unfortunately can't clone
0506    a 'struct' type using 'typedef' and still have a 'struct' type, so
0507    use a blunter instrument instead. */
0508 #define vki_user_regs_struct vki_user_pt_regs
0509 
0510 struct vki_user_fpsimd_state {
0511         __uint128_t     vregs[32];
0512         __vki_u32           fpsr;
0513         __vki_u32           fpcr;
0514 };
0515 
0516 //----------------------------------------------------------------------
0517 // From linux-3.9.9/arch/arm64/include/asm/elf.h
0518 //----------------------------------------------------------------------
0519 
0520 typedef unsigned long vki_elf_greg_t;
0521 
0522 #define VKI_ELF_NGREG (sizeof (struct vki_user_pt_regs) / sizeof(vki_elf_greg_t))
0523 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0524 
0525 typedef struct vki_user_fpsimd_state vki_elf_fpregset_t;
0526 
0527 //----------------------------------------------------------------------
0528 // From linux-3.10.5/arch/arm64/include/asm/ucontext.h
0529 //----------------------------------------------------------------------
0530 
0531 struct vki_ucontext {
0532         unsigned long           uc_flags;
0533         struct vki_ucontext    *uc_link;
0534         vki_stack_t             uc_stack;
0535         vki_sigset_t            uc_sigmask;
0536         /* glibc uses a 1024-bit sigset_t */
0537         __vki_u8                __unused0[1024 / 8 - sizeof(vki_sigset_t)];
0538         /* last for future expansion */
0539         struct vki_sigcontext   uc_mcontext;
0540 };
0541 
0542 //ZZ //----------------------------------------------------------------------
0543 //ZZ // From linux-2.6.9/include/asm-x86_64/segment.h
0544 //ZZ //----------------------------------------------------------------------
0545 //ZZ 
0546 //ZZ #define VKI_GDT_ENTRY_TLS_ENTRIES 3
0547 //ZZ 
0548 //ZZ #define VKI_GDT_ENTRY_TLS_MIN 11
0549 //ZZ #define VKI_GDT_ENTRY_TLS_MAX 13
0550 //ZZ 
0551 //ZZ //----------------------------------------------------------------------
0552 //ZZ // From linux-2.6.11.9/include/asm-x86_64/prctl.h
0553 //ZZ //----------------------------------------------------------------------
0554 //ZZ 
0555 //ZZ #define VKI_ARCH_SET_GS 0x1001
0556 //ZZ #define VKI_ARCH_SET_FS 0x1002
0557 //ZZ #define VKI_ARCH_GET_FS 0x1003
0558 //ZZ #define VKI_ARCH_GET_GS 0x1004
0559 //ZZ 
0560 //ZZ //----------------------------------------------------------------------
0561 //ZZ // From linux-2.6.9/include/asm-x86_64/ldt.h
0562 //ZZ //----------------------------------------------------------------------
0563 //ZZ 
0564 //ZZ // I think this LDT stuff will have to be reinstated for amd64, but I'm not
0565 //ZZ // certain.  (Nb: The sys_arch_prctl seems to have replaced
0566 //ZZ // [gs]et_thread_area syscalls.)
0567 //ZZ //
0568 //ZZ // Note that the type here is very slightly different to the
0569 //ZZ // type for x86 (the final 'lm' field is added);  I'm not sure about the
0570 //ZZ // significance of that... --njn
0571 //ZZ 
0572 //ZZ /* [[Nb: This is the structure passed to the modify_ldt syscall.  Just so as
0573 //ZZ    to confuse and annoy everyone, this is _not_ the same as an
0574 //ZZ    VgLdtEntry and has to be translated into such.  The logic for doing
0575 //ZZ    so, in vg_ldt.c, is copied from the kernel sources.]] */
0576 //ZZ /* Note also that a comment in ldt.h indicates that the below
0577 //ZZ    contains several fields ignored on 64bit, and that modify_ldt
0578 //ZZ    is rather for 32bit. */
0579 //ZZ struct vki_user_desc {
0580 //ZZ    unsigned int  entry_number;
0581 //ZZ    unsigned long base_addr;
0582 //ZZ    unsigned int  limit;
0583 //ZZ    unsigned int  seg_32bit:1;
0584 //ZZ    unsigned int  contents:2;
0585 //ZZ    unsigned int  read_exec_only:1;
0586 //ZZ    unsigned int  limit_in_pages:1;
0587 //ZZ    unsigned int  seg_not_present:1;
0588 //ZZ    unsigned int  useable:1;
0589 //ZZ         unsigned int  lm:1;
0590 //ZZ };
0591 //ZZ 
0592 //ZZ // [[Nb: for our convenience within Valgrind, use a more specific name]]
0593 
0594 typedef char vki_modify_ldt_t;
0595 
0596 //----------------------------------------------------------------------
0597 // From linux-3.10.5/include/asm-generic/ipcbuf.h
0598 //----------------------------------------------------------------------
0599 
0600 struct vki_ipc64_perm
0601 {
0602     __vki_kernel_key_t  key;
0603     __vki_kernel_uid32_t    uid;
0604     __vki_kernel_gid32_t    gid;
0605     __vki_kernel_uid32_t    cuid;
0606     __vki_kernel_gid32_t    cgid;
0607     __vki_kernel_mode_t mode;
0608         unsigned char           __pad1[4 - sizeof(__vki_kernel_mode_t)];
0609     unsigned short      seq;
0610     unsigned short      __pad2;
0611     unsigned long       __unused1;
0612     unsigned long       __unused2;
0613 };
0614 
0615 //----------------------------------------------------------------------
0616 // From linux-3.10.5/include/uapi/asm-generic/sembuf.h
0617 //----------------------------------------------------------------------
0618 
0619 struct vki_semid64_ds {
0620     struct vki_ipc64_perm sem_perm;     /* permissions .. see ipc.h */
0621     __vki_kernel_time_t sem_otime;      /* last semop time */
0622     __vki_kernel_time_t sem_ctime;      /* last change time */
0623     unsigned long   sem_nsems;      /* no. of semaphores in array */
0624     unsigned long   __unused3;
0625     unsigned long   __unused4;
0626 };
0627 
0628 //----------------------------------------------------------------------
0629 // From linux-3.10.5/include/uapi/asm-generic/msgbuf.h
0630 //----------------------------------------------------------------------
0631 
0632 struct vki_msqid64_ds {
0633     struct vki_ipc64_perm msg_perm;
0634     __vki_kernel_time_t msg_stime;  /* last msgsnd time */
0635     __vki_kernel_time_t msg_rtime;  /* last msgrcv time */
0636     __vki_kernel_time_t msg_ctime;  /* last change time */
0637     unsigned long  msg_cbytes;  /* current number of bytes on queue */
0638     unsigned long  msg_qnum;    /* number of messages in queue */
0639     unsigned long  msg_qbytes;  /* max number of bytes on queue */
0640     __vki_kernel_pid_t msg_lspid;   /* pid of last msgsnd */
0641     __vki_kernel_pid_t msg_lrpid;   /* last receive pid */
0642     unsigned long  __unused4;
0643     unsigned long  __unused5;
0644 };
0645 
0646 //----------------------------------------------------------------------
0647 // From linux-3.10.5/include/uapi/asm-generic/shmbuf.h
0648 //----------------------------------------------------------------------
0649 
0650 struct vki_shmid64_ds {
0651     struct vki_ipc64_perm   shm_perm;   /* operation perms */
0652     vki_size_t      shm_segsz;  /* size of segment (bytes) */
0653     __vki_kernel_time_t shm_atime;  /* last attach time */
0654     __vki_kernel_time_t shm_dtime;  /* last detach time */
0655     __vki_kernel_time_t shm_ctime;  /* last change time */
0656     __vki_kernel_pid_t  shm_cpid;   /* pid of creator */
0657     __vki_kernel_pid_t  shm_lpid;   /* pid of last operator */
0658     unsigned long       shm_nattch; /* no. of current attaches */
0659     unsigned long       __unused4;
0660     unsigned long       __unused5;
0661 };
0662 
0663 struct vki_shminfo64 {
0664     unsigned long   shmmax;
0665     unsigned long   shmmin;
0666     unsigned long   shmmni;
0667     unsigned long   shmseg;
0668     unsigned long   shmall;
0669     unsigned long   __unused1;
0670     unsigned long   __unused2;
0671     unsigned long   __unused3;
0672     unsigned long   __unused4;
0673 };
0674 
0675 //----------------------------------------------------------------------
0676 // From linux-3.9.9/arch/arm64/include/asm/ptrace.h
0677 //----------------------------------------------------------------------
0678 
0679 #define VKI_PTRACE_GETREGS            12
0680 #define VKI_PTRACE_SETREGS            13
0681 //#define VKI_PTRACE_GETFPREGS          14
0682 //#define VKI_PTRACE_SETFPREGS          15
0683 
0684 //----------------------------------------------------------------------
0685 // From linux-2.6.8.1/include/asm-generic/errno.h
0686 //----------------------------------------------------------------------
0687 
0688 #define VKI_ENOSYS       38  /* Function not implemented */
0689 #define VKI_EOVERFLOW    75  /* Value too large for defined data type */
0690 
0691 //----------------------------------------------------------------------
0692 // From linux-3.19.0/include/uapi/asm-generic/ioctls.h
0693 //----------------------------------------------------------------------
0694 
0695 #define VKI_TIOCGSERIAL     0x541E
0696 #define VKI_TIOCSSERIAL     0x541F
0697 
0698 //----------------------------------------------------------------------
0699 // From linux-4.17/include/uapi/asm-generic/ioctls.h
0700 //----------------------------------------------------------------------
0701 
0702 #define VKI_HWCAP_FP                (1 << 0)
0703 #define VKI_HWCAP_ASIMD             (1 << 1)
0704 #define VKI_HWCAP_EVTSTRM           (1 << 2)
0705 #define VKI_HWCAP_AES               (1 << 3)
0706 #define VKI_HWCAP_PMULL             (1 << 4)
0707 #define VKI_HWCAP_SHA1              (1 << 5)
0708 #define VKI_HWCAP_SHA2              (1 << 6)
0709 #define VKI_HWCAP_CRC32             (1 << 7)
0710 #define VKI_HWCAP_ATOMICS           (1 << 8)
0711 #define VKI_HWCAP_FPHP              (1 << 9)
0712 #define VKI_HWCAP_ASIMDHP           (1 << 10)
0713 #define VKI_HWCAP_CPUID             (1 << 11)
0714 #define VKI_HWCAP_ASIMDRDM          (1 << 12)
0715 #define VKI_HWCAP_JSCVT             (1 << 13)
0716 #define VKI_HWCAP_FCMA              (1 << 14)
0717 #define VKI_HWCAP_LRCPC             (1 << 15)
0718 #define VKI_HWCAP_DCPOP             (1 << 16)
0719 #define VKI_HWCAP_SHA3              (1 << 17)
0720 #define VKI_HWCAP_SM3               (1 << 18)
0721 #define VKI_HWCAP_SM4               (1 << 19)
0722 #define VKI_HWCAP_ASIMDDP           (1 << 20)
0723 #define VKI_HWCAP_SHA512            (1 << 21)
0724 #define VKI_HWCAP_SVE               (1 << 22)
0725 #define VKI_HWCAP_ASIMDFHM          (1 << 23)
0726 #define VKI_HWCAP_DIT               (1 << 24)
0727 #define VKI_HWCAP_USCAT             (1 << 25)
0728 #define VKI_HWCAP_ILRCPC            (1 << 26)
0729 #define VKI_HWCAP_FLAGM             (1 << 27)
0730 
0731 //----------------------------------------------------------------------
0732 // And that's it!
0733 //----------------------------------------------------------------------
0734  
0735 #endif // __VKI_ARM64_LINUX_H
0736 
0737 /*--------------------------------------------------------------------*/
0738 /*--- end                                                          ---*/
0739 /*--------------------------------------------------------------------*/