|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)dosig.c 4.3 84/05/05"; ! 3: #endif ! 4: ! 5: /* From Lou Salkind: compat/RCS/dosig.c,v 1.2 84/01/31 13:34:17 */ ! 6: ! 7: /* ! 8: * Handle signal trapping from version 6 or ! 9: * version 7 compatability mode programs. ! 10: * Art Wetzel November 1979 ! 11: */ ! 12: ! 13: #ifdef TRACE ! 14: #include <stdio.h> ! 15: #endif ! 16: #include <signal.h> ! 17: #include "defs.h" ! 18: ! 19: int sigtrapped; ! 20: unsigned int sigvals[NSIG+1]; ! 21: ! 22: /* actual catch point for all signals */ ! 23: sigcatch(signum, faultcode, scp) ! 24: int signum, faultcode; ! 25: struct sigcontext *scp; ! 26: { ! 27: unsigned short *pcptr; ! 28: extern getregs(); ! 29: if(incompat) { ! 30: /* hurry up and get the registers before they are destroyed */ ! 31: getregs(); ! 32: } else { ! 33: /* we were in native mode simulating a sys call */ ! 34: /* set it up with the old values */ ! 35: dosig(signum, pc); ! 36: /* go back where we were doing the sys call */ ! 37: return(0); ! 38: } ! 39: /* figure out the pc */ ! 40: pcptr = (unsigned short *) &scp->sc_pc; ! 41: pc = (unsigned short *) *pcptr; ! 42: /* get the psl with condition codes */ ! 43: psl = 0x83c00000 | (scp->sc_ps & 017); ! 44: /* actually do the thing */ ! 45: if (sigvals[signum] != (unsigned int)SIG_DFL && ! 46: (sigvals[signum] & (unsigned int)SIG_IGN) == 0) ! 47: dosig(signum, pc); ! 48: /* go back to compatability mode and the signal routine there */ ! 49: sigsetmask(scp->sc_mask); ! 50: incompat++; ! 51: compat(); ! 52: } ! 53: ! 54: /* routine to set up pdp11 space for return from a signal */ ! 55: dosig(signum, from) ! 56: int signum, from; ! 57: { ! 58: unsigned short *sp; ! 59: ! 60: #ifdef TRACE ! 61: fprintf(stderr,"Caught sig %d from 0%o -> 0%o\n",signum,(pc-1),*(pc-1)); ! 62: #endif ! 63: sigtrapped = 1; ! 64: /* where is the stack */ ! 65: sp = (unsigned short *)regs[6]; ! 66: /* stack up psw condition codes so rti works */ ! 67: *(--sp) = psl & 017; ! 68: /* stack pc */ ! 69: *(--sp) = (unsigned short)(int)pc; ! 70: /* reset stack pointer */ ! 71: regs[6] = (unsigned short)(int)sp; ! 72: /* reset pc to signal catching routine */ ! 73: pc = (unsigned short *)sigvals[signum]; ! 74: /* signal(signum, SIG_DFL); */ ! 75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.