vki-mips32-linux.h 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066
  1. /*--------------------------------------------------------------------*/
  2. /*--- mips/Linux-specific kernel interface. vki-mips32-linux.h ---*/
  3. /*--------------------------------------------------------------------*/
  4. /*
  5. This file is part of Valgrind, a dynamic binary instrumentation
  6. framework.
  7. Copyright (C) 2010-2017 RT-RK
  8. mips-valgrind@rt-rk.com
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License as
  11. published by the Free Software Foundation; either version 2 of the
  12. License, or (at your option) any later version.
  13. This program is distributed in the hope that it will be useful, but
  14. WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. General Public License for more details.
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  20. 02111-1307, USA.
  21. The GNU General Public License is contained in the file COPYING.
  22. */
  23. #ifndef __VKI_MIPS32_LINUX_H
  24. #define __VKI_MIPS32_LINUX_H
  25. #include <config.h>
  26. // mips endian
  27. #if defined (_MIPSEL)
  28. #define VKI_LITTLE_ENDIAN 1
  29. #elif defined (_MIPSEB)
  30. #define VKI_BIG_ENDIAN 1
  31. #endif
  32. //----------------------------------------------------------------------
  33. // From linux-2.6.35.5/include/asm-generic/int-ll64.h
  34. //----------------------------------------------------------------------
  35. typedef __signed__ char __vki_s8;
  36. typedef unsigned char __vki_u8;
  37. typedef __signed__ short __vki_s16;
  38. typedef unsigned short __vki_u16;
  39. typedef __signed__ int __vki_s32;
  40. typedef unsigned int __vki_u32;
  41. typedef __signed char vki_s8;
  42. typedef unsigned char vki_u8;
  43. typedef __signed short vki_s16;
  44. typedef unsigned short vki_u16;
  45. typedef __signed int vki_s32;
  46. typedef unsigned int vki_u32;
  47. typedef __signed__ long long __vki_s64;
  48. typedef unsigned long long __vki_u64;
  49. //----------------------------------------------------------------------
  50. // From linux-2.6.35.5/include/asm-mips/page.h
  51. //----------------------------------------------------------------------
  52. /* MIPS32 uses runtime pagesize detection */
  53. extern UWord VKI_PAGE_SHIFT;
  54. extern UWord VKI_PAGE_SIZE;
  55. #define VKI_PAGE_MASK (~(VKI_PAGE_SIZE-1))
  56. #define VKI_MAX_PAGE_SHIFT 16
  57. #define VKI_MAX_PAGE_SIZE (1UL << VKI_MAX_PAGE_SHIFT)
  58. //----------------------------------------------------------------------
  59. // From linux-2.6.35.9/arch/mips/include/bits/shm.h
  60. //----------------------------------------------------------------------
  61. #define VKI_SHMLBA 0x40000
  62. //----------------------------------------------------------------------
  63. // From linux-2.6.35.5/include/asm/signal.h
  64. //----------------------------------------------------------------------
  65. #define VKI_MINSIGSTKSZ 2048
  66. #define VKI_SIG_BLOCK 1 /* for blocking signals */
  67. #define VKI_SIG_UNBLOCK 2 /* for unblocking signals */
  68. #define VKI_SIG_SETMASK 3 /* for setting the signal mask */
  69. /* Type of a signal handler. */
  70. typedef void __vki_signalfn_t(int);
  71. typedef __vki_signalfn_t __user *__vki_sighandler_t;
  72. typedef void __vki_restorefn_t(void);
  73. typedef __vki_restorefn_t __user *__vki_sigrestore_t;
  74. #define VKI_SIG_DFL ((__vki_sighandler_t)0) /* default signal handling */
  75. #define VKI_SIG_IGN ((__vki_sighandler_t)1) /* ignore signal */
  76. #define _VKI_NSIG 128
  77. #define _VKI_NSIG_BPW 32
  78. #define _VKI_NSIG_WORDS (_VKI_NSIG / _VKI_NSIG_BPW)
  79. typedef unsigned long vki_old_sigset_t; /* at least 32 bits */
  80. typedef struct {
  81. unsigned long sig[_VKI_NSIG_WORDS];
  82. } vki_sigset_t;
  83. #define VKI_SIGHUP 1 /* Hangup (POSIX). */
  84. #define VKI_SIGINT 2 /* Interrupt (ANSI). */
  85. #define VKI_SIGQUIT 3 /* Quit (POSIX). */
  86. #define VKI_SIGILL 4 /* Illegal instruction (ANSI). */
  87. #define VKI_SIGTRAP 5 /* Trace trap (POSIX). */
  88. #define VKI_SIGIOT 6 /* IOT trap (4.2 BSD). */
  89. #define VKI_SIGABRT VKI_SIGIOT /* Abort (ANSI). */
  90. #define VKI_SIGEMT 7
  91. #define VKI_SIGFPE 8 /* Floating-point exception (ANSI). */
  92. #define VKI_SIGKILL 9 /* Kill, unblockable (POSIX). */
  93. #define VKI_SIGBUS 10 /* BUS error (4.2 BSD). */
  94. #define VKI_SIGSEGV 11 /* Segmentation violation (ANSI). */
  95. #define VKI_SIGSYS 12
  96. #define VKI_SIGPIPE 13 /* Broken pipe (POSIX). */
  97. #define VKI_SIGALRM 14 /* Alarm clock (POSIX). */
  98. #define VKI_SIGTERM 15 /* Termination (ANSI). */
  99. #define VKI_SIGUSR1 16 /* User-defined signal 1 (POSIX). */
  100. #define VKI_SIGUSR2 17 /* User-defined signal 2 (POSIX). */
  101. #define VKI_SIGCHLD 18 /* Child status has changed (POSIX). */
  102. #define VKI_SIGCLD VKI_SIGCHLD /* Same as SIGCHLD (System V). */
  103. #define VKI_SIGPWR 19 /* Power failure restart (System V). */
  104. #define VKI_SIGWINCH 20 /* Window size change (4.3 BSD, Sun). */
  105. #define VKI_SIGURG 21 /* Urgent condition on socket (4.2 BSD). */
  106. #define VKI_SIGIO 22 /* I/O now possible (4.2 BSD). */
  107. #define VKI_SIGPOLL VKI_SIGIO /* Pollable event occurred (System V). */
  108. #define VKI_SIGSTOP 23 /* Stop, unblockable (POSIX). */
  109. #define VKI_SIGTSTP 24 /* Keyboard stop (POSIX). */
  110. #define VKI_SIGCONT 25 /* Continue (POSIX). */
  111. #define VKI_SIGTTIN 26 /* Background read from tty (POSIX). */
  112. #define VKI_SIGTTOU 27 /* Background write to tty (POSIX). */
  113. #define VKI_SIGVTALRM 28 /* Virtual alarm clock (4.2 BSD). */
  114. #define VKI_SIGPROF 29 /* Profiling alarm clock (4.2 BSD). */
  115. #define VKI_SIGXCPU 30 /* CPU limit exceeded (4.2 BSD). */
  116. #define VKI_SIGXFSZ 31 /* File size limit exceeded (4.2 BSD). */
  117. /* These should not be considered constants from userland. */
  118. #define VKI_SIGRTMIN 32
  119. // [[This was (_NSIG-1) in 2.4.X... not sure if it matters.]]
  120. #define VKI_SIGRTMAX _VKI_NSIG
  121. #define VKI_SA_ONSTACK 0x08000000
  122. #define VKI_SA_RESETHAND 0x80000000
  123. #define VKI_SA_RESTART 0x10000000
  124. #define VKI_SA_SIGINFO 0x00000008
  125. #define VKI_SA_NODEFER 0x40000000
  126. #define VKI_SA_NOCLDWAIT 0x00010000
  127. #define VKI_SA_NOCLDSTOP 0x00000001
  128. #define VKI_SA_NOMASK VKI_SA_NODEFER
  129. #define VKI_SA_ONESHOT VKI_SA_RESETHAND
  130. //#define VKI_SA_INTERRUPT 0x20000000 /* dummy -- ignored */
  131. #define VKI_SA_RESTORER 0x04000000
  132. #define VKI_SS_ONSTACK 1
  133. #define VKI_SS_DISABLE 2
  134. struct vki_old_sigaction {
  135. // [[Nb: a 'k' prefix is added to "sa_handler" because
  136. // bits/sigaction.h (which gets dragged in somehow via signal.h)
  137. // #defines it as something else. Since that is done for glibc's
  138. // purposes, which we don't care about here, we use our own name.]]
  139. unsigned long sa_flags;
  140. __vki_sighandler_t ksa_handler;
  141. vki_old_sigset_t sa_mask;
  142. __vki_sigrestore_t sa_restorer;
  143. };
  144. struct vki_sigaction {
  145. unsigned int sa_flags;
  146. __vki_sighandler_t sa_handler;
  147. vki_sigset_t sa_mask;
  148. };
  149. struct vki_sigaction_base {
  150. // [[See comment about extra 'k' above]]
  151. unsigned long sa_flags;
  152. __vki_sighandler_t ksa_handler;
  153. vki_sigset_t sa_mask; /* mask last for extensibility */
  154. __vki_sigrestore_t sa_restorer;
  155. };
  156. /* On Linux we use the same type for passing sigactions to
  157. and from the kernel. Hence: */
  158. typedef struct vki_sigaction_base vki_sigaction_toK_t;
  159. typedef struct vki_sigaction_base vki_sigaction_fromK_t;
  160. typedef struct vki_sigaltstack {
  161. void __user *ss_sp;
  162. vki_size_t ss_size;
  163. int ss_flags;
  164. } vki_stack_t;
  165. //----------------------------------------------------------------------
  166. // From 2.6.35.5/include/asm-mips/sigcontext.h
  167. //----------------------------------------------------------------------
  168. struct _vki_fpreg {
  169. unsigned short significand[4];
  170. unsigned short exponent;
  171. };
  172. struct _vki_fpxreg {
  173. unsigned short significand[4];
  174. unsigned short exponent;
  175. unsigned short padding[3];
  176. };
  177. struct _vki_xmmreg {
  178. unsigned long element[4];
  179. };
  180. struct _vki_fpstate {
  181. /* Regular FPU environment */
  182. unsigned long cw;
  183. unsigned long sw;
  184. unsigned long tag;
  185. unsigned long ipoff;
  186. unsigned long cssel;
  187. unsigned long dataoff;
  188. unsigned long datasel;
  189. struct _vki_fpreg _st[8];
  190. unsigned short status;
  191. unsigned short magic; /* 0xffff = regular FPU data only */
  192. /* FXSR FPU environment */
  193. unsigned long _fxsr_env[6]; /* FXSR FPU env is ignored */
  194. unsigned long mxcsr;
  195. unsigned long reserved;
  196. struct _vki_fpxreg _fxsr_st[8]; /* FXSR FPU reg data is ignored */
  197. struct _vki_xmmreg _xmm[8];
  198. unsigned long padding[56];
  199. };
  200. //----------------------------------------------------------------------
  201. // From linux-2.6.35.5/include/asm-mips/sigcontext.h
  202. //----------------------------------------------------------------------
  203. struct vki_sigcontext {
  204. unsigned int sc_regmask; /* Unused */
  205. unsigned int sc_status; /* Unused */
  206. unsigned long long sc_pc;
  207. unsigned long long sc_regs[32];
  208. unsigned long long sc_fpregs[32];
  209. unsigned int sc_acx; /* Was sc_ownedfp */
  210. unsigned int sc_fpc_csr;
  211. unsigned int sc_fpc_eir; /* Unused */
  212. unsigned int sc_used_math;
  213. unsigned int sc_dsp; /* dsp status, was sc_ssflags */
  214. unsigned long long sc_mdhi;
  215. unsigned long long sc_mdlo;
  216. unsigned long sc_hi1; /* Was sc_cause */
  217. unsigned long sc_lo1; /* Was sc_badvaddr */
  218. unsigned long sc_hi2; /* Was sc_sigset[4] */
  219. unsigned long sc_lo2;
  220. unsigned long sc_hi3;
  221. unsigned long sc_lo3;
  222. };
  223. //----------------------------------------------------------------------
  224. // From linux-2.6.35.5/include/asm-mips/mman.h
  225. //----------------------------------------------------------------------
  226. #define VKI_PROT_NONE 0x0 /* No page permissions */
  227. #define VKI_PROT_READ 0x1 /* page can be read */
  228. #define VKI_PROT_WRITE 0x2 /* page can be written */
  229. #define VKI_PROT_EXEC 0x4 /* page can be executed */
  230. #define VKI_PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
  231. #define VKI_PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
  232. #define VKI_MAP_SHARED 0x001 /* Share changes */
  233. #define VKI_MAP_PRIVATE 0x002 /* Changes are private */
  234. #define VKI_MAP_FIXED 0x010 /* Interpret addr exactly */
  235. #define VKI_MAP_NORESERVE 0x0400 /* don't reserve swap pages */
  236. /* These are linux-specific */
  237. #define VKI_MAP_NORESERVE 0x0400 /* don't check for reservations */
  238. #define VKI_MAP_ANONYMOUS 0x0800 /* don't use a file */
  239. #define VKI_MAP_GROWSDOWN 0x1000 /* stack-like segment */
  240. #define VKI_MAP_DENYWRITE 0x2000 /* ETXTBSY */
  241. #define VKI_MAP_EXECUTABLE 0x4000 /* mark it as an executable */
  242. #define VKI_MAP_LOCKED 0x8000 /* pages are locked */
  243. #define VKI_MAP_POPULATE 0x10000 /* populate (prefault) pagetables */
  244. #define VKI_MAP_NONBLOCK 0x20000 /* do not block on IO */
  245. //----------------------------------------------------------------------
  246. // From linux-2.6.35.5/include/asm-mips/fcntl.h
  247. //----------------------------------------------------------------------
  248. #define VKI_O_ACCMODE 03
  249. #define VKI_O_RDONLY 00
  250. #define VKI_O_WRONLY 01
  251. #define VKI_O_RDWR 02
  252. #define VKI_O_CREAT 0x0100 /* not fcntl */
  253. #define VKI_O_EXCL 0x0400 /* not fcntl */
  254. #define VKI_O_TRUNC 0x0200 /* not fcntl */
  255. #define VKI_O_APPEND 0x0008
  256. #define VKI_O_NONBLOCK 0x0080
  257. #define VKI_O_LARGEFILE 0x2000
  258. #define VKI_AT_FDCWD -100
  259. #define VKI_F_DUPFD 0 /* dup */
  260. #define VKI_F_GETFD 1 /* get close_on_exec */
  261. #define VKI_F_SETFD 2 /* set/clear close_on_exec */
  262. #define VKI_F_GETFL 3 /* get file->f_flags */
  263. #define VKI_F_SETFL 4 /* set file->f_flags */
  264. #define VKI_F_GETLK 14
  265. #define VKI_F_SETLK 6
  266. #define VKI_F_SETLKW 7
  267. #define VKI_F_SETOWN 24 /* for sockets. */
  268. #define VKI_F_GETOWN 23 /* for sockets. */
  269. #define VKI_F_SETSIG 10 /* for sockets. */
  270. #define VKI_F_GETSIG 11 /* for sockets. */
  271. #define VKI_F_SETOWN_EX 15
  272. #define VKI_F_GETOWN_EX 16
  273. #define VKI_F_OFD_GETLK 36
  274. #define VKI_F_OFD_SETLK 37
  275. #define VKI_F_OFD_SETLKW 38
  276. #define VKI_F_GETLK64 33 /* using 'struct flock64' */
  277. #define VKI_F_SETLK64 34
  278. #define VKI_F_SETLKW64 35
  279. /* for F_[GET|SET]FL */
  280. #define VKI_FD_CLOEXEC 1 /* actually anything with low bit set goes */
  281. #define VKI_F_LINUX_SPECIFIC_BASE 1024
  282. struct vki_f_owner_ex {
  283. int type;
  284. __vki_kernel_pid_t pid;
  285. };
  286. //----------------------------------------------------------------------
  287. // From linux-2.6.35.5/include/asm-mips/resource.h
  288. //----------------------------------------------------------------------
  289. #define VKI_RLIMIT_DATA 2 /* max data size */
  290. #define VKI_RLIMIT_STACK 3 /* max stack size */
  291. #define VKI_RLIMIT_CORE 4 /* max core file size */
  292. #define VKI_RLIMIT_NOFILE 5 /* max number of open files */
  293. //----------------------------------------------------------------------
  294. // From linux-2.6.35.5/include/asm-mips/socket.h
  295. //----------------------------------------------------------------------
  296. #define VKI_SOL_SOCKET 0xffff
  297. #define VKI_SO_TYPE 0x1008
  298. #define VKI_SO_ATTACH_FILTER 26
  299. //----------------------------------------------------------------------
  300. // From linux-2.6.35.5/include/asm-i386/sockios.h
  301. //----------------------------------------------------------------------
  302. #define VKI_SIOCATMARK _VKI_IOR('s', 7, int)
  303. #define VKI_SIOCSPGRP _VKI_IOW('s', 8, vki_pid_t)
  304. #define VKI_SIOCGPGRP _VKI_IOR('s', 9, vki_pid_t)
  305. #define VKI_SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
  306. #define VKI_SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
  307. //----------------------------------------------------------------------
  308. // From linux-2.6.35.5/include/asm-mips/stat.h
  309. //----------------------------------------------------------------------
  310. struct vki_stat {
  311. unsigned st_dev;
  312. long st_pad1[3]; /* Reserved for network id */
  313. unsigned long st_ino;
  314. unsigned int st_mode;
  315. unsigned long st_nlink;
  316. unsigned int st_uid;
  317. unsigned int st_gid;
  318. unsigned st_rdev;
  319. long st_pad2[2];
  320. long st_size;
  321. long st_pad3;
  322. /*
  323. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  324. * but we don't have it under Linux.
  325. */
  326. long st_atime;
  327. long st_atime_nsec;
  328. long st_mtime;
  329. long st_mtime_nsec;
  330. long st_ctime;
  331. long st_ctime_nsec;
  332. long st_blksize;
  333. long st_blocks;
  334. long st_pad4[14];
  335. };
  336. /*
  337. * This matches struct stat64 in glibc2.1, hence the absolutely insane
  338. * amounts of padding around dev_t's. The memory layout is the same as of
  339. * struct stat of the 64-bit kernel.
  340. */
  341. struct vki_stat64 {
  342. unsigned long st_dev;
  343. unsigned long st_pad0[3]; /* Reserved for st_dev expansion */
  344. unsigned long long st_ino;
  345. unsigned int st_mode;
  346. unsigned long st_nlink;
  347. unsigned int st_uid;
  348. unsigned int st_gid;
  349. unsigned long st_rdev;
  350. unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */
  351. long long st_size;
  352. /*
  353. * Actually this should be timestruc_t st_atime, st_mtime and st_ctime
  354. * but we don't have it under Linux.
  355. */
  356. long st_atime;
  357. unsigned long st_atime_nsec; /* Reserved for st_atime expansion */
  358. long st_mtime;
  359. unsigned long st_mtime_nsec; /* Reserved for st_mtime expansion */
  360. long st_ctime;
  361. unsigned long st_ctime_nsec; /* Reserved for st_ctime expansion */
  362. unsigned long st_blksize;
  363. unsigned long st_pad2;
  364. long long st_blocks;
  365. };
  366. //----------------------------------------------------------------------
  367. // From linux-2.6.35.5/include/asm-mips/statfs.h
  368. //----------------------------------------------------------------------
  369. struct vki_statfs {
  370. long f_type;
  371. long f_bsize;
  372. long f_frsize; /* Fragment size - unsupported */
  373. long f_blocks;
  374. long f_bfree;
  375. long f_files;
  376. long f_ffree;
  377. long f_bavail;
  378. /* Linux specials */
  379. __vki_kernel_fsid_t f_fsid;
  380. long f_namelen;
  381. long f_spare[6];
  382. };
  383. //----------------------------------------------------------------------
  384. // From linux-2.6.35.5/include/asm-mips/termios.h
  385. //----------------------------------------------------------------------
  386. struct vki_winsize {
  387. unsigned short ws_row;
  388. unsigned short ws_col;
  389. unsigned short ws_xpixel;
  390. unsigned short ws_ypixel;
  391. };
  392. #define NCC 8
  393. #define NCCS 23
  394. struct vki_termio {
  395. unsigned short c_iflag; /* input mode flags */
  396. unsigned short c_oflag; /* output mode flags */
  397. unsigned short c_cflag; /* control mode flags */
  398. unsigned short c_lflag; /* local mode flags */
  399. char c_line; /* line discipline */
  400. unsigned char c_cc[NCCS]; /* control characters */
  401. };
  402. //----------------------------------------------------------------------
  403. // From linux-2.6.35.5/include/asm-mips/termbits.h
  404. //----------------------------------------------------------------------
  405. typedef unsigned char vki_cc_t;
  406. typedef unsigned long vki_speed_t;
  407. typedef unsigned long vki_tcflag_t;
  408. struct vki_termios {
  409. vki_tcflag_t c_iflag; /* input mode flags */
  410. vki_tcflag_t c_oflag; /* output mode flags */
  411. vki_tcflag_t c_cflag; /* control mode flags */
  412. vki_tcflag_t c_lflag; /* local mode flags */
  413. vki_cc_t c_line; /* line discipline */
  414. vki_cc_t c_cc[NCCS]; /* control characters */
  415. };
  416. //----------------------------------------------------------------------
  417. // From linux-2.6.35.5/include/asm-mips/ioctl.h
  418. //----------------------------------------------------------------------
  419. #define _VKI_IOC_NRBITS 8
  420. #define _VKI_IOC_TYPEBITS 8
  421. #define _VKI_IOC_SIZEBITS 13
  422. #define _VKI_IOC_DIRBITS 3
  423. #define _VKI_IOC_NRMASK ((1 << _VKI_IOC_NRBITS)-1)
  424. #define _VKI_IOC_TYPEMASK ((1 << _VKI_IOC_TYPEBITS)-1)
  425. #define _VKI_IOC_SIZEMASK ((1 << _VKI_IOC_SIZEBITS)-1)
  426. #define _VKI_IOC_DIRMASK ((1 << _VKI_IOC_DIRBITS)-1)
  427. #define _VKI_IOC_NRSHIFT 0
  428. #define _VKI_IOC_TYPESHIFT (_VKI_IOC_NRSHIFT+_VKI_IOC_NRBITS)
  429. #define _VKI_IOC_SIZESHIFT (_VKI_IOC_TYPESHIFT+_VKI_IOC_TYPEBITS)
  430. #define _VKI_IOC_DIRSHIFT (_VKI_IOC_SIZESHIFT+_VKI_IOC_SIZEBITS)
  431. #define _VKI_IOC_NONE 1U
  432. #define _VKI_IOC_READ 2U
  433. #define _VKI_IOC_WRITE 4U
  434. #define _VKI_IOC(dir,type,nr,size) \
  435. (((dir) << _VKI_IOC_DIRSHIFT) | \
  436. ((type) << _VKI_IOC_TYPESHIFT) | \
  437. ((nr) << _VKI_IOC_NRSHIFT) | \
  438. ((size) << _VKI_IOC_SIZESHIFT))
  439. /* provoke compile error for invalid uses of size argument */
  440. extern unsigned int __VKI_invalid_size_argument_for_IOC;
  441. /* used to create numbers */
  442. #define _VKI_IO(type,nr) _VKI_IOC(_VKI_IOC_NONE,(type),(nr),0)
  443. #define _VKI_IOR(type,nr,size) _VKI_IOC(_VKI_IOC_READ,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
  444. #define _VKI_IOW(type,nr,size) _VKI_IOC(_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
  445. #define _VKI_IOWR(type,nr,size) _VKI_IOC(_VKI_IOC_READ|_VKI_IOC_WRITE,(type),(nr),(_VKI_IOC_TYPECHECK(size)))
  446. /* used to decode ioctl numbers.. */
  447. #define _VKI_IOC_DIR(nr) (((nr) >> _VKI_IOC_DIRSHIFT) & _VKI_IOC_DIRMASK)
  448. #define _VKI_IOC_TYPE(nr) (((nr) >> _VKI_IOC_TYPESHIFT) & _VKI_IOC_TYPEMASK)
  449. #define _VKI_IOC_NR(nr) (((nr) >> _VKI_IOC_NRSHIFT) & _VKI_IOC_NRMASK)
  450. #define _VKI_IOC_SIZE(nr) (((nr) >> _VKI_IOC_SIZESHIFT) & _VKI_IOC_SIZEMASK)
  451. //----------------------------------------------------------------------
  452. // From linux-2.6.35.5/include/asm-mips/ioctls.h
  453. //----------------------------------------------------------------------
  454. #define VKI_TCGETA 0x5401
  455. #define VKI_TCSETA 0x5402 /* Clashes with SNDCTL_TMR_START sound ioctl */
  456. #define VKI_TCSETAW 0x5403
  457. #define VKI_TCSETAF 0x5404
  458. #define VKI_TCSBRK 0x5405
  459. #define VKI_TCXONC 0x5406
  460. #define VKI_TCFLSH 0x5407
  461. #define VKI_TCGETS 0x540d
  462. #define VKI_TCSETS 0x540e
  463. #define VKI_TCSETSW 0x540f
  464. #define VKI_TCSETSF 0x5410
  465. #define VKI_TIOCEXCL 0x740d /* set exclusive use of tty */
  466. #define VKI_TIOCNXCL 0x740e /* reset exclusive use of tty */
  467. #define VKI_TIOCOUTQ 0x7472 /* output queue size */
  468. #define VKI_TIOCSTI 0x5472 /* simulate terminal input */
  469. #define VKI_TIOCMGET 0x741d /* get all modem bits */
  470. #define VKI_TIOCMBIS 0x741b /* bis modem bits */
  471. #define VKI_TIOCMBIC 0x741c /* bic modem bits */
  472. #define VKI_TIOCMSET 0x741a /* set all modem bits */
  473. #define VKI_TIOCPKT 0x5470 /* pty: set/clear packet mode */
  474. #define VKI_TIOCPKT_DATA 0x00 /* data packet */
  475. #define VKI_TIOCPKT_FLUSHREAD 0x01 /* flush packet */
  476. #define VKI_TIOCPKT_FLUSHWRITE 0x02 /* flush packet */
  477. #define VKI_TIOCPKT_STOP 0x04 /* stop output */
  478. #define VKI_TIOCPKT_START 0x08 /* start output */
  479. #define VKI_TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */
  480. #define VKI_TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */
  481. /* #define TIOCPKT_IOCTL 0x40 state change of pty driver */
  482. #define VKI_TIOCSWINSZ _VKI_IOW('t', 103, struct vki_winsize) /* set window size */
  483. #define VKI_TIOCGWINSZ _VKI_IOR('t', 104, struct vki_winsize) /* get window size */
  484. #define VKI_TIOCNOTTY 0x5471 /* void tty association */
  485. #define VKI_TIOCSETD 0x7401
  486. #define VKI_TIOCGETD 0x7400
  487. #define VKI_FIOCLEX 0x6601
  488. #define VKI_FIONCLEX 0x6602
  489. #define VKI_FIOASYNC 0x667d
  490. #define VKI_FIONBIO 0x667e
  491. #define VKI_FIOQSIZE 0x667f
  492. #define VKI_TIOCGLTC 0x7474 /* get special local chars */
  493. #define VKI_TIOCSLTC 0x7475 /* set special local chars */
  494. #define VKI_TIOCSPGRP _VKI_IOW('t', 118, int) /* set pgrp of tty */
  495. #define VKI_TIOCGPGRP _VKI_IOR('t', 119, int) /* get pgrp of tty */
  496. #define VKI_TIOCCONS _VKI_IOW('t', 120, int) /* become virtual console */
  497. #define VKI_FIONREAD 0x467f
  498. #define VKI_TIOCINQ FIONREAD
  499. #define VKI_TIOCGETP 0x7408
  500. #define VKI_TIOCSETP 0x7409
  501. #define VKI_TIOCSETN 0x740a /* TIOCSETP wo flush */
  502. #define VKI_TIOCSBRK 0x5427 /* BSD compatibility */
  503. #define VKI_TIOCCBRK 0x5428 /* BSD compatibility */
  504. #define VKI_TIOCGSID 0x7416 /* Return the session ID of FD */
  505. #define VKI_TIOCGPTN _VKI_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
  506. #define VKI_TIOCSPTLCK _VKI_IOW('T',0x31, int) /* Lock/unlock Pty */
  507. /* I hope the range from 0x5480 on is free ... */
  508. #define VKI_TIOCSCTTY 0x5480 /* become controlling tty */
  509. #define VKI_TIOCGSOFTCAR 0x5481
  510. #define VKI_TIOCSSOFTCAR 0x5482
  511. #define VKI_TIOCLINUX 0x5483
  512. #define VKI_TIOCGSERIAL 0x5484
  513. #define VKI_TIOCSSERIAL 0x5485
  514. #define VKI_TCSBRKP 0x5486 /* Needed for POSIX tcsendbreak() */
  515. #define VKI_TIOCSERCONFIG 0x5488
  516. #define VKI_TIOCSERGWILD 0x5489
  517. #define VKI_TIOCSERSWILD 0x548a
  518. #define VKI_TIOCGLCKTRMIOS 0x548b
  519. #define VKI_TIOCSLCKTRMIOS 0x548c
  520. #define VKI_TIOCSERGSTRUCT 0x548d /* For debugging only */
  521. #define VKI_TIOCSERGETLSR 0x548e /* Get line status register */
  522. #define VKI_TIOCSERGETMULTI 0x548f /* Get multiport config */
  523. #define VKI_TIOCSERSETMULTI 0x5490 /* Set multiport config */
  524. #define VKI_TIOCMIWAIT 0x5491 /* wait for a change on serial input line(s) */
  525. #define VKI_TIOCGICOUNT 0x5492 /* read serial port inline interrupt counts */
  526. #define VKI_TIOCGHAYESESP 0x5493 /* Get Hayes ESP configuration */
  527. #define VKI_TIOCSHAYESESP 0x5494 /* Set Hayes ESP configuration */
  528. //----------------------------------------------------------------------
  529. // From asm-generic/poll.h
  530. //----------------------------------------------------------------------
  531. /* These are specified by iBCS2 */
  532. #define VKI_POLLIN 0x0001
  533. struct vki_pollfd {
  534. int fd;
  535. short events;
  536. short revents;
  537. };
  538. //----------------------------------------------------------------------
  539. // From linux-2.6.35.5/include/asm-mips/ucontext.h
  540. //----------------------------------------------------------------------
  541. struct vki_ucontext {
  542. unsigned long uc_flags;
  543. struct vki_ucontext *uc_link;
  544. vki_stack_t uc_stack;
  545. struct vki_sigcontext uc_mcontext;
  546. vki_sigset_t uc_sigmask; /* mask last for extensibility */
  547. };
  548. // CAB: TODO
  549. typedef char vki_modify_ldt_t;
  550. //----------------------------------------------------------------------
  551. // From linux-2.6.35.5/include/asm-mips/ipcbuf.h
  552. //----------------------------------------------------------------------
  553. struct vki_ipc64_perm
  554. {
  555. __vki_kernel_key_t key;
  556. __vki_kernel_uid_t uid;
  557. __vki_kernel_gid_t gid;
  558. __vki_kernel_uid_t cuid;
  559. __vki_kernel_gid_t cgid;
  560. __vki_kernel_mode_t mode;
  561. unsigned short seq;
  562. unsigned short __pad1;
  563. unsigned long __unused1;
  564. unsigned long __unused2;
  565. };
  566. //----------------------------------------------------------------------
  567. // From linux-2.6.35.5/include/asm-mips/sembuf.h
  568. //----------------------------------------------------------------------
  569. struct vki_semid64_ds {
  570. struct vki_ipc64_perm sem_perm; /* permissions .. see ipc.h */
  571. __vki_kernel_time_t sem_otime; /* last semop time */
  572. __vki_kernel_time_t sem_ctime; /* last change time */
  573. unsigned long sem_nsems; /* no. of semaphores in array */
  574. unsigned long __unused1;
  575. unsigned long __unused2;
  576. };
  577. //----------------------------------------------------------------------
  578. // From linux-2.6.35.5/include/asm-mips/msgbuf.h
  579. //----------------------------------------------------------------------
  580. struct vki_msqid64_ds {
  581. struct vki_ipc64_perm msg_perm;
  582. __vki_kernel_time_t msg_stime; /* last msgsnd time */
  583. unsigned long __unused1;
  584. __vki_kernel_time_t msg_rtime; /* last msgrcv time */
  585. unsigned long __unused2;
  586. __vki_kernel_time_t msg_ctime; /* last change time */
  587. unsigned long __unused3;
  588. unsigned long msg_cbytes; /* current number of bytes on queue */
  589. unsigned long msg_qnum; /* number of messages in queue */
  590. unsigned long msg_qbytes; /* max number of bytes on queue */
  591. __vki_kernel_pid_t msg_lspid; /* pid of last msgsnd */
  592. __vki_kernel_pid_t msg_lrpid; /* last receive pid */
  593. unsigned long __unused4;
  594. unsigned long __unused5;
  595. };
  596. //----------------------------------------------------------------------
  597. // From linux-2.6.35.5/include/asm-mips/ipc.h
  598. //----------------------------------------------------------------------
  599. struct vki_ipc_kludge {
  600. struct vki_msgbuf __user *msgp;
  601. long msgtyp;
  602. };
  603. #define VKI_SEMOP 1
  604. #define VKI_SEMGET 2
  605. #define VKI_SEMCTL 3
  606. #define VKI_SEMTIMEDOP 4
  607. #define VKI_MSGSND 11
  608. #define VKI_MSGRCV 12
  609. #define VKI_MSGGET 13
  610. #define VKI_MSGCTL 14
  611. #define VKI_SHMAT 21
  612. #define VKI_SHMDT 22
  613. #define VKI_SHMGET 23
  614. #define VKI_SHMCTL 24
  615. //----------------------------------------------------------------------
  616. // From linux-2.6.35.5/include/asm-mips/shmbuf.h
  617. //----------------------------------------------------------------------
  618. struct vki_shmid64_ds {
  619. struct vki_ipc64_perm shm_perm; /* operation perms */
  620. vki_size_t shm_segsz; /* size of segment (bytes) */
  621. __vki_kernel_time_t shm_atime; /* last attach time */
  622. __vki_kernel_time_t shm_dtime; /* last detach time */
  623. __vki_kernel_time_t shm_ctime; /* last change time */
  624. __vki_kernel_pid_t shm_cpid; /* pid of creator */
  625. __vki_kernel_pid_t shm_lpid; /* pid of last operator */
  626. unsigned long shm_nattch; /* no. of current attaches */
  627. unsigned long __unused1;
  628. unsigned long __unused2;
  629. };
  630. struct vki_shminfo64 {
  631. unsigned long shmmax;
  632. unsigned long shmmin;
  633. unsigned long shmmni;
  634. unsigned long shmseg;
  635. unsigned long shmall;
  636. unsigned long __unused1;
  637. unsigned long __unused2;
  638. unsigned long __unused3;
  639. unsigned long __unused4;
  640. };
  641. //----------------------------------------------------------------------
  642. // From linux-2.6.35.5/include/asm-mips/ptrace.h
  643. //----------------------------------------------------------------------
  644. struct vki_pt_regs {
  645. #ifdef CONFIG_32BIT
  646. /* Pad bytes for argument save space on the stack. */
  647. unsigned long pad0[6];
  648. #endif
  649. /* Saved main processor registers. */
  650. unsigned long regs[32];
  651. /* Saved special registers. */
  652. unsigned long cp0_status;
  653. unsigned long hi;
  654. unsigned long lo;
  655. #ifdef CONFIG_CPU_HAS_SMARTMIPS
  656. unsigned long acx;
  657. #endif
  658. unsigned long cp0_badvaddr;
  659. unsigned long cp0_cause;
  660. unsigned long cp0_epc;
  661. #ifdef CONFIG_MIPS_MT_SMTC
  662. unsigned long cp0_tcstatus;
  663. #endif /* CONFIG_MIPS_MT_SMTC */
  664. #ifdef CONFIG_CPU_CAVIUM_OCTEON
  665. unsigned long long mpl[3]; /* MTM{0,1,2} */
  666. unsigned long long mtp[3]; /* MTP{0,1,2} */
  667. #endif
  668. } __attribute__ ((aligned (8)));
  669. #define VKI_PTRACE_GETREGS 12
  670. #define VKI_PTRACE_SETREGS 13
  671. #define VKI_PTRACE_GETFPREGS 14
  672. #define VKI_PTRACE_SETFPREGS 15
  673. //----------------------------------------------------------------------
  674. // From linux-4.5/arch/mips/include/uapi/asm/reg.h
  675. //----------------------------------------------------------------------
  676. #define VKI_MIPS32_EF_R0 6
  677. #define VKI_MIPS32_EF_R1 7
  678. #define VKI_MIPS32_EF_R2 8
  679. #define VKI_MIPS32_EF_R3 9
  680. #define VKI_MIPS32_EF_R4 10
  681. #define VKI_MIPS32_EF_R5 11
  682. #define VKI_MIPS32_EF_R6 12
  683. #define VKI_MIPS32_EF_R7 13
  684. #define VKI_MIPS32_EF_R8 14
  685. #define VKI_MIPS32_EF_R9 15
  686. #define VKI_MIPS32_EF_R10 16
  687. #define VKI_MIPS32_EF_R11 17
  688. #define VKI_MIPS32_EF_R12 18
  689. #define VKI_MIPS32_EF_R13 19
  690. #define VKI_MIPS32_EF_R14 20
  691. #define VKI_MIPS32_EF_R15 21
  692. #define VKI_MIPS32_EF_R16 22
  693. #define VKI_MIPS32_EF_R17 23
  694. #define VKI_MIPS32_EF_R18 24
  695. #define VKI_MIPS32_EF_R19 25
  696. #define VKI_MIPS32_EF_R20 26
  697. #define VKI_MIPS32_EF_R21 27
  698. #define VKI_MIPS32_EF_R22 28
  699. #define VKI_MIPS32_EF_R23 29
  700. #define VKI_MIPS32_EF_R24 30
  701. #define VKI_MIPS32_EF_R25 31
  702. #define VKI_MIPS32_EF_R26 32
  703. #define VKI_MIPS32_EF_R27 33
  704. #define VKI_MIPS32_EF_R28 34
  705. #define VKI_MIPS32_EF_R29 35
  706. #define VKI_MIPS32_EF_R30 36
  707. #define VKI_MIPS32_EF_R31 37
  708. #define VKI_MIPS32_EF_LO 38
  709. #define VKI_MIPS32_EF_HI 39
  710. #define VKI_MIPS32_EF_CP0_EPC 40
  711. #define VKI_MIPS32_EF_CP0_BADVADDR 41
  712. #define VKI_MIPS32_EF_CP0_STATUS 42
  713. #define VKI_MIPS32_EF_CP0_CAUSE 43
  714. #define VKI_MIPS32_EF_UNUSED0 44
  715. //----------------------------------------------------------------------
  716. // From linux-4.5/arch/mips/include/asm/elf.h
  717. //----------------------------------------------------------------------
  718. typedef unsigned long vki_elf_greg_t;
  719. #define VKI_ELF_NGREG 45
  720. #define VKI_ELF_NFPREG 33 /* includes fpscr */
  721. typedef vki_elf_greg_t vki_elf_gregset_t[VKI_ELF_NGREG];
  722. typedef double vki_elf_fpreg_t;
  723. typedef vki_elf_fpreg_t vki_elf_fpregset_t[VKI_ELF_NFPREG];
  724. typedef struct vki_user_fxsr_struct vki_elf_fpxregset_t;
  725. #define VKI_AT_SYSINFO 32
  726. //----------------------------------------------------------------------
  727. // From linux-2.6.35.5/include/asm-generic/siginfo.h
  728. //----------------------------------------------------------------------
  729. #define HAVE_ARCH_SIGINFO_T
  730. typedef union vki_sigval {
  731. int sival_int;
  732. void __user *sival_ptr;
  733. } vki_sigval_t;
  734. #ifndef __VKI_ARCH_SI_PREAMBLE_SIZE
  735. #define __VKI_ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
  736. #endif
  737. #define VKI_SI_MAX_SIZE 128
  738. #ifndef VKI_SI_PAD_SIZE
  739. #define VKI_SI_PAD_SIZE ((VKI_SI_MAX_SIZE - __VKI_ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
  740. #endif
  741. #ifndef __VKI_ARCH_SI_UID_T
  742. #define __VKI_ARCH_SI_UID_T vki_uid_t
  743. #endif
  744. #ifndef __VKI_ARCH_SI_BAND_T
  745. #define __VKI_ARCH_SI_BAND_T long
  746. #endif
  747. typedef struct vki_siginfo {
  748. int si_signo;
  749. int si_code;
  750. int si_errno;
  751. int __pad0[VKI_SI_MAX_SIZE / sizeof(int) - VKI_SI_PAD_SIZE - 3];
  752. union {
  753. int _pad[VKI_SI_PAD_SIZE];
  754. /* kill() */
  755. struct {
  756. vki_pid_t _pid; /* sender's pid */
  757. __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
  758. } _kill;
  759. /* POSIX.1b timers */
  760. struct {
  761. vki_timer_t _tid; /* timer id */
  762. int _overrun; /* overrun count */
  763. char _pad[sizeof( __VKI_ARCH_SI_UID_T) - sizeof(int)];
  764. vki_sigval_t _sigval; /* same as below */
  765. int _sys_private; /* not to be passed to user */
  766. } _timer;
  767. /* POSIX.1b signals */
  768. struct {
  769. vki_pid_t _pid; /* sender's pid */
  770. __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
  771. vki_sigval_t _sigval;
  772. } _rt;
  773. /* SIGCHLD */
  774. struct {
  775. vki_pid_t _pid; /* which child */
  776. __VKI_ARCH_SI_UID_T _uid; /* sender's uid */
  777. int _status; /* exit code */
  778. vki_clock_t _utime;
  779. vki_clock_t _stime;
  780. } _sigchld;
  781. /* IRIX SIGCHLD */
  782. struct {
  783. vki_pid_t _pid; /* which child */
  784. vki_clock_t _utime;
  785. int _status; /* exit code */
  786. vki_clock_t _stime;
  787. } _irix_sigchld;
  788. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  789. struct {
  790. void __user *_addr; /* faulting insn/memory ref. */
  791. #ifdef __ARCH_SI_TRAPNO
  792. int _trapno; /* TRAP # which caused the signal */
  793. #endif
  794. } _sigfault;
  795. /* SIGPOLL, SIGXFSZ (To do ...) */
  796. struct {
  797. __VKI_ARCH_SI_BAND_T _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  798. int _fd;
  799. } _sigpoll;
  800. } _sifields;
  801. } vki_siginfo_t;
  802. //----------------------------------------------------------------------
  803. // From linux-2.6.35.5/include/asm/break.h
  804. //----------------------------------------------------------------------
  805. #define VKI_BRK_OVERFLOW 6 /* Overflow check */
  806. #define VKI_BRK_DIVZERO 7 /* Divide by zero check */
  807. //----------------------------------------------------------------------
  808. // From linux-3.6.35.5/arch/mips/include/socket.h
  809. //----------------------------------------------------------------------
  810. enum vki_sock_type {
  811. VKI_SOCK_STREAM = 2,
  812. // [[others omitted]]
  813. };
  814. #define ARCH_HAS_SOCKET_TYPES 1
  815. //----------------------------------------------------------------------
  816. // From linux-3.7.0/arch/mips/include/uapi/asm/errno.h
  817. //----------------------------------------------------------------------
  818. #define VKI_ELIBBAD 84 /* Accessing a corrupted shared library */
  819. #define VKI_EOPNOTSUPP 122 /* Operation not supported on transport
  820. endpoint */
  821. //----------------------------------------------------------------------
  822. // From linux-3.13.0/include/asm/errno.h
  823. //----------------------------------------------------------------------
  824. #define VKI_ENOSYS 89 /* Function not implemented */
  825. #define VKI_EOVERFLOW 79 /* Value too large for defined data type */
  826. //----------------------------------------------------------------------
  827. // From linux-3.14.0/arch/mips/include/asm/elf.h
  828. //----------------------------------------------------------------------
  829. #define VKI_EF_MIPS_FP64 0x00000200
  830. //----------------------------------------------------------------------
  831. // From linux-4.1.0/arch/mips/include/asm/elf.h
  832. //----------------------------------------------------------------------
  833. #define VKI_MIPS_ABI_FP_UNKNOWN (-1)
  834. #define VKI_MIPS_ABI_FP_ANY 0 /* FP ABI doesn't matter */
  835. #define VKI_MIPS_ABI_FP_DOUBLE 1 /* -mdouble-float */
  836. #define VKI_MIPS_ABI_FP_SINGLE 2 /* -msingle-float */
  837. #define VKI_MIPS_ABI_FP_SOFT 3 /* -msoft-float */
  838. #define VKI_MIPS_ABI_FP_OLD_64 4 /* -mips32r2 -mfp64 */
  839. #define VKI_MIPS_ABI_FP_XX 5 /* -mfpxx */
  840. #define VKI_MIPS_ABI_FP_64 6 /* -mips32r2 -mfp64 */
  841. #define VKI_MIPS_ABI_FP_64A 7 /* -mips32r2 -mfp64 -mno-odd-spreg */
  842. struct vki_arch_elf_state {
  843. int fp_abi;
  844. int interp_fp_abi;
  845. int overall_fp_mode;
  846. };
  847. #define VKI_INIT_ARCH_ELF_STATE { \
  848. .fp_abi = VKI_MIPS_ABI_FP_UNKNOWN, \
  849. .interp_fp_abi = VKI_MIPS_ABI_FP_UNKNOWN, \
  850. .overall_fp_mode = -1, \
  851. }
  852. struct vki_mips_elf_abiflags_v0 {
  853. vki_u16 version; /* Version of flags structure */
  854. vki_u8 isa_level; /* The level of the ISA: 1-5, 32, 64 */
  855. vki_u8 isa_rev; /* The revision of ISA: 0 for MIPS V and below,
  856. 1-n otherwise */
  857. vki_u8 gpr_size; /* The size of general purpose registers */
  858. vki_u8 cpr1_size; /* The size of co-processor 1 registers */
  859. vki_u8 cpr2_size; /* The size of co-processor 2 registers */
  860. vki_u8 fp_abi; /* The floating-point ABI */
  861. vki_u32 isa_ext; /* Mask of processor-specific extensions */
  862. vki_u32 ases; /* Mask of ASEs used */
  863. vki_u32 flags1; /* Mask of general flags */
  864. vki_u32 flags2;
  865. };
  866. #define VKI_PT_MIPS_ABIFLAGS 0x70000003
  867. //----------------------------------------------------------------------
  868. // From linux-4.1.0/arch/mips/kernel/elf.c
  869. //----------------------------------------------------------------------
  870. enum {
  871. VKI_FP_FRE,
  872. VKI_FP_FR0,
  873. VKI_FP_FR1,
  874. };
  875. #endif // __VKI_MIPS32_LINUX_H
  876. /*--------------------------------------------------------------------*/
  877. /*--- end vki-mips32-linux.h ---*/
  878. /*--------------------------------------------------------------------*/