.title kill ;kill all tasks on ti: (no tktn version) .psect kill .ident /v2/ .ENABL LC ; library-created 3/5/80 - for WHT-SM c runtime .mcall exit$s,dir$ dpb: .byte 9.,4 ;for the alter priority .word 0 .word 0 .word 247. max = 25. ;max tasks to buffer first: .blkw max last: .blkw max tcb: .word tcbs-2 tcbs: .blkw max nfirst: .rad50 /MCR/ /PRT/ /TRN/ /REC/ /SEN/ nlast: .rad50 /.../ /.../ /SFR/ /EIV/ /DER/ ;tasks not abortable nabo = <.-nlast>/2 jpl: .rad50 /JPL/ ;this is special tasks: .word ;# tasks found j: .word k: .word start: mov $tskhd,r5 ;get the task list header mov $tktcb,r4 ;our tcb address (for KNOWING ourselves) mov t.ucb(r4),r0 ;get our ucb address (for matching ti's) mov #first,r1 mov #last,r2 ;first and last addrs in regs for speed mov #tcbs,r3 call $lockl clr tasks KIL1=. CMP t.ucb(r5),r0 ;IS t.ucb(r5) = r0 BNE KIL3 ;Not if NE CMP r5,r4 ;IS r5 NE r4 BEQ KIL6 ;Not if EQ TST t.stat(r5) ;IS t.stat(r5) GE #0 BLT KIL9 ;Not if LT BR KIL12 ;Here IF t.stat(r5) GE #0 KIL9=. BR KIL6 ;Here if not KIL12=. BR KIL13 ;Here IF r5 NE r4 AND t.stat(r5) GE #0 KIL6=. BR KIL3 ;Here if not KIL13=. mov t.nam(r5),(r1)+ mov t.nam+2(r5),(r2)+ ;store 2 word rad50 task name mov r5,(r3)+ ;save tcb pointer too inc tasks CMP tasks,#max ;IS tasks GE #max BLT KIL14 ;Not if LT JMP KIL2 ;break KIL14=. ; KIL16=. KIL3=. ; KIL5=. mov t.tcbl(r5),r5 ;next tcb TST t.tcbl(r5) ;IS t.tcbl(r5) = #0 BNE KIL17 ;Not if NE JMP KIL2 ;break KIL17=. ; KIL19=. JMP KIL1 ;Repeat loop KIL2=. call $unlkl ;unlock lists mov #first,r0 mov #last,r1 mov #tcbs-2,tcb ;initialize tcb pointer as well MOV #1,j ;Init loop index KIL20=. CMP j,tasks ;done loop? BGT KIL21 ;yes if GT add #2,tcb ;increment first (initially = tcbs) mov (r0)+,r2 ;first 1/2 of tsk name mov (r1)+,r3 ;second 1/2 mov #nfirst,r4 ;first 1/2 of non abort tsk name mov #nlast,r5 ;2nd 1/2 MOV #1,k ;Init loop index KIL22=. CMP k,#nabo ;done loop? BGT KIL23 ;yes if GT CMP (r4),r2 ;IS (r4) = r2 BNE KIL24 ;Not if NE CMP (r5),r3 ;IS (r5) = r3 BNE KIL27 ;Not if NE BR KIL30 ;Here IF (r5) = r3 KIL27=. BR KIL24 ;Here if not KIL30=. jmp nokill KIL24=. ; KIL26=. CMP r3,jpl ;IS r3 = jpl BNE KIL34 ;Not if NE BR KIL32 ;condition met KIL34=. CMP r2,jpl ;IS r2 = jpl BNE KIL31 ;Not if NE KIL32=. jmp nokill ;special case no kill KIL31=. ; KIL33=. tst (r4)+ tst (r5)+ INC k JMP KIL22 ;back to top KIL23=. mov @tcb,r5 ;get tcb address of this task mov r2,dpb+2 ;set up task name mov r3,dpb+4 ;part 2 call abo ;do an internal abort (so we can set reason) nokill: INC j JMP KIL20 ;back to top KIL21=. exit$s abo: mov r0,-(sp) mov r1,-(sp) mov r2,-(sp) mov r3,-(sp) mov r4,-(sp) emt 376 ;switch stacks .word 69$ ;return address TST T.STAT(R5) ; IS TASK ACTIVE BMI 68$ ; NO, SKIP MOV R5,R1 ; YES, COPY TCB ADDRESS MOV #34.,R0 ; SET ABORT REASON hopefully no message JSR PC,$ABTSK MOV R5,R0 ; GET TCB ADDRESS MOV R5,R1 ; GET TCB ADDRESS AGAIN ADD #T.STAT,R1 ; GET ADDRESS OF STATUS WORD MOV $TKTCB,R2 ; GET OUR TCB ADDRESS MOV #dpb+6,R3 ; GET ADDRESS OF NEW PRIORITY MOV R2,R5 ; COPY OUR TCB ADDRESS ADD #T.STAT,R2 ; GET ADDRESS OF OUR STATUS WORD JSR PC,$DRATP 68$: RETURN ; RETURN TO USER MODE 69$: mov (sp)+,r4 mov (sp)+,r3 mov (sp)+,r2 mov (sp)+,r1 mov (sp)+,r0 return .end start