Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Kyle McMartin | df570b9 | 2006-08-27 11:04:26 -0400 | [diff] [blame] | 8 | #include <linux/thread_info.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | |
Christoph Hellwig | e28cbf2 | 2010-03-10 15:21:19 -0800 | [diff] [blame] | 10 | #define COMPAT_USER_HZ 100 |
| 11 | #define COMPAT_UTS_MACHINE "parisc\0\0" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | typedef u32 compat_size_t; |
| 14 | typedef s32 compat_ssize_t; |
| 15 | typedef s32 compat_time_t; |
| 16 | typedef s32 compat_clock_t; |
| 17 | typedef s32 compat_pid_t; |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 18 | typedef u32 __compat_uid_t; |
| 19 | typedef u32 __compat_gid_t; |
| 20 | typedef u32 __compat_uid32_t; |
| 21 | typedef u32 __compat_gid32_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | typedef u16 compat_mode_t; |
| 23 | typedef u32 compat_ino_t; |
| 24 | typedef u32 compat_dev_t; |
| 25 | typedef s32 compat_off_t; |
| 26 | typedef s64 compat_loff_t; |
| 27 | typedef u16 compat_nlink_t; |
| 28 | typedef u16 compat_ipc_pid_t; |
| 29 | typedef s32 compat_daddr_t; |
| 30 | typedef u32 compat_caddr_t; |
Stephen Rothwell | 0d77e5a | 2005-06-23 00:10:14 -0700 | [diff] [blame] | 31 | typedef s32 compat_timer_t; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | |
| 33 | typedef s32 compat_int_t; |
| 34 | typedef s32 compat_long_t; |
Arnd Bergmann | 4b77758 | 2007-07-15 23:41:11 -0700 | [diff] [blame] | 35 | typedef s64 compat_s64; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | typedef u32 compat_uint_t; |
| 37 | typedef u32 compat_ulong_t; |
Arnd Bergmann | 4b77758 | 2007-07-15 23:41:11 -0700 | [diff] [blame] | 38 | typedef u64 compat_u64; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
| 40 | struct compat_timespec { |
| 41 | compat_time_t tv_sec; |
| 42 | s32 tv_nsec; |
| 43 | }; |
| 44 | |
| 45 | struct compat_timeval { |
| 46 | compat_time_t tv_sec; |
| 47 | s32 tv_usec; |
| 48 | }; |
| 49 | |
| 50 | struct compat_stat { |
| 51 | compat_dev_t st_dev; /* dev_t is 32 bits on parisc */ |
| 52 | compat_ino_t st_ino; /* 32 bits */ |
| 53 | compat_mode_t st_mode; /* 16 bits */ |
| 54 | compat_nlink_t st_nlink; /* 16 bits */ |
| 55 | u16 st_reserved1; /* old st_uid */ |
| 56 | u16 st_reserved2; /* old st_gid */ |
| 57 | compat_dev_t st_rdev; |
| 58 | compat_off_t st_size; |
| 59 | compat_time_t st_atime; |
| 60 | u32 st_atime_nsec; |
| 61 | compat_time_t st_mtime; |
| 62 | u32 st_mtime_nsec; |
| 63 | compat_time_t st_ctime; |
| 64 | u32 st_ctime_nsec; |
| 65 | s32 st_blksize; |
| 66 | s32 st_blocks; |
| 67 | u32 __unused1; /* ACL stuff */ |
| 68 | compat_dev_t __unused2; /* network */ |
| 69 | compat_ino_t __unused3; /* network */ |
| 70 | u32 __unused4; /* cnodes */ |
| 71 | u16 __unused5; /* netsite */ |
| 72 | short st_fstype; |
| 73 | compat_dev_t st_realdev; |
| 74 | u16 st_basemode; |
| 75 | u16 st_spareshort; |
Stephen Rothwell | 202e597 | 2005-09-06 15:16:40 -0700 | [diff] [blame] | 76 | __compat_uid32_t st_uid; |
| 77 | __compat_gid32_t st_gid; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | u32 st_spare4[3]; |
| 79 | }; |
| 80 | |
| 81 | struct compat_flock { |
| 82 | short l_type; |
| 83 | short l_whence; |
| 84 | compat_off_t l_start; |
| 85 | compat_off_t l_len; |
| 86 | compat_pid_t l_pid; |
| 87 | }; |
| 88 | |
| 89 | struct compat_flock64 { |
| 90 | short l_type; |
| 91 | short l_whence; |
| 92 | compat_loff_t l_start; |
| 93 | compat_loff_t l_len; |
| 94 | compat_pid_t l_pid; |
| 95 | }; |
| 96 | |
| 97 | struct compat_statfs { |
| 98 | s32 f_type; |
| 99 | s32 f_bsize; |
| 100 | s32 f_blocks; |
| 101 | s32 f_bfree; |
| 102 | s32 f_bavail; |
| 103 | s32 f_files; |
| 104 | s32 f_ffree; |
| 105 | __kernel_fsid_t f_fsid; |
| 106 | s32 f_namelen; |
| 107 | s32 f_frsize; |
Eric W. Biederman | 1448c72 | 2011-10-17 13:40:02 -0700 | [diff] [blame] | 108 | s32 f_flags; |
| 109 | s32 f_spare[4]; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | struct compat_sigcontext { |
| 113 | compat_int_t sc_flags; |
| 114 | compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */ |
| 115 | u64 sc_fr[32]; |
| 116 | compat_int_t sc_iasq[2]; |
| 117 | compat_int_t sc_iaoq[2]; |
| 118 | compat_int_t sc_sar; /* cr11 */ |
| 119 | }; |
| 120 | |
| 121 | #define COMPAT_RLIM_INFINITY 0xffffffff |
| 122 | |
| 123 | typedef u32 compat_old_sigset_t; /* at least 32 bits */ |
| 124 | |
| 125 | #define _COMPAT_NSIG 64 |
| 126 | #define _COMPAT_NSIG_BPW 32 |
| 127 | |
| 128 | typedef u32 compat_sigset_word; |
| 129 | |
| 130 | #define COMPAT_OFF_T_MAX 0x7fffffff |
| 131 | #define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL |
| 132 | |
| 133 | /* |
| 134 | * A pointer passed in from user mode. This should not |
| 135 | * be used for syscall parameters, just declare them |
| 136 | * as pointers because the syscall entry code will have |
Marcin Ĺšlusarz | 8b3de0d | 2008-02-03 16:32:51 +0200 | [diff] [blame] | 137 | * appropriately converted them already. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 138 | */ |
| 139 | typedef u32 compat_uptr_t; |
| 140 | |
| 141 | static inline void __user *compat_ptr(compat_uptr_t uptr) |
| 142 | { |
| 143 | return (void __user *)(unsigned long)uptr; |
| 144 | } |
| 145 | |
Ingo Molnar | 213b63b7 | 2006-03-27 01:16:12 -0800 | [diff] [blame] | 146 | static inline compat_uptr_t ptr_to_compat(void __user *uptr) |
| 147 | { |
| 148 | return (u32)(unsigned long)uptr; |
| 149 | } |
| 150 | |
H. Peter Anvin | c41d68a | 2010-09-07 16:16:18 -0700 | [diff] [blame] | 151 | static __inline__ void __user *arch_compat_alloc_user_space(long len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 152 | { |
| 153 | struct pt_regs *regs = ¤t->thread.regs; |
| 154 | return (void __user *)regs->gr[30]; |
| 155 | } |
| 156 | |
Kyle McMartin | a3ea84f | 2006-06-16 19:10:02 +0000 | [diff] [blame] | 157 | static inline int __is_compat_task(struct task_struct *t) |
| 158 | { |
Roman Zippel | c9f4f06 | 2007-05-09 02:35:16 -0700 | [diff] [blame] | 159 | return test_ti_thread_flag(task_thread_info(t), TIF_32BIT); |
Kyle McMartin | a3ea84f | 2006-06-16 19:10:02 +0000 | [diff] [blame] | 160 | } |
| 161 | |
| 162 | static inline int is_compat_task(void) |
| 163 | { |
| 164 | return __is_compat_task(current); |
| 165 | } |
| 166 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | #endif /* _ASM_PARISC_COMPAT_H */ |