xref: /linux/arch/loongarch/include/uapi/asm/sigcontext.h (revision 72bea132f3680ee51e7ed2cee62892b6f5121909)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2 /*
3  * Author: Hanlu Li <lihanlu@loongson.cn>
4  *         Huacai Chen <chenhuacai@loongson.cn>
5  *
6  * Copyright (C) 2020-2022 Loongson Technology Corporation Limited
7  */
8 #ifndef _UAPI_ASM_SIGCONTEXT_H
9 #define _UAPI_ASM_SIGCONTEXT_H
10 
11 #include <linux/types.h>
12 #include <linux/posix_types.h>
13 
14 /* FP context was used */
15 #define SC_USED_FP		(1 << 0)
16 /* Address error was due to memory load */
17 #define SC_ADDRERR_RD		(1 << 30)
18 /* Address error was due to memory store */
19 #define SC_ADDRERR_WR		(1 << 31)
20 
21 struct sigcontext {
22 	__u64	sc_pc;
23 	__u64	sc_regs[32];
24 	__u32	sc_flags;
25 	__u64	sc_extcontext[0] __attribute__((__aligned__(16)));
26 };
27 
28 #define CONTEXT_INFO_ALIGN	16
29 struct sctx_info {
30 	__u32	magic;
31 	__u32	size;
32 	__u64	padding;	/* padding to 16 bytes */
33 };
34 
35 /* FPU context */
36 #define FPU_CTX_MAGIC		0x46505501
37 #define FPU_CTX_ALIGN		8
38 struct fpu_context {
39 	__u64	regs[32];
40 	__u64	fcc;
41 	__u32	fcsr;
42 };
43 
44 /* LSX context */
45 #define LSX_CTX_MAGIC		0x53580001
46 #define LSX_CTX_ALIGN		16
47 struct lsx_context {
48 	__u64	regs[2*32];
49 	__u64	fcc;
50 	__u32	fcsr;
51 };
52 
53 /* LASX context */
54 #define LASX_CTX_MAGIC		0x41535801
55 #define LASX_CTX_ALIGN		32
56 struct lasx_context {
57 	__u64	regs[4*32];
58 	__u64	fcc;
59 	__u32	fcsr;
60 };
61 
62 /* LBT context */
63 #define LBT_CTX_MAGIC		0x42540001
64 #define LBT_CTX_ALIGN		8
65 struct lbt_context {
66 	__u64	regs[4];
67 	__u32	eflags;
68 	__u32	ftop;
69 };
70 
71 
72 #endif /* _UAPI_ASM_SIGCONTEXT_H */
73