Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*--- mips/Linux-specific kernel interface.     vki-mips32-linux.h ---*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2010-2017 RT-RK
0011 
0012    This program is free software; you can redistribute it and/or
0013    modify it under the terms of the GNU General Public License as
0014    published by the Free Software Foundation; either version 2 of the
0015    License, or (at your option) any later version.
0016 
0017    This program is distributed in the hope that it will be useful, but
0018    WITHOUT ANY WARRANTY; without even the implied warranty of
0019    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0020    General Public License for more details.
0021 
0022    You should have received a copy of the GNU General Public License
0023    along with this program; if not, see <http://www.gnu.org/licenses/>.
0024 
0025    The GNU General Public License is contained in the file COPYING.
0026 */
0027 
0028 #ifndef __VKI_MIPS32_LINUX_H
0029 #define __VKI_MIPS32_LINUX_H
0030 
0031 #include <config.h>
0032 
0033 // mips endian
0034 #if defined (_MIPSEL)
0035 #define VKI_LITTLE_ENDIAN  1
0036 #elif defined (_MIPSEB)
0037 #define VKI_BIG_ENDIAN  1
0038 #endif
0039 
0040 
0041 //----------------------------------------------------------------------
0042 // From linux-2.6.35.5/include/asm-generic/int-ll64.h
0043 //----------------------------------------------------------------------
0044 
0045 typedef __signed__ char __vki_s8;
0046 typedef unsigned char __vki_u8;
0047 
0048 typedef __signed__ short __vki_s16;
0049 typedef unsigned short __vki_u16;
0050 
0051 typedef __signed__ int __vki_s32;
0052 typedef unsigned int __vki_u32;
0053 
0054 typedef __signed char vki_s8;
0055 typedef unsigned char vki_u8;
0056 
0057 typedef __signed short vki_s16;
0058 typedef unsigned short vki_u16;
0059 
0060 typedef __signed int vki_s32;
0061 typedef unsigned int vki_u32;
0062 
0063 typedef __signed__ long long __vki_s64;
0064 typedef unsigned long long __vki_u64;
0065 
0066 
0067 //----------------------------------------------------------------------
0068 // From linux-2.6.35.5/include/asm-mips/page.h
0069 //----------------------------------------------------------------------
0070 
0071 /* MIPS32 uses runtime pagesize detection */
0072 extern UWord VKI_PAGE_SHIFT;
0073 extern UWord VKI_PAGE_SIZE;
0074 #define VKI_PAGE_MASK           (~(VKI_PAGE_SIZE-1))
0075 #define VKI_MAX_PAGE_SHIFT      16
0076 #define VKI_MAX_PAGE_SIZE       (1UL << VKI_MAX_PAGE_SHIFT)
0077 
0078 //----------------------------------------------------------------------
0079 // From linux-2.6.35.9/arch/mips/include/bits/shm.h
0080 //----------------------------------------------------------------------
0081 
0082 #define VKI_SHMLBA  0x40000
0083 
0084 //----------------------------------------------------------------------
0085 // From linux-2.6.35.5/include/asm/signal.h
0086 //----------------------------------------------------------------------
0087 
0088 #define VKI_MINSIGSTKSZ     2048
0089 
0090 #define VKI_SIG_BLOCK       1    /* for blocking signals */
0091 #define VKI_SIG_UNBLOCK     2    /* for unblocking signals */
0092 #define VKI_SIG_SETMASK     3    /* for setting the signal mask */
0093 
0094 /* Type of a signal handler.  */
0095 typedef void __vki_signalfn_t(int);
0096 typedef __vki_signalfn_t __user *__vki_sighandler_t;
0097 
0098 typedef void __vki_restorefn_t(void);
0099 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
0100 
0101 #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
0102 #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
0103 
0104 #define _VKI_NSIG       128
0105 #define _VKI_NSIG_BPW   32
0106 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
0107 
0108 typedef unsigned long vki_old_sigset_t;     /* at least 32 bits */
0109 
0110 typedef struct {
0111         unsigned long sig[_VKI_NSIG_WORDS];
0112 } vki_sigset_t;
0113 
0114 #define VKI_SIGHUP       1  /* Hangup (POSIX).  */
0115 #define VKI_SIGINT       2  /* Interrupt (ANSI).  */
0116 #define VKI_SIGQUIT      3  /* Quit (POSIX).  */
0117 #define VKI_SIGILL       4  /* Illegal instruction (ANSI).  */
0118 #define VKI_SIGTRAP      5  /* Trace trap (POSIX).  */
0119 #define VKI_SIGIOT       6  /* IOT trap (4.2 BSD).  */
0120 #define VKI_SIGABRT      VKI_SIGIOT /* Abort (ANSI).  */
0121 #define VKI_SIGEMT       7
0122 #define VKI_SIGFPE       8  /* Floating-point exception (ANSI).  */
0123 #define VKI_SIGKILL      9  /* Kill, unblockable (POSIX).  */
0124 #define VKI_SIGBUS      10  /* BUS error (4.2 BSD).  */
0125 #define VKI_SIGSEGV     11  /* Segmentation violation (ANSI).  */
0126 #define VKI_SIGSYS      12
0127 #define VKI_SIGPIPE     13  /* Broken pipe (POSIX).  */
0128 #define VKI_SIGALRM     14  /* Alarm clock (POSIX).  */
0129 #define VKI_SIGTERM     15  /* Termination (ANSI).  */
0130 #define VKI_SIGUSR1     16  /* User-defined signal 1 (POSIX).  */
0131 #define VKI_SIGUSR2     17  /* User-defined signal 2 (POSIX).  */
0132 #define VKI_SIGCHLD     18  /* Child status has changed (POSIX).  */
0133 #define VKI_SIGCLD      VKI_SIGCHLD /* Same as SIGCHLD (System V).  */
0134 #define VKI_SIGPWR      19  /* Power failure restart (System V).  */
0135 #define VKI_SIGWINCH    20  /* Window size change (4.3 BSD, Sun).  */
0136 #define VKI_SIGURG      21  /* Urgent condition on socket (4.2 BSD).  */
0137 #define VKI_SIGIO       22  /* I/O now possible (4.2 BSD).  */
0138 #define VKI_SIGPOLL     VKI_SIGIO   /* Pollable event occurred (System V).  */
0139 #define VKI_SIGSTOP     23  /* Stop, unblockable (POSIX).  */
0140 #define VKI_SIGTSTP     24  /* Keyboard stop (POSIX).  */
0141 #define VKI_SIGCONT     25  /* Continue (POSIX).  */
0142 #define VKI_SIGTTIN     26  /* Background read from tty (POSIX).  */
0143 #define VKI_SIGTTOU     27  /* Background write to tty (POSIX).  */
0144 #define VKI_SIGVTALRM   28  /* Virtual alarm clock (4.2 BSD).  */
0145 #define VKI_SIGPROF     29  /* Profiling alarm clock (4.2 BSD).  */
0146 #define VKI_SIGXCPU     30  /* CPU limit exceeded (4.2 BSD).  */
0147 #define VKI_SIGXFSZ     31  /* File size limit exceeded (4.2 BSD).  */
0148 
0149 /* These should not be considered constants from userland.  */
0150 #define VKI_SIGRTMIN    32
0151 // [[This was (_NSIG-1) in 2.4.X... not sure if it matters.]]
0152 #define VKI_SIGRTMAX    _VKI_NSIG
0153 
0154 #define VKI_SA_ONSTACK      0x08000000
0155 #define VKI_SA_RESETHAND    0x80000000
0156 #define VKI_SA_RESTART      0x10000000
0157 #define VKI_SA_SIGINFO      0x00000008
0158 #define VKI_SA_NODEFER      0x40000000
0159 #define VKI_SA_NOCLDWAIT    0x00010000
0160 #define VKI_SA_NOCLDSTOP    0x00000001
0161 
0162 #define VKI_SA_NOMASK       VKI_SA_NODEFER
0163 #define VKI_SA_ONESHOT      VKI_SA_RESETHAND
0164 //#define VKI_SA_INTERRUPT  0x20000000 /* dummy -- ignored */
0165 
0166 #define VKI_SA_RESTORER     0x04000000
0167 
0168 #define VKI_SS_ONSTACK      1
0169 #define VKI_SS_DISABLE      2
0170 
0171 struct vki_old_sigaction {
0172         // [[Nb: a 'k' prefix is added to "sa_handler" because
0173         // bits/sigaction.h (which gets dragged in somehow via signal.h)
0174         // #defines it as something else.  Since that is done for glibc's
0175         // purposes, which we don't care about here, we use our own name.]]
0176     unsigned long sa_flags;
0177         __vki_sighandler_t ksa_handler;
0178         vki_old_sigset_t sa_mask;
0179         __vki_sigrestore_t sa_restorer;
0180 };
0181 
0182 struct vki_sigaction {
0183         unsigned int    sa_flags;
0184         __vki_sighandler_t  sa_handler;
0185         vki_sigset_t        sa_mask;
0186 };
0187 
0188 
0189 struct vki_sigaction_base {
0190         // [[See comment about extra 'k' above]]
0191         unsigned long sa_flags;
0192     __vki_sighandler_t ksa_handler;
0193 
0194     vki_sigset_t sa_mask;       /* mask last for extensibility */
0195         __vki_sigrestore_t sa_restorer;
0196 };
0197 
0198 /* On Linux we use the same type for passing sigactions to
0199    and from the kernel.  Hence: */
0200 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0201 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0202 
0203 typedef struct vki_sigaltstack {
0204     void __user *ss_sp;
0205     vki_size_t ss_size;
0206     int ss_flags;
0207 
0208 } vki_stack_t;
0209 
0210 
0211 //----------------------------------------------------------------------
0212 // From 2.6.35.5/include/asm-mips/sigcontext.h
0213 //----------------------------------------------------------------------
0214 
0215 struct _vki_fpreg {
0216     unsigned short significand[4];
0217     unsigned short exponent;
0218 };
0219 
0220 struct _vki_fpxreg {
0221     unsigned short significand[4];
0222     unsigned short exponent;
0223     unsigned short padding[3];
0224 };
0225 
0226 struct _vki_xmmreg {
0227     unsigned long element[4];
0228 };
0229 
0230 struct _vki_fpstate {
0231     /* Regular FPU environment */
0232     unsigned long   cw;
0233     unsigned long   sw;
0234     unsigned long   tag;
0235     unsigned long   ipoff;
0236     unsigned long   cssel;
0237     unsigned long   dataoff;
0238     unsigned long   datasel;
0239     struct _vki_fpreg   _st[8];
0240     unsigned short  status;
0241     unsigned short  magic;      /* 0xffff = regular FPU data only */
0242 
0243     /* FXSR FPU environment */
0244     unsigned long   _fxsr_env[6];   /* FXSR FPU env is ignored */
0245     unsigned long   mxcsr;
0246     unsigned long   reserved;
0247     struct _vki_fpxreg  _fxsr_st[8];    /* FXSR FPU reg data is ignored */
0248     struct _vki_xmmreg  _xmm[8];
0249     unsigned long   padding[56];
0250 };
0251 
0252 //----------------------------------------------------------------------
0253 // From linux-2.6.35.5/include/asm-mips/sigcontext.h
0254 //----------------------------------------------------------------------
0255 
0256 struct vki_sigcontext {
0257         unsigned int            sc_regmask;     /* Unused */
0258         unsigned int            sc_status;      /* Unused */
0259         unsigned long long      sc_pc;
0260         unsigned long long      sc_regs[32];
0261         unsigned long long      sc_fpregs[32];
0262         unsigned int            sc_acx;         /* Was sc_ownedfp */
0263         unsigned int            sc_fpc_csr;
0264         unsigned int            sc_fpc_eir;     /* Unused */
0265         unsigned int            sc_used_math;
0266         unsigned int            sc_dsp;         /* dsp status, was sc_ssflags */
0267         unsigned long long      sc_mdhi;
0268         unsigned long long      sc_mdlo;
0269         unsigned long           sc_hi1;         /* Was sc_cause */
0270         unsigned long           sc_lo1;         /* Was sc_badvaddr */
0271         unsigned long           sc_hi2;         /* Was sc_sigset[4] */
0272         unsigned long           sc_lo2;
0273         unsigned long           sc_hi3;
0274         unsigned long           sc_lo3;
0275 };
0276 
0277 //----------------------------------------------------------------------
0278 // From linux-2.6.35.5/include/asm-mips/mman.h
0279 //----------------------------------------------------------------------
0280 
0281 #define VKI_PROT_NONE       0x0      /* No page permissions */
0282 #define VKI_PROT_READ       0x1      /* page can be read */
0283 #define VKI_PROT_WRITE      0x2      /* page can be written */
0284 #define VKI_PROT_EXEC       0x4      /* page can be executed */
0285 #define VKI_PROT_GROWSDOWN  0x01000000  /* mprotect flag: extend change to start of growsdown vma */
0286 #define VKI_PROT_GROWSUP    0x02000000  /* mprotect flag: extend change to end of growsup vma */
0287 
0288 #define VKI_MAP_SHARED      0x001     /* Share changes */
0289 #define VKI_MAP_PRIVATE     0x002     /* Changes are private */
0290 #define VKI_MAP_FIXED       0x010     /* Interpret addr exactly */
0291 
0292 #define VKI_MAP_NORESERVE   0x0400   /* don't reserve swap pages */
0293 
0294 /* These are linux-specific */
0295 #define VKI_MAP_NORESERVE   0x0400          /* don't check for reservations */
0296 #define VKI_MAP_ANONYMOUS   0x0800          /* don't use a file */
0297 #define VKI_MAP_GROWSDOWN   0x1000          /* stack-like segment */
0298 #define VKI_MAP_DENYWRITE   0x2000          /* ETXTBSY */
0299 #define VKI_MAP_EXECUTABLE  0x4000          /* mark it as an executable */
0300 #define VKI_MAP_LOCKED      0x8000          /* pages are locked */
0301 #define VKI_MAP_POPULATE    0x10000         /* populate (prefault) pagetables */
0302 #define VKI_MAP_NONBLOCK    0x20000         /* do not block on IO */
0303 
0304 
0305 //----------------------------------------------------------------------
0306 // From linux-2.6.35.5/include/asm-mips/fcntl.h
0307 //----------------------------------------------------------------------
0308 
0309 #define VKI_O_ACCMODE          03
0310 #define VKI_O_RDONLY           00
0311 #define VKI_O_WRONLY           01
0312 #define VKI_O_RDWR         02
0313 
0314 #define VKI_O_CREAT     0x0100      /* not fcntl */
0315 #define VKI_O_EXCL      0x0400      /* not fcntl */
0316 
0317 #define VKI_O_TRUNC     0x0200  /* not fcntl */
0318 
0319 #define VKI_O_APPEND        0x0008
0320 #define VKI_O_NONBLOCK      0x0080
0321 #define VKI_O_LARGEFILE         0x2000
0322 
0323 #define VKI_AT_FDCWD            -100
0324 
0325 #define VKI_F_DUPFD      0          /* dup */
0326 #define VKI_F_GETFD      1          /* get close_on_exec */
0327 #define VKI_F_SETFD      2          /* set/clear close_on_exec */
0328 #define VKI_F_GETFL      3          /* get file->f_flags */
0329 #define VKI_F_SETFL      4          /* set file->f_flags */
0330 
0331 #define VKI_F_GETLK      14
0332 #define VKI_F_SETLK      6
0333 #define VKI_F_SETLKW         7
0334 
0335 #define VKI_F_SETOWN         24         /*  for sockets. */
0336 #define VKI_F_GETOWN         23         /*  for sockets. */
0337 #define VKI_F_SETSIG         10         /*  for sockets. */
0338 #define VKI_F_GETSIG         11         /*  for sockets. */
0339 
0340 #define VKI_F_SETOWN_EX     15
0341 #define VKI_F_GETOWN_EX     16
0342 
0343 #define VKI_F_OFD_GETLK     36
0344 #define VKI_F_OFD_SETLK     37
0345 #define VKI_F_OFD_SETLKW    38
0346 
0347 #define VKI_F_GETLK64       33          /*  using 'struct flock64' */
0348 #define VKI_F_SETLK64       34
0349 #define VKI_F_SETLKW64      35
0350 
0351 /* for F_[GET|SET]FL */
0352 #define VKI_FD_CLOEXEC   1      /* actually anything with low bit set goes */
0353 
0354 #define VKI_F_LINUX_SPECIFIC_BASE   1024
0355 
0356 struct vki_f_owner_ex {
0357     int type;
0358     __vki_kernel_pid_t  pid;
0359 };
0360 
0361 //----------------------------------------------------------------------
0362 // From linux-2.6.35.5/include/asm-mips/resource.h
0363 //----------------------------------------------------------------------
0364 
0365 #define VKI_RLIMIT_DATA     2   /* max data size */
0366 #define VKI_RLIMIT_STACK    3   /* max stack size */
0367 #define VKI_RLIMIT_CORE     4   /* max core file size */
0368 #define VKI_RLIMIT_NOFILE   5   /* max number of open files */
0369 #define VKI_RLIM_INFINITY 0x7fffffffUL
0370 
0371 //----------------------------------------------------------------------
0372 // From linux-2.6.35.5/include/asm-mips/socket.h
0373 //----------------------------------------------------------------------
0374 
0375 #define VKI_SOL_SOCKET  0xffff
0376 
0377 #define VKI_SO_TYPE 0x1008
0378 
0379 #define VKI_SO_ATTACH_FILTER    26
0380 
0381 //----------------------------------------------------------------------
0382 // From linux-2.6.35.5/include/asm-i386/sockios.h
0383 //----------------------------------------------------------------------
0384 
0385 #define VKI_SIOCATMARK          _VKI_IOR('s', 7, int)
0386 #define VKI_SIOCSPGRP           _VKI_IOW('s', 8, vki_pid_t)
0387 #define VKI_SIOCGPGRP           _VKI_IOR('s', 9, vki_pid_t)
0388 #define VKI_SIOCGSTAMP          0x8906      /* Get stamp (timeval) */
0389 #define VKI_SIOCGSTAMPNS        0x8907      /* Get stamp (timespec) */
0390 
0391 //----------------------------------------------------------------------
0392 // From linux-2.6.35.5/include/asm-mips/stat.h
0393 //----------------------------------------------------------------------
0394 
0395 struct vki_stat {
0396     unsigned    st_dev;
0397     long        st_pad1[3];     /* Reserved for network id */
0398     unsigned long   st_ino;
0399     unsigned int    st_mode;
0400     unsigned long   st_nlink;
0401     unsigned int    st_uid;
0402     unsigned int    st_gid;
0403     unsigned    st_rdev;
0404     long        st_pad2[2];
0405     long        st_size;
0406     long        st_pad3;
0407     /*
0408      * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
0409      * but we don't have it under Linux.
0410      */
0411     long        st_atime;
0412     long        st_atime_nsec;
0413     long        st_mtime;
0414     long        st_mtime_nsec;
0415     long        st_ctime;
0416     long        st_ctime_nsec;
0417     long        st_blksize;
0418     long        st_blocks;
0419     long        st_pad4[14];
0420 };
0421 
0422 /*
0423  * This matches struct stat64 in glibc2.1, hence the absolutely insane
0424  * amounts of padding around dev_t's.  The memory layout is the same as of
0425  * struct stat of the 64-bit kernel.
0426  */
0427 
0428 struct vki_stat64 {
0429     unsigned long   st_dev;
0430     unsigned long   st_pad0[3]; /* Reserved for st_dev expansion  */
0431 
0432     unsigned long long  st_ino;
0433 
0434     unsigned int    st_mode;
0435     unsigned long   st_nlink;
0436 
0437     unsigned int    st_uid;
0438     unsigned int    st_gid;
0439 
0440     unsigned long   st_rdev;
0441     unsigned long   st_pad1[3]; /* Reserved for st_rdev expansion  */
0442 
0443     long long   st_size;
0444 
0445     /*
0446      * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
0447      * but we don't have it under Linux.
0448      */
0449     long        st_atime;
0450     unsigned long   st_atime_nsec;  /* Reserved for st_atime expansion  */
0451 
0452     long        st_mtime;
0453     unsigned long   st_mtime_nsec;  /* Reserved for st_mtime expansion  */
0454 
0455     long        st_ctime;
0456     unsigned long   st_ctime_nsec;  /* Reserved for st_ctime expansion  */
0457 
0458     unsigned long   st_blksize;
0459     unsigned long   st_pad2;
0460 
0461     long long   st_blocks;
0462 };
0463 
0464 //----------------------------------------------------------------------
0465 // From linux-2.6.35.5/include/asm-mips/statfs.h
0466 //----------------------------------------------------------------------
0467 
0468 struct vki_statfs {
0469     long        f_type;
0470     long        f_bsize;
0471     long        f_frsize;   /* Fragment size - unsupported */
0472     long        f_blocks;
0473     long        f_bfree;
0474     long        f_files;
0475     long        f_ffree;
0476     long        f_bavail;
0477 
0478     /* Linux specials */
0479     __vki_kernel_fsid_t f_fsid;
0480     long        f_namelen;
0481     long        f_spare[6];
0482 };
0483 
0484 //----------------------------------------------------------------------
0485 // From linux-2.6.35.5/include/asm-mips/termios.h
0486 //----------------------------------------------------------------------
0487 
0488 struct vki_winsize {
0489     unsigned short ws_row;
0490     unsigned short ws_col;
0491     unsigned short ws_xpixel;
0492     unsigned short ws_ypixel;
0493 };
0494 
0495 #define NCC 8
0496 #define NCCS    23
0497 struct vki_termio {
0498     unsigned short c_iflag;     /* input mode flags */
0499     unsigned short c_oflag;     /* output mode flags */
0500     unsigned short c_cflag;     /* control mode flags */
0501     unsigned short c_lflag;     /* local mode flags */
0502     char c_line;            /* line discipline */
0503     unsigned char c_cc[NCCS];   /* control characters */
0504 };
0505 
0506 
0507 //----------------------------------------------------------------------
0508 // From linux-2.6.35.5/include/asm-mips/termbits.h
0509 //----------------------------------------------------------------------
0510 
0511 typedef unsigned char   vki_cc_t;
0512 typedef unsigned long   vki_speed_t;
0513 typedef unsigned long   vki_tcflag_t;
0514 
0515 struct vki_termios {
0516     vki_tcflag_t c_iflag;       /* input mode flags */
0517     vki_tcflag_t c_oflag;       /* output mode flags */
0518     vki_tcflag_t c_cflag;       /* control mode flags */
0519     vki_tcflag_t c_lflag;       /* local mode flags */
0520     vki_cc_t c_line;            /* line discipline */
0521     vki_cc_t c_cc[NCCS];        /* control characters */
0522 };
0523 
0524 //----------------------------------------------------------------------
0525 // From linux-2.6.35.5/include/asm-mips/ioctl.h
0526 //----------------------------------------------------------------------
0527 
0528 #define _VKI_IOC_NRBITS     8
0529 #define _VKI_IOC_TYPEBITS   8
0530 #define _VKI_IOC_SIZEBITS   13
0531 #define _VKI_IOC_DIRBITS    3
0532 
0533 #define _VKI_IOC_NRMASK     ((1 << _VKI_IOC_NRBITS)-1)
0534 #define _VKI_IOC_TYPEMASK   ((1 << _VKI_IOC_TYPEBITS)-1)
0535 #define _VKI_IOC_SIZEMASK   ((1 << _VKI_IOC_SIZEBITS)-1)
0536 #define _VKI_IOC_DIRMASK    ((1 << _VKI_IOC_DIRBITS)-1)
0537 
0538 #define _VKI_IOC_NRSHIFT    0
0539 #define _VKI_IOC_TYPESHIFT  (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0540 #define _VKI_IOC_SIZESHIFT  (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0541 #define _VKI_IOC_DIRSHIFT   (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0542 
0543 #define _VKI_IOC_NONE   1U
0544 #define _VKI_IOC_READ   2U
0545 #define _VKI_IOC_WRITE  4U
0546 
0547 #define _VKI_IOC(dir,type,nr,size) \
0548     (((dir)  << _VKI_IOC_DIRSHIFT) | \
0549      ((type) << _VKI_IOC_TYPESHIFT) | \
0550      ((nr)   << _VKI_IOC_NRSHIFT) | \
0551      ((size) << _VKI_IOC_SIZESHIFT))
0552 
0553 /* provoke compile error for invalid uses of size argument */
0554 extern unsigned int __VKI_invalid_size_argument_for_IOC;
0555 /* used to create numbers */
0556 #define _VKI_IO(type,nr)    _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0557 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0558 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0559 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
0560 
0561 /* used to decode ioctl numbers.. */
0562 #define _VKI_IOC_DIR(nr)    (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0563 #define _VKI_IOC_TYPE(nr)   (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
0564 #define _VKI_IOC_NR(nr)     (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
0565 #define _VKI_IOC_SIZE(nr)   (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0566 
0567 //----------------------------------------------------------------------
0568 // From linux-2.6.35.5/include/asm-mips/ioctls.h
0569 //----------------------------------------------------------------------
0570 
0571 #define VKI_TCGETA      0x5401
0572 #define VKI_TCSETA      0x5402  /* Clashes with SNDCTL_TMR_START sound ioctl */
0573 #define VKI_TCSETAW     0x5403
0574 #define VKI_TCSETAF     0x5404
0575 
0576 #define VKI_TCSBRK      0x5405
0577 #define VKI_TCXONC      0x5406
0578 #define VKI_TCFLSH      0x5407
0579 
0580 #define VKI_TCGETS      0x540d
0581 #define VKI_TCSETS      0x540e
0582 #define VKI_TCSETSW     0x540f
0583 #define VKI_TCSETSF     0x5410
0584 
0585 #define VKI_TIOCEXCL        0x740d      /* set exclusive use of tty */
0586 #define VKI_TIOCNXCL        0x740e      /* reset exclusive use of tty */
0587 #define VKI_TIOCOUTQ        0x7472      /* output queue size */
0588 #define VKI_TIOCSTI     0x5472      /* simulate terminal input */
0589 #define VKI_TIOCMGET        0x741d      /* get all modem bits */
0590 #define VKI_TIOCMBIS        0x741b      /* bis modem bits */
0591 #define VKI_TIOCMBIC        0x741c      /* bic modem bits */
0592 #define VKI_TIOCMSET        0x741a      /* set all modem bits */
0593 #define VKI_TIOCPKT     0x5470      /* pty: set/clear packet mode */
0594 #define  VKI_TIOCPKT_DATA       0x00    /* data packet */
0595 #define  VKI_TIOCPKT_FLUSHREAD      0x01    /* flush packet */
0596 #define  VKI_TIOCPKT_FLUSHWRITE     0x02    /* flush packet */
0597 #define  VKI_TIOCPKT_STOP       0x04    /* stop output */
0598 #define  VKI_TIOCPKT_START      0x08    /* start output */
0599 #define  VKI_TIOCPKT_NOSTOP     0x10    /* no more ^S, ^Q */
0600 #define  VKI_TIOCPKT_DOSTOP     0x20    /* now do ^S ^Q */
0601 /* #define  TIOCPKT_IOCTL       0x40    state change of pty driver */
0602 #define VKI_TIOCSWINSZ  _VKI_IOW('t', 103, struct vki_winsize)  /* set window size */
0603 #define VKI_TIOCGWINSZ  _VKI_IOR('t', 104, struct vki_winsize)  /* get window size */
0604 #define VKI_TIOCNOTTY   0x5471      /* void tty association */
0605 #define VKI_TIOCSETD    0x7401
0606 #define VKI_TIOCGETD    0x7400
0607 
0608 #define VKI_FIOCLEX     0x6601
0609 #define VKI_FIONCLEX        0x6602
0610 #define VKI_FIOASYNC        0x667d
0611 #define VKI_FIONBIO     0x667e
0612 #define VKI_FIOQSIZE        0x667f
0613 
0614 #define VKI_TIOCGLTC        0x7474          /* get special local chars */
0615 #define VKI_TIOCSLTC        0x7475          /* set special local chars */
0616 #define VKI_TIOCSPGRP       _VKI_IOW('t', 118, int) /* set pgrp of tty */
0617 #define VKI_TIOCGPGRP       _VKI_IOR('t', 119, int) /* get pgrp of tty */
0618 #define VKI_TIOCCONS        _VKI_IOW('t', 120, int) /* become virtual console */
0619 
0620 #define VKI_FIONREAD        0x467f
0621 #define VKI_TIOCINQ     FIONREAD
0622 
0623 #define VKI_TIOCGETP            0x7408
0624 #define VKI_TIOCSETP            0x7409
0625 #define VKI_TIOCSETN            0x740a          /* TIOCSETP wo flush */
0626 
0627 #define VKI_TIOCSBRK    0x5427  /* BSD compatibility */
0628 #define VKI_TIOCCBRK    0x5428  /* BSD compatibility */
0629 #define VKI_TIOCGSID    0x7416  /* Return the session ID of FD */
0630 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
0631 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)  /* Lock/unlock Pty */
0632 
0633 /* I hope the range from 0x5480 on is free ... */
0634 #define VKI_TIOCSCTTY       0x5480      /* become controlling tty */
0635 #define VKI_TIOCGSOFTCAR    0x5481
0636 #define VKI_TIOCSSOFTCAR    0x5482
0637 #define VKI_TIOCLINUX       0x5483
0638 #define VKI_TIOCGSERIAL     0x5484
0639 #define VKI_TIOCSSERIAL     0x5485
0640 #define VKI_TCSBRKP     0x5486  /* Needed for POSIX tcsendbreak() */
0641 #define VKI_TIOCSERCONFIG   0x5488
0642 #define VKI_TIOCSERGWILD    0x5489
0643 #define VKI_TIOCSERSWILD    0x548a
0644 #define VKI_TIOCGLCKTRMIOS  0x548b
0645 #define VKI_TIOCSLCKTRMIOS  0x548c
0646 #define VKI_TIOCSERGSTRUCT  0x548d /* For debugging only */
0647 #define VKI_TIOCSERGETLSR       0x548e /* Get line status register */
0648 #define VKI_TIOCSERGETMULTI     0x548f /* Get multiport config  */
0649 #define VKI_TIOCSERSETMULTI     0x5490 /* Set multiport config */
0650 #define VKI_TIOCMIWAIT          0x5491 /* wait for a change on serial input line(s) */
0651 #define VKI_TIOCGICOUNT         0x5492 /* read serial port inline interrupt counts */
0652 #define VKI_TIOCGHAYESESP   0x5493 /* Get Hayes ESP configuration */
0653 #define VKI_TIOCSHAYESESP   0x5494 /* Set Hayes ESP configuration */
0654 
0655 //----------------------------------------------------------------------
0656 // From asm-generic/poll.h
0657 //----------------------------------------------------------------------
0658 
0659 /* These are specified by iBCS2 */
0660 #define VKI_POLLIN      0x0001
0661 
0662 struct vki_pollfd {
0663     int fd;
0664     short events;
0665     short revents;
0666 };
0667 //----------------------------------------------------------------------
0668 // From linux-2.6.35.5/include/asm-mips/ucontext.h
0669 //----------------------------------------------------------------------
0670 
0671 struct vki_ucontext {
0672     unsigned long       uc_flags;
0673     struct vki_ucontext    *uc_link;
0674     vki_stack_t     uc_stack;
0675     struct vki_sigcontext   uc_mcontext;
0676     vki_sigset_t        uc_sigmask; /* mask last for extensibility */
0677 };
0678 
0679 // CAB: TODO
0680 typedef char vki_modify_ldt_t;
0681 
0682 //----------------------------------------------------------------------
0683 // From linux-2.6.35.5/include/asm-mips/ipcbuf.h
0684 //----------------------------------------------------------------------
0685 
0686 struct vki_ipc64_perm
0687 {
0688         __vki_kernel_key_t  key;
0689         __vki_kernel_uid_t  uid;
0690         __vki_kernel_gid_t  gid;
0691         __vki_kernel_uid_t  cuid;
0692         __vki_kernel_gid_t  cgid;
0693         __vki_kernel_mode_t mode;
0694         unsigned short  seq;
0695         unsigned short  __pad1;
0696         unsigned long   __unused1;
0697         unsigned long   __unused2;
0698 };
0699 
0700 //----------------------------------------------------------------------
0701 // From linux-2.6.35.5/include/asm-mips/sembuf.h
0702 //----------------------------------------------------------------------
0703 
0704 struct vki_semid64_ds {
0705         struct vki_ipc64_perm sem_perm;             /* permissions .. see ipc.h */
0706         __vki_kernel_time_t sem_otime;              /* last semop time */
0707         __vki_kernel_time_t sem_ctime;              /* last change time */
0708         unsigned long   sem_nsems;              /* no. of semaphores in array */
0709         unsigned long   __unused1;
0710         unsigned long   __unused2;
0711 };
0712 
0713 
0714 //----------------------------------------------------------------------
0715 // From linux-2.6.35.5/include/asm-mips/msgbuf.h
0716 //----------------------------------------------------------------------
0717 
0718 struct vki_msqid64_ds {
0719     struct vki_ipc64_perm msg_perm;
0720     __vki_kernel_time_t msg_stime;  /* last msgsnd time */
0721     unsigned long   __unused1;
0722     __vki_kernel_time_t msg_rtime;  /* last msgrcv time */
0723     unsigned long   __unused2;
0724     __vki_kernel_time_t msg_ctime;  /* last change time */
0725     unsigned long   __unused3;
0726     unsigned long  msg_cbytes;  /* current number of bytes on queue */
0727     unsigned long  msg_qnum;    /* number of messages in queue */
0728     unsigned long  msg_qbytes;  /* max number of bytes on queue */
0729     __vki_kernel_pid_t msg_lspid;   /* pid of last msgsnd */
0730     __vki_kernel_pid_t msg_lrpid;   /* last receive pid */
0731     unsigned long  __unused4;
0732     unsigned long  __unused5;
0733 };
0734 
0735 //----------------------------------------------------------------------
0736 // From linux-2.6.35.5/include/asm-mips/ipc.h
0737 //----------------------------------------------------------------------
0738 
0739 struct vki_ipc_kludge {
0740         struct vki_msgbuf __user *msgp;
0741         long msgtyp;
0742 };
0743 
0744 #define VKI_SEMOP            1
0745 #define VKI_SEMGET           2
0746 #define VKI_SEMCTL           3
0747 #define VKI_SEMTIMEDOP       4
0748 #define VKI_MSGSND          11
0749 #define VKI_MSGRCV          12
0750 #define VKI_MSGGET          13
0751 #define VKI_MSGCTL          14
0752 #define VKI_SHMAT           21
0753 #define VKI_SHMDT           22
0754 #define VKI_SHMGET          23
0755 #define VKI_SHMCTL          24
0756 
0757 //----------------------------------------------------------------------
0758 // From linux-2.6.35.5/include/asm-mips/shmbuf.h
0759 //----------------------------------------------------------------------
0760 
0761 struct vki_shmid64_ds {
0762         struct vki_ipc64_perm       shm_perm;       /* operation perms */
0763         vki_size_t                  shm_segsz;      /* size of segment (bytes) */
0764         __vki_kernel_time_t         shm_atime;      /* last attach time */
0765         __vki_kernel_time_t         shm_dtime;      /* last detach time */
0766         __vki_kernel_time_t         shm_ctime;      /* last change time */
0767         __vki_kernel_pid_t          shm_cpid;       /* pid of creator */
0768         __vki_kernel_pid_t          shm_lpid;       /* pid of last operator */
0769         unsigned long           shm_nattch;     /* no. of current attaches */
0770         unsigned long           __unused1;
0771         unsigned long           __unused2;
0772 };
0773 
0774 struct vki_shminfo64 {
0775         unsigned long   shmmax;
0776         unsigned long   shmmin;
0777         unsigned long   shmmni;
0778         unsigned long   shmseg;
0779         unsigned long   shmall;
0780         unsigned long   __unused1;
0781         unsigned long   __unused2;
0782         unsigned long   __unused3;
0783         unsigned long   __unused4;
0784 };
0785 //----------------------------------------------------------------------
0786 // From linux-2.6.35.5/include/asm-mips/ptrace.h
0787 //----------------------------------------------------------------------
0788 
0789 struct vki_pt_regs {
0790 #ifdef CONFIG_32BIT
0791         /* Pad bytes for argument save space on the stack. */
0792         unsigned long pad0[6];
0793 #endif
0794         /* Saved main processor registers. */
0795         unsigned long regs[32];
0796 
0797         /* Saved special registers. */
0798         unsigned long cp0_status;
0799         unsigned long hi;
0800         unsigned long lo;
0801 #ifdef CONFIG_CPU_HAS_SMARTMIPS
0802         unsigned long acx;
0803 #endif
0804         unsigned long cp0_badvaddr;
0805         unsigned long cp0_cause;
0806         unsigned long cp0_epc;
0807 #ifdef CONFIG_MIPS_MT_SMTC
0808         unsigned long cp0_tcstatus;
0809 #endif /* CONFIG_MIPS_MT_SMTC */
0810 #ifdef CONFIG_CPU_CAVIUM_OCTEON
0811         unsigned long long mpl[3];        /* MTM{0,1,2} */
0812         unsigned long long mtp[3];        /* MTP{0,1,2} */
0813 #endif
0814 } __attribute__ ((aligned (8)));
0815 
0816 #define VKI_PTRACE_GETREGS            12
0817 #define VKI_PTRACE_SETREGS            13
0818 #define VKI_PTRACE_GETFPREGS          14
0819 #define VKI_PTRACE_SETFPREGS          15
0820 //----------------------------------------------------------------------
0821 // From linux-4.5/arch/mips/include/uapi/asm/reg.h
0822 //----------------------------------------------------------------------
0823 #define VKI_MIPS32_EF_R0               6
0824 #define VKI_MIPS32_EF_R1               7
0825 #define VKI_MIPS32_EF_R2               8
0826 #define VKI_MIPS32_EF_R3               9
0827 #define VKI_MIPS32_EF_R4              10
0828 #define VKI_MIPS32_EF_R5              11
0829 #define VKI_MIPS32_EF_R6              12
0830 #define VKI_MIPS32_EF_R7              13
0831 #define VKI_MIPS32_EF_R8              14
0832 #define VKI_MIPS32_EF_R9              15
0833 #define VKI_MIPS32_EF_R10             16
0834 #define VKI_MIPS32_EF_R11             17
0835 #define VKI_MIPS32_EF_R12             18
0836 #define VKI_MIPS32_EF_R13             19
0837 #define VKI_MIPS32_EF_R14             20
0838 #define VKI_MIPS32_EF_R15             21
0839 #define VKI_MIPS32_EF_R16             22
0840 #define VKI_MIPS32_EF_R17             23
0841 #define VKI_MIPS32_EF_R18             24
0842 #define VKI_MIPS32_EF_R19             25
0843 #define VKI_MIPS32_EF_R20             26
0844 #define VKI_MIPS32_EF_R21             27
0845 #define VKI_MIPS32_EF_R22             28
0846 #define VKI_MIPS32_EF_R23             29
0847 #define VKI_MIPS32_EF_R24             30
0848 #define VKI_MIPS32_EF_R25             31
0849 #define VKI_MIPS32_EF_R26             32
0850 #define VKI_MIPS32_EF_R27             33
0851 #define VKI_MIPS32_EF_R28             34
0852 #define VKI_MIPS32_EF_R29             35
0853 #define VKI_MIPS32_EF_R30             36
0854 #define VKI_MIPS32_EF_R31             37
0855 #define VKI_MIPS32_EF_LO              38
0856 #define VKI_MIPS32_EF_HI              39
0857 #define VKI_MIPS32_EF_CP0_EPC         40
0858 #define VKI_MIPS32_EF_CP0_BADVADDR    41
0859 #define VKI_MIPS32_EF_CP0_STATUS      42
0860 #define VKI_MIPS32_EF_CP0_CAUSE       43
0861 #define VKI_MIPS32_EF_UNUSED0         44
0862 
0863 //----------------------------------------------------------------------
0864 // From linux-4.5/arch/mips/include/asm/elf.h
0865 //----------------------------------------------------------------------
0866 typedef unsigned long vki_elf_greg_t;
0867 
0868 #define VKI_ELF_NGREG      45
0869 #define VKI_ELF_NFPREG     33 /* includes fpscr */
0870 
0871 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0872 
0873 typedef double vki_elf_fpreg_t;
0874 typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
0875 
0876 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
0877 
0878 #define VKI_AT_SYSINFO      32
0879 //----------------------------------------------------------------------
0880 // From linux-2.6.35.5/include/asm-generic/siginfo.h
0881 //----------------------------------------------------------------------
0882 #define HAVE_ARCH_SIGINFO_T
0883 
0884 typedef union vki_sigval {
0885     int sival_int;
0886     void __user *sival_ptr;
0887 } vki_sigval_t;
0888 
0889 #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE
0890 #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
0891 #endif
0892 
0893 #define VKI_SI_MAX_SIZE 128
0894 
0895 #ifndef VKI_SI_PAD_SIZE
0896 #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
0897 #endif
0898 
0899 #ifndef __VKI_ARCH_SI_UID_T
0900 #define __VKI_ARCH_SI_UID_T vki_uid_t
0901 #endif
0902 
0903 #ifndef __VKI_ARCH_SI_BAND_T
0904 #define __VKI_ARCH_SI_BAND_T long
0905 #endif
0906 
0907 typedef struct vki_siginfo {
0908         int si_signo;
0909         int si_code;
0910         int si_errno;
0911         int __pad0[VKI_SI_MAX_SIZE / sizeof(int) - VKI_SI_PAD_SIZE - 3];
0912 
0913         union {
0914                 int _pad[VKI_SI_PAD_SIZE];
0915 
0916                 /* kill() */
0917                 struct {
0918                         vki_pid_t _pid;             /* sender's pid */
0919                         __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0920                 } _kill;
0921 
0922                 /* POSIX.1b timers */
0923                 struct {
0924                         vki_timer_t _tid;           /* timer id */
0925                         int _overrun;           /* overrun count */
0926                         char _pad[sizeof( __VKI_ARCH_SI_UID_T) - sizeof(int)];
0927                         vki_sigval_t _sigval;       /* same as below */
0928                         int _sys_private;       /* not to be passed to user */
0929                 } _timer;
0930 
0931                 /* POSIX.1b signals */
0932                 struct {
0933                         vki_pid_t _pid;             /* sender's pid */
0934                         __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0935                         vki_sigval_t _sigval;
0936                 } _rt;
0937 
0938                 /* SIGCHLD */
0939                 struct {
0940                         vki_pid_t _pid;             /* which child */
0941                         __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0942                         int _status;            /* exit code */
0943                         vki_clock_t _utime;
0944                         vki_clock_t _stime;
0945                 } _sigchld;
0946 
0947                 /* IRIX SIGCHLD */
0948                 struct {
0949                         vki_pid_t _pid;             /* which child */
0950                         vki_clock_t _utime;
0951                         int _status;            /* exit code */
0952                         vki_clock_t _stime;
0953                 } _irix_sigchld;
0954 
0955                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
0956                 struct {
0957                         void __user *_addr; /* faulting insn/memory ref. */
0958 #ifdef __ARCH_SI_TRAPNO
0959                         int _trapno;    /* TRAP # which caused the signal */
0960 #endif
0961                 } _sigfault;
0962 
0963                 /* SIGPOLL, SIGXFSZ (To do ...)  */
0964                 struct {
0965                         __VKI_ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
0966                         int _fd;
0967                 } _sigpoll;
0968         } _sifields;
0969 } vki_siginfo_t;
0970 
0971 //----------------------------------------------------------------------
0972 // From linux-2.6.35.5/include/asm/break.h
0973 //----------------------------------------------------------------------
0974 #define VKI_BRK_OVERFLOW         6    /* Overflow check */
0975 #define VKI_BRK_DIVZERO          7    /* Divide by zero check */
0976 
0977 //----------------------------------------------------------------------
0978 // From linux-3.6.35.5/arch/mips/include/socket.h
0979 //----------------------------------------------------------------------
0980 enum vki_sock_type {
0981         VKI_SOCK_STREAM = 2,
0982         // [[others omitted]]
0983 };
0984 #define ARCH_HAS_SOCKET_TYPES 1
0985 
0986 //----------------------------------------------------------------------
0987 // From linux-3.7.0/arch/mips/include/uapi/asm/errno.h
0988 //----------------------------------------------------------------------
0989 
0990 #define VKI_ELIBBAD      84  /* Accessing a corrupted shared library */
0991 #define VKI_EOPNOTSUPP   122 /* Operation not supported on transport
0992                                  endpoint */
0993 
0994 //----------------------------------------------------------------------
0995 // From linux-3.13.0/include/asm/errno.h
0996 //----------------------------------------------------------------------
0997 
0998 #define VKI_ENOSYS       89  /* Function not implemented */
0999 #define VKI_EOVERFLOW    79  /* Value too large for defined data type */
1000 
1001 //----------------------------------------------------------------------
1002 // From linux-3.14.0/arch/mips/include/asm/elf.h
1003 //----------------------------------------------------------------------
1004 
1005 #define VKI_EF_MIPS_FP64    0x00000200
1006 
1007 //----------------------------------------------------------------------
1008 // From linux-4.1.0/arch/mips/include/asm/elf.h
1009 //----------------------------------------------------------------------
1010 
1011 #define VKI_MIPS_ABI_FP_UNKNOWN (-1)
1012 #define VKI_MIPS_ABI_FP_ANY       0  /* FP ABI doesn't matter */
1013 #define VKI_MIPS_ABI_FP_DOUBLE    1  /* -mdouble-float */
1014 #define VKI_MIPS_ABI_FP_SINGLE    2  /* -msingle-float */
1015 #define VKI_MIPS_ABI_FP_SOFT      3  /* -msoft-float */
1016 #define VKI_MIPS_ABI_FP_OLD_64    4  /* -mips32r2 -mfp64 */
1017 #define VKI_MIPS_ABI_FP_XX        5  /* -mfpxx */
1018 #define VKI_MIPS_ABI_FP_64        6  /* -mips32r2 -mfp64 */
1019 #define VKI_MIPS_ABI_FP_64A       7  /* -mips32r2 -mfp64 -mno-odd-spreg */
1020 
1021 struct vki_arch_elf_state {
1022    int fp_abi;
1023    int interp_fp_abi;
1024    int overall_fp_mode;
1025 };
1026 
1027 #define VKI_INIT_ARCH_ELF_STATE {             \
1028    .fp_abi = VKI_MIPS_ABI_FP_UNKNOWN,         \
1029    .interp_fp_abi = VKI_MIPS_ABI_FP_UNKNOWN,  \
1030    .overall_fp_mode = -1,                     \
1031 }
1032 
1033 struct vki_mips_elf_abiflags_v0 {
1034    vki_u16 version;     /* Version of flags structure */
1035    vki_u8  isa_level;   /* The level of the ISA: 1-5, 32, 64 */
1036    vki_u8  isa_rev;     /* The revision of ISA: 0 for MIPS V and below,
1037                            1-n otherwise */
1038    vki_u8  gpr_size;    /* The size of general purpose registers */
1039    vki_u8  cpr1_size;   /* The size of co-processor 1 registers */
1040    vki_u8  cpr2_size;   /* The size of co-processor 2 registers */
1041    vki_u8  fp_abi;      /* The floating-point ABI */
1042    vki_u32 isa_ext;     /* Mask of processor-specific extensions */
1043    vki_u32 ases;        /* Mask of ASEs used */
1044    vki_u32 flags1;      /* Mask of general flags */
1045    vki_u32 flags2;
1046 };
1047 
1048 #define VKI_PT_MIPS_ABIFLAGS   0x70000003
1049 
1050 //----------------------------------------------------------------------
1051 // From linux-4.1.0/arch/mips/kernel/elf.c
1052 //----------------------------------------------------------------------
1053 
1054 enum {
1055    VKI_FP_FRE,
1056    VKI_FP_FR0,
1057    VKI_FP_FR1,
1058 };
1059 
1060 #endif // __VKI_MIPS32_LINUX_H
1061 
1062 /*--------------------------------------------------------------------*/
1063 /*--- end                                       vki-mips32-linux.h ---*/
1064 /*--------------------------------------------------------------------*/