Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/valgrind/vki/vki-arm-linux.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- arm/Linux-specific kernel interface.         vki-arm-linux.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2000-2017 Julian Seward 
0011       jseward@acm.org
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_ARM_LINUX_H
0030 #define __VKI_ARM_LINUX_H
0031 
0032 // arm is little-endian.
0033 #define VKI_LITTLE_ENDIAN  1
0034 
0035 // The various comments below indicating i386-ness should be regarded
0036 // with great skepticism -- they are quite possibly wrong.  But see
0037 // also bug 269079 comment 0.
0038 
0039 //----------------------------------------------------------------------
0040 // From linux-2.6.8.1/include/asm-i386/types.h
0041 //----------------------------------------------------------------------
0042 
0043 typedef unsigned char __vki_u8;
0044 
0045 typedef __signed__ short __vki_s16;
0046 typedef unsigned short __vki_u16;
0047 
0048 typedef __signed__ int __vki_s32;
0049 typedef unsigned int __vki_u32;
0050 
0051 typedef __signed__ long long __vki_s64;
0052 typedef unsigned long long __vki_u64;
0053 
0054 typedef unsigned short vki_u16;
0055 
0056 typedef unsigned int vki_u32;
0057 
0058 //----------------------------------------------------------------------
0059 // From linux-2.6.8.1/include/asm-i386/page.h
0060 //----------------------------------------------------------------------
0061 
0062 /* PAGE_SHIFT determines the page size */
0063 #define VKI_PAGE_SHIFT  12
0064 #define VKI_PAGE_SIZE   (1UL << VKI_PAGE_SHIFT)
0065 #define VKI_MAX_PAGE_SHIFT  VKI_PAGE_SHIFT
0066 #define VKI_MAX_PAGE_SIZE   VKI_PAGE_SIZE
0067 
0068 //----------------------------------------------------------------------
0069 // From linux-2.6.35.4/arch/arm/include/asm/shmparam.h
0070 //----------------------------------------------------------------------
0071 
0072 #define VKI_SHMLBA  (4 * VKI_PAGE_SIZE)
0073 
0074 //----------------------------------------------------------------------
0075 // From linux-2.6.8.1/include/asm-i386/signal.h
0076 //----------------------------------------------------------------------
0077 
0078 #define VKI_MINSIGSTKSZ 2048
0079 
0080 #define VKI_SIG_BLOCK          0    /* for blocking signals */
0081 #define VKI_SIG_UNBLOCK        1    /* for unblocking signals */
0082 #define VKI_SIG_SETMASK        2    /* for setting the signal mask */
0083 
0084 /* Type of a signal handler.  */
0085 typedef void __vki_signalfn_t(int);
0086 typedef __vki_signalfn_t __user *__vki_sighandler_t;
0087 
0088 typedef void __vki_restorefn_t(void);
0089 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
0090 
0091 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
0092 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
0093 
0094 #define _VKI_NSIG   64
0095 #define _VKI_NSIG_BPW   32
0096 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
0097 
0098 typedef unsigned long vki_old_sigset_t;     /* at least 32 bits */
0099 
0100 typedef struct {
0101     unsigned long sig[_VKI_NSIG_WORDS];
0102 } vki_sigset_t;
0103 
0104 #define VKI_SIGHUP       1
0105 #define VKI_SIGINT       2
0106 #define VKI_SIGQUIT      3
0107 #define VKI_SIGILL       4
0108 #define VKI_SIGTRAP      5
0109 #define VKI_SIGABRT      6
0110 //#define VKI_SIGIOT         6
0111 #define VKI_SIGBUS       7
0112 #define VKI_SIGFPE       8
0113 #define VKI_SIGKILL      9
0114 #define VKI_SIGUSR1     10
0115 #define VKI_SIGSEGV     11
0116 #define VKI_SIGUSR2     12
0117 #define VKI_SIGPIPE     13
0118 #define VKI_SIGALRM     14
0119 #define VKI_SIGTERM     15
0120 #define VKI_SIGSTKFLT       16
0121 #define VKI_SIGCHLD     17
0122 #define VKI_SIGCONT     18
0123 #define VKI_SIGSTOP     19
0124 #define VKI_SIGTSTP     20
0125 #define VKI_SIGTTIN     21
0126 #define VKI_SIGTTOU     22
0127 #define VKI_SIGURG      23
0128 #define VKI_SIGXCPU     24
0129 #define VKI_SIGXFSZ     25
0130 #define VKI_SIGVTALRM       26
0131 #define VKI_SIGPROF     27
0132 #define VKI_SIGWINCH        28
0133 #define VKI_SIGIO       29
0134 #define VKI_SIGPWR      30
0135 #define VKI_SIGSYS      31
0136 #define VKI_SIGUNUSED       31
0137 
0138 /* These should not be considered constants from userland.  */
0139 #define VKI_SIGRTMIN    32
0140 // [[This was (_NSIG-1) in 2.4.X... not sure if it matters.]]
0141 #define VKI_SIGRTMAX    _VKI_NSIG
0142 
0143 #define VKI_SA_NOCLDSTOP    0x00000001u
0144 #define VKI_SA_NOCLDWAIT    0x00000002u
0145 #define VKI_SA_SIGINFO      0x00000004u
0146 #define VKI_SA_ONSTACK      0x08000000u
0147 #define VKI_SA_RESTART      0x10000000u
0148 #define VKI_SA_NODEFER      0x40000000u
0149 #define VKI_SA_RESETHAND    0x80000000u
0150 
0151 #define VKI_SA_NOMASK       VKI_SA_NODEFER
0152 #define VKI_SA_ONESHOT      VKI_SA_RESETHAND
0153 //#define VKI_SA_INTERRUPT  0x20000000 /* dummy -- ignored */
0154 
0155 #define VKI_SA_RESTORER     0x04000000
0156 
0157 #define VKI_SS_ONSTACK  1
0158 #define VKI_SS_DISABLE  2
0159 
0160 struct vki_old_sigaction {
0161         // [[Nb: a 'k' prefix is added to "sa_handler" because
0162         // bits/sigaction.h (which gets dragged in somehow via signal.h)
0163         // #defines it as something else.  Since that is done for glibc's
0164         // purposes, which we don't care about here, we use our own name.]]
0165         __vki_sighandler_t ksa_handler;
0166         vki_old_sigset_t sa_mask;
0167         unsigned long sa_flags;
0168         __vki_sigrestore_t sa_restorer;
0169 };
0170 
0171 struct vki_sigaction_base {
0172         // [[See comment about extra 'k' above]]
0173     __vki_sighandler_t ksa_handler;
0174     unsigned long sa_flags;
0175     __vki_sigrestore_t sa_restorer;
0176     vki_sigset_t sa_mask;       /* mask last for extensibility */
0177 };
0178 
0179 /* On Linux we use the same type for passing sigactions to
0180    and from the kernel.  Hence: */
0181 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0182 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0183 
0184 
0185 typedef struct vki_sigaltstack {
0186     void __user *ss_sp;
0187     int ss_flags;
0188     vki_size_t ss_size;
0189 } vki_stack_t;
0190 
0191 //----------------------------------------------------------------------
0192 // From linux-2.6.8.1/include/asm-i386/sigcontext.h
0193 //----------------------------------------------------------------------
0194 
0195 struct vki_sigcontext {
0196         unsigned long trap_no;
0197         unsigned long error_code;
0198         unsigned long oldmask;
0199         unsigned long arm_r0;
0200         unsigned long arm_r1;
0201         unsigned long arm_r2;
0202         unsigned long arm_r3;
0203         unsigned long arm_r4;
0204         unsigned long arm_r5;
0205         unsigned long arm_r6;
0206         unsigned long arm_r7;
0207         unsigned long arm_r8;
0208         unsigned long arm_r9;
0209         unsigned long arm_r10;
0210         unsigned long arm_fp;
0211         unsigned long arm_ip;
0212         unsigned long arm_sp;
0213         unsigned long arm_lr;
0214         unsigned long arm_pc;
0215         unsigned long arm_cpsr;
0216         unsigned long fault_address;
0217 };
0218 
0219 //----------------------------------------------------------------------
0220 // From linux-2.6.8.1/include/asm-i386/mman.h
0221 //----------------------------------------------------------------------
0222 
0223 #define VKI_PROT_NONE   0x0     /* No page permissions */
0224 #define VKI_PROT_READ   0x1     /* page can be read */
0225 #define VKI_PROT_WRITE  0x2     /* page can be written */
0226 #define VKI_PROT_EXEC   0x4     /* page can be executed */
0227 #define VKI_PROT_GROWSDOWN  0x01000000  /* mprotect flag: extend change to start of growsdown vma */
0228 #define VKI_PROT_GROWSUP    0x02000000  /* mprotect flag: extend change to end of growsup vma */
0229 
0230 #define VKI_MAP_SHARED  0x01        /* Share changes */
0231 #define VKI_MAP_PRIVATE 0x02        /* Changes are private */
0232 //#define VKI_MAP_TYPE  0x0f        /* Mask for type of mapping */
0233 #define VKI_MAP_FIXED   0x10        /* Interpret addr exactly */
0234 #define VKI_MAP_ANONYMOUS   0x20    /* don't use a file */
0235 #define VKI_MAP_NORESERVE   0x4000      /* don't check for reservations */
0236 
0237 //----------------------------------------------------------------------
0238 // From linux-2.6.8.1/include/asm-i386/fcntl.h
0239 //----------------------------------------------------------------------
0240 
0241 #define VKI_O_ACCMODE        03
0242 #define VKI_O_RDONLY         00
0243 #define VKI_O_WRONLY         01
0244 #define VKI_O_RDWR       02
0245 #define VKI_O_CREAT    0100 /* not fcntl */
0246 #define VKI_O_EXCL     0200 /* not fcntl */
0247 #define VKI_O_TRUNC   01000 /* not fcntl */
0248 #define VKI_O_APPEND      02000
0249 #define VKI_O_NONBLOCK    04000
0250 #define VKI_O_LARGEFILE 0100000
0251 #define VKI_O_DIRECT    0200000
0252 
0253 #define VKI_AT_FDCWD            -100
0254 
0255 #define VKI_F_DUPFD     0   /* dup */
0256 #define VKI_F_GETFD     1   /* get close_on_exec */
0257 #define VKI_F_SETFD     2   /* set/clear close_on_exec */
0258 #define VKI_F_GETFL     3   /* get file->f_flags */
0259 #define VKI_F_SETFL     4   /* set file->f_flags */
0260 #define VKI_F_GETLK     5
0261 #define VKI_F_SETLK     6
0262 #define VKI_F_SETLKW        7
0263 
0264 #define VKI_F_SETOWN        8   /*  for sockets. */
0265 #define VKI_F_GETOWN        9   /*  for sockets. */
0266 #define VKI_F_SETSIG        10  /*  for sockets. */
0267 #define VKI_F_GETSIG        11  /*  for sockets. */
0268 
0269 #define VKI_F_GETLK64       12  /*  using 'struct flock64' */
0270 #define VKI_F_SETLK64       13
0271 #define VKI_F_SETLKW64      14
0272 
0273 #define VKI_F_SETOWN_EX     15
0274 #define VKI_F_GETOWN_EX     16
0275 
0276 #define VKI_F_OFD_GETLK     36
0277 #define VKI_F_OFD_SETLK     37
0278 #define VKI_F_OFD_SETLKW    38
0279 
0280 #define VKI_F_OWNER_TID     0
0281 #define VKI_F_OWNER_PID     1
0282 #define VKI_F_OWNER_PGRP    2
0283 
0284 struct vki_f_owner_ex {
0285     int type;
0286     __vki_kernel_pid_t  pid;
0287 };
0288 
0289 /* for F_[GET|SET]FL */
0290 #define VKI_FD_CLOEXEC  1   /* actually anything with low bit set goes */
0291 
0292 #define VKI_F_LINUX_SPECIFIC_BASE   1024
0293 
0294 //----------------------------------------------------------------------
0295 // From linux-2.6.8.1/include/asm-i386/resource.h
0296 //----------------------------------------------------------------------
0297 
0298 #define VKI_RLIMIT_DATA     2   /* max data size */
0299 #define VKI_RLIMIT_STACK    3   /* max stack size */
0300 #define VKI_RLIMIT_CORE     4   /* max core file size */
0301 #define VKI_RLIMIT_NOFILE   7   /* max number of open files */
0302 
0303 //----------------------------------------------------------------------
0304 // From linux-2.6.8.1/include/asm-i386/socket.h
0305 //----------------------------------------------------------------------
0306 
0307 #define VKI_SOL_SOCKET  1
0308 
0309 #define VKI_SO_TYPE 3
0310 
0311 #define VKI_SO_ATTACH_FILTER    26
0312 
0313 //----------------------------------------------------------------------
0314 // From linux-2.6.8.1/include/asm-i386/sockios.h
0315 //----------------------------------------------------------------------
0316 
0317 #define VKI_SIOCSPGRP           0x8902
0318 #define VKI_SIOCGPGRP           0x8904
0319 #define VKI_SIOCATMARK          0x8905
0320 #define VKI_SIOCGSTAMP          0x8906      /* Get stamp (timeval) */
0321 #define VKI_SIOCGSTAMPNS        0x8907      /* Get stamp (timespec) */
0322 
0323 //----------------------------------------------------------------------
0324 // From linux-2.6.8.1/include/asm-i386/stat.h
0325 //----------------------------------------------------------------------
0326 
0327 struct vki_stat {
0328     unsigned long  st_dev;
0329     unsigned long  st_ino;
0330     unsigned short st_mode;
0331     unsigned short st_nlink;
0332     unsigned short st_uid;
0333     unsigned short st_gid;
0334     unsigned long  st_rdev;
0335     unsigned long  st_size;
0336     unsigned long  st_blksize;
0337     unsigned long  st_blocks;
0338     unsigned long  st_atime;
0339     unsigned long  st_atime_nsec;
0340     unsigned long  st_mtime;
0341     unsigned long  st_mtime_nsec;
0342     unsigned long  st_ctime;
0343     unsigned long  st_ctime_nsec;
0344     unsigned long  __unused4;
0345     unsigned long  __unused5;
0346 };
0347 
0348 struct vki_stat64 {
0349     unsigned long long  st_dev;
0350     unsigned char   __pad0[4];
0351 
0352 #define STAT64_HAS_BROKEN_ST_INO    1
0353     unsigned long   __st_ino;
0354 
0355     unsigned int    st_mode;
0356     unsigned int    st_nlink;
0357 
0358     unsigned long   st_uid;
0359     unsigned long   st_gid;
0360 
0361     unsigned long long  st_rdev;
0362     unsigned char   __pad3[4];
0363 
0364     long long   st_size;
0365     unsigned long   st_blksize;
0366 
0367     unsigned long   st_blocks;  /* Number 512-byte blocks allocated. */
0368     unsigned long   __pad4;     /* future possible st_blocks high bits */
0369 
0370     unsigned long   st_atime;
0371     unsigned long   st_atime_nsec;
0372 
0373     unsigned long   st_mtime;
0374     unsigned int    st_mtime_nsec;
0375 
0376     unsigned long   st_ctime;
0377     unsigned long   st_ctime_nsec;
0378 
0379     unsigned long long  st_ino;
0380 };
0381 
0382 //----------------------------------------------------------------------
0383 // From linux-2.6.8.1/include/asm-i386/statfs.h
0384 //----------------------------------------------------------------------
0385 
0386 // [[Nb: asm-i386/statfs.h just #include asm-generic/statfs.h directly]]
0387 struct vki_statfs {
0388     __vki_u32 f_type;
0389     __vki_u32 f_bsize;
0390     __vki_u32 f_blocks;
0391     __vki_u32 f_bfree;
0392     __vki_u32 f_bavail;
0393     __vki_u32 f_files;
0394     __vki_u32 f_ffree;
0395     __vki_kernel_fsid_t f_fsid;
0396     __vki_u32 f_namelen;
0397     __vki_u32 f_frsize;
0398     __vki_u32 f_spare[5];
0399 };
0400 
0401 //----------------------------------------------------------------------
0402 // From linux-2.6.8.1/include/asm-i386/termios.h
0403 //----------------------------------------------------------------------
0404 
0405 struct vki_winsize {
0406     unsigned short ws_row;
0407     unsigned short ws_col;
0408     unsigned short ws_xpixel;
0409     unsigned short ws_ypixel;
0410 };
0411 
0412 #define VKI_NCC 8
0413 struct vki_termio {
0414     unsigned short c_iflag;     /* input mode flags */
0415     unsigned short c_oflag;     /* output mode flags */
0416     unsigned short c_cflag;     /* control mode flags */
0417     unsigned short c_lflag;     /* local mode flags */
0418     unsigned char c_line;       /* line discipline */
0419     unsigned char c_cc[VKI_NCC];    /* control characters */
0420 };
0421 
0422 
0423 //----------------------------------------------------------------------
0424 // From linux-2.6.8.1/include/asm-i386/termbits.h
0425 //----------------------------------------------------------------------
0426 
0427 typedef unsigned char   vki_cc_t;
0428 typedef unsigned int    vki_tcflag_t;
0429 
0430 #define VKI_NCCS 19
0431 struct vki_termios {
0432     vki_tcflag_t c_iflag;       /* input mode flags */
0433     vki_tcflag_t c_oflag;       /* output mode flags */
0434     vki_tcflag_t c_cflag;       /* control mode flags */
0435     vki_tcflag_t c_lflag;       /* local mode flags */
0436     vki_cc_t c_line;        /* line discipline */
0437     vki_cc_t c_cc[VKI_NCCS];    /* control characters */
0438 };
0439 
0440 //----------------------------------------------------------------------
0441 // From linux-2.6.8.1/include/asm-i386/ioctl.h
0442 //----------------------------------------------------------------------
0443 
0444 #define _VKI_IOC_NRBITS     8
0445 #define _VKI_IOC_TYPEBITS   8
0446 #define _VKI_IOC_SIZEBITS   14
0447 #define _VKI_IOC_DIRBITS    2
0448 
0449 #define _VKI_IOC_NRMASK     ((1 << _VKI_IOC_NRBITS)-1)
0450 #define _VKI_IOC_TYPEMASK   ((1 << _VKI_IOC_TYPEBITS)-1)
0451 #define _VKI_IOC_SIZEMASK   ((1 << _VKI_IOC_SIZEBITS)-1)
0452 #define _VKI_IOC_DIRMASK    ((1 << _VKI_IOC_DIRBITS)-1)
0453 
0454 #define _VKI_IOC_NRSHIFT    0
0455 #define _VKI_IOC_TYPESHIFT  (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0456 #define _VKI_IOC_SIZESHIFT  (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0457 #define _VKI_IOC_DIRSHIFT   (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0458 
0459 #define _VKI_IOC_NONE   0U
0460 #define _VKI_IOC_WRITE  1U
0461 #define _VKI_IOC_READ   2U
0462 
0463 #define _VKI_IOC(dir,type,nr,size) \
0464     (((dir)  << _VKI_IOC_DIRSHIFT) | \
0465      ((type) << _VKI_IOC_TYPESHIFT) | \
0466      ((nr)   << _VKI_IOC_NRSHIFT) | \
0467      ((size) << _VKI_IOC_SIZESHIFT))
0468 
0469 /* used to create numbers */
0470 #define _VKI_IO(type,nr)    _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0471 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0472 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0473 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0474 
0475 /* used to decode ioctl numbers.. */
0476 #define _VKI_IOC_DIR(nr)    (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0477 #define _VKI_IOC_TYPE(nr)   (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
0478 #define _VKI_IOC_NR(nr)     (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
0479 #define _VKI_IOC_SIZE(nr)   (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0480 
0481 //----------------------------------------------------------------------
0482 // From linux-2.6.8.1/include/asm-i386/ioctls.h
0483 //----------------------------------------------------------------------
0484 
0485 #define VKI_TCGETS  0x5401
0486 #define VKI_TCSETS  0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
0487 #define VKI_TCSETSW 0x5403
0488 #define VKI_TCSETSF 0x5404
0489 #define VKI_TCGETA  0x5405
0490 #define VKI_TCSETA  0x5406
0491 #define VKI_TCSETAW 0x5407
0492 #define VKI_TCSETAF 0x5408
0493 #define VKI_TCSBRK  0x5409
0494 #define VKI_TCXONC  0x540A
0495 #define VKI_TCFLSH  0x540B
0496 #define VKI_TIOCSCTTY   0x540E
0497 #define VKI_TIOCGPGRP   0x540F
0498 #define VKI_TIOCSPGRP   0x5410
0499 #define VKI_TIOCOUTQ    0x5411
0500 #define VKI_TIOCGWINSZ  0x5413
0501 #define VKI_TIOCSWINSZ  0x5414
0502 #define VKI_TIOCMGET    0x5415
0503 #define VKI_TIOCMBIS    0x5416
0504 #define VKI_TIOCMBIC    0x5417
0505 #define VKI_TIOCMSET    0x5418
0506 #define VKI_FIONREAD    0x541B
0507 #define VKI_TIOCLINUX   0x541C
0508 #define VKI_FIONBIO 0x5421
0509 #define VKI_TIOCNOTTY   0x5422
0510 #define VKI_TCSBRKP 0x5425  /* Needed for POSIX tcsendbreak() */
0511 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
0512 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)  /* Lock/unlock Pty */
0513 
0514 #define VKI_FIONCLEX    0x5450
0515 #define VKI_FIOCLEX 0x5451
0516 #define VKI_FIOASYNC    0x5452
0517 #define VKI_TIOCSERGETLSR   0x5459 /* Get line status register */
0518 
0519 #define VKI_TIOCGICOUNT 0x545D  /* read serial port inline interrupt counts */
0520 
0521 //----------------------------------------------------------------------
0522 // From linux-2.6.39-rc2/arch/arm/include/asm/ioctls.h
0523 //----------------------------------------------------------------------
0524 
0525 #define VKI_FIOQSIZE 0x545E
0526 
0527 //----------------------------------------------------------------------
0528 // From asm-generic/poll.h
0529 //----------------------------------------------------------------------
0530 
0531 /* These are specified by iBCS2 */
0532 #define VKI_POLLIN      0x0001
0533 
0534 struct vki_pollfd {
0535     int fd;
0536     short events;
0537     short revents;
0538 };
0539 
0540 //----------------------------------------------------------------------
0541 // From linux-2.6.8.1/include/asm-i386/user.h
0542 //----------------------------------------------------------------------
0543 
0544 struct vki_user_fp {
0545     struct vki_fp_reg {
0546         unsigned int sign1:1;
0547         unsigned int unused:15;
0548         unsigned int sign2:1;
0549         unsigned int exponent:14;
0550         unsigned int j:1;
0551         unsigned int mantissa1:31;
0552         unsigned int mantissa0:32;
0553     } fpregs[8];
0554     unsigned int fpsr:32;
0555     unsigned int fpcr:32;
0556     unsigned char ftype[8];
0557     unsigned int init_flag;
0558 };
0559 
0560 struct vki_user_vfp {
0561     unsigned long long fpregs[32];
0562     unsigned long fpscr;
0563 };
0564 
0565 #define VKI_IWMMXT_SIZE 0x98
0566 
0567 struct vki_iwmmxt_struct {
0568     unsigned int save[VKI_IWMMXT_SIZE / sizeof(unsigned int)];
0569 };
0570 
0571 struct vki_crunch_state {
0572     unsigned int    mvdx[16][2];
0573     unsigned int    mvax[4][3];
0574     unsigned int    dspsc[2];
0575 };
0576 
0577 #define VKI_CRUNCH_SIZE sizeof(struct vki_crunch_state)
0578 
0579 struct vki_user_regs_struct {
0580     long uregs[18];
0581 };
0582 #define ARM_cpsr    uregs[16]
0583 #define ARM_pc      uregs[15]
0584 #define ARM_lr      uregs[14]
0585 #define ARM_sp      uregs[13]
0586 #define ARM_ip      uregs[12]
0587 #define ARM_fp      uregs[11]
0588 #define ARM_r10     uregs[10]
0589 #define ARM_r9      uregs[9]
0590 #define ARM_r8      uregs[8]
0591 #define ARM_r7      uregs[7]
0592 #define ARM_r6      uregs[6]
0593 #define ARM_r5      uregs[5]
0594 #define ARM_r4      uregs[4]
0595 #define ARM_r3      uregs[3]
0596 #define ARM_r2      uregs[2]
0597 #define ARM_r1      uregs[1]
0598 #define ARM_r0      uregs[0]
0599 #define ARM_ORIG_r0 uregs[17]
0600 //----------------------------------------------------------------------
0601 // From linux-2.6.8.1/include/asm-i386/elf.h
0602 //----------------------------------------------------------------------
0603 
0604 typedef unsigned long vki_elf_greg_t;
0605 
0606 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
0607 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0608 
0609 typedef struct vki_user_fp vki_elf_fpregset_t;
0610 
0611 #define VKI_AT_SYSINFO      32
0612 
0613 //----------------------------------------------------------------------
0614 // From linux-2.6.8.1/include/asm-i386/ucontext.h
0615 //----------------------------------------------------------------------
0616 
0617 struct vki_ucontext {
0618     unsigned long       uc_flags;
0619     struct vki_ucontext    *uc_link;
0620     vki_stack_t     uc_stack;
0621     struct vki_sigcontext   uc_mcontext;
0622     vki_sigset_t        uc_sigmask; /* mask last for extensibility */
0623     int              __unused0[32 - (sizeof (vki_sigset_t) / sizeof (int))];
0624     unsigned long     uc_regspace[128] __attribute__((__aligned__(8)));
0625 
0626 };
0627 
0628 //----------------------------------------------------------------------
0629 // From linux-2.6.8.1/include/asm-i386/segment.h
0630 //----------------------------------------------------------------------
0631 
0632 #define VKI_GDT_ENTRY_TLS_ENTRIES   3
0633 #define VKI_GDT_ENTRY_TLS_MIN   6
0634 #define VKI_GDT_ENTRY_TLS_MAX   (VKI_GDT_ENTRY_TLS_MIN + VKI_GDT_ENTRY_TLS_ENTRIES - 1)
0635 
0636 //----------------------------------------------------------------------
0637 // From linux-2.6.8.1/include/asm-i386/ldt.h
0638 //----------------------------------------------------------------------
0639 
0640 /* [[Nb: This is the structure passed to the modify_ldt syscall.  Just so as
0641    to confuse and annoy everyone, this is _not_ the same as an
0642    VgLdtEntry and has to be translated into such.  The logic for doing
0643    so, in vg_ldt.c, is copied from the kernel sources.]] */
0644 struct vki_user_desc {
0645     unsigned int  entry_number;
0646     unsigned long base_addr;
0647     unsigned int  limit;
0648     unsigned int  seg_32bit:1;
0649     unsigned int  contents:2;
0650     unsigned int  read_exec_only:1;
0651     unsigned int  limit_in_pages:1;
0652     unsigned int  seg_not_present:1;
0653     unsigned int  useable:1;
0654         // [[Nb: this field is not in the kernel sources, but it has always
0655         // been in the Valgrind sources so I will keep it there in case it's
0656         // important... this is an x86-defined data structure so who
0657         // knows;  maybe it's important to set this field to zero at some
0658         // point.  --njn]]
0659     unsigned int  reserved:25;
0660 };
0661 
0662 // [[Nb: for our convenience within Valgrind, use a more specific name]]
0663 typedef struct vki_user_desc vki_modify_ldt_t;
0664 
0665 //----------------------------------------------------------------------
0666 // From linux-2.6.8.1/include/asm-i386/ipcbuf.h
0667 //----------------------------------------------------------------------
0668 
0669 struct vki_ipc64_perm
0670 {
0671     __vki_kernel_key_t  key;
0672     __vki_kernel_uid32_t    uid;
0673     __vki_kernel_gid32_t    gid;
0674     __vki_kernel_uid32_t    cuid;
0675     __vki_kernel_gid32_t    cgid;
0676     __vki_kernel_mode_t mode;
0677     unsigned short      __pad1;
0678     unsigned short      seq;
0679     unsigned short      __pad2;
0680     unsigned long       __unused1;
0681     unsigned long       __unused2;
0682 };
0683 
0684 //----------------------------------------------------------------------
0685 // From linux-2.6.8.1/include/asm-i386/sembuf.h
0686 //----------------------------------------------------------------------
0687 
0688 struct vki_semid64_ds {
0689     struct vki_ipc64_perm sem_perm;     /* permissions .. see ipc.h */
0690     __vki_kernel_time_t sem_otime;      /* last semop time */
0691     unsigned long   __unused1;
0692     __vki_kernel_time_t sem_ctime;      /* last change time */
0693     unsigned long   __unused2;
0694     unsigned long   sem_nsems;      /* no. of semaphores in array */
0695     unsigned long   __unused3;
0696     unsigned long   __unused4;
0697 };
0698 
0699 //----------------------------------------------------------------------
0700 // From linux-2.6.8.1/include/asm-i386/msgbuf.h
0701 //----------------------------------------------------------------------
0702 
0703 struct vki_msqid64_ds {
0704     struct vki_ipc64_perm msg_perm;
0705     __vki_kernel_time_t msg_stime;  /* last msgsnd time */
0706     unsigned long   __unused1;
0707     __vki_kernel_time_t msg_rtime;  /* last msgrcv time */
0708     unsigned long   __unused2;
0709     __vki_kernel_time_t msg_ctime;  /* last change time */
0710     unsigned long   __unused3;
0711     unsigned long  msg_cbytes;  /* current number of bytes on queue */
0712     unsigned long  msg_qnum;    /* number of messages in queue */
0713     unsigned long  msg_qbytes;  /* max number of bytes on queue */
0714     __vki_kernel_pid_t msg_lspid;   /* pid of last msgsnd */
0715     __vki_kernel_pid_t msg_lrpid;   /* last receive pid */
0716     unsigned long  __unused4;
0717     unsigned long  __unused5;
0718 };
0719 
0720 //----------------------------------------------------------------------
0721 // From linux-2.6.8.1/include/asm-i386/ipc.h
0722 //----------------------------------------------------------------------
0723 
0724 struct vki_ipc_kludge {
0725     struct vki_msgbuf __user *msgp;
0726     long msgtyp;
0727 };
0728 
0729 #define VKI_SEMOP        1
0730 #define VKI_SEMGET       2
0731 #define VKI_SEMCTL       3
0732 #define VKI_SEMTIMEDOP       4
0733 #define VKI_MSGSND      11
0734 #define VKI_MSGRCV      12
0735 #define VKI_MSGGET      13
0736 #define VKI_MSGCTL      14
0737 #define VKI_SHMAT       21
0738 #define VKI_SHMDT       22
0739 #define VKI_SHMGET      23
0740 #define VKI_SHMCTL      24
0741 
0742 //----------------------------------------------------------------------
0743 // From linux-2.6.8.1/include/asm-i386/shmbuf.h
0744 //----------------------------------------------------------------------
0745 
0746 struct vki_shmid64_ds {
0747     struct vki_ipc64_perm   shm_perm;   /* operation perms */
0748     vki_size_t      shm_segsz;  /* size of segment (bytes) */
0749     __vki_kernel_time_t shm_atime;  /* last attach time */
0750     unsigned long       __unused1;
0751     __vki_kernel_time_t shm_dtime;  /* last detach time */
0752     unsigned long       __unused2;
0753     __vki_kernel_time_t shm_ctime;  /* last change time */
0754     unsigned long       __unused3;
0755     __vki_kernel_pid_t  shm_cpid;   /* pid of creator */
0756     __vki_kernel_pid_t  shm_lpid;   /* pid of last operator */
0757     unsigned long       shm_nattch; /* no. of current attaches */
0758     unsigned long       __unused4;
0759     unsigned long       __unused5;
0760 };
0761 
0762 struct vki_shminfo64 {
0763     unsigned long   shmmax;
0764     unsigned long   shmmin;
0765     unsigned long   shmmni;
0766     unsigned long   shmseg;
0767     unsigned long   shmall;
0768     unsigned long   __unused1;
0769     unsigned long   __unused2;
0770     unsigned long   __unused3;
0771     unsigned long   __unused4;
0772 };
0773 
0774 //----------------------------------------------------------------------
0775 // DRM ioctls
0776 //----------------------------------------------------------------------
0777 
0778 // jrs 20050207: where did all this stuff come from?  Is it really
0779 // i386 specific, or should it go into the linux-generic category?
0780 //struct vki_drm_buf_pub {
0781 //  Int       idx;         /**< Index into the master buffer list */
0782 //  Int       total;       /**< Buffer size */
0783 //  Int       used;        /**< Amount of buffer in use (for DMA) */
0784 //  void      __user *address;     /**< Address of buffer */
0785 //};
0786 //
0787 //struct vki_drm_buf_map {
0788 //  Int       count;        /**< Length of the buffer list */
0789 //  void          __user *virtual;  /**< Mmap'd area in user-virtual */
0790 //  struct vki_drm_buf_pub __user *list;    /**< Buffer information */
0791 //};
0792 //
0793 ///* We need to pay attention to this, because it mmaps memory */
0794 //#define VKI_DRM_IOCTL_MAP_BUFS        _VKI_IOWR('d', 0x19, struct vki_drm_buf_map)
0795 
0796 //----------------------------------------------------------------------
0797 // From linux-2.6.9/include/asm-i386/ptrace.h
0798 //----------------------------------------------------------------------
0799 
0800 #define VKI_PTRACE_GETREGS            12
0801 #define VKI_PTRACE_SETREGS            13
0802 #define VKI_PTRACE_GETFPREGS          14
0803 #define VKI_PTRACE_SETFPREGS          15
0804 #define VKI_PTRACE_GETWMMXREGS        18
0805 #define VKI_PTRACE_SETWMMXREGS        19
0806 #define VKI_PTRACE_GET_THREAD_AREA    22
0807 #define VKI_PTRACE_SET_SYSCALL        23
0808 #define VKI_PTRACE_GETCRUNCHREGS      25
0809 #define VKI_PTRACE_SETCRUNCHREGS      26
0810 #define VKI_PTRACE_GETVFPREGS         27
0811 #define VKI_PTRACE_SETVFPREGS         28
0812 #define VKI_PTRACE_GETHBPREGS         29
0813 #define VKI_PTRACE_SETHBPREGS         30
0814 
0815 //----------------------------------------------------------------------
0816 // From linux-2.6.15.4/include/asm-i386/vm86.h
0817 //----------------------------------------------------------------------
0818 
0819 #define VKI_VM86_PLUS_INSTALL_CHECK 0
0820 #define VKI_VM86_ENTER          1
0821 #define VKI_VM86_ENTER_NO_BYPASS    2
0822 #define VKI_VM86_REQUEST_IRQ        3
0823 #define VKI_VM86_FREE_IRQ       4
0824 #define VKI_VM86_GET_IRQ_BITS       5
0825 #define VKI_VM86_GET_AND_RESET_IRQ  6
0826 
0827 struct vki_vm86_regs {
0828 /*
0829  * normal regs, with special meaning for the segment descriptors..
0830  */
0831     long ebx;
0832     long ecx;
0833     long edx;
0834     long esi;
0835     long edi;
0836     long ebp;
0837     long eax;
0838     long __null_ds;
0839     long __null_es;
0840     long __null_fs;
0841     long __null_gs;
0842     long orig_eax;
0843     long eip;
0844     unsigned short cs, __csh;
0845     long eflags;
0846     long esp;
0847     unsigned short ss, __ssh;
0848 /*
0849  * these are specific to v86 mode:
0850  */
0851     unsigned short es, __esh;
0852     unsigned short ds, __dsh;
0853     unsigned short fs, __fsh;
0854     unsigned short gs, __gsh;
0855 };
0856 
0857 struct vki_revectored_struct {
0858     unsigned long __map[8];         /* 256 bits */
0859 };
0860 
0861 struct vki_vm86_struct {
0862     struct vki_vm86_regs regs;
0863     unsigned long flags;
0864     unsigned long screen_bitmap;
0865     unsigned long cpu_type;
0866     struct vki_revectored_struct int_revectored;
0867     struct vki_revectored_struct int21_revectored;
0868 };
0869 
0870 struct vki_vm86plus_info_struct {
0871     unsigned long force_return_for_pic:1;
0872     unsigned long vm86dbg_active:1;       /* for debugger */
0873     unsigned long vm86dbg_TFpendig:1;     /* for debugger */
0874     unsigned long unused:28;
0875     unsigned long is_vm86pus:1;       /* for vm86 internal use */
0876     unsigned char vm86dbg_intxxtab[32];   /* for debugger */
0877 };
0878 
0879 struct vki_vm86plus_struct {
0880     struct vki_vm86_regs regs;
0881     unsigned long flags;
0882     unsigned long screen_bitmap;
0883     unsigned long cpu_type;
0884     struct vki_revectored_struct int_revectored;
0885     struct vki_revectored_struct int21_revectored;
0886     struct vki_vm86plus_info_struct vm86plus;
0887 };
0888 
0889 //----------------------------------------------------------------------
0890 // From linux-2.6.35.4/arch/arm/include/asm/hwcap.h
0891 //----------------------------------------------------------------------
0892 
0893 #define VKI_HWCAP_NEON      4096
0894 
0895 //----------------------------------------------------------------------
0896 // From linux-2.6.8.1/include/asm-generic/errno.h
0897 //----------------------------------------------------------------------
0898 
0899 #define VKI_ENOSYS       38  /* Function not implemented */
0900 #define VKI_EOVERFLOW    75  /* Value too large for defined data type */
0901 
0902 //----------------------------------------------------------------------
0903 // From linux-3.19.0/include/uapi/asm-generic/ioctls.h
0904 //----------------------------------------------------------------------
0905 
0906 #define VKI_TIOCGSERIAL     0x541E
0907 #define VKI_TIOCSSERIAL     0x541F
0908 
0909 //----------------------------------------------------------------------
0910 // And that's it!
0911 //----------------------------------------------------------------------
0912 
0913 #endif // __VKI_ARM_LINUX_H
0914 
0915 /*--------------------------------------------------------------------*/
0916 /*--- end                                          vki-arm-linux.h ---*/
0917 /*--------------------------------------------------------------------*/