| 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 |
typedef unsigned long __riscv_mc_gp_state[32]; |
| 10 |
|
| 11 |
struct __riscv_mc_f_ext_state { |
| 12 |
unsigned int __f[32]; |
| 13 |
unsigned int __fcsr; |
| 14 |
}; |
| 15 |
|
| 16 |
struct __riscv_mc_d_ext_state { |
| 17 |
unsigned long long __f[32]; |
| 18 |
unsigned int __fcsr; |
| 19 |
}; |
| 20 |
|
| 21 |
struct __riscv_mc_q_ext_state { |
| 22 |
unsigned long long __f[64] __attribute__((__aligned__(16))); |
| 23 |
unsigned int __fcsr; |
| 24 |
unsigned int __reserved[3]; |
| 25 |
}; |
| 26 |
|
| 27 |
union __riscv_mc_fp_state { |
| 28 |
struct __riscv_mc_f_ext_state __f; |
| 29 |
struct __riscv_mc_d_ext_state __d; |
| 30 |
struct __riscv_mc_q_ext_state __q; |
| 31 |
}; |
| 32 |
|
| 33 |
typedef struct mcontext_t { |
| 34 |
__riscv_mc_gp_state __gregs; |
| 35 |
union __riscv_mc_fp_state __fpregs; |
| 36 |
} mcontext_t; |
| 37 |
|
| 38 |
#if defined(_GNU_SOURCE) |
| 39 |
#define REG_PC 0 |
| 40 |
#define REG_RA 1 |
| 41 |
#define REG_SP 2 |
| 42 |
#define REG_TP 4 |
| 43 |
#define REG_S0 8 |
| 44 |
#define REG_S1 9 |
| 45 |
#define REG_A0 10 |
| 46 |
#define REG_S2 18 |
| 47 |
#endif |
| 48 |
|
| 49 |
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 50 |
typedef unsigned long greg_t; |
| 51 |
typedef unsigned long gregset_t[32]; |
| 52 |
typedef union __riscv_mc_fp_state fpregset_t; |
| 53 |
struct sigcontext { |
| 54 |
gregset_t gregs; |
| 55 |
fpregset_t fpregs; |
| 56 |
}; |
| 57 |
#endif |
| 58 |
|
| 59 |
struct sigaltstack { |
| 60 |
void *ss_sp; |
| 61 |
int ss_flags; |
| 62 |
size_t ss_size; |
| 63 |
}; |
| 64 |
|
| 65 |
typedef struct __ucontext |
| 66 |
{ |
| 67 |
unsigned long uc_flags; |
| 68 |
struct __ucontext *uc_link; |
| 69 |
stack_t uc_stack; |
| 70 |
sigset_t uc_sigmask; |
| 71 |
mcontext_t uc_mcontext; |
| 72 |
} ucontext_t; |
| 73 |
|
| 74 |
#define SA_NOCLDSTOP 1 |
| 75 |
#define SA_NOCLDWAIT 2 |
| 76 |
#define SA_SIGINFO 4 |
| 77 |
#define SA_ONSTACK 0x08000000 |
| 78 |
#define SA_RESTART 0x10000000 |
| 79 |
#define SA_NODEFER 0x40000000 |
| 80 |
#define SA_RESETHAND 0x80000000 |
| 81 |
|
| 82 |
#endif |
| 83 |
|
| 84 |
#define SIGHUP 1 |
| 85 |
#define SIGINT 2 |
| 86 |
#define SIGQUIT 3 |
| 87 |
#define SIGILL 4 |
| 88 |
#define SIGTRAP 5 |
| 89 |
#define SIGABRT 6 |
| 90 |
#define SIGIOT SIGABRT |
| 91 |
#define SIGBUS 7 |
| 92 |
#define SIGFPE 8 |
| 93 |
#define SIGKILL 9 |
| 94 |
#define SIGUSR1 10 |
| 95 |
#define SIGSEGV 11 |
| 96 |
#define SIGUSR2 12 |
| 97 |
#define SIGPIPE 13 |
| 98 |
#define SIGALRM 14 |
| 99 |
#define SIGTERM 15 |
| 100 |
#define SIGSTKFLT 16 |
| 101 |
#define SIGCHLD 17 |
| 102 |
#define SIGCONT 18 |
| 103 |
#define SIGSTOP 19 |
| 104 |
#define SIGTSTP 20 |
| 105 |
#define SIGTTIN 21 |
| 106 |
#define SIGTTOU 22 |
| 107 |
#define SIGURG 23 |
| 108 |
#define SIGXCPU 24 |
| 109 |
#define SIGXFSZ 25 |
| 110 |
#define SIGVTALRM 26 |
| 111 |
#define SIGPROF 27 |
| 112 |
#define SIGWINCH 28 |
| 113 |
#define SIGIO 29 |
| 114 |
#define SIGPOLL SIGIO |
| 115 |
#define SIGPWR 30 |
| 116 |
#define SIGSYS 31 |
| 117 |
#define SIGUNUSED SIGSYS |
| 118 |
|
| 119 |
#define _NSIG 65 |