xref: /linux/arch/arm64/include/asm/signal32.h (revision 03b0f2ce735e97e9f49790d4563c82515b8fa702)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2012 ARM Ltd.
4  */
5 #ifndef __ASM_SIGNAL32_H
6 #define __ASM_SIGNAL32_H
7 
8 #ifdef __KERNEL__
9 #ifdef CONFIG_COMPAT
10 #include <linux/compat.h>
11 
12 struct compat_sigcontext {
13 	/* We always set these two fields to 0 */
14 	compat_ulong_t			trap_no;
15 	compat_ulong_t			error_code;
16 
17 	compat_ulong_t			oldmask;
18 	compat_ulong_t			arm_r0;
19 	compat_ulong_t			arm_r1;
20 	compat_ulong_t			arm_r2;
21 	compat_ulong_t			arm_r3;
22 	compat_ulong_t			arm_r4;
23 	compat_ulong_t			arm_r5;
24 	compat_ulong_t			arm_r6;
25 	compat_ulong_t			arm_r7;
26 	compat_ulong_t			arm_r8;
27 	compat_ulong_t			arm_r9;
28 	compat_ulong_t			arm_r10;
29 	compat_ulong_t			arm_fp;
30 	compat_ulong_t			arm_ip;
31 	compat_ulong_t			arm_sp;
32 	compat_ulong_t			arm_lr;
33 	compat_ulong_t			arm_pc;
34 	compat_ulong_t			arm_cpsr;
35 	compat_ulong_t			fault_address;
36 };
37 
38 struct compat_ucontext {
39 	compat_ulong_t			uc_flags;
40 	compat_uptr_t			uc_link;
41 	compat_stack_t			uc_stack;
42 	struct compat_sigcontext	uc_mcontext;
43 	compat_sigset_t			uc_sigmask;
44 	int 				__unused[32 - (sizeof(compat_sigset_t) / sizeof(int))];
45 	compat_ulong_t			uc_regspace[128] __attribute__((__aligned__(8)));
46 };
47 
48 struct compat_sigframe {
49 	struct compat_ucontext	uc;
50 	compat_ulong_t		retcode[2];
51 };
52 
53 struct compat_rt_sigframe {
54 	struct compat_siginfo info;
55 	struct compat_sigframe sig;
56 };
57 
58 int compat_setup_frame(int usig, struct ksignal *ksig, sigset_t *set,
59 		       struct pt_regs *regs);
60 int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
61 			  struct pt_regs *regs);
62 
63 void compat_setup_restart_syscall(struct pt_regs *regs);
64 #else
65 
66 static inline int compat_setup_frame(int usid, struct ksignal *ksig,
67 				     sigset_t *set, struct pt_regs *regs)
68 {
69 	return -ENOSYS;
70 }
71 
72 static inline int compat_setup_rt_frame(int usig, struct ksignal *ksig, sigset_t *set,
73 					struct pt_regs *regs)
74 {
75 	return -ENOSYS;
76 }
77 
78 static inline void compat_setup_restart_syscall(struct pt_regs *regs)
79 {
80 }
81 #endif /* CONFIG_COMPAT */
82 #endif /* __KERNEL__ */
83 #endif /* __ASM_SIGNAL32_H */
84