xref: /openbmc/linux/arch/parisc/include/asm/compat.h (revision 7effbd18)
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 #define compat_ipc_pid_t compat_ipc_pid_t
15 typedef u16	compat_ipc_pid_t;
16 
17 #define compat_ipc64_perm compat_ipc64_perm
18 
19 #include <asm-generic/compat.h>
20 
21 #define COMPAT_UTS_MACHINE	"parisc\0\0"
22 
23 typedef u16	compat_nlink_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_sigcontext {
57 	compat_int_t sc_flags;
58 	compat_int_t sc_gr[32]; /* PSW in sc_gr[0] */
59 	u64 sc_fr[32];
60 	compat_int_t sc_iasq[2];
61 	compat_int_t sc_iaoq[2];
62 	compat_int_t sc_sar; /* cr11 */
63 };
64 
65 struct compat_ipc64_perm {
66 	compat_key_t key;
67 	__compat_uid_t uid;
68 	__compat_gid_t gid;
69 	__compat_uid_t cuid;
70 	__compat_gid_t cgid;
71 	unsigned short int __pad1;
72 	compat_mode_t mode;
73 	unsigned short int __pad2;
74 	unsigned short int seq;
75 	unsigned int __pad3;
76 	unsigned long __unused1;	/* yes they really are 64bit pads */
77 	unsigned long __unused2;
78 };
79 
80 struct compat_semid64_ds {
81 	struct compat_ipc64_perm sem_perm;
82 	unsigned int sem_otime_high;
83 	unsigned int sem_otime;
84 	unsigned int sem_ctime_high;
85 	unsigned int sem_ctime;
86 	compat_ulong_t sem_nsems;
87 	compat_ulong_t __unused3;
88 	compat_ulong_t __unused4;
89 };
90 
91 struct compat_msqid64_ds {
92 	struct compat_ipc64_perm msg_perm;
93 	unsigned int msg_stime_high;
94 	unsigned int msg_stime;
95 	unsigned int msg_rtime_high;
96 	unsigned int msg_rtime;
97 	unsigned int msg_ctime_high;
98 	unsigned int msg_ctime;
99 	compat_ulong_t msg_cbytes;
100 	compat_ulong_t msg_qnum;
101 	compat_ulong_t msg_qbytes;
102 	compat_pid_t msg_lspid;
103 	compat_pid_t msg_lrpid;
104 	compat_ulong_t __unused4;
105 	compat_ulong_t __unused5;
106 };
107 
108 struct compat_shmid64_ds {
109 	struct compat_ipc64_perm shm_perm;
110 	unsigned int shm_atime_high;
111 	unsigned int shm_atime;
112 	unsigned int shm_dtime_high;
113 	unsigned int shm_dtime;
114 	unsigned int shm_ctime_high;
115 	unsigned int shm_ctime;
116 	unsigned int __unused4;
117 	compat_size_t shm_segsz;
118 	compat_pid_t shm_cpid;
119 	compat_pid_t shm_lpid;
120 	compat_ulong_t shm_nattch;
121 	compat_ulong_t __unused5;
122 	compat_ulong_t __unused6;
123 };
124 
125 /*
126  * The type of struct elf_prstatus.pr_reg in compatible core dumps.
127  */
128 #define COMPAT_ELF_NGREG 80
129 typedef compat_ulong_t compat_elf_gregset_t[COMPAT_ELF_NGREG];
130 
131 static inline int __is_compat_task(struct task_struct *t)
132 {
133 	return test_tsk_thread_flag(t, TIF_32BIT);
134 }
135 
136 static inline int is_compat_task(void)
137 {
138 	return __is_compat_task(current);
139 }
140 
141 #endif /* _ASM_PARISC_COMPAT_H */
142