Merge tag 'drivers-5.10-2020-10-12' of git://git.kernel.dk/linux-block
[linux-2.6-block.git] / arch / parisc / include / asm / compat.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
1da177e4
LT
2#ifndef _ASM_PARISC_COMPAT_H
3#define _ASM_PARISC_COMPAT_H
4/*
5 * Architecture specific compatibility types
6 */
7#include <linux/types.h>
8#include <linux/sched.h>
df570b9c 9#include <linux/thread_info.h>
1da177e4 10
fb373975
AB
11#include <asm-generic/compat.h>
12
e28cbf22
CH
13#define COMPAT_USER_HZ 100
14#define COMPAT_UTS_MACHINE "parisc\0\0"
1da177e4 15
202e5979
SR
16typedef u32 __compat_uid_t;
17typedef u32 __compat_gid_t;
18typedef u32 __compat_uid32_t;
19typedef u32 __compat_gid32_t;
1da177e4 20typedef u16 compat_mode_t;
1da177e4 21typedef u32 compat_dev_t;
1da177e4
LT
22typedef u16 compat_nlink_t;
23typedef u16 compat_ipc_pid_t;
1da177e4 24typedef u32 compat_caddr_t;
1da177e4 25
1da177e4
LT
26struct compat_stat {
27 compat_dev_t st_dev; /* dev_t is 32 bits on parisc */
28 compat_ino_t st_ino; /* 32 bits */
29 compat_mode_t st_mode; /* 16 bits */
30 compat_nlink_t st_nlink; /* 16 bits */
31 u16 st_reserved1; /* old st_uid */
32 u16 st_reserved2; /* old st_gid */
33 compat_dev_t st_rdev;
34 compat_off_t st_size;
9afc5eee 35 old_time32_t st_atime;
1da177e4 36 u32 st_atime_nsec;
9afc5eee 37 old_time32_t st_mtime;
1da177e4 38 u32 st_mtime_nsec;
9afc5eee 39 old_time32_t st_ctime;
1da177e4
LT
40 u32 st_ctime_nsec;
41 s32 st_blksize;
42 s32 st_blocks;
43 u32 __unused1; /* ACL stuff */
44 compat_dev_t __unused2; /* network */
45 compat_ino_t __unused3; /* network */
46 u32 __unused4; /* cnodes */
47 u16 __unused5; /* netsite */
48 short st_fstype;
49 compat_dev_t st_realdev;
50 u16 st_basemode;
51 u16 st_spareshort;
202e5979
SR
52 __compat_uid32_t st_uid;
53 __compat_gid32_t st_gid;
1da177e4
LT
54 u32 st_spare4[3];
55};
56
57struct compat_flock {
58 short l_type;
59 short l_whence;
60 compat_off_t l_start;
61 compat_off_t l_len;
62 compat_pid_t l_pid;
63};
64
65struct compat_flock64 {
66 short l_type;
67 short l_whence;
68 compat_loff_t l_start;
69 compat_loff_t l_len;
70 compat_pid_t l_pid;
71};
72
73struct compat_statfs {
74 s32 f_type;
75 s32 f_bsize;
76 s32 f_blocks;
77 s32 f_bfree;
78 s32 f_bavail;
79 s32 f_files;
80 s32 f_ffree;
81 __kernel_fsid_t f_fsid;
82 s32 f_namelen;
83 s32 f_frsize;
1448c721
EB
84 s32 f_flags;
85 s32 f_spare[4];
1da177e4
LT
86};
87
88struct compat_sigcontext {
89 compat_int_t sc_flags;
90 compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
91 u64 sc_fr[32];
92 compat_int_t sc_iasq[2];
93 compat_int_t sc_iaoq[2];
94 compat_int_t sc_sar; /* cr11 */
95};
96
97#define COMPAT_RLIM_INFINITY 0xffffffff
98
99typedef u32 compat_old_sigset_t; /* at least 32 bits */
100
101#define _COMPAT_NSIG 64
102#define _COMPAT_NSIG_BPW 32
103
104typedef u32 compat_sigset_word;
105
106#define COMPAT_OFF_T_MAX 0x7fffffff
1da177e4 107
bf581e15
HD
108struct compat_ipc64_perm {
109 compat_key_t key;
110 __compat_uid_t uid;
111 __compat_gid_t gid;
112 __compat_uid_t cuid;
113 __compat_gid_t cgid;
114 unsigned short int __pad1;
115 compat_mode_t mode;
116 unsigned short int __pad2;
117 unsigned short int seq;
118 unsigned int __pad3;
119 unsigned long __unused1; /* yes they really are 64bit pads */
120 unsigned long __unused2;
121};
122
123struct compat_semid64_ds {
124 struct compat_ipc64_perm sem_perm;
f69c97f6
AB
125 unsigned int sem_otime_high;
126 unsigned int sem_otime;
127 unsigned int sem_ctime_high;
128 unsigned int sem_ctime;
bf581e15
HD
129 compat_ulong_t sem_nsems;
130 compat_ulong_t __unused3;
131 compat_ulong_t __unused4;
132};
133
134struct compat_msqid64_ds {
135 struct compat_ipc64_perm msg_perm;
f69c97f6
AB
136 unsigned int msg_stime_high;
137 unsigned int msg_stime;
138 unsigned int msg_rtime_high;
139 unsigned int msg_rtime;
140 unsigned int msg_ctime_high;
141 unsigned int msg_ctime;
bf581e15
HD
142 compat_ulong_t msg_cbytes;
143 compat_ulong_t msg_qnum;
144 compat_ulong_t msg_qbytes;
145 compat_pid_t msg_lspid;
146 compat_pid_t msg_lrpid;
147 compat_ulong_t __unused4;
148 compat_ulong_t __unused5;
149};
150
151struct compat_shmid64_ds {
152 struct compat_ipc64_perm shm_perm;
f69c97f6
AB
153 unsigned int shm_atime_high;
154 unsigned int shm_atime;
155 unsigned int shm_dtime_high;
156 unsigned int shm_dtime;
157 unsigned int shm_ctime_high;
158 unsigned int shm_ctime;
bf581e15
HD
159 unsigned int __unused4;
160 compat_size_t shm_segsz;
161 compat_pid_t shm_cpid;
162 compat_pid_t shm_lpid;
163 compat_ulong_t shm_nattch;
164 compat_ulong_t __unused5;
165 compat_ulong_t __unused6;
166};
167
71d577db
HD
168/*
169 * The type of struct elf_prstatus.pr_reg in compatible core dumps.
170 */
171#define COMPAT_ELF_NGREG 80
172typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
173
c41d68a5 174static __inline__ void __user *arch_compat_alloc_user_space(long len)
1da177e4
LT
175{
176 struct pt_regs *regs = &current->thread.regs;
177 return (void __user *)regs->gr[30];
178}
179
a3ea84fa
KM
180static inline int __is_compat_task(struct task_struct *t)
181{
c9f4f06d 182 return test_ti_thread_flag(task_thread_info(t), TIF_32BIT);
a3ea84fa
KM
183}
184
185static inline int is_compat_task(void)
186{
187 return __is_compat_task(current);
188}
189
1da177e4 190#endif /* _ASM_PARISC_COMPAT_H */