xref: /linux-6.15/include/linux/elfcore-compat.h (revision 95af469c)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2ab799dedSRoland McGrath #ifndef _LINUX_ELFCORE_COMPAT_H
3ab799dedSRoland McGrath #define _LINUX_ELFCORE_COMPAT_H
4ab799dedSRoland McGrath 
5ab799dedSRoland McGrath #include <linux/elf.h>
6ab799dedSRoland McGrath #include <linux/elfcore.h>
7ab799dedSRoland McGrath #include <linux/compat.h>
8ab799dedSRoland McGrath 
9ab799dedSRoland McGrath /*
10ab799dedSRoland McGrath  * Make sure these layouts match the linux/elfcore.h native definitions.
11ab799dedSRoland McGrath  */
12ab799dedSRoland McGrath 
13ab799dedSRoland McGrath struct compat_elf_siginfo
14ab799dedSRoland McGrath {
15ab799dedSRoland McGrath 	compat_int_t			si_signo;
16ab799dedSRoland McGrath 	compat_int_t			si_code;
17ab799dedSRoland McGrath 	compat_int_t			si_errno;
18ab799dedSRoland McGrath };
19ab799dedSRoland McGrath 
20f2485a2dSAl Viro struct compat_elf_prstatus_common
21ab799dedSRoland McGrath {
22ab799dedSRoland McGrath 	struct compat_elf_siginfo	pr_info;
23ab799dedSRoland McGrath 	short				pr_cursig;
24ab799dedSRoland McGrath 	compat_ulong_t			pr_sigpend;
25ab799dedSRoland McGrath 	compat_ulong_t			pr_sighold;
26ab799dedSRoland McGrath 	compat_pid_t			pr_pid;
27ab799dedSRoland McGrath 	compat_pid_t			pr_ppid;
28ab799dedSRoland McGrath 	compat_pid_t			pr_pgrp;
29ab799dedSRoland McGrath 	compat_pid_t			pr_sid;
309afc5eeeSArnd Bergmann 	struct old_timeval32		pr_utime;
319afc5eeeSArnd Bergmann 	struct old_timeval32		pr_stime;
329afc5eeeSArnd Bergmann 	struct old_timeval32		pr_cutime;
339afc5eeeSArnd Bergmann 	struct old_timeval32		pr_cstime;
34f2485a2dSAl Viro };
35f2485a2dSAl Viro 
36ab799dedSRoland McGrath struct compat_elf_prpsinfo
37ab799dedSRoland McGrath {
38ab799dedSRoland McGrath 	char				pr_state;
39ab799dedSRoland McGrath 	char				pr_sname;
40ab799dedSRoland McGrath 	char				pr_zomb;
41ab799dedSRoland McGrath 	char				pr_nice;
42ab799dedSRoland McGrath 	compat_ulong_t			pr_flag;
43b5993164SRoland McGrath 	__compat_uid_t			pr_uid;
44b5993164SRoland McGrath 	__compat_gid_t			pr_gid;
45ab799dedSRoland McGrath 	compat_pid_t			pr_pid, pr_ppid, pr_pgrp, pr_sid;
46*95af469cSYafang Shao 	/*
47*95af469cSYafang Shao 	 * The hard-coded 16 is derived from TASK_COMM_LEN, but it can't be
48*95af469cSYafang Shao 	 * changed as it is exposed to userspace. We'd better make it hard-coded
49*95af469cSYafang Shao 	 * here.
50*95af469cSYafang Shao 	 */
51ab799dedSRoland McGrath 	char				pr_fname[16];
52ab799dedSRoland McGrath 	char				pr_psargs[ELF_PRARGSZ];
53ab799dedSRoland McGrath };
54ab799dedSRoland McGrath 
557facdc42SAl Viro #ifdef CONFIG_ARCH_HAS_ELFCORE_COMPAT
567facdc42SAl Viro #include <asm/elfcore-compat.h>
577facdc42SAl Viro #endif
587facdc42SAl Viro 
597facdc42SAl Viro struct compat_elf_prstatus
607facdc42SAl Viro {
617facdc42SAl Viro 	struct compat_elf_prstatus_common	common;
627facdc42SAl Viro 	compat_elf_gregset_t		pr_reg;
637facdc42SAl Viro 	compat_int_t			pr_fpvalid;
647facdc42SAl Viro };
657facdc42SAl Viro 
66ab799dedSRoland McGrath #endif /* _LINUX_ELFCORE_COMPAT_H */
67