4 /* TODO(bernhard): use {u,}int* types */
7 // Note by hs: my signal.h includes sys/uconctext which conflicts with
8 // asm/ucontext - this hack kinda solves the problem for me ;-)
9 // so feel free to blame me for that s**t
10 #if defined __USE_XOPEN2K8
13 #warning hs-hack: undefining __USE_XOPEN2K8 for signal.h
17 #define __USE_XOPEN2K8
20 #include <sys/ucontext.h>
22 #include "prototypes.h"
24 void trap(int nSignal, siginfo_t *info, void *ctx)
26 printf("sig: %d\n", nSignal);
28 mcontext_t *mctx = &((ucontext_t *) ctx)->uc_mcontext;
29 unsigned int from = (unsigned int) mctx->gregs[REG_EIP];
31 //mateTrapHandler(nSignal, info, ctx, from);
33 printf("from: 0x%08x\n", from);
38 void registerSignalHandlers2(void (*f)(int, siginfo_t*,void*))
40 printf("registering2\n");
41 struct sigaction illaction;
42 illaction.sa_sigaction = f;
43 sigemptyset(&illaction.sa_mask);
44 illaction.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
45 sigaction(SIGILL, &illaction, NULL);