1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
2/*
3* Copyright (C) 2020 Loongson Technology Corporation Limited
4*
5* Author: Hanlu Li <lihanlu@loongson.cn>
6*/
7#ifndef _UAPI_ASM_SIGCONTEXT_H
8#define _UAPI_ASM_SIGCONTEXT_H
9
10#include <linux/types.h>
11#include <linux/posix_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
20struct 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
28struct 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
37struct 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
46struct 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
55struct 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
64struct lbt_context {
65	__u64	scr[4];
66	__u32	eflags;
67};
68
69#endif /* _UAPI_ASM_SIGCONTEXT_H */
70