| 1 | #include "platform.h" |
| 2 | |
| 3 | #include "diskBack.unix.c" |
| 4 | #include "displayMem.proc.c" |
| 5 | #include "mmap-protect.c" |
| 6 | #include "nonwin.c" |
| 7 | #include "sysctl.c" |
| 8 | #include "use-mmap.c" |
| 9 | |
| 10 | static void catcher (__attribute__ ((unused)) int signo, |
| 11 | __attribute__ ((unused)) siginfo_t* info, |
| 12 | void* context) { |
| 13 | ucontext_t* ucp = (ucontext_t*)context; |
| 14 | |
| 15 | #if (defined (__x86_64__)) |
| 16 | GC_handleSigProf ((code_pointer) ucp->sc_rip); |
| 17 | #elif (defined (__i386__)) |
| 18 | GC_handleSigProf ((code_pointer) ucp->sc_eip); |
| 19 | #else |
| 20 | #error Profiling handler is missing for this architecture |
| 21 | #endif |
| 22 | |
| 23 | } |
| 24 | |
| 25 | void GC_setSigProfHandler (struct sigaction *sa) { |
| 26 | sa->sa_flags = SA_ONSTACK | SA_RESTART | SA_SIGINFO; |
| 27 | sa->sa_sigaction = (void (*)(int, siginfo_t*, void*))catcher; |
| 28 | } |