aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-mips/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-mips/compat.h')
-rw-r--r--include/asm-mips/compat.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
new file mode 100644
index 000000000000..dce92079e7fc
--- /dev/null
+++ b/include/asm-mips/compat.h
@@ -0,0 +1,144 @@
1#ifndef _ASM_COMPAT_H
2#define _ASM_COMPAT_H
3/*
4 * Architecture specific compatibility types
5 */
6#include <linux/types.h>
7#include <asm/page.h>
8
9#define COMPAT_USER_HZ 100
10
11typedef u32 compat_size_t;
12typedef s32 compat_ssize_t;
13typedef s32 compat_time_t;
14typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t;
16
17typedef s32 compat_pid_t;
18typedef s32 compat_uid_t;
19typedef s32 compat_gid_t;
20typedef u32 compat_mode_t;
21typedef u32 compat_ino_t;
22typedef u32 compat_dev_t;
23typedef s32 compat_off_t;
24typedef s64 compat_loff_t;
25typedef u32 compat_nlink_t;
26typedef s32 compat_ipc_pid_t;
27typedef s32 compat_daddr_t;
28typedef s32 compat_caddr_t;
29typedef struct {
30 s32 val[2];
31} compat_fsid_t;
32
33typedef s32 compat_int_t;
34typedef s32 compat_long_t;
35typedef u32 compat_uint_t;
36typedef u32 compat_ulong_t;
37
38struct compat_timespec {
39 compat_time_t tv_sec;
40 s32 tv_nsec;
41};
42
43struct compat_timeval {
44 compat_time_t tv_sec;
45 s32 tv_usec;
46};
47
48struct compat_stat {
49 compat_dev_t st_dev;
50 s32 st_pad1[3];
51 compat_ino_t st_ino;
52 compat_mode_t st_mode;
53 compat_nlink_t st_nlink;
54 compat_uid_t st_uid;
55 compat_gid_t st_gid;
56 compat_dev_t st_rdev;
57 s32 st_pad2[2];
58 compat_off_t st_size;
59 s32 st_pad3;
60 compat_time_t st_atime;
61 s32 st_atime_nsec;
62 compat_time_t st_mtime;
63 s32 st_mtime_nsec;
64 compat_time_t st_ctime;
65 s32 st_ctime_nsec;
66 s32 st_blksize;
67 s32 st_blocks;
68 s32 st_pad4[14];
69};
70
71struct compat_flock {
72 short l_type;
73 short l_whence;
74 compat_off_t l_start;
75 compat_off_t l_len;
76 s32 l_sysid;
77 compat_pid_t l_pid;
78 short __unused;
79 s32 pad[4];
80};
81
82#define F_GETLK64 33
83#define F_SETLK64 34
84#define F_SETLKW64 35
85
86struct compat_flock64 {
87 short l_type;
88 short l_whence;
89 compat_loff_t l_start;
90 compat_loff_t l_len;
91 compat_pid_t l_pid;
92};
93
94struct compat_statfs {
95 int f_type;
96 int f_bsize;
97 int f_frsize;
98 int f_blocks;
99 int f_bfree;
100 int f_files;
101 int f_ffree;
102 int f_bavail;
103 compat_fsid_t f_fsid;
104 int f_namelen;
105 int f_spare[6];
106};
107
108#define COMPAT_RLIM_INFINITY 0x7fffffffUL
109
110typedef u32 compat_old_sigset_t; /* at least 32 bits */
111
112#define _COMPAT_NSIG 128 /* Don't ask !$@#% ... */
113#define _COMPAT_NSIG_BPW 32
114
115typedef u32 compat_sigset_word;
116
117#define COMPAT_OFF_T_MAX 0x7fffffff
118#define COMPAT_LOFF_T_MAX 0x7fffffffffffffffL
119
120/*
121 * A pointer passed in from user mode. This should not
122 * be used for syscall parameters, just declare them
123 * as pointers because the syscall entry code will have
124 * appropriately comverted them already.
125 */
126typedef u32 compat_uptr_t;
127
128static inline void *compat_ptr(compat_uptr_t uptr)
129{
130 return (void *)(long)uptr;
131}
132
133static inline void *compat_alloc_user_space(long len)
134{
135 struct pt_regs *regs = (struct pt_regs *)
136 ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1;
137
138 return (void *) (regs->regs[29] - len);
139}
140#if defined (__MIPSEL__)
141#define __COMPAT_ENDIAN_SWAP__ 1
142#endif
143
144#endif /* _ASM_COMPAT_H */