76d7ad80c8cdbc57294ae51c4b4b59e7bc0e7d58
[musl] / arch / riscv64 / bits / signal.h
1 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
2  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
3
4 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
5 # define MINSIGSTKSZ 2048
6 # define SIGSTKSZ 8192
7 #endif
8
9 /* gregs[0] holds the program counter. */
10
11 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
12 typedef unsigned long greg_t;
13 typedef unsigned long gregset_t[32];
14
15 struct __riscv_mc_f_ext_state {
16         unsigned int f[32];
17         unsigned int fcsr;
18 };
19
20 struct __riscv_mc_d_ext_state {
21         unsigned long long f[32];
22         unsigned int fcsr;
23 };
24
25 struct __riscv_mc_q_ext_state {
26         unsigned long long f[64] __attribute__((aligned(16)));
27         unsigned int fcsr;
28         unsigned int reserved[3];
29 };
30
31 union __riscv_mc_fp_state {
32         struct __riscv_mc_f_ext_state f;
33         struct __riscv_mc_d_ext_state d;
34         struct __riscv_mc_q_ext_state q;
35 };
36
37 typedef union __riscv_mc_fp_state fpregset_t;
38
39 typedef struct sigcontext {
40         gregset_t gregs;
41         fpregset_t fpregs;
42 } mcontext_t;
43
44 #else
45 typedef struct {
46         unsigned long gregs[32];
47         unsigned long long fpregs[66];
48 } mcontext_t;
49 #endif
50
51 struct sigaltstack {
52         void *ss_sp;
53         int ss_flags;
54         size_t ss_size;
55 };
56
57 typedef struct __ucontext
58 {
59         unsigned long uc_flags;
60         struct __ucontext *uc_link;
61         stack_t uc_stack;
62         sigset_t uc_sigmask;
63         mcontext_t uc_mcontext;
64 } ucontext_t;
65
66 #define SA_NOCLDSTOP 1
67 #define SA_NOCLDWAIT 2
68 #define SA_SIGINFO   4
69 #define SA_ONSTACK   0x08000000
70 #define SA_RESTART   0x10000000
71 #define SA_NODEFER   0x40000000
72 #define SA_RESETHAND 0x80000000
73 #define SA_RESTORER  0x04000000
74
75 #endif
76
77 #define SIGHUP     1
78 #define SIGINT     2
79 #define SIGQUIT    3
80 #define SIGILL     4
81 #define SIGTRAP    5
82 #define SIGABRT    6
83 #define SIGIOT     SIGABRT
84 #define SIGBUS     7
85 #define SIGFPE     8
86 #define SIGKILL    9
87 #define SIGUSR1   10
88 #define SIGSEGV   11
89 #define SIGUSR2   12
90 #define SIGPIPE   13
91 #define SIGALRM   14
92 #define SIGTERM   15
93 #define SIGSTKFLT 16
94 #define SIGCHLD   17
95 #define SIGCONT   18
96 #define SIGSTOP   19
97 #define SIGTSTP   20
98 #define SIGTTIN   21
99 #define SIGTTOU   22
100 #define SIGURG    23
101 #define SIGXCPU   24
102 #define SIGXFSZ   25
103 #define SIGVTALRM 26
104 #define SIGPROF   27
105 #define SIGWINCH  28
106 #define SIGIO     29
107 #define SIGPOLL   SIGIO
108 #define SIGPWR    30
109 #define SIGSYS    31
110 #define SIGUNUSED SIGSYS
111
112 #define _NSIG     65