Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

sighandler_platform.c

Go to the documentation of this file.
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 *ip;
00017     ip = (void*) ctx->uc_mcontext.sc_ip;
00018     for (s = sigsafe_syscalls_; s->minjmp != NULL; s++) {
00019         /*
00020          * XXX
00021          *
00022          * There are two funny things about the next lines:
00023          * - the extra dereference; why? function pointers on ia64 are just
00024          *   like this?
00025          * - the "+ 1" in the maxjmp. It's clearly something to do with how
00026          *   the break.i instruction is bundled, but I don't completely get
00027          *   it.
00028          */
00029         void *minjmp = * (void**) s->minjmp;
00030         void *maxjmp = * (void**) s->maxjmp + 1;
00031         void *jmpto  = * (void**) s->jmpto;
00032         if (minjmp <= ip && ip <= maxjmp) {
00033 #ifdef SIGSAFE_DEBUG_JUMP
00034             write(2, "[J]", 3);
00035 #endif
00036             ctx->uc_mcontext.sc_ip = (unsigned long) jmpto;
00037             return;
00038         }
00039     }
00040 }

Generated on Fri Feb 4 11:13:32 2005 for sigsafe by doxygen 1.3.5