Annotation of lucent/sys/src/ape/lib/ap/68020/f002677, revision 1.1.1.1

1.1       root        1: #include "../plan9/lib.h"
                      2: #include "../plan9/sys9.h"
                      3: #include <signal.h>
                      4: 
                      5: /* A stack to hold pcs when signals nest */
                      6: #define MAXSIGSTACK 20
                      7: typedef struct Pcstack Pcstack;
                      8: static struct Pcstack {
                      9:        int sig;
                     10:        void (*hdlr)(int, char*, Ureg*);
                     11:        unsigned long restorepc;
                     12: } pcstack[MAXSIGSTACK];
                     13: static int nstack = 0;
                     14: 
                     15: static void notecont(Ureg*, char*);
                     16: 
                     17: void
                     18: _notetramp(int sig, void (*hdlr)(int, char*, Ureg*), Ureg *u)
                     19: {
                     20:        Pcstack *p;
                     21: 
                     22:        if(nstack >= MAXSIGSTACK)
                     23:                _NOTED(1);      /* nesting too deep; just do system default */
                     24:        p = &pcstack[nstack];
                     25:        p->restorepc = u->pc;
                     26:        p->sig = sig;
                     27:        p->hdlr = hdlr;
                     28:        nstack++;
                     29:        u->pc = (unsigned long) notecont;
                     30:        _NOTED(2);      /* NSAVE: clear note but hold state */
                     31: }
                     32: 
                     33: static void
                     34: notecont(Ureg *u, char *s)
                     35: {
                     36:        Pcstack *p;
                     37:        void(*f)(int, char*, Ureg*);
                     38: 
                     39:        p = &pcstack[nstack-1];
                     40:        f = p->hdlr;
                     41:        u->pc = p->restorepc;
                     42:        nstack--;
                     43:        (*f)(p->sig, s, u);
                     44:        _NOTED(3);      /* NRSTR */
                     45: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.