| 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 4096 |
| 6 | #define SIGSTKSZ 16384 |
| 7 | #endif |
| 8 | |
| 9 | #if defined(_GNU_SOURCE) |
| 10 | #define LARCH_NGREG 32 |
| 11 | #define LARCH_REG_RA 1 |
| 12 | #define LARCH_REG_SP 3 |
| 13 | #define LARCH_REG_S0 23 |
| 14 | #define LARCH_REG_S1 24 |
| 15 | #define LARCH_REG_A0 4 |
| 16 | #define LARCH_REG_S2 25 |
| 17 | #define LARCH_REG_NARGS 8 |
| 18 | #endif |
| 19 | |
| 20 | #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 21 | #define SC_USED_FP (1U << 0) |
| 22 | #define SC_ADDRERR_RD (1U << 30) |
| 23 | #define SC_ADDRERR_WR (1U << 31) |
| 24 | |
| 25 | typedef unsigned long greg_t, gregset_t[32]; |
| 26 | |
| 27 | struct sigcontext { |
| 28 | unsigned long sc_pc; |
| 29 | unsigned long sc_regs[32]; |
| 30 | unsigned sc_flags; |
| 31 | unsigned long sc_extcontext[] __attribute__((__aligned__(16))); |
| 32 | }; |
| 33 | |
| 34 | #define CONTEXT_INFO_ALIGN 16 |
| 35 | struct sctx_info { |
| 36 | unsigned magic; |
| 37 | unsigned size; |
| 38 | unsigned long padding; |
| 39 | }; |
| 40 | |
| 41 | #define FPU_CTX_MAGIC 0x46505501 |
| 42 | #define FPU_CTX_ALIGN 8 |
| 43 | struct fpu_context { |
| 44 | unsigned long regs[32]; |
| 45 | unsigned long fcc; |
| 46 | unsigned fcsr; |
| 47 | }; |
| 48 | |
| 49 | #define LSX_CTX_MAGIC 0x53580001 |
| 50 | #define LSX_CTX_ALIGN 16 |
| 51 | struct lsx_context { |
| 52 | unsigned long regs[2*32]; |
| 53 | unsigned long fcc; |
| 54 | unsigned fcsr; |
| 55 | }; |
| 56 | |
| 57 | #define LASX_CTX_MAGIC 0x41535801 |
| 58 | #define LASX_CTX_ALIGN 32 |
| 59 | struct lasx_context { |
| 60 | unsigned long regs[4*32]; |
| 61 | unsigned long fcc; |
| 62 | unsigned fcsr; |
| 63 | }; |
| 64 | |
| 65 | #define LBT_CTX_MAGIC 0x42540001 |
| 66 | #define LBT_CTX_ALIGN 8 |
| 67 | struct lbt_context { |
| 68 | unsigned long regs[4]; |
| 69 | unsigned eflags; |
| 70 | unsigned ftop; |
| 71 | }; |
| 72 | #endif |
| 73 | |
| 74 | typedef struct { |
| 75 | unsigned long __pc; |
| 76 | unsigned long __gregs[32]; |
| 77 | unsigned __flags; |
| 78 | unsigned long __extcontext[] __attribute__((__aligned__(16))); |
| 79 | } mcontext_t; |
| 80 | |
| 81 | struct sigaltstack { |
| 82 | void *ss_sp; |
| 83 | int ss_flags; |
| 84 | size_t ss_size; |
| 85 | }; |
| 86 | |
| 87 | typedef struct __ucontext |
| 88 | { |
| 89 | unsigned long uc_flags; |
| 90 | struct __ucontext *uc_link; |
| 91 | stack_t uc_stack; |
| 92 | sigset_t uc_sigmask; |
| 93 | long __uc_pad; |
| 94 | mcontext_t uc_mcontext; |
| 95 | } ucontext_t; |
| 96 | |
| 97 | #define __uc_flags uc_flags |
| 98 | |
| 99 | #define SA_NOCLDSTOP 1 |
| 100 | #define SA_NOCLDWAIT 2 |
| 101 | #define SA_SIGINFO 4 |
| 102 | #define SA_ONSTACK 0x08000000 |
| 103 | #define SA_RESTART 0x10000000 |
| 104 | #define SA_NODEFER 0x40000000 |
| 105 | #define SA_RESETHAND 0x80000000 |
| 106 | |
| 107 | #endif |
| 108 | |
| 109 | #define SIGHUP 1 |
| 110 | #define SIGINT 2 |
| 111 | #define SIGQUIT 3 |
| 112 | #define SIGILL 4 |
| 113 | #define SIGTRAP 5 |
| 114 | #define SIGABRT 6 |
| 115 | #define SIGIOT SIGABRT |
| 116 | #define SIGBUS 7 |
| 117 | #define SIGFPE 8 |
| 118 | #define SIGKILL 9 |
| 119 | #define SIGUSR1 10 |
| 120 | #define SIGSEGV 11 |
| 121 | #define SIGUSR2 12 |
| 122 | #define SIGPIPE 13 |
| 123 | #define SIGALRM 14 |
| 124 | #define SIGTERM 15 |
| 125 | #define SIGSTKFLT 16 |
| 126 | #define SIGCHLD 17 |
| 127 | #define SIGCONT 18 |
| 128 | #define SIGSTOP 19 |
| 129 | #define SIGTSTP 20 |
| 130 | #define SIGTTIN 21 |
| 131 | #define SIGTTOU 22 |
| 132 | #define SIGURG 23 |
| 133 | #define SIGXCPU 24 |
| 134 | #define SIGXFSZ 25 |
| 135 | #define SIGVTALRM 26 |
| 136 | #define SIGPROF 27 |
| 137 | #define SIGWINCH 28 |
| 138 | #define SIGIO 29 |
| 139 | #define SIGPOLL SIGIO |
| 140 | #define SIGPWR 30 |
| 141 | #define SIGSYS 31 |
| 142 | #define SIGUNUSED SIGSYS |
| 143 | |
| 144 | #define _NSIG 65 |