00001
00010 #include "sigsafe_internal.h"
00011 #include <ucontext.h>
00012 #include <unistd.h>
00013
00014 void sigsafe_handler_for_platform_(ucontext_t *ctx) {
00015 struct sigsafe_syscall_ *s;
00016 void *pc;
00017 pc = (void*) ctx->uc_mcontext.gregs[REG_PC];
00018 for (s = sigsafe_syscalls_; s->minjmp != NULL; s++) {
00019 if (s->minjmp <= pc && pc <= s->maxjmp) {
00020 #ifdef SIGSAFE_DEBUG_JUMP
00021 write(2, "[J]", 3);
00022 #endif
00023 ctx->uc_mcontext.gregs[REG_PC ] = (long) s->jmpto;
00024 ctx->uc_mcontext.gregs[REG_nPC] = (long) s->jmpto + 4;
00025 return;
00026 }
00027 }
00028 }