$MACRO push mov #@1,-(sp) $ENDM $MACRO pop mov (sp)+,#@1 $ENDM / .title kill ;kill all tasks on ti: (no tktn version) .psect kill .ident /v2/ PROGRAM KIL .mcall exit$s,dir$ ;~ abort: abrt$ AAABBB ;to be stuffed later 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 ;~ R5R4: .WORD ;~ UCB: .WORD ;~ STAT: .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 ;+ ; check for ucb match (our ti:), not us (tktcb not the tcb we are ; looking at) and task active, (negative status) ;- ;~ IF T.UCB(R5) = R0 ;~ INC UCB ;~ FI ;~ IF R5 = R4 ;~ INC R5R4 ;~ FI ;~ IF T.STAT(R5) LT #0 ;~ INC STAT ;~ FI DO FOREVER IF t.ucb(r5) = r0 AND r5 NE r4 AND t.stat(r5) GE #0 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 BREAK IF tasks GE #max FI mov t.tcbl(r5),r5 ;next tcb BREAK IF t.tcbl(r5) = #0 ;null task, quit OD call $unlkl ;unlock lists ;+ ; now abort all tasks we found except ; for those nonabortables above. ;- mov #first,r0 mov #last,r1 mov #tcbs-2,tcb ;initialize tcb pointer as well LOOP for j = #1 TO tasks 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 LOOP for k = #1 TO #nabo IF (r4) = r2 AND (r5) = r3 ;task namme match jmp nokill FI IF r2 = jpl OR r3 = jpl jmp nokill ;special case no kill FI tst (r4)+ tst (r5)+ NEXT k ;~ mov r2,abort+a.bttn ;~ mov r3,abort+a.bttn+2 ;~ dir$ #abort 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: NEXT j exit$s ;+ ; abo -- This routine aborts a task without tktn notification ; ; input: r5 = address of tcb to abort ; dpb+2,4 = rad50 task name to abort (and alter pri on) ; ; output: ; The task is aborted ;- abo: push r0 push r1 push r2 push r3 push r4 ;;66$: CALL $SWSTK,69$ ; SWITCH TO SYSTEM STATE 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 CALL $ABTSK ; ABORT TASK 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 #247.,(R3) ; SET NEW PRIORITY MOV R2,R5 ; COPY OUR TCB ADDRESS ADD #T.STAT,R2 ; GET ADDRESS OF OUR STATUS WORD CALL $DRATP ; ALTER PRIORITY 68$: RETURN ; RETURN TO USER MODE 69$: pop r4 pop r3 pop r2 pop r1 pop r0 return .end start