Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-08 08:54:39

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