/* Handle signal trapping from version 6 or version 7 compatability
* Art Wetzel November 1979
unsigned int sigvals
[NSIG
+1];
/* actual catch point for all signals */
sigcatch(signum
) int signum
; {
/* hurry up and get the registers before they are destroyed */
/* we were in native mode simulating a sys call */
/* set it up with the old values */
/* go back where we were doing the sys call */
pcptr
= (unsigned short *)((char *)&pcptr
+ 20);
pc
= (unsigned short *) *pcptr
;
/* get the psl with condition codes */
/* requires UNIX-32V patch to not clear out condition codes */
psl
= 0x83c00000 | (*(pcptr
- 6) & 017);
/* actually do the thing */
if(sigvals
[signum
] != (unsigned int)SIG_DFL
&& (sigvals
[signum
] & (unsigned int)SIG_IGN
) == 0)
/* go back to compatability mode and the signal routine there */
/* routine to set up pdp11 space for return from a signal */
fprintf(stderr
,"Caught sig %d from 0%o -> 0%o\n",signum
,(pc
-1),*(pc
-1));
sp
= (unsigned short *)regs
[6];
/* stack up psw condition codes so rti works */
*(--sp
) = (unsigned short)(int)pc
;
/* reset stack pointer */
regs
[6] = (unsigned short)(int)sp
;
/* reset pc to signal catching routine */
pc
= (unsigned short *)sigvals
[signum
];