xref: /linux/arch/loongarch/include/uapi/asm/sigcontext.h (revision c7546e2c3cb739a3c1a2f5acaf9bb629d401afe5)
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 
13 /* FP context was used */
14 #define SC_USED_FP		(1 << 0)
15 /* Address error was due to memory load */
16 #define SC_ADDRERR_RD		(1 << 30)
17 /* Address error was due to memory store */
18 #define SC_ADDRERR_WR		(1 << 31)
19 
20 struct sigcontext {
21 	__u64	sc_pc;
22 	__u64	sc_regs[32];
23 	__u32	sc_flags;
24 	__u64	sc_extcontext[0] __attribute__((__aligned__(16)));
25 };
26 
27 #define CONTEXT_INFO_ALIGN	16
28 struct sctx_info {
29 	__u32	magic;
30 	__u32	size;
31 	__u64	padding;	/* padding to 16 bytes */
32 };
33 
34 /* FPU context */
35 #define FPU_CTX_MAGIC		0x46505501
36 #define FPU_CTX_ALIGN		8
37 struct fpu_context {
38 	__u64	regs[32];
39 	__u64	fcc;
40 	__u32	fcsr;
41 };
42 
43 /* LSX context */
44 #define LSX_CTX_MAGIC		0x53580001
45 #define LSX_CTX_ALIGN		16
46 struct lsx_context {
47 	__u64	regs[2*32];
48 	__u64	fcc;
49 	__u32	fcsr;
50 };
51 
52 /* LASX context */
53 #define LASX_CTX_MAGIC		0x41535801
54 #define LASX_CTX_ALIGN		32
55 struct lasx_context {
56 	__u64	regs[4*32];
57 	__u64	fcc;
58 	__u32	fcsr;
59 };
60 
61 /* LBT context */
62 #define LBT_CTX_MAGIC		0x42540001
63 #define LBT_CTX_ALIGN		8
64 struct lbt_context {
65 	__u64	regs[4];
66 	__u32	eflags;
67 	__u32	ftop;
68 };
69 
70 
71 #endif /* _UAPI_ASM_SIGCONTEXT_H */
72