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