Back to home page

EIC code displayed by LXR

 
 

    


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

0001 
0002 /*--------------------------------------------------------------------*/
0003 /*-- nanoMIPS/Linux-specific kernel interface  vki-nanomips-linux.h --*/
0004 /*--------------------------------------------------------------------*/
0005 
0006 /*
0007    This file is part of Valgrind, a dynamic binary instrumentation
0008    framework.
0009 
0010    Copyright (C) 2018 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, write to the Free Software
0024    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
0025    02111-1307, USA.
0026 
0027    The GNU General Public License is contained in the file COPYING.
0028 */
0029 
0030 #ifndef __VKI_NANOMIPS_LINUX_H
0031 #define __VKI_NANOMIPS_LINUX_H
0032 
0033 #include <config.h>
0034 
0035 #if defined (_MIPSEL)
0036 #define VKI_LITTLE_ENDIAN    1
0037 #elif defined (_MIPSEB)
0038 #define VKI_BIG_ENDIAN       1
0039 #endif
0040 
0041 #define VKI_PAGE_MASK        (~(VKI_PAGE_SIZE - 1))
0042 #define VKI_MAX_PAGE_SHIFT   16
0043 #define VKI_MAX_PAGE_SIZE    (1UL << VKI_MAX_PAGE_SHIFT)
0044 
0045 #define VKI_SIGHUP           1
0046 #define VKI_SIGINT           2
0047 #define VKI_SIGQUIT          3
0048 #define VKI_SIGILL           4
0049 #define VKI_SIGTRAP          5
0050 #define VKI_SIGABRT          6
0051 #define VKI_SIGIOT           6
0052 #define VKI_SIGBUS           7
0053 #define VKI_SIGFPE           8
0054 #define VKI_SIGKILL          9
0055 #define VKI_SIGUSR1          10
0056 #define VKI_SIGSEGV          11
0057 #define VKI_SIGUSR2          12
0058 #define VKI_SIGPIPE          13
0059 #define VKI_SIGALRM          14
0060 #define VKI_SIGTERM          15
0061 #define VKI_SIGSTKFLT        16
0062 #define VKI_SIGCHLD          17
0063 #define VKI_SIGCONT          18
0064 #define VKI_SIGSTOP          19
0065 #define VKI_SIGTSTP          20
0066 #define VKI_SIGTTIN          21
0067 #define VKI_SIGTTOU          22
0068 #define VKI_SIGURG           23
0069 #define VKI_SIGXCPU          24
0070 #define VKI_SIGXFSZ          25
0071 #define VKI_SIGVTALRM        26
0072 #define VKI_SIGPROF          27
0073 #define VKI_SIGWINCH         28
0074 #define VKI_SIGIO            29
0075 #define VKI_SIGPWR           30
0076 #define VKI_SIGSYS           31
0077 #define VKI_SIGRTMIN         32
0078 
0079 #define VKI_SIG_BLOCK        0    /* for blocking signals */
0080 #define VKI_SIG_UNBLOCK      1    /* for unblocking signals */
0081 #define VKI_SIG_SETMASK      2    /* for setting the signal mask */
0082 
0083 /* default signal handling */
0084 #define VKI_SIG_DFL  ((__vki_sighandler_t)0)
0085 /* ignore signal */
0086 #define VKI_SIG_IGN  ((__vki_sighandler_t)1)
0087 
0088 #define VKI_SIGRTMAX         _VKI_NSIG
0089 #define VKI_MINSIGSTKSZ      2048
0090 #define _VKI_NSIG            64
0091 #define _VKI_NSIG_BPW        32
0092 #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
0093 
0094 #define VKI_SA_NOCLDSTOP     0x00000001
0095 #define VKI_SA_NOCLDWAIT     0x00000002
0096 #define VKI_SA_SIGINFO       0x00000004
0097 #define VKI_SA_ONSTACK       0x08000000
0098 #define VKI_SA_RESTART       0x10000000
0099 #define VKI_SA_NODEFER       0x40000000
0100 #define VKI_SA_RESETHAND     0x80000000
0101 #define VKI_SA_RESTORER      0x04000000
0102 #define VKI_SA_NOMASK        VKI_SA_NODEFER
0103 #define VKI_SA_ONESHOT       VKI_SA_RESETHAND
0104 
0105 #define VKI_SS_ONSTACK       1
0106 #define VKI_SS_DISABLE       2
0107 
0108 #define VKI_PROT_NONE        0x0       /* No page permissions */
0109 #define VKI_PROT_READ        0x1       /* page can be read */
0110 #define VKI_PROT_WRITE       0x2       /* page can be written */
0111 #define VKI_PROT_EXEC        0x4       /* page can be executed */
0112 #define VKI_PROT_GROWSDOWN   0x1000000 /* mprotect flag: extend change to start
0113                                                          of growsdown vma */
0114 #define VKI_PROT_GROWSUP     0x2000000 /* mprotect flag: extend change to end
0115                                                          of growsup vma */
0116 #define VKI_MAP_SHARED       0x01      /* Share changes */
0117 #define VKI_MAP_PRIVATE      0x02      /* Changes are private */
0118 #define VKI_MAP_TYPE         0x0f      /* Mask for type of mapping */
0119 #define VKI_MAP_FIXED        0x10      /* Interpret addr exactly */
0120 #define VKI_MAP_ANONYMOUS    0x0800    /* don't use a file */
0121 #define VKI_MAP_GROWSDOWN    0x1000    /* stack-like segment */
0122 #define VKI_MAP_DENYWRITE    0x2000    /* ETXTBSY */
0123 #define VKI_MAP_EXECUTABLE   0x4000    /* mark it as an executable */
0124 #define VKI_MAP_LOCKED       0x8000    /* pages are locked */
0125 #define VKI_MAP_NORESERVE    0x0400    /* don't check for reservations */
0126 #define VKI_MAP_POPULATE     0x10000   /* populate (prefault) pagetables */
0127 #define VKI_MAP_NONBLOCK     0x20000   /* do not block on IO */
0128 
0129 #define VKI_O_ACCMODE        03
0130 #define VKI_O_RDONLY         00
0131 #define VKI_O_WRONLY         01
0132 #define VKI_O_RDWR           02
0133 #define VKI_O_APPEND         0x000400
0134 #define VKI_O_DSYNC          0x001000
0135 #define VKI_O_NONBLOCK       0x000800
0136 #define VKI_O_CREAT          0x000040
0137 #define VKI_O_TRUNC          0x000200
0138 #define VKI_O_EXCL           0x000080
0139 #define VKI_O_NOCTTY         0x000100
0140 #define VKI_FASYNC           0x002000
0141 #define VKI_O_LARGEFILE      0x008000
0142 #define __VKI_O_SYNC         0x101000
0143 #define VKI_O_DIRECT         0x004000
0144 #define VKI_O_CLOEXEC        0x080000
0145 
0146 #define VKI_AT_FDCWD         -100
0147 #define VKI_AT_EMPTY_PATH    0x1000
0148 
0149 #define VKI_F_DUPFD          0   /* dup */
0150 #define VKI_F_GETFD          1   /* get close_on_exec */
0151 #define VKI_F_SETFD          2   /* set/clear close_on_exec */
0152 #define VKI_F_GETFL          3   /* get file->f_flags */
0153 #define VKI_F_SETFL          4   /* set file->f_flags */
0154 #define VKI_F_GETLK          5
0155 #define VKI_F_SETLK          6
0156 #define VKI_F_SETLKW         7
0157 #define VKI_F_SETOWN         8   /*  for sockets. */
0158 #define VKI_F_GETOWN         9   /*  for sockets. */
0159 #define VKI_F_SETSIG         10  /*  for sockets. */
0160 #define VKI_F_GETSIG         11  /*  for sockets. */
0161 #define VKI_F_GETLK64        12
0162 #define VKI_F_SETLK64        13
0163 #define VKI_F_SETLKW64       14
0164 #define VKI_F_SETOWN_EX      15
0165 #define VKI_F_GETOWN_EX      16
0166 #define VKI_F_OFD_GETLK      36
0167 #define VKI_F_OFD_SETLK      37
0168 #define VKI_F_OFD_SETLKW     38
0169 #define VKI_F_LINUX_SPECIFIC_BASE 1024
0170 
0171 #define VKI_FD_CLOEXEC       1
0172 
0173 #define VKI_RLIMIT_DATA      2   /* max data size */
0174 #define VKI_RLIMIT_STACK     3   /* max stack size */
0175 #define VKI_RLIMIT_CORE      4   /* max core file size */
0176 #define VKI_RLIMIT_NOFILE    7   /* max number of open files */
0177 
0178 #define VKI_SOL_SOCKET       0xffff
0179 
0180 #define VKI_SO_TYPE          0x1008
0181 
0182 #define _VKI_IOC_NRBITS      8
0183 #define _VKI_IOC_TYPEBITS    8
0184 #define _VKI_IOC_SIZEBITS    13
0185 #define _VKI_IOC_DIRBITS     3
0186 
0187 #define _VKI_IOC_NRMASK      ((1 << _VKI_IOC_NRBITS)-1)
0188 #define _VKI_IOC_TYPEMASK    ((1 << _VKI_IOC_TYPEBITS)-1)
0189 #define _VKI_IOC_SIZEMASK    ((1 << _VKI_IOC_SIZEBITS)-1)
0190 #define _VKI_IOC_DIRMASK     ((1 << _VKI_IOC_DIRBITS)-1)
0191 
0192 #define _VKI_IOC_NRSHIFT     0
0193 #define _VKI_IOC_TYPESHIFT   (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
0194 #define _VKI_IOC_SIZESHIFT   (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
0195 #define _VKI_IOC_DIRSHIFT    (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
0196 
0197 #define _VKI_IOC_NONE        1U
0198 #define _VKI_IOC_READ        2U
0199 #define _VKI_IOC_WRITE       4U
0200 
0201 #define _VKI_IOC(a,b,c,d)    (((a)<<29) | ((b)<<8) | (c) | ((d)<<16))
0202 
0203 #define _VKI_IO(type,nr)        _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
0204 #define _VKI_IOR(type,nr,size)  _VKI_IOC(_VKI_IOC_READ,(type),(nr), \
0205                                         (_VKI_IOC_TYPECHECK(size)))
0206 #define _VKI_IOW(type,nr,size)  _VKI_IOC(_VKI_IOC_WRITE,(type),(nr), \
0207                                         (_VKI_IOC_TYPECHECK(size)))
0208 #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type), \
0209                                         (nr),(_VKI_IOC_TYPECHECK(size)))
0210 
0211 #define _VKI_IOC_DIR(nr)   (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
0212 #define _VKI_IOC_TYPE(nr)  (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
0213 #define _VKI_IOC_NR(nr)    (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
0214 #define _VKI_IOC_SIZE(nr)  (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
0215 
0216 #define VKI_TCGETA           0x5401
0217 #define VKI_TCSETA           0x5402
0218 #define VKI_TCSETAW          0x5403
0219 #define VKI_TCSETAF          0x5404
0220 #define VKI_TCSBRK           0x5405
0221 #define VKI_TCXONC           0x5406
0222 #define VKI_TCFLSH           0x5407
0223 #define VKI_TCGETS           0x540D
0224 #define VKI_TCSETS           0x540E
0225 #define VKI_TCSETSW          0x540F
0226 #define VKI_TCSETSF          0x5410
0227 
0228 #define VKI_FIONREAD         0x467F
0229 #define VKI_FIOCLEX          0x6601
0230 #define VKI_FIONCLEX         0x6602
0231 #define VKI_FIOASYNC         0x667D
0232 #define VKI_FIONBIO          0x667E
0233 #define VKI_FIOQSIZE         0x667F
0234 
0235 #define VKI_TIOCSBRK         0x5427 /* BSD compatibility */
0236 #define VKI_TIOCCBRK         0x5428 /* BSD compatibility */
0237 #define VKI_TIOCPKT          0x5470 /* pty: set/clear packet mode */
0238 #define VKI_TIOCNOTTY        0x5471
0239 #define VKI_TIOCSTI          0x5472 /* simulate terminal input */
0240 #define VKI_TIOCSCTTY        0x5480 /* become controlling tty */
0241 #define VKI_TIOCGSOFTCAR     0x5481
0242 #define VKI_TIOCSSOFTCAR     0x5482
0243 #define VKI_TIOCLINUX        0x5483
0244 #define VKI_TIOCGSERIAL      0x5484
0245 #define VKI_TIOCSSERIAL      0x5485
0246 #define VKI_TCSBRKP          0x5486 /* Needed for POSIX tcsendbreak() */
0247 #define VKI_TIOCSERCONFIG    0x5488
0248 #define VKI_TIOCSERGWILD     0x5489
0249 #define VKI_TIOCSERSWILD     0x548a
0250 #define VKI_TIOCGLCKTRMIOS   0x548b
0251 #define VKI_TIOCSLCKTRMIOS   0x548c
0252 #define VKI_TIOCSERGSTRUCT   0x548d /* For debugging only */
0253 #define VKI_TIOCSERGETLSR    0x548e /* Get line status register */
0254 #define VKI_TIOCSERGETMULTI  0x548f /* Get multiport config  */
0255 #define VKI_TIOCSERSETMULTI  0x5490 /* Set multiport config */
0256 #define VKI_TIOCMIWAIT       0x5491 /* wait for a change on serial input line(s) */
0257 #define VKI_TIOCGICOUNT      0x5492 /* read serial port inline interrupt counts */
0258 #define VKI_TIOCGHAYESESP    0x5493 /* Get Hayes ESP configuration */
0259 #define VKI_TIOCSHAYESESP    0x5494 /* Set Hayes ESP configuration */
0260 #define VKI_TIOCGETD         0x7400
0261 #define VKI_TIOCSETD         0x7401
0262 #define VKI_TIOCGETP         0x7408
0263 #define VKI_TIOCSETP         0x7409
0264 #define VKI_TIOCSETN         0x740A /* TIOCSETP wo flush */
0265 #define VKI_TIOCEXCL         0x740D /* set exclusive use of tty */
0266 #define VKI_TIOCNXCL         0x740E /* reset exclusive use of tty */
0267 #define VKI_TIOCGSID         0x7416 /* Return the session ID of FD */
0268 #define VKI_TIOCMSET         0x741A /* set all modem bits */
0269 #define VKI_TIOCMBIS         0x741B /* bis modem bits */
0270 #define VKI_TIOCMBIC         0x741C /* bic modem bits */
0271 #define VKI_TIOCMGET         0x741D /* get all modem bits */
0272 #define VKI_TIOCOUTQ         0x7472 /* output queue size */
0273 #define VKI_TIOCGLTC         0x7474
0274 #define VKI_TIOCSLTC         0x7475
0275 #define VKI_TIOCINQ          VKI_FIONREAD
0276 
0277 #define VKI_TIOCSWINSZ  _VKI_IOW('t', 103, struct vki_winsize)
0278 #define VKI_TIOCGWINSZ  _VKI_IOR('t', 104, struct vki_winsize)
0279 #define VKI_TIOCSPGRP   _VKI_IOW('t', 118, int)
0280 #define VKI_TIOCGPGRP   _VKI_IOR('t', 119, int)
0281 #define VKI_TIOCCONS    _VKI_IOW('t', 120, int)
0282 #define VKI_TIOCGPTN    _VKI_IOR('T',0x30, unsigned int)
0283 #define VKI_TIOCSPTLCK  _VKI_IOW('T',0x31, int)
0284 
0285 #define VKI_TIOCPKT_DATA       0x00    /* data packet */
0286 #define VKI_TIOCPKT_FLUSHREAD  0x01    /* flush packet */
0287 #define VKI_TIOCPKT_FLUSHWRITE 0x02    /* flush packet */
0288 #define VKI_TIOCPKT_STOP       0x04    /* stop output */
0289 #define VKI_TIOCPKT_START      0x08    /* start output */
0290 #define VKI_TIOCPKT_NOSTOP     0x10    /* no more ^S, ^Q */
0291 #define VKI_TIOCPKT_DOSTOP     0x20    /* now do ^S ^Q */
0292 
0293 #define NCC                  8
0294 #define NCCS                 23
0295 
0296 #define VKI_SO_ATTACH_FILTER 26
0297 
0298 #define VKI_SIOCATMARK  _VKI_IOR('s', 7, int)
0299 #define VKI_SIOCSPGRP   _VKI_IOW('s', 8, vki_pid_t)
0300 #define VKI_SIOCGPGRP   _VKI_IOR('s', 9, vki_pid_t)
0301 #define VKI_SIOCGSTAMP       0x8906
0302 #define VKI_SIOCGSTAMPNS     0x8907
0303 
0304 #define VKI_POLLIN           0x0001
0305 
0306 #define VKI_SEMOP            1
0307 #define VKI_SEMGET           2
0308 #define VKI_SEMCTL           3
0309 #define VKI_SEMTIMEDOP       4
0310 #define VKI_MSGSND           11
0311 #define VKI_MSGRCV           12
0312 #define VKI_MSGGET           13
0313 #define VKI_MSGCTL           14
0314 #define VKI_SHMAT            21
0315 #define VKI_SHMDT            22
0316 #define VKI_SHMGET           23
0317 #define VKI_SHMCTL           24
0318 #define VKI_SHMLBA           0x40000
0319 
0320 #define VKI_EF_NANOMIPS_ABI     0x0000F000
0321 #define VKI_EF_NANOMIPS_ABI_P32 0x00001000
0322 
0323 #define VKI_PTRACE_GETREGS   12
0324 #define VKI_PTRACE_SETREGS   13
0325 #define VKI_PTRACE_GETFPREGS 14
0326 #define VKI_PTRACE_SETFPREGS 15
0327 
0328 #define VKI_MIPS32_EF_R0     6
0329 #define VKI_MIPS32_EF_R1     7
0330 #define VKI_MIPS32_EF_R2     8
0331 #define VKI_MIPS32_EF_R3     9
0332 #define VKI_MIPS32_EF_R4     10
0333 #define VKI_MIPS32_EF_R5     11
0334 #define VKI_MIPS32_EF_R6     12
0335 #define VKI_MIPS32_EF_R7     13
0336 #define VKI_MIPS32_EF_R8     14
0337 #define VKI_MIPS32_EF_R9     15
0338 #define VKI_MIPS32_EF_R10    16
0339 #define VKI_MIPS32_EF_R11    17
0340 #define VKI_MIPS32_EF_R12    18
0341 #define VKI_MIPS32_EF_R13    19
0342 #define VKI_MIPS32_EF_R14    20
0343 #define VKI_MIPS32_EF_R15    21
0344 #define VKI_MIPS32_EF_R16    22
0345 #define VKI_MIPS32_EF_R17    23
0346 #define VKI_MIPS32_EF_R18    24
0347 #define VKI_MIPS32_EF_R19    25
0348 #define VKI_MIPS32_EF_R20    26
0349 #define VKI_MIPS32_EF_R21    27
0350 #define VKI_MIPS32_EF_R22    28
0351 #define VKI_MIPS32_EF_R23    29
0352 #define VKI_MIPS32_EF_R24    30
0353 #define VKI_MIPS32_EF_R25    31
0354 #define VKI_MIPS32_EF_R26    32
0355 #define VKI_MIPS32_EF_R27    33
0356 #define VKI_MIPS32_EF_R28    34
0357 #define VKI_MIPS32_EF_R29    35
0358 #define VKI_MIPS32_EF_R30    36
0359 #define VKI_MIPS32_EF_R31    37
0360 
0361 #define VKI_MIPS32_EF_CP0_EPC      40
0362 #define VKI_MIPS32_EF_CP0_BADVADDR 41
0363 #define VKI_MIPS32_EF_CP0_STATUS   42
0364 #define VKI_MIPS32_EF_CP0_CAUSE    43
0365 #define VKI_MIPS32_EF_UNUSED0      44
0366 
0367 #define VKI_ELF_NGREG        45
0368 #define VKI_ELF_NFPREG       1 /* Not used. Just to satisfy compiler. */
0369 
0370 #define VKI_AT_SYSINFO       32
0371 
0372 #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE
0373 #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
0374 #endif
0375 
0376 #define VKI_SI_MAX_SIZE 128
0377 
0378 #ifndef VKI_SI_PAD_SIZE
0379 #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) \
0380                          / sizeof(int))
0381 #endif
0382 
0383 #ifndef __VKI_ARCH_SI_UID_T
0384 #define __VKI_ARCH_SI_UID_T   vki_uid_t
0385 #endif
0386 
0387 #ifndef __VKI_ARCH_SI_BAND_T
0388 #define __VKI_ARCH_SI_BAND_T long
0389 #endif
0390 
0391 #define VKI_BRK_OVERFLOW     6   /* Overflow check */
0392 #define VKI_BRK_DIVZERO      7   /* Divide by zero check */
0393 
0394 #define VKI_ELIBBAD          84  /* Accessing a corrupted shared library */
0395 #define VKI_EOPNOTSUPP       122 /* Operation not supported on transport
0396                                     endpoint */
0397 #define VKI_ENOSYS           38  /* Function not implemented */
0398 #define VKI_EOVERFLOW        75  /* Value too large for defined data type */
0399 
0400 #define ARCH_HAS_SOCKET_TYPES 1
0401 #define HAVE_ARCH_SIGINFO_T   1
0402 
0403 #define VKI_RLIM_INFINITY 0x7fffffffUL
0404 
0405 typedef __signed__ char __vki_s8;
0406 typedef unsigned   char __vki_u8;
0407 
0408 typedef __signed__ short __vki_s16;
0409 typedef unsigned   short __vki_u16;
0410 
0411 typedef __signed__ int __vki_s32;
0412 typedef unsigned   int __vki_u32;
0413 
0414 typedef __signed__ long long __vki_s64;
0415 typedef unsigned   long long __vki_u64;
0416 
0417 typedef __signed char vki_s8;
0418 typedef unsigned char vki_u8;
0419 
0420 typedef __signed short vki_s16;
0421 typedef unsigned short vki_u16;
0422 
0423 typedef __signed int vki_s32;
0424 typedef unsigned int vki_u32;
0425 
0426 typedef void __vki_signalfn_t(int);
0427 typedef __vki_signalfn_t __user *__vki_sighandler_t;
0428 
0429 typedef void __vki_restorefn_t(void);
0430 typedef __vki_restorefn_t __user *__vki_sigrestore_t;
0431 
0432 typedef unsigned long vki_old_sigset_t;
0433 
0434 typedef struct {
0435    unsigned long sig[_VKI_NSIG_WORDS];
0436 } vki_sigset_t;
0437 
0438 struct vki_old_sigaction {
0439    __vki_sighandler_t ksa_handler;
0440    unsigned int sa_flags;
0441    vki_old_sigset_t sa_mask;
0442    __vki_sigrestore_t sa_restorer;
0443 };
0444 
0445 struct vki_sigaction_base {
0446    __vki_sighandler_t ksa_handler;
0447    unsigned int sa_flags;
0448    vki_sigset_t sa_mask;
0449    __vki_sigrestore_t sa_restorer;
0450 };
0451 
0452 // On Linux we use the same type for passing sigactions to
0453 // and from the kernel.  Hence: */
0454 typedef  struct vki_sigaction_base  vki_sigaction_toK_t;
0455 typedef  struct vki_sigaction_base  vki_sigaction_fromK_t;
0456 
0457 typedef struct vki_sigaltstack {
0458    void __user *ss_sp;
0459    int ss_flags;
0460    vki_size_t ss_size;
0461 } vki_stack_t;
0462 
0463 struct vki_sigcontext {
0464    __vki_u64 sc_regs[32];
0465    __vki_u64 sc_pc;
0466    __vki_u32 sc_used_math;
0467    __vki_u32 sc_reserved;
0468 };
0469 
0470 struct vki_winsize {
0471    unsigned short ws_row;
0472    unsigned short ws_col;
0473    unsigned short ws_xpixel;
0474    unsigned short ws_ypixel;
0475 };
0476 
0477 struct vki_termio {
0478    unsigned short c_iflag;   /* input mode flags */
0479    unsigned short c_oflag;   /* output mode flags */
0480    unsigned short c_cflag;   /* control mode flags */
0481    unsigned short c_lflag;   /* local mode flags */
0482    char c_line;              /* line discipline */
0483    unsigned char c_cc[NCCS]; /* control characters */
0484 };
0485 
0486 typedef unsigned char   vki_cc_t;
0487 typedef unsigned long   vki_speed_t;
0488 typedef unsigned long   vki_tcflag_t;
0489 
0490 struct vki_termios {
0491    vki_tcflag_t c_iflag;     /* input mode flags */
0492    vki_tcflag_t c_oflag;     /* output mode flags */
0493    vki_tcflag_t c_cflag;     /* control mode flags */
0494    vki_tcflag_t c_lflag;     /* local mode flags */
0495    vki_cc_t c_line;          /* line discipline */
0496    vki_cc_t c_cc[NCCS];      /* control characters */
0497 };
0498 
0499 struct vki_f_owner_ex {
0500    int type;
0501    __vki_kernel_pid_t pid;
0502 };
0503 
0504 struct vki_pollfd {
0505    int fd;
0506    short events;
0507    short revents;
0508 };
0509 
0510 struct vki_ucontext {
0511    unsigned long uc_flags;
0512    struct vki_ucontext *uc_link;
0513    vki_stack_t uc_stack;
0514    struct vki_sigcontext uc_mcontext;
0515    vki_sigset_t uc_sigmask; /* mask last for extensibility */
0516 };
0517 
0518 typedef char vki_modify_ldt_t;
0519 
0520 struct vki_ipc64_perm {
0521    __vki_kernel_key_t  key;
0522    __vki_kernel_uid_t  uid;
0523    __vki_kernel_gid_t  gid;
0524    __vki_kernel_uid_t  cuid;
0525    __vki_kernel_gid_t  cgid;
0526    __vki_kernel_mode_t mode;
0527    unsigned short  seq;
0528    unsigned short  __pad1;
0529    unsigned long   __unused1;
0530    unsigned long   __unused2;
0531 };
0532 
0533 struct vki_semid64_ds {
0534    struct vki_ipc64_perm sem_perm;             /* permissions .. see ipc.h */
0535    __vki_kernel_time_t sem_otime;              /* last semop time */
0536    __vki_kernel_time_t sem_ctime;              /* last change time */
0537    unsigned long sem_nsems;              /* no. of semaphores in array */
0538    unsigned long __unused1;
0539    unsigned long __unused2;
0540 };
0541 
0542 struct vki_msqid64_ds {
0543    struct vki_ipc64_perm msg_perm;
0544    __vki_kernel_time_t msg_stime;   /* last msgsnd time */
0545    unsigned long  __unused1;
0546    __vki_kernel_time_t msg_rtime;   /* last msgrcv time */
0547    unsigned long  __unused2;
0548    __vki_kernel_time_t msg_ctime;   /* last change time */
0549    unsigned long  __unused3;
0550    unsigned long  msg_cbytes; /* current number of bytes on queue */
0551    unsigned long  msg_qnum;   /* number of messages in queue */
0552    unsigned long  msg_qbytes; /* max number of bytes on queue */
0553    __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */
0554    __vki_kernel_pid_t msg_lrpid; /* last receive pid */
0555    unsigned long  __unused4;
0556    unsigned long  __unused5;
0557 };
0558 
0559 struct vki_ipc_kludge {
0560    struct vki_msgbuf __user *msgp;
0561    long msgtyp;
0562 };
0563 
0564 struct vki_shmid64_ds {
0565    struct vki_ipc64_perm       shm_perm;       /* operation perms */
0566    vki_size_t                  shm_segsz;      /* size of segment (bytes) */
0567    __vki_kernel_time_t         shm_atime;      /* last attach time */
0568    __vki_kernel_time_t         shm_dtime;      /* last detach time */
0569    __vki_kernel_time_t         shm_ctime;      /* last change time */
0570    __vki_kernel_pid_t          shm_cpid;       /* pid of creator */
0571    __vki_kernel_pid_t          shm_lpid;       /* pid of last operator */
0572    unsigned long           shm_nattch;     /* no. of current attaches */
0573    unsigned long           __unused1;
0574    unsigned long           __unused2;
0575 };
0576 
0577 struct vki_shminfo64 {
0578    unsigned long   shmmax;
0579    unsigned long   shmmin;
0580    unsigned long   shmmni;
0581    unsigned long   shmseg;
0582    unsigned long   shmall;
0583    unsigned long   __unused1;
0584    unsigned long   __unused2;
0585    unsigned long   __unused3;
0586    unsigned long   __unused4;
0587 };
0588 
0589 typedef unsigned long vki_elf_greg_t;
0590 
0591 typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
0592 
0593 typedef double vki_elf_fpreg_t;
0594 
0595 typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
0596 
0597 typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
0598 
0599 typedef union vki_sigval {
0600    int sival_int;
0601    void __user *sival_ptr;
0602 } vki_sigval_t;
0603 
0604 typedef struct vki_siginfo {
0605    int si_signo;
0606    int si_errno;
0607    int si_code;
0608    int __pad0[VKI_SI_MAX_SIZE / sizeof(int) - VKI_SI_PAD_SIZE - 3];
0609 
0610    union {
0611       int _pad[VKI_SI_PAD_SIZE];
0612 
0613       /* kill() */
0614       struct {
0615          vki_pid_t _pid;             /* sender's pid */
0616          __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0617       } _kill;
0618 
0619       /* POSIX.1b timers */
0620       struct {
0621          vki_timer_t _tid;           /* timer id */
0622          int _overrun;           /* overrun count */
0623          char _pad[sizeof( __VKI_ARCH_SI_UID_T) - sizeof(int)];
0624          vki_sigval_t _sigval;       /* same as below */
0625          int _sys_private;       /* not to be passed to user */
0626       } _timer;
0627 
0628       /* POSIX.1b signals */
0629       struct {
0630          vki_pid_t _pid;             /* sender's pid */
0631          __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0632          vki_sigval_t _sigval;
0633       } _rt;
0634 
0635       /* SIGCHLD */
0636       struct {
0637          vki_pid_t _pid;             /* which child */
0638          __VKI_ARCH_SI_UID_T _uid;   /* sender's uid */
0639          int _status;            /* exit code */
0640          vki_clock_t _utime;
0641          vki_clock_t _stime;
0642       } _sigchld;
0643 
0644       /* IRIX SIGCHLD */
0645       struct {
0646          vki_pid_t _pid;             /* which child */
0647          vki_clock_t _utime;
0648          int _status;            /* exit code */
0649          vki_clock_t _stime;
0650       } _irix_sigchld;
0651 
0652       /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
0653       struct {
0654          void __user *_addr; /* faulting insn/memory ref. */
0655 #ifdef __ARCH_SI_TRAPNO
0656          int _trapno;    /* TRAP # which caused the signal */
0657 #endif
0658       } _sigfault;
0659 
0660       /* SIGPOLL, SIGXFSZ (To do ...)  */
0661       struct {
0662          __VKI_ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
0663          int _fd;
0664       } _sigpoll;
0665    } _sifields;
0666 } vki_siginfo_t;
0667 
0668 enum vki_sock_type {
0669    VKI_SOCK_STREAM = 2,
0670 };
0671 
0672 /* nanoMIPS uses runtime pagesize detection */
0673 extern UWord VKI_PAGE_SHIFT;
0674 extern UWord VKI_PAGE_SIZE;
0675 
0676 #endif
0677 
0678 /*--------------------------------------------------------------------*/
0679 /*--- end                                     vki-nanomips-linux.h ---*/
0680 /*--------------------------------------------------------------------*/