]> git.karo-electronics.de Git - karo-tx-linux.git/blob - arch/arm64/include/uapi/asm/sigcontext.h
arm64: signal: factor out signal frame record allocation
[karo-tx-linux.git] / arch / arm64 / include / uapi / asm / sigcontext.h
1 /*
2  * Copyright (C) 2012 ARM Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef _UAPI__ASM_SIGCONTEXT_H
17 #define _UAPI__ASM_SIGCONTEXT_H
18
19 #include <linux/types.h>
20
21 /*
22  * Signal context structure - contains all info to do with the state
23  * before the signal handler was invoked.
24  */
25 struct sigcontext {
26         __u64 fault_address;
27         /* AArch64 registers */
28         __u64 regs[31];
29         __u64 sp;
30         __u64 pc;
31         __u64 pstate;
32         /* 4K reserved for FP/SIMD state and future expansion */
33         __u8 __reserved[4096] __attribute__((__aligned__(16)));
34 };
35
36 /*
37  * Allocation of __reserved[]:
38  * (Note: records do not necessarily occur in the order shown here.)
39  *
40  *      size            description
41  *
42  *      0x210           fpsimd_context
43  *       0x10           esr_context
44  *       0x10           terminator (null _aarch64_ctx)
45  *
46  *      0xdd0           (reserved for future allocation)
47  *
48  * New records that can exceed this space need to be opt-in for userspace, so
49  * that an expanded signal frame is not generated unexpectedly.  The mechanism
50  * for opting in will depend on the extension that generates each new record.
51  * The above table documents the maximum set and sizes of records than can be
52  * generated when userspace does not opt in for any such extension.
53  */
54
55 /*
56  * Header to be used at the beginning of structures extending the user
57  * context. Such structures must be placed after the rt_sigframe on the stack
58  * and be 16-byte aligned. The last structure must be a dummy one with the
59  * magic and size set to 0.
60  */
61 struct _aarch64_ctx {
62         __u32 magic;
63         __u32 size;
64 };
65
66 #define FPSIMD_MAGIC    0x46508001
67
68 struct fpsimd_context {
69         struct _aarch64_ctx head;
70         __u32 fpsr;
71         __u32 fpcr;
72         __uint128_t vregs[32];
73 };
74
75 /* ESR_EL1 context */
76 #define ESR_MAGIC       0x45535201
77
78 struct esr_context {
79         struct _aarch64_ctx head;
80         __u64 esr;
81 };
82
83 #endif /* _UAPI__ASM_SIGCONTEXT_H */