| 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 |
#ifdef _GNU_SOURCE |
| 10 |
enum { R_D0 = 0 }; |
| 11 |
#define R_D0 R_D0 |
| 12 |
enum { R_D1 = 1 }; |
| 13 |
#define R_D1 R_D1 |
| 14 |
enum { R_D2 = 2 }; |
| 15 |
#define R_D2 R_D2 |
| 16 |
enum { R_D3 = 3 }; |
| 17 |
#define R_D3 R_D3 |
| 18 |
enum { R_D4 = 4 }; |
| 19 |
#define R_D4 R_D4 |
| 20 |
enum { R_D5 = 5 }; |
| 21 |
#define R_D5 R_D5 |
| 22 |
enum { R_D6 = 6 }; |
| 23 |
#define R_D6 R_D6 |
| 24 |
enum { R_D7 = 7 }; |
| 25 |
#define R_D7 R_D7 |
| 26 |
enum { R_A0 = 8 }; |
| 27 |
#define R_A0 R_A0 |
| 28 |
enum { R_A1 = 9 }; |
| 29 |
#define R_A1 R_A1 |
| 30 |
enum { R_A2 = 10 }; |
| 31 |
#define R_A2 R_A2 |
| 32 |
enum { R_A3 = 11 }; |
| 33 |
#define R_A3 R_A3 |
| 34 |
enum { R_A4 = 12 }; |
| 35 |
#define R_A4 R_A4 |
| 36 |
enum { R_A5 = 13 }; |
| 37 |
#define R_A5 R_A5 |
| 38 |
enum { R_A6 = 14 }; |
| 39 |
#define R_A6 R_A6 |
| 40 |
enum { R_A7 = 15 }; |
| 41 |
#define R_A7 R_A7 |
| 42 |
enum { R_SP = 15 }; |
| 43 |
#define R_SP R_SP |
| 44 |
enum { R_PC = 16 }; |
| 45 |
#define R_PC R_PC |
| 46 |
enum { R_PS = 17 }; |
| 47 |
#define R_PS R_PS |
| 48 |
#endif |
| 49 |
|
| 50 |
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) |
| 51 |
|
| 52 |
struct sigcontext { |
| 53 |
unsigned long sc_mask, sc_usp, sc_d0, sc_d1, sc_a0, sc_a1; |
| 54 |
unsigned short sc_sr; |
| 55 |
unsigned long sc_pc; |
| 56 |
unsigned short sc_formatvec; |
| 57 |
unsigned long sc_fpregs[6], sc_fpcntl[3]; |
| 58 |
unsigned char sc_fpstate[216]; |
| 59 |
}; |
| 60 |
|
| 61 |
typedef int greg_t, gregset_t[18]; |
| 62 |
typedef struct { |
| 63 |
int f_pcr, f_psr, f_fpiaddr, f_fpregs[8][3]; |
| 64 |
} fpregset_t; |
| 65 |
|
| 66 |
typedef struct { |
| 67 |
int version; |
| 68 |
gregset_t gregs; |
| 69 |
fpregset_t fpregs; |
| 70 |
} mcontext_t; |
| 71 |
#else |
| 72 |
typedef struct { |
| 73 |
int __version; |
| 74 |
int __gregs[18]; |
| 75 |
int __fpregs[27]; |
| 76 |
} mcontext_t; |
| 77 |
#endif |
| 78 |
|
| 79 |
struct sigaltstack { |
| 80 |
void *ss_sp; |
| 81 |
int ss_flags; |
| 82 |
size_t ss_size; |
| 83 |
}; |
| 84 |
|
| 85 |
typedef struct __ucontext { |
| 86 |
unsigned long uc_flags; |
| 87 |
struct __ucontext *uc_link; |
| 88 |
stack_t uc_stack; |
| 89 |
mcontext_t uc_mcontext; |
| 90 |
long __reserved[80]; |
| 91 |
sigset_t uc_sigmask; |
| 92 |
} ucontext_t; |
| 93 |
|
| 94 |
#define SA_NOCLDSTOP 1 |
| 95 |
#define SA_NOCLDWAIT 2 |
| 96 |
#define SA_SIGINFO 4 |
| 97 |
#define SA_ONSTACK 0x08000000 |
| 98 |
#define SA_RESTART 0x10000000 |
| 99 |
#define SA_NODEFER 0x40000000 |
| 100 |
#define SA_RESETHAND 0x80000000 |
| 101 |
#define SA_RESTORER 0x04000000 |
| 102 |
|
| 103 |
#endif |
| 104 |
|
| 105 |
#define SIGHUP 1 |
| 106 |
#define SIGINT 2 |
| 107 |
#define SIGQUIT 3 |
| 108 |
#define SIGILL 4 |
| 109 |
#define SIGTRAP 5 |
| 110 |
#define SIGABRT 6 |
| 111 |
#define SIGIOT SIGABRT |
| 112 |
#define SIGBUS 7 |
| 113 |
#define SIGFPE 8 |
| 114 |
#define SIGKILL 9 |
| 115 |
#define SIGUSR1 10 |
| 116 |
#define SIGSEGV 11 |
| 117 |
#define SIGUSR2 12 |
| 118 |
#define SIGPIPE 13 |
| 119 |
#define SIGALRM 14 |
| 120 |
#define SIGTERM 15 |
| 121 |
#define SIGSTKFLT 16 |
| 122 |
#define SIGCHLD 17 |
| 123 |
#define SIGCONT 18 |
| 124 |
#define SIGSTOP 19 |
| 125 |
#define SIGTSTP 20 |
| 126 |
#define SIGTTIN 21 |
| 127 |
#define SIGTTOU 22 |
| 128 |
#define SIGURG 23 |
| 129 |
#define SIGXCPU 24 |
| 130 |
#define SIGXFSZ 25 |
| 131 |
#define SIGVTALRM 26 |
| 132 |
#define SIGPROF 27 |
| 133 |
#define SIGWINCH 28 |
| 134 |
#define SIGIO 29 |
| 135 |
#define SIGPOLL 29 |
| 136 |
#define SIGPWR 30 |
| 137 |
#define SIGSYS 31 |
| 138 |
#define SIGUNUSED SIGSYS |
| 139 |
|
| 140 |
#define _NSIG 65 |