.TITLE BAPSTP .IDENT /V3.00/ .ENABL LC .NLIST BEX ;************************************************************************** ; ; BAPSTP.MAC ; ; This module services the STOP and CONTINUE commands from the ; Queue Manager. ; ;-------------------------------------------------------------------------- ; ; Version: V3.00 April 1983 ; ; Modification History ; ==================== ; ; ;-------------------------------------------------------------------------- ; ; Steve Thompson ; School of Chemical Engineering ; Olin Hall ; Cornell University ; Ithaca ; NY 14850 ; (607) 256 4616 (office) ; (607) 256 3895 (computer room) ; ;************************************************************************** .PAGE .SBTTL STOP SERVICE ROUTINE ;+ ; **-$STPEP-Process a STOP command. ; ; This command forces the batch processor to stop a job. All ; tasks currently in the batch stream are blocked. ; This routine may be called at AST level, and so all registers ; must be preserved. ; ;- $STPEP::TSTB JOBFLG ; Job executing? BEQ 10$ ; If EQ no CLR R4 ; Yes, set flag for block CALL BLOCK ; Stop all tasks MOV #QM.SPA,R0 ; Get solicited pause function code CALL QMGMSG ; Send to Queue Manager 10$: RETURN ; .PAGE .SBTTL CONTINUE SERVICE ROUTINE ;+ ; **-$CONEP-Process a CONTINUE command. ; ; This command requests the batch processor to unblock all tasks ; running in the batch stream that were previously blocked by a ; STOP command. ; This routine may be called at AST level, and so all registers ; must be preserved. ; ;- $CONEP::TSTB JOBFLG ; Job executing? BEQ 10$ ; If EQ no MOV SP,R4 ; Set flag for unblock CALL BLOCK ; Continue tasks 10$: RETURN ; .PAGE .SBTTL SUBROUTINES ;+ ; **-BLOCK-Block or unblock batch tasks. ; ; Inputs: ; R4 Block if zero, unblock if non-zero. ; ;- BLOCK: CALL $SWSTK,30$ ; Switch stacks MOV $TSKHD,R5 ;; Get start of task list (and skip ;; the loader) 10$: TST T.TCBL(R5) ;; Null task TCB? BEQ 30$ ;; If EQ yes, done TST T.STAT(R5) ;; Task active? BMI 20$ ;; If MI no, skip it CMP VTUCB,T.UCB(R5) ;; Task in batch stream? BNE 20$ ;; If NE no, skip it CMP $MCRPT,R5 ;; MCR...? BEQ 20$ ;; If EQ yes, skip it TSTB T.ST2(R5) ;; Task being aborted? BMI 20$ ;; If MI yes, leave it alone TST R4 ;; Blocking? BEQ 12$ ;; If EQ yes BIC #TS.STP,T.STAT(R5) ;; No, clear the blocking bit BR 15$ ;; Activate task 12$: BIT #,T.ST3(R5) ;; Task blockable? BNE 20$ ;; If NE no, skip it BIS #TS.STP,T.STAT(R5) ;; Set the blocking bit 15$: MOV T.PCB(R5),R0 ;; Get PCB address CALL $NXTSK ;; Reallocate partition (R4 and R5 are ;; preserved). 20$: MOV T.TCBL(R5),R5 ;; Point to next task in list BR 10$ ;; Keep going 30$: RETURN ;; Back to task level and then ;; to caller. .END