compat.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. #ifndef _ASM_PARISC_COMPAT_H
  2. #define _ASM_PARISC_COMPAT_H
  3. /*
  4. * Architecture specific compatibility types
  5. */
  6. #include <linux/types.h>
  7. #include <linux/sched.h>
  8. #include <linux/thread_info.h>
  9. #define COMPAT_USER_HZ 100
  10. #define COMPAT_UTS_MACHINE "parisc\0\0"
  11. typedef u32 compat_size_t;
  12. typedef s32 compat_ssize_t;
  13. typedef s32 compat_time_t;
  14. typedef s32 compat_clock_t;
  15. typedef s32 compat_pid_t;
  16. typedef u32 __compat_uid_t;
  17. typedef u32 __compat_gid_t;
  18. typedef u32 __compat_uid32_t;
  19. typedef u32 __compat_gid32_t;
  20. typedef u16 compat_mode_t;
  21. typedef u32 compat_ino_t;
  22. typedef u32 compat_dev_t;
  23. typedef s32 compat_off_t;
  24. typedef s64 compat_loff_t;
  25. typedef u16 compat_nlink_t;
  26. typedef u16 compat_ipc_pid_t;
  27. typedef s32 compat_daddr_t;
  28. typedef u32 compat_caddr_t;
  29. typedef s32 compat_timer_t;
  30. typedef s32 compat_int_t;
  31. typedef s32 compat_long_t;
  32. typedef s64 compat_s64;
  33. typedef u32 compat_uint_t;
  34. typedef u32 compat_ulong_t;
  35. typedef u64 compat_u64;
  36. typedef u32 compat_uptr_t;
  37. struct compat_timespec {
  38. compat_time_t tv_sec;
  39. s32 tv_nsec;
  40. };
  41. struct compat_timeval {
  42. compat_time_t tv_sec;
  43. s32 tv_usec;
  44. };
  45. struct compat_stat {
  46. compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
  47. compat_ino_t st_ino; /* 32 bits */
  48. compat_mode_t st_mode; /* 16 bits */
  49. compat_nlink_t st_nlink; /* 16 bits */
  50. u16 st_reserved1; /* old st_uid */
  51. u16 st_reserved2; /* old st_gid */
  52. compat_dev_t st_rdev;
  53. compat_off_t st_size;
  54. compat_time_t st_atime;
  55. u32 st_atime_nsec;
  56. compat_time_t st_mtime;
  57. u32 st_mtime_nsec;
  58. compat_time_t st_ctime;
  59. u32 st_ctime_nsec;
  60. s32 st_blksize;
  61. s32 st_blocks;
  62. u32 __unused1; /* ACL stuff */
  63. compat_dev_t __unused2; /* network */
  64. compat_ino_t __unused3; /* network */
  65. u32 __unused4; /* cnodes */
  66. u16 __unused5; /* netsite */
  67. short st_fstype;
  68. compat_dev_t st_realdev;
  69. u16 st_basemode;
  70. u16 st_spareshort;
  71. __compat_uid32_t st_uid;
  72. __compat_gid32_t st_gid;
  73. u32 st_spare4[3];
  74. };
  75. struct compat_flock {
  76. short l_type;
  77. short l_whence;
  78. compat_off_t l_start;
  79. compat_off_t l_len;
  80. compat_pid_t l_pid;
  81. };
  82. struct compat_flock64 {
  83. short l_type;
  84. short l_whence;
  85. compat_loff_t l_start;
  86. compat_loff_t l_len;
  87. compat_pid_t l_pid;
  88. };
  89. struct compat_statfs {
  90. s32 f_type;
  91. s32 f_bsize;
  92. s32 f_blocks;
  93. s32 f_bfree;
  94. s32 f_bavail;
  95. s32 f_files;
  96. s32 f_ffree;
  97. __kernel_fsid_t f_fsid;
  98. s32 f_namelen;
  99. s32 f_frsize;
  100. s32 f_flags;
  101. s32 f_spare[4];
  102. };
  103. struct compat_sigcontext {
  104. compat_int_t sc_flags;
  105. compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
  106. u64 sc_fr[32];
  107. compat_int_t sc_iasq[2];
  108. compat_int_t sc_iaoq[2];
  109. compat_int_t sc_sar; /* cr11 */
  110. };
  111. #define COMPAT_RLIM_INFINITY 0xffffffff
  112. typedef u32 compat_old_sigset_t; /* at least 32 bits */
  113. #define _COMPAT_NSIG 64
  114. #define _COMPAT_NSIG_BPW 32
  115. typedef u32 compat_sigset_word;
  116. typedef union compat_sigval {
  117. compat_int_t sival_int;
  118. compat_uptr_t sival_ptr;
  119. } compat_sigval_t;
  120. typedef struct compat_siginfo {
  121. int si_signo;
  122. int si_errno;
  123. int si_code;
  124. union {
  125. int _pad[128/sizeof(int) - 3];
  126. /* kill() */
  127. struct {
  128. unsigned int _pid; /* sender's pid */
  129. unsigned int _uid; /* sender's uid */
  130. } _kill;
  131. /* POSIX.1b timers */
  132. struct {
  133. compat_timer_t _tid; /* timer id */
  134. int _overrun; /* overrun count */
  135. char _pad[sizeof(unsigned int) - sizeof(int)];
  136. compat_sigval_t _sigval; /* same as below */
  137. int _sys_private; /* not to be passed to user */
  138. } _timer;
  139. /* POSIX.1b signals */
  140. struct {
  141. unsigned int _pid; /* sender's pid */
  142. unsigned int _uid; /* sender's uid */
  143. compat_sigval_t _sigval;
  144. } _rt;
  145. /* SIGCHLD */
  146. struct {
  147. unsigned int _pid; /* which child */
  148. unsigned int _uid; /* sender's uid */
  149. int _status; /* exit code */
  150. compat_clock_t _utime;
  151. compat_clock_t _stime;
  152. } _sigchld;
  153. /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
  154. struct {
  155. unsigned int _addr; /* faulting insn/memory ref. */
  156. } _sigfault;
  157. /* SIGPOLL */
  158. struct {
  159. int _band; /* POLL_IN, POLL_OUT, POLL_MSG */
  160. int _fd;
  161. } _sigpoll;
  162. } _sifields;
  163. } compat_siginfo_t;
  164. #define COMPAT_OFF_T_MAX 0x7fffffff
  165. #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
  166. /*
  167. * A pointer passed in from user mode. This should not
  168. * be used for syscall parameters, just declare them
  169. * as pointers because the syscall entry code will have
  170. * appropriately converted them already.
  171. */
  172. static inline void __user *compat_ptr(compat_uptr_t uptr)
  173. {
  174. return (void __user *)(unsigned long)uptr;
  175. }
  176. static inline compat_uptr_t ptr_to_compat(void __user *uptr)
  177. {
  178. return (u32)(unsigned long)uptr;
  179. }
  180. static __inline__ void __user *arch_compat_alloc_user_space(long len)
  181. {
  182. struct pt_regs *regs = &current->thread.regs;
  183. return (void __user *)regs->gr[30];
  184. }
  185. static inline int __is_compat_task(struct task_struct *t)
  186. {
  187. return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
  188. }
  189. static inline int is_compat_task(void)
  190. {
  191. return __is_compat_task(current);
  192. }
  193. #endif /* _ASM_PARISC_COMPAT_H */