1: SIGDORTI = 1000 2: rtt = 6 3: iot = 4 4: .signal = 48. 5: .globl _sigsys, __sigcatch, _mvectors, cerror 6: NSIG = 32 7: _sigsys: 8: mov r5,-(sp) 9: mov sp,r5 10: mov 6(r5),-(sp) / push signal action 11: mov 4(r5),-(sp) / push signal number 12: sys .signal+200 13: bes 1f 14: cmp (sp)+,(sp)+ 15: mov (sp)+,r5 16: rts pc 17: 1: 18: cmp (sp)+,(sp)+ 19: jmp cerror 20: 21: _mvectors: / these vectors are treated as an array in C 22: jsr r0,1f / dummy there is no signal 0 23: jsr r0,1f / for signal 1 24: jsr r0,1f / for signal 2 etc... 25: jsr r0,1f 26: jsr r0,1f 27: jsr r0,1f 28: jsr r0,1f 29: jsr r0,1f 30: jsr r0,1f 31: jsr r0,1f 32: jsr r0,1f 33: jsr r0,1f 34: jsr r0,1f 35: jsr r0,1f 36: jsr r0,1f 37: jsr r0,1f 38: jsr r0,1f 39: jsr r0,1f 40: jsr r0,1f 41: jsr r0,1f 42: jsr r0,1f 43: jsr r0,1f 44: jsr r0,1f 45: jsr r0,1f 46: jsr r0,1f 47: jsr r0,1f 48: jsr r0,1f 49: jsr r0,1f 50: jsr r0,1f 51: jsr r0,1f 52: jsr r0,1f 53: jsr r0,1f 54: jsr r0,1f / for signal 32 55: 1: 56: mov r1,-(sp) / r0 is already on stack from jsr r0,... 57: sub $_mvectors+4,r0 / if sig is == 1, r0 will be _mvectors + 8 58: asr r0 / divide by 4 to get signal number 59: asr r0 60: mov r0,-(sp) / make an extra copy so sigcatch can clobberit 61: mov r0,-(sp) / this one is sigcatch's argument 62: jsr pc,*$__sigcatch / we know sigcatch will save regs 2-5! 63: tst (sp)+ / discard argument 64: mov (sp)+,r1 / get back signal number 65: tst r0 / if zero we do nothiing - just rtt 66: bne 1f 67: mov (sp)+,r1 68: mov (sp)+,r0 / restore last of registers 69: rtt 70: / here we are re-enabling the signal with the value returned by sigcatch 71: 1: 72: bis $SIGDORTI,r1 / tell kernel to simulate rti upon return 73: mov 2(sp),-(sp) / mov saved r0 down 74: mov 2(sp),-(sp) / mov saved r1 down, leaving two words for arg 75: mov r1,4(sp) / mov sig num to top (after r0 r1 popped) 76: mov r0,6(sp) / mov action on stack too. 77: mov (sp)+,r1 78: mov (sp)+,r0 / restore last of registers 79: / now all registers are totally restored 80: / and signal syscall args are on top of stack 81: / so that when system simulates the rti it 82: / will first pop off args to the syscall 83: sys .signal+200 / set signals and rti (kernel shouldn't 84: / smash ANY register here 85: iot / should never happen - lets find out!