Back to home page

EIC code displayed by LXR

 
 

    


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

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 
0252 #define VKI_AT_FDCWD            -100
0253 
0254 #define VKI_F_DUPFD     0   /* dup */
0255 #define VKI_F_GETFD     1   /* get close_on_exec */
0256 #define VKI_F_SETFD     2   /* set/clear close_on_exec */
0257 #define VKI_F_GETFL     3   /* get file->f_flags */
0258 #define VKI_F_SETFL     4   /* set file->f_flags */
0259 #define VKI_F_GETLK     5
0260 #define VKI_F_SETLK     6
0261 #define VKI_F_SETLKW        7
0262 
0263 #define VKI_F_SETOWN        8   /*  for sockets. */
0264 #define VKI_F_GETOWN        9   /*  for sockets. */
0265 #define VKI_F_SETSIG        10  /*  for sockets. */
0266 #define VKI_F_GETSIG        11  /*  for sockets. */
0267 
0268 #define VKI_F_GETLK64       12  /*  using 'struct flock64' */
0269 #define VKI_F_SETLK64       13
0270 #define VKI_F_SETLKW64      14
0271 
0272 #define VKI_F_SETOWN_EX     15
0273 #define VKI_F_GETOWN_EX     16
0274 
0275 #define VKI_F_OFD_GETLK     36
0276 #define VKI_F_OFD_SETLK     37
0277 #define VKI_F_OFD_SETLKW    38
0278 
0279 #define VKI_F_OWNER_TID     0
0280 #define VKI_F_OWNER_PID     1
0281 #define VKI_F_OWNER_PGRP    2
0282 
0283 struct vki_f_owner_ex {
0284     int type;
0285     __vki_kernel_pid_t  pid;
0286 };
0287 
0288 /* for F_[GET|SET]FL */
0289 #define VKI_FD_CLOEXEC  1   /* actually anything with low bit set goes */
0290 
0291 #define VKI_F_LINUX_SPECIFIC_BASE   1024
0292 
0293 //----------------------------------------------------------------------
0294 // From linux-2.6.8.1/include/asm-i386/resource.h
0295 //----------------------------------------------------------------------
0296 
0297 #define VKI_RLIMIT_DATA     2   /* max data size */
0298 #define VKI_RLIMIT_STACK    3   /* max stack size */
0299 #define VKI_RLIMIT_CORE     4   /* max core file size */
0300 #define VKI_RLIMIT_NOFILE   7   /* max number of open files */
0301 
0302 //----------------------------------------------------------------------
0303 // From linux-2.6.8.1/include/asm-i386/socket.h
0304 //----------------------------------------------------------------------
0305 
0306 #define VKI_SOL_SOCKET  1
0307 
0308 #define VKI_SO_TYPE 3
0309 
0310 #define VKI_SO_ATTACH_FILTER    26
0311 
0312 //----------------------------------------------------------------------
0313 // From linux-2.6.8.1/include/asm-i386/sockios.h
0314 //----------------------------------------------------------------------
0315 
0316 #define VKI_SIOCSPGRP           0x8902
0317 #define VKI_SIOCGPGRP           0x8904
0318 #define VKI_SIOCATMARK          0x8905
0319 #define VKI_SIOCGSTAMP          0x8906      /* Get stamp (timeval) */
0320 #define VKI_SIOCGSTAMPNS        0x8907      /* Get stamp (timespec) */
0321 
0322 //----------------------------------------------------------------------
0323 // From linux-2.6.8.1/include/asm-i386/stat.h
0324 //----------------------------------------------------------------------
0325 
0326 struct vki_stat {
0327     unsigned long  st_dev;
0328     unsigned long  st_ino;
0329     unsigned short st_mode;
0330     unsigned short st_nlink;
0331     unsigned short st_uid;
0332     unsigned short st_gid;
0333     unsigned long  st_rdev;
0334     unsigned long  st_size;
0335     unsigned long  st_blksize;
0336     unsigned long  st_blocks;
0337     unsigned long  st_atime;
0338     unsigned long  st_atime_nsec;
0339     unsigned long  st_mtime;
0340     unsigned long  st_mtime_nsec;
0341     unsigned long  st_ctime;
0342     unsigned long  st_ctime_nsec;
0343     unsigned long  __unused4;
0344     unsigned long  __unused5;
0345 };
0346 
0347 struct vki_stat64 {
0348     unsigned long long  st_dev;
0349     unsigned char   __pad0[4];
0350 
0351 #define STAT64_HAS_BROKEN_ST_INO    1
0352     unsigned long   __st_ino;
0353 
0354     unsigned int    st_mode;
0355     unsigned int    st_nlink;
0356 
0357     unsigned long   st_uid;
0358     unsigned long   st_gid;
0359 
0360     unsigned long long  st_rdev;
0361     unsigned char   __pad3[4];
0362 
0363     long long   st_size;
0364     unsigned long   st_blksize;
0365 
0366     unsigned long   st_blocks;  /* Number 512-byte blocks allocated. */
0367     unsigned long   __pad4;     /* future possible st_blocks high bits */
0368 
0369     unsigned long   st_atime;
0370     unsigned long   st_atime_nsec;
0371 
0372     unsigned long   st_mtime;
0373     unsigned int    st_mtime_nsec;
0374 
0375     unsigned long   st_ctime;
0376     unsigned long   st_ctime_nsec;
0377 
0378     unsigned long long  st_ino;
0379 };
0380 
0381 //----------------------------------------------------------------------
0382 // From linux-2.6.8.1/include/asm-i386/statfs.h
0383 //----------------------------------------------------------------------
0384 
0385 // [[Nb: asm-i386/statfs.h just #include asm-generic/statfs.h directly]]
0386 struct vki_statfs {
0387     __vki_u32 f_type;
0388     __vki_u32 f_bsize;
0389     __vki_u32 f_blocks;
0390     __vki_u32 f_bfree;
0391     __vki_u32 f_bavail;
0392     __vki_u32 f_files;
0393     __vki_u32 f_ffree;
0394     __vki_kernel_fsid_t f_fsid;
0395     __vki_u32 f_namelen;
0396     __vki_u32 f_frsize;
0397     __vki_u32 f_spare[5];
0398 };
0399 
0400 //----------------------------------------------------------------------
0401 // From linux-2.6.8.1/include/asm-i386/termios.h
0402 //----------------------------------------------------------------------
0403 
0404 struct vki_winsize {
0405     unsigned short ws_row;
0406     unsigned short ws_col;
0407     unsigned short ws_xpixel;
0408     unsigned short ws_ypixel;
0409 };
0410 
0411 #define VKI_NCC 8
0412 struct vki_termio {
0413     unsigned short c_iflag;     /* input mode flags */
0414     unsigned short c_oflag;     /* output mode flags */
0415     unsigned short c_cflag;     /* control mode flags */
0416     unsigned short c_lflag;     /* local mode flags */
0417     unsigned char c_line;       /* line discipline */
0418     unsigned char c_cc[VKI_NCC];    /* control characters */
0419 };
0420 
0421 
0422 //----------------------------------------------------------------------
0423 // From linux-2.6.8.1/include/asm-i386/termbits.h
0424 //----------------------------------------------------------------------
0425 
0426 typedef unsigned char   vki_cc_t;
0427 typedef unsigned int    vki_tcflag_t;
0428 
0429 #define VKI_NCCS 19
0430 struct vki_termios {
0431     vki_tcflag_t c_iflag;       /* input mode flags */
0432     vki_tcflag_t c_oflag;       /* output mode flags */
0433     vki_tcflag_t c_cflag;       /* control mode flags */
0434     vki_tcflag_t c_lflag;       /* local mode flags */
0435     vki_cc_t c_line;        /* line discipline */
0436     vki_cc_t c_cc[VKI_NCCS];    /* control characters */
0437 };
0438 
0439 //----------------------------------------------------------------------
0440 // From linux-2.6.8.1/include/asm-i386/ioctl.h
0441 //----------------------------------------------------------------------
0442 
0443 #define _VKI_IOC_NRBITS     8
0444 #define _VKI_IOC_TYPEBITS   8
0445 #define _VKI_IOC_SIZEBITS   14
0446 #define _VKI_IOC_DIRBITS    2
0447 
0448 #define _VKI_IOC_NRMASK     ((1 << _VKI_IOC_NRBITS)-1)
0449 #define _VKI_IOC_TYPEMASK   ((1 << _VKI_IOC_TYPEBITS)-1)
0450 #define _VKI_IOC_SIZEMASK   ((1 << _VKI_IOC_SIZEBITS)-1)
0451 #define _VKI_IOC_DIRMASK    ((1 << _VKI_IOC_DIRBITS)-1)
0452 
0453 #define _VKI_IOC_NRSHIFT    0
0454 #define _VKI_IOC_TYPESHIFT  (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0455 #define _VKI_IOC_SIZESHIFT  (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0456 #define _VKI_IOC_DIRSHIFT   (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0457 
0458 #define _VKI_IOC_NONE   0U
0459 #define _VKI_IOC_WRITE  1U
0460 #define _VKI_IOC_READ   2U
0461 
0462 #define _VKI_IOC(dir,type,nr,size) \
0463     (((dir)  << _VKI_IOC_DIRSHIFT) | \
0464      ((type) << _VKI_IOC_TYPESHIFT) | \
0465      ((nr)   << _VKI_IOC_NRSHIFT) | \
0466      ((size) << _VKI_IOC_SIZESHIFT))
0467 
0468 /* used to create numbers */
0469 #define _VKI_IO(type,nr)    _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0470 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0471 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0472 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0473 
0474 /* used to decode ioctl numbers.. */
0475 #define _VKI_IOC_DIR(nr)    (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0476 #define _VKI_IOC_TYPE(nr)   (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
0477 #define _VKI_IOC_NR(nr)     (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
0478 #define _VKI_IOC_SIZE(nr)   (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0479 
0480 //----------------------------------------------------------------------
0481 // From linux-2.6.8.1/include/asm-i386/ioctls.h
0482 //----------------------------------------------------------------------
0483 
0484 #define VKI_TCGETS  0x5401
0485 #define VKI_TCSETS  0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
0486 #define VKI_TCSETSW 0x5403
0487 #define VKI_TCSETSF 0x5404
0488 #define VKI_TCGETA  0x5405
0489 #define VKI_TCSETA  0x5406
0490 #define VKI_TCSETAW 0x5407
0491 #define VKI_TCSETAF 0x5408
0492 #define VKI_TCSBRK  0x5409
0493 #define VKI_TCXONC  0x540A
0494 #define VKI_TCFLSH  0x540B
0495 #define VKI_TIOCSCTTY   0x540E
0496 #define VKI_TIOCGPGRP   0x540F
0497 #define VKI_TIOCSPGRP   0x5410
0498 #define VKI_TIOCOUTQ    0x5411
0499 #define VKI_TIOCGWINSZ  0x5413
0500 #define VKI_TIOCSWINSZ  0x5414
0501 #define VKI_TIOCMGET    0x5415
0502 #define VKI_TIOCMBIS    0x5416
0503 #define VKI_TIOCMBIC    0x5417
0504 #define VKI_TIOCMSET    0x5418
0505 #define VKI_FIONREAD    0x541B
0506 #define VKI_TIOCLINUX   0x541C
0507 #define VKI_FIONBIO 0x5421
0508 #define VKI_TIOCNOTTY   0x5422
0509 #define VKI_TCSBRKP 0x5425  /* Needed for POSIX tcsendbreak() */
0510 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
0511 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)  /* Lock/unlock Pty */
0512 
0513 #define VKI_FIONCLEX    0x5450
0514 #define VKI_FIOCLEX 0x5451
0515 #define VKI_FIOASYNC    0x5452
0516 #define VKI_TIOCSERGETLSR   0x5459 /* Get line status register */
0517 
0518 #define VKI_TIOCGICOUNT 0x545D  /* read serial port inline interrupt counts */
0519 
0520 //----------------------------------------------------------------------
0521 // From linux-2.6.39-rc2/arch/arm/include/asm/ioctls.h
0522 //----------------------------------------------------------------------
0523 
0524 #define VKI_FIOQSIZE 0x545E
0525 
0526 //----------------------------------------------------------------------
0527 // From asm-generic/poll.h
0528 //----------------------------------------------------------------------
0529 
0530 /* These are specified by iBCS2 */
0531 #define VKI_POLLIN      0x0001
0532 
0533 struct vki_pollfd {
0534     int fd;
0535     short events;
0536     short revents;
0537 };
0538 
0539 //----------------------------------------------------------------------
0540 // From linux-2.6.8.1/include/asm-i386/user.h
0541 //----------------------------------------------------------------------
0542 
0543 struct vki_user_fp {
0544     struct vki_fp_reg {
0545         unsigned int sign1:1;
0546         unsigned int unused:15;
0547         unsigned int sign2:1;
0548         unsigned int exponent:14;
0549         unsigned int j:1;
0550         unsigned int mantissa1:31;
0551         unsigned int mantissa0:32;
0552     } fpregs[8];
0553     unsigned int fpsr:32;
0554     unsigned int fpcr:32;
0555     unsigned char ftype[8];
0556     unsigned int init_flag;
0557 };
0558 
0559 struct vki_user_vfp {
0560     unsigned long long fpregs[32];
0561     unsigned long fpscr;
0562 };
0563 
0564 #define VKI_IWMMXT_SIZE 0x98
0565 
0566 struct vki_iwmmxt_struct {
0567     unsigned int save[VKI_IWMMXT_SIZE / sizeof(unsigned int)];
0568 };
0569 
0570 struct vki_crunch_state {
0571     unsigned int    mvdx[16][2];
0572     unsigned int    mvax[4][3];
0573     unsigned int    dspsc[2];
0574 };
0575 
0576 #define VKI_CRUNCH_SIZE sizeof(struct vki_crunch_state)
0577 
0578 struct vki_user_regs_struct {
0579     long uregs[18];
0580 };
0581 #define ARM_cpsr    uregs[16]
0582 #define ARM_pc      uregs[15]
0583 #define ARM_lr      uregs[14]
0584 #define ARM_sp      uregs[13]
0585 #define ARM_ip      uregs[12]
0586 #define ARM_fp      uregs[11]
0587 #define ARM_r10     uregs[10]
0588 #define ARM_r9      uregs[9]
0589 #define ARM_r8      uregs[8]
0590 #define ARM_r7      uregs[7]
0591 #define ARM_r6      uregs[6]
0592 #define ARM_r5      uregs[5]
0593 #define ARM_r4      uregs[4]
0594 #define ARM_r3      uregs[3]
0595 #define ARM_r2      uregs[2]
0596 #define ARM_r1      uregs[1]
0597 #define ARM_r0      uregs[0]
0598 #define ARM_ORIG_r0 uregs[17]
0599 //----------------------------------------------------------------------
0600 // From linux-2.6.8.1/include/asm-i386/elf.h
0601 //----------------------------------------------------------------------
0602 
0603 typedef unsigned long vki_elf_greg_t;
0604 
0605 #define VKI_ELF_NGREG (sizeof (struct vki_user_regs_struct) / sizeof(vki_elf_greg_t))
0606 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0607 
0608 typedef struct vki_user_fp vki_elf_fpregset_t;
0609 
0610 #define VKI_AT_SYSINFO      32
0611 
0612 //----------------------------------------------------------------------
0613 // From linux-2.6.8.1/include/asm-i386/ucontext.h
0614 //----------------------------------------------------------------------
0615 
0616 struct vki_ucontext {
0617     unsigned long       uc_flags;
0618     struct vki_ucontext    *uc_link;
0619     vki_stack_t     uc_stack;
0620     struct vki_sigcontext   uc_mcontext;
0621     vki_sigset_t        uc_sigmask; /* mask last for extensibility */
0622     int              __unused0[32 - (sizeof (vki_sigset_t) / sizeof (int))];
0623     unsigned long     uc_regspace[128] __attribute__((__aligned__(8)));
0624 
0625 };
0626 
0627 //----------------------------------------------------------------------
0628 // From linux-2.6.8.1/include/asm-i386/segment.h
0629 //----------------------------------------------------------------------
0630 
0631 #define VKI_GDT_ENTRY_TLS_ENTRIES   3
0632 #define VKI_GDT_ENTRY_TLS_MIN   6
0633 #define VKI_GDT_ENTRY_TLS_MAX   (VKI_GDT_ENTRY_TLS_MIN + VKI_GDT_ENTRY_TLS_ENTRIES - 1)
0634 
0635 //----------------------------------------------------------------------
0636 // From linux-2.6.8.1/include/asm-i386/ldt.h
0637 //----------------------------------------------------------------------
0638 
0639 /* [[Nb: This is the structure passed to the modify_ldt syscall.  Just so as
0640    to confuse and annoy everyone, this is _not_ the same as an
0641    VgLdtEntry and has to be translated into such.  The logic for doing
0642    so, in vg_ldt.c, is copied from the kernel sources.]] */
0643 struct vki_user_desc {
0644     unsigned int  entry_number;
0645     unsigned long base_addr;
0646     unsigned int  limit;
0647     unsigned int  seg_32bit:1;
0648     unsigned int  contents:2;
0649     unsigned int  read_exec_only:1;
0650     unsigned int  limit_in_pages:1;
0651     unsigned int  seg_not_present:1;
0652     unsigned int  useable:1;
0653         // [[Nb: this field is not in the kernel sources, but it has always
0654         // been in the Valgrind sources so I will keep it there in case it's
0655         // important... this is an x86-defined data structure so who
0656         // knows;  maybe it's important to set this field to zero at some
0657         // point.  --njn]]
0658     unsigned int  reserved:25;
0659 };
0660 
0661 // [[Nb: for our convenience within Valgrind, use a more specific name]]
0662 typedef struct vki_user_desc vki_modify_ldt_t;
0663 
0664 //----------------------------------------------------------------------
0665 // From linux-2.6.8.1/include/asm-i386/ipcbuf.h
0666 //----------------------------------------------------------------------
0667 
0668 struct vki_ipc64_perm
0669 {
0670     __vki_kernel_key_t  key;
0671     __vki_kernel_uid32_t    uid;
0672     __vki_kernel_gid32_t    gid;
0673     __vki_kernel_uid32_t    cuid;
0674     __vki_kernel_gid32_t    cgid;
0675     __vki_kernel_mode_t mode;
0676     unsigned short      __pad1;
0677     unsigned short      seq;
0678     unsigned short      __pad2;
0679     unsigned long       __unused1;
0680     unsigned long       __unused2;
0681 };
0682 
0683 //----------------------------------------------------------------------
0684 // From linux-2.6.8.1/include/asm-i386/sembuf.h
0685 //----------------------------------------------------------------------
0686 
0687 struct vki_semid64_ds {
0688     struct vki_ipc64_perm sem_perm;     /* permissions .. see ipc.h */
0689     __vki_kernel_time_t sem_otime;      /* last semop time */
0690     unsigned long   __unused1;
0691     __vki_kernel_time_t sem_ctime;      /* last change time */
0692     unsigned long   __unused2;
0693     unsigned long   sem_nsems;      /* no. of semaphores in array */
0694     unsigned long   __unused3;
0695     unsigned long   __unused4;
0696 };
0697 
0698 //----------------------------------------------------------------------
0699 // From linux-2.6.8.1/include/asm-i386/msgbuf.h
0700 //----------------------------------------------------------------------
0701 
0702 struct vki_msqid64_ds {
0703     struct vki_ipc64_perm msg_perm;
0704     __vki_kernel_time_t msg_stime;  /* last msgsnd time */
0705     unsigned long   __unused1;
0706     __vki_kernel_time_t msg_rtime;  /* last msgrcv time */
0707     unsigned long   __unused2;
0708     __vki_kernel_time_t msg_ctime;  /* last change time */
0709     unsigned long   __unused3;
0710     unsigned long  msg_cbytes;  /* current number of bytes on queue */
0711     unsigned long  msg_qnum;    /* number of messages in queue */
0712     unsigned long  msg_qbytes;  /* max number of bytes on queue */
0713     __vki_kernel_pid_t msg_lspid;   /* pid of last msgsnd */
0714     __vki_kernel_pid_t msg_lrpid;   /* last receive pid */
0715     unsigned long  __unused4;
0716     unsigned long  __unused5;
0717 };
0718 
0719 //----------------------------------------------------------------------
0720 // From linux-2.6.8.1/include/asm-i386/ipc.h
0721 //----------------------------------------------------------------------
0722 
0723 struct vki_ipc_kludge {
0724     struct vki_msgbuf __user *msgp;
0725     long msgtyp;
0726 };
0727 
0728 #define VKI_SEMOP        1
0729 #define VKI_SEMGET       2
0730 #define VKI_SEMCTL       3
0731 #define VKI_SEMTIMEDOP       4
0732 #define VKI_MSGSND      11
0733 #define VKI_MSGRCV      12
0734 #define VKI_MSGGET      13
0735 #define VKI_MSGCTL      14
0736 #define VKI_SHMAT       21
0737 #define VKI_SHMDT       22
0738 #define VKI_SHMGET      23
0739 #define VKI_SHMCTL      24
0740 
0741 //----------------------------------------------------------------------
0742 // From linux-2.6.8.1/include/asm-i386/shmbuf.h
0743 //----------------------------------------------------------------------
0744 
0745 struct vki_shmid64_ds {
0746     struct vki_ipc64_perm   shm_perm;   /* operation perms */
0747     vki_size_t      shm_segsz;  /* size of segment (bytes) */
0748     __vki_kernel_time_t shm_atime;  /* last attach time */
0749     unsigned long       __unused1;
0750     __vki_kernel_time_t shm_dtime;  /* last detach time */
0751     unsigned long       __unused2;
0752     __vki_kernel_time_t shm_ctime;  /* last change time */
0753     unsigned long       __unused3;
0754     __vki_kernel_pid_t  shm_cpid;   /* pid of creator */
0755     __vki_kernel_pid_t  shm_lpid;   /* pid of last operator */
0756     unsigned long       shm_nattch; /* no. of current attaches */
0757     unsigned long       __unused4;
0758     unsigned long       __unused5;
0759 };
0760 
0761 struct vki_shminfo64 {
0762     unsigned long   shmmax;
0763     unsigned long   shmmin;
0764     unsigned long   shmmni;
0765     unsigned long   shmseg;
0766     unsigned long   shmall;
0767     unsigned long   __unused1;
0768     unsigned long   __unused2;
0769     unsigned long   __unused3;
0770     unsigned long   __unused4;
0771 };
0772 
0773 //----------------------------------------------------------------------
0774 // DRM ioctls
0775 //----------------------------------------------------------------------
0776 
0777 // jrs 20050207: where did all this stuff come from?  Is it really
0778 // i386 specific, or should it go into the linux-generic category?
0779 //struct vki_drm_buf_pub {
0780 //  Int       idx;         /**< Index into the master buffer list */
0781 //  Int       total;       /**< Buffer size */
0782 //  Int       used;        /**< Amount of buffer in use (for DMA) */
0783 //  void      __user *address;     /**< Address of buffer */
0784 //};
0785 //
0786 //struct vki_drm_buf_map {
0787 //  Int       count;        /**< Length of the buffer list */
0788 //  void          __user *virtual;  /**< Mmap'd area in user-virtual */
0789 //  struct vki_drm_buf_pub __user *list;    /**< Buffer information */
0790 //};
0791 //
0792 ///* We need to pay attention to this, because it mmaps memory */
0793 //#define VKI_DRM_IOCTL_MAP_BUFS        _VKI_IOWR('d', 0x19, struct vki_drm_buf_map)
0794 
0795 //----------------------------------------------------------------------
0796 // From linux-2.6.9/include/asm-i386/ptrace.h
0797 //----------------------------------------------------------------------
0798 
0799 #define VKI_PTRACE_GETREGS            12
0800 #define VKI_PTRACE_SETREGS            13
0801 #define VKI_PTRACE_GETFPREGS          14
0802 #define VKI_PTRACE_SETFPREGS          15
0803 #define VKI_PTRACE_GETWMMXREGS        18
0804 #define VKI_PTRACE_SETWMMXREGS        19
0805 #define VKI_PTRACE_GET_THREAD_AREA    22
0806 #define VKI_PTRACE_SET_SYSCALL        23
0807 #define VKI_PTRACE_GETCRUNCHREGS      25
0808 #define VKI_PTRACE_SETCRUNCHREGS      26
0809 #define VKI_PTRACE_GETVFPREGS         27
0810 #define VKI_PTRACE_SETVFPREGS         28
0811 #define VKI_PTRACE_GETHBPREGS         29
0812 #define VKI_PTRACE_SETHBPREGS         30
0813 
0814 //----------------------------------------------------------------------
0815 // From linux-2.6.15.4/include/asm-i386/vm86.h
0816 //----------------------------------------------------------------------
0817 
0818 #define VKI_VM86_PLUS_INSTALL_CHECK 0
0819 #define VKI_VM86_ENTER          1
0820 #define VKI_VM86_ENTER_NO_BYPASS    2
0821 #define VKI_VM86_REQUEST_IRQ        3
0822 #define VKI_VM86_FREE_IRQ       4
0823 #define VKI_VM86_GET_IRQ_BITS       5
0824 #define VKI_VM86_GET_AND_RESET_IRQ  6
0825 
0826 struct vki_vm86_regs {
0827 /*
0828  * normal regs, with special meaning for the segment descriptors..
0829  */
0830     long ebx;
0831     long ecx;
0832     long edx;
0833     long esi;
0834     long edi;
0835     long ebp;
0836     long eax;
0837     long __null_ds;
0838     long __null_es;
0839     long __null_fs;
0840     long __null_gs;
0841     long orig_eax;
0842     long eip;
0843     unsigned short cs, __csh;
0844     long eflags;
0845     long esp;
0846     unsigned short ss, __ssh;
0847 /*
0848  * these are specific to v86 mode:
0849  */
0850     unsigned short es, __esh;
0851     unsigned short ds, __dsh;
0852     unsigned short fs, __fsh;
0853     unsigned short gs, __gsh;
0854 };
0855 
0856 struct vki_revectored_struct {
0857     unsigned long __map[8];         /* 256 bits */
0858 };
0859 
0860 struct vki_vm86_struct {
0861     struct vki_vm86_regs regs;
0862     unsigned long flags;
0863     unsigned long screen_bitmap;
0864     unsigned long cpu_type;
0865     struct vki_revectored_struct int_revectored;
0866     struct vki_revectored_struct int21_revectored;
0867 };
0868 
0869 struct vki_vm86plus_info_struct {
0870     unsigned long force_return_for_pic:1;
0871     unsigned long vm86dbg_active:1;       /* for debugger */
0872     unsigned long vm86dbg_TFpendig:1;     /* for debugger */
0873     unsigned long unused:28;
0874     unsigned long is_vm86pus:1;       /* for vm86 internal use */
0875     unsigned char vm86dbg_intxxtab[32];   /* for debugger */
0876 };
0877 
0878 struct vki_vm86plus_struct {
0879     struct vki_vm86_regs regs;
0880     unsigned long flags;
0881     unsigned long screen_bitmap;
0882     unsigned long cpu_type;
0883     struct vki_revectored_struct int_revectored;
0884     struct vki_revectored_struct int21_revectored;
0885     struct vki_vm86plus_info_struct vm86plus;
0886 };
0887 
0888 //----------------------------------------------------------------------
0889 // From linux-2.6.35.4/arch/arm/include/asm/hwcap.h
0890 //----------------------------------------------------------------------
0891 
0892 #define VKI_HWCAP_NEON      4096
0893 
0894 //----------------------------------------------------------------------
0895 // From linux-2.6.8.1/include/asm-generic/errno.h
0896 //----------------------------------------------------------------------
0897 
0898 #define VKI_ENOSYS       38  /* Function not implemented */
0899 #define VKI_EOVERFLOW    75  /* Value too large for defined data type */
0900 
0901 //----------------------------------------------------------------------
0902 // From linux-3.19.0/include/uapi/asm-generic/ioctls.h
0903 //----------------------------------------------------------------------
0904 
0905 #define VKI_TIOCGSERIAL     0x541E
0906 #define VKI_TIOCSSERIAL     0x541F
0907 
0908 //----------------------------------------------------------------------
0909 // And that's it!
0910 //----------------------------------------------------------------------
0911 
0912 #endif // __VKI_ARM_LINUX_H
0913 
0914 /*--------------------------------------------------------------------*/
0915 /*--- end                                          vki-arm-linux.h ---*/
0916 /*--------------------------------------------------------------------*/