X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/e804469b5b0975de34bae1e66c3e6371249d3ee7..0f4556f12c8f75078501c9d1338ae7648a97f975:/usr/src/games/compat/dosig.c diff --git a/usr/src/games/compat/dosig.c b/usr/src/games/compat/dosig.c index 415eba7e97..0dd5b5e1e6 100644 --- a/usr/src/games/compat/dosig.c +++ b/usr/src/games/compat/dosig.c @@ -1,22 +1,23 @@ -static char sccsid[] = " dosig.c 4.1 82/05/12 "; +static char sccsid[] = "@(#)dosig.c 4.2 83/07/31"; -#define FBSD -/* Handle signal trapping from version 6 or version 7 compatability - * mode programs. +/* + * Handle signal trapping from version 6 or + * version 7 compatability mode programs. * Art Wetzel November 1979 */ + #ifdef TRACE #include #endif #include #include "defs.h" + unsigned int sigvals[NSIG+1]; + /* actual catch point for all signals */ -#ifdef FBSD -sigcatch(signum,faultcode,myaddr,stpc,stps) int signum; -#else -sigcatch(signum) int signum; -#endif +sigcatch(signum, faultcode, scp) + int signum, faultcode; + struct sigcontext *scp; { unsigned short *pcptr; extern getregs(); @@ -31,29 +32,26 @@ sigcatch(signum) int signum; return(0); } /* figure out the pc */ -#ifdef FBSD - pcptr = (unsigned short *) &stpc; -#else - pcptr = (unsigned short *)((char *)&pcptr + 20); -#endif + pcptr = (unsigned short *) &scp->sc_pc; pc = (unsigned short *) *pcptr; /* get the psl with condition codes */ - /* requires UNIX-32V patch to not clear out condition codes */ -#ifdef FBSD - psl = 0x83c00000 | (stps & 017); -#else - psl = 0x83c00000 | (*(pcptr - 6) & 017); -#endif + psl = 0x83c00000 | (scp->sc_ps & 017); /* actually do the thing */ - if(sigvals[signum] != (unsigned int)SIG_DFL && (sigvals[signum] & (unsigned int)SIG_IGN) == 0) + if (sigvals[signum] != (unsigned int)SIG_DFL && + (sigvals[signum] & (unsigned int)SIG_IGN) == 0) dosig(signum, pc); /* go back to compatability mode and the signal routine there */ + sigsetmask(scp->sc_mask); incompat++; compat(); } + /* routine to set up pdp11 space for return from a signal */ -dosig(signum, from) { +dosig(signum, from) + int signum, from; +{ unsigned short *sp; + #ifdef TRACE fprintf(stderr,"Caught sig %d from 0%o -> 0%o\n",signum,(pc-1),*(pc-1)); #endif @@ -67,4 +65,5 @@ dosig(signum, from) { regs[6] = (unsigned short)(int)sp; /* reset pc to signal catching routine */ pc = (unsigned short *)sigvals[signum]; + signal(signum, SIG_DFL); }