1570af302Sopenharmony_ci#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \ 2570af302Sopenharmony_ci || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 3570af302Sopenharmony_ci 4570af302Sopenharmony_ci#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 5570af302Sopenharmony_ci# define MINSIGSTKSZ 2048 6570af302Sopenharmony_ci# define SIGSTKSZ 8192 7570af302Sopenharmony_ci#endif 8570af302Sopenharmony_ci 9570af302Sopenharmony_citypedef unsigned long __riscv_mc_gp_state[32]; 10570af302Sopenharmony_ci 11570af302Sopenharmony_cistruct __riscv_mc_f_ext_state { 12570af302Sopenharmony_ci unsigned int __f[32]; 13570af302Sopenharmony_ci unsigned int __fcsr; 14570af302Sopenharmony_ci}; 15570af302Sopenharmony_ci 16570af302Sopenharmony_cistruct __riscv_mc_d_ext_state { 17570af302Sopenharmony_ci unsigned long long __f[32]; 18570af302Sopenharmony_ci unsigned int __fcsr; 19570af302Sopenharmony_ci}; 20570af302Sopenharmony_ci 21570af302Sopenharmony_cistruct __riscv_mc_q_ext_state { 22570af302Sopenharmony_ci unsigned long long __f[64] __attribute__((aligned(16))); 23570af302Sopenharmony_ci unsigned int __fcsr; 24570af302Sopenharmony_ci unsigned int __reserved[3]; 25570af302Sopenharmony_ci}; 26570af302Sopenharmony_ci 27570af302Sopenharmony_ciunion __riscv_mc_fp_state { 28570af302Sopenharmony_ci struct __riscv_mc_f_ext_state __f; 29570af302Sopenharmony_ci struct __riscv_mc_d_ext_state __d; 30570af302Sopenharmony_ci struct __riscv_mc_q_ext_state __q; 31570af302Sopenharmony_ci}; 32570af302Sopenharmony_ci 33570af302Sopenharmony_citypedef struct mcontext_t { 34570af302Sopenharmony_ci __riscv_mc_gp_state __gregs; 35570af302Sopenharmony_ci union __riscv_mc_fp_state __fpregs; 36570af302Sopenharmony_ci} mcontext_t; 37570af302Sopenharmony_ci 38570af302Sopenharmony_ci#if defined(_GNU_SOURCE) 39570af302Sopenharmony_ci#define REG_PC 0 40570af302Sopenharmony_ci#define REG_RA 1 41570af302Sopenharmony_ci#define REG_SP 2 42570af302Sopenharmony_ci#define REG_TP 4 43570af302Sopenharmony_ci#define REG_S0 8 44570af302Sopenharmony_ci#define REG_S1 9 45570af302Sopenharmony_ci#define REG_A0 10 46570af302Sopenharmony_ci#define REG_S2 18 47570af302Sopenharmony_ci#endif 48570af302Sopenharmony_ci 49570af302Sopenharmony_ci#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) 50570af302Sopenharmony_citypedef unsigned long greg_t; 51570af302Sopenharmony_citypedef unsigned long gregset_t[32]; 52570af302Sopenharmony_citypedef union __riscv_mc_fp_state fpregset_t; 53570af302Sopenharmony_cistruct sigcontext { 54570af302Sopenharmony_ci gregset_t gregs; 55570af302Sopenharmony_ci fpregset_t fpregs; 56570af302Sopenharmony_ci}; 57570af302Sopenharmony_ci#endif 58570af302Sopenharmony_ci 59570af302Sopenharmony_cistruct sigaltstack { 60570af302Sopenharmony_ci void *ss_sp; 61570af302Sopenharmony_ci int ss_flags; 62570af302Sopenharmony_ci size_t ss_size; 63570af302Sopenharmony_ci}; 64570af302Sopenharmony_ci 65570af302Sopenharmony_citypedef struct __ucontext 66570af302Sopenharmony_ci{ 67570af302Sopenharmony_ci unsigned long uc_flags; 68570af302Sopenharmony_ci struct __ucontext *uc_link; 69570af302Sopenharmony_ci stack_t uc_stack; 70570af302Sopenharmony_ci sigset_t uc_sigmask; 71570af302Sopenharmony_ci mcontext_t uc_mcontext; 72570af302Sopenharmony_ci} ucontext_t; 73570af302Sopenharmony_ci 74570af302Sopenharmony_ci#define SA_NOCLDSTOP 1 75570af302Sopenharmony_ci#define SA_NOCLDWAIT 2 76570af302Sopenharmony_ci#define SA_SIGINFO 4 77570af302Sopenharmony_ci#define SA_ONSTACK 0x08000000 78570af302Sopenharmony_ci#define SA_RESTART 0x10000000 79570af302Sopenharmony_ci#define SA_NODEFER 0x40000000 80570af302Sopenharmony_ci#define SA_RESETHAND 0x80000000 81570af302Sopenharmony_ci 82570af302Sopenharmony_ci#endif 83570af302Sopenharmony_ci 84570af302Sopenharmony_ci#define SIGHUP 1 85570af302Sopenharmony_ci#define SIGINT 2 86570af302Sopenharmony_ci#define SIGQUIT 3 87570af302Sopenharmony_ci#define SIGILL 4 88570af302Sopenharmony_ci#define SIGTRAP 5 89570af302Sopenharmony_ci#define SIGABRT 6 90570af302Sopenharmony_ci#define SIGIOT SIGABRT 91570af302Sopenharmony_ci#define SIGBUS 7 92570af302Sopenharmony_ci#define SIGFPE 8 93570af302Sopenharmony_ci#define SIGKILL 9 94570af302Sopenharmony_ci#define SIGUSR1 10 95570af302Sopenharmony_ci#define SIGSEGV 11 96570af302Sopenharmony_ci#define SIGUSR2 12 97570af302Sopenharmony_ci#define SIGPIPE 13 98570af302Sopenharmony_ci#define SIGALRM 14 99570af302Sopenharmony_ci#define SIGTERM 15 100570af302Sopenharmony_ci#define SIGSTKFLT 16 101570af302Sopenharmony_ci#define SIGCHLD 17 102570af302Sopenharmony_ci#define SIGCONT 18 103570af302Sopenharmony_ci#define SIGSTOP 19 104570af302Sopenharmony_ci#define SIGTSTP 20 105570af302Sopenharmony_ci#define SIGTTIN 21 106570af302Sopenharmony_ci#define SIGTTOU 22 107570af302Sopenharmony_ci#define SIGURG 23 108570af302Sopenharmony_ci#define SIGXCPU 24 109570af302Sopenharmony_ci#define SIGXFSZ 25 110570af302Sopenharmony_ci#define SIGVTALRM 26 111570af302Sopenharmony_ci#define SIGPROF 27 112570af302Sopenharmony_ci#define SIGWINCH 28 113570af302Sopenharmony_ci#define SIGIO 29 114570af302Sopenharmony_ci#define SIGPOLL SIGIO 115570af302Sopenharmony_ci#define SIGPWR 30 116570af302Sopenharmony_ci#define SIGSYS 31 117570af302Sopenharmony_ci#define SIGUNUSED SIGSYS 118570af302Sopenharmony_ci 119570af302Sopenharmony_ci#define _NSIG 65 120