Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/cex/cexsch.m11
There are no other files named cexsch.m11 in the archive.
.TITLE CEXSCH - Comm/Exec Scheduler
.IDENT /003170/
.ENABL LC
;
; COPYRIGHT (c) 1980, 1981, 1982
; DIGITAL EQUIPMENT CORPORATION
; Maynard, Massachusetts
;
; This software is furnished under a license and may be used
; and copied only in accordance with the terms of such license
; and with the inclusion of the above copyright notice. This
; software or any other copies thereof may not be provided or
; otherwise made available to any other person. No title to
; and ownership of the software is hereby transferred.
;
; The information in this software is subject to change
; without notice and should not be construed as a commitment
; by DIGITAL EQUIPMENT CORPORATION.
;
; DIGITAL assumes no responsibility for the use or reliability
; of its software on equipment which is not supplied by
; DIGITAL.
;
;++
; FACILITY: MCB Communications Executive
;
; FUNCTIONAL ABSTRACT:
;
; This module contains the routines to handle scheduling
; of processes and interrupt synchronization.
;
; ENVIRONMENT: RSX kernel mode with EIS
;
; AUTHOR: Alan D. Peckham, CREATION DATE: 21-MAR-80
;
; MODIFIED BY:
;
; Alan D. Peckham, 2-Jul-80: VERSION 3.0
; 01 - Change CRSH$ references to CRSH$S.
; 02 - Globalize references to I/O page.
; 03 - Moved global data to seperate module.
; Eliminated local data (module can now be made read-only).
; 04 - Correct MUL bugs in SCHCCB.
; Do proper dispatch in $LLCDS.
; 05 - Reset .CEXDP properly during scheduler shutdown.
; 06 - Fix references to SCHRT inserted by edit #5.
; 07 - Clear CCB link before dispatching in SCHCCB.
; Reset SYNCH block usage flag before dispatching.
; 08 - Update CRSH$S contexts.
; 09 - Add conditional process activation signal to
; $DDMDS, $DLCDS, $LLCDS, $SCHRQ.
; 10 - Fix bug introduced in $LLCDS by 09.
; Take advantage of process descriptor re-organization.
; New signal status codes for process activation.
; 11 - Remove process activation signals.
; Dispatch SYNCH to LLC process, if requested nicely.
; 12 - Add CCB address verification routine.
; Alan D. Peckham, 9-Dec-80: VERSION 3.1
; 13 - Rework for MCB V3.1
; 14 - Add support for data base words in $PRCDS.
; Alan D. Peckham, 30-Jan-80: VERSION 3.2
; 15 - Fix bugs introduced in 3.1(14) in SCHSYN.
; Support new SYNCH block in SCHSYN.
; Merge in CEXLLC routines $LLCRS and $LLCDB.
; Support new C.SRC and C.DST in $LLCRS.
; Support .CRPDB current process descriptor address.
; Change input parameters for $PRCDS.
; 16 - Support .CRDSP in context switches.
; Disallow PIX #0 in $SCHED.
; 17 - Added $PAUSE service routine.
;--
.SBTTL DECLARATIONS
;
; INCLUDE FILES:
;
.MCALL CRSH$S,DSP$B
.GLOBL $FORK0
.GLOBL $IGNAL,KISAR5
;
; MACROS:
;
; None
;
; EQUATED SYMBOLS:
;
; None
;
; OWN STORAGE:
;
.GLOBL .PDBNM ; Number of processes.
.GLOBL .PDBVB ; Process descriptor vector.
.GLOBL .PDBVE ; End of process descriptor vector.
.GLOBL .FRKBK ; Address of Comm/Exec fork block.
.GLOBL .CEXDP ; Comm/Exec processing level:
; <0 RSX level
; 0 Process level
; >0 Interrupt level
.GLOBL .CEXRQ ; MCB scheduling requested.
.GLOBL .RSXMP ; Saved RSX mapping to APR 6.
.GLOBL .SYNQH ; SYNCH queue.
.GLOBL .CBLQH ; CCB queue, to lower level process.
.GLOBL .CBHQH ; CCB queue, to higher level process.
.GLOBL .CRPDB ; Current process descriptor.
.GLOBL .CRDAT ; Current data base bias/address
.GLOBL .CRPIX ; Current process index.
.PSECT $PLIT$,D,RO
.DSPCR::DSP$B ; CCB dispatch crash table:
DSP$ FC.AST ; FC.AST
DSP$ FC.XME ; FC.XME
DSP$ FC.RCE ; FC.RCE
DSP$ FC.KIL ; FC.KIL
DSP$ FC.CTL ; FC.CTL
DSP$ FC.TIM,DSPRT ; FC.TIM
DSP$ FC.XCP ; FC.XCP
DSP$ FC.RCP ; FC.RCP
DSP$ FC.KCP ; FC.KCP
DSP$ FC.CCP ; FC.CCP
DSP$E
;
; VALIDATION DECLARATIONS:
;
.IIF NE,<Z.DSP-0>,.ERROR Z.DSP; Must be first words in PD
.IIF NE,<Z.DAT-4-Z.DSP>,.ERROR Z.DAT; must follow Z.DSP words
.IIF NE,<Z.PIX-4-Z.DAT>,.ERROR Z.PIX; Must follow Z.DAT words
.SBTTL $CCBCK - Verify CCB address
;++
; FUNCTIONAL DESCRIPTION:
;
; Spring a SIGNAL_STOP if the CCB address is not within
; range of the allocated DSR memory blocks.
;
; CALLING SEQUENCE:
;
; CALL $CCBCK
;
; INPUT PARAMETERS:
;
; R4 = Address of CCB to verify.
;
; IMPLICIT INPUTS:
;
; .CCBDM = address/length of DSR allocated for CCBs.
; .RDBDM = address/length of DSR allocated for RDB CCBs.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
.IF NE,D$$BUG
$CCBCK::PUSH$S R4 ; Check if a CCB/CCB
SUB .CCBDM+0,(SP)
CMP .CCBDM+2,(SP)+
BHI 90$
PUSH$S R4 ; or a RDB/CCB.
SUB .RDBDM+0,(SP)
CMP .RDBDM+2,(SP)+
BLO 100$
90$: RETURN
100$: TST (SP)+
CRSH$S CBR ; Invalid CCB address.
.ENDC
.SBTTL $CCBQH - Queue CCB to Higher Level
;++
; FUNCTIONAL DESCRIPTION:
;
; Place the given CCB on the .CBHQH queue.
;
; CALLING SEQUENCE:
;
; CALL $CCBQH
;
; INPUT PARAMETERS:
;
; R4 = Address of CCB to queue.
;
; IMPLICIT INPUTS:
;
; .CBHQH = CCB queue list header.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; Register R4 is not preserved.
;--
.PSECT $CODE$,I,RO
$CCBQH::JSR R3,CCBQ ; Queue the CCB
.WORD .CBHQH ; to the .CBHQH queue.
.SBTTL $CCBQL - Queue CCB to Lower Level
;++
; FUNCTIONAL DESCRIPTION:
;
; Place the given CCB on the .CBLQH queue.
;
; CALLING SEQUENCE:
;
; CALL $CCBQL
;
; INPUT PARAMETERS:
;
; R4 = Address of CCB to queue.
;
; IMPLICIT INPUTS:
;
; .CBLQH = CCB queue list header.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$CCBQL::JSR R3,CCBQ
.WORD .CBLQH
;
; Common processor for $CCBQ* routines.
;
CCBQ: MOV (R3),R3 ; Get queue address
CALL $CMQIN ; and insert the CCB.
INC .CEXRQ ; Request scheduling
POP$S R3 ; and restore his R3.
RETURN
.SBTTL $CEXSV - Exit from Comm/Exec and Reschedule if Necessary
;++
; FUNCTIONAL DESCRIPTION:
;
; None
;
; CALLING SEQUENCE:
;
; None
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$CEXSV::INC .CEXDP ; become the Comm/Exec,
BNE 90$
SMAP$ .RSXMP ; and save APR 6.
90$: RETURN
.SBTTL $CEXXT - Exit from Comm/Exec and Reschedule if Necessary
;++
; FUNCTIONAL DESCRIPTION:
;
; None
;
; CALLING SEQUENCE:
;
; None
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$CEXXT::DEC .CEXDP ;; If really exiting
BPL 80$ ;; then
MAP$ .RSXMP ;; restore APR 6.
TST .CEXRQ ;; If requests are outstanding
BEQ 80$ ;; then
DSABL$ ;; disable interrupts.
MOV .FRKBK,R4 ;; Get fork block address
BNE 60$ ;;; and if active
ENABL$ ;;; reenable interrupts
80$: RETURN ;; and go away.
60$: CLR .FRKBK ;;; Stake our claim,
ENABL$ ;;; reenable interrupts,
PUSH$S (R4)+ ;; push the scheduler address
JMP $FORK0 ;; and schedule the fork.
.SBTTL $CRSH - Set up Comm/Exec crash
;++
; FUNCTIONAL DESCRIPTION:
;
; None
;
; CALLING SEQUENCE:
;
; None
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$CRSH:: PUSH$S <@(SP)+,#1> ; Get the status code and arg count
CALL $IGNAL ; and signal the exception.
POP$S ,2 ; remove the parameters
RETURN ; and return control to the user.
.SBTTL $DSPCR - Undefined CCB Dispatch Crash
;++
; FUNCTIONAL DESCRIPTION:
;
; Crash entry point for undefined dispatch vector entries.
;
; CALLING SEQUENCE:
;
; CALL $DSPCR
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$DSPCR::CRSH$S DSP ; Illegal CCB dispatch
DSPRT: RETURN ; (for FC.TIM dispatch)
.SBTTL $ILVCK - Verify processing at interrupt level
;++
; FUNCTIONAL DESCRIPTION:
;
; Crash is not at interrupt processing level.
;
; CALLING SEQUENCE:
;
; CALL $ILVCK
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; .CEXDP = Comm/Exec processing level.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
.IF NE,D$$BUG
$ILVCK::TST .INTCB ; If not in interrupt
BEQ 100$ ; then crash.
RETURN
100$: TST (SP)+
CRSH$S ILV ; Routine must be called at interrupt level
.ENDC
.SBTTL $PAUSE - Pause in execution of process.
;++
; FUNCTIONAL DESCRIPTION:
;
; This routine is provided to processes in order to allow them
; to suspend processing during time consuming operations. This
; allows accumulated SYNCHs to be dispatched. The resume address
; is saved in the provided SYNCH block and it is rescheduled.
;
; CALLING SEQUENCE:
;
; CALL $PAUSE
;
; INPUT PARAMETERS:
;
; R4 = address of synch block containing:
; S.DSP = Routine to call on resumption.
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
$PAUSE::PLVL$ ; Crash if not at process level.
.IF NE,D$$BUG
TST S.PDB(R4) ; If SYNCH block is active
BNE 100$ ; then crash about it,
.IFTF
MOV .CRPDB,S.PDB(R4) ; otherwise set PDB
CLR (R4) ; Reset the link pointer.
DSABL$ ; No interrupts, please!
MOV R4,@.SYNQH+2 ;;; Link to last block
MOV R4,.SYNQH+2 ;;; and make this the last block.
ENABL$ ;;; reenable interrupts
INC .CEXRQ ; indicate scheduling requested
RETURN ; and go away.
.IFT
100$: CRSH$S SYN ; and say SYNCH block already active.
.ENDC
.SBTTL $PLVCK - Verify processing at process level
;++
; FUNCTIONAL DESCRIPTION:
;
; Crash if not at process level.
;
; CALLING SEQUENCE:
;
; CALL $PLVCK
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; .CEXDP = Comm/Exec processing level.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
.IF NE,D$$BUG
$PLVCK::TST .INTCB ; If in interrupt
BNE 100$ ; or
TST .CEXDP ; not at process level
BNE 100$ ; then crash.
RETURN
100$: TST (SP)+
CRSH$S PLV ; Routine must be called at process level
.ENDC
.SBTTL $PRCDS - Dispatch to a Process
;++
; FUNCTIONAL DESCRIPTION:
;
; Set up the context and dispatch to process servicing the
; given data base.
;
; CALLING SEQUENCE:
;
; CALL $PRCDS
;
; INPUT PARAMETERS:
;
; R3 = Function modifier.
; R2 = Function code.
; R0 = Process descriptor block.
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; KISAR5 = mapped to the CEX process.
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; Registers R0 through R5 and KISAR6 are not preserved.
;--
.PSECT $CODE$,I,RO
$PRCDS::MOV R0,.CRPDB ; Set current process
MOV (R0)+,@#KISAR5 ; process mapping bias,
ADD (R0),R2 ; dispatch vector,
MOV (R0)+,.CRDSP
MAP$ (R0) ; data base bias,
MOV (R0)+,.CRDAT+0
MOV (R0),R5 ; address,
MOV (R0)+,.CRDAT+2
MOVB (R0),.CRPIX ; and index.
CALL @(R2)+ ; let process do its thing,
MOV .CRPDB,R1 ; recover
TST (R1)+
MOV .CRDSP,(R1)+ ; dispatch address
MOV .CRDAT+0,(R1)+ ; data base
MOV .CRDAT+2,(R1) ; bias/address
MOV @.PDBVB,@#KISAR5 ; and return to the CEX process.
RETURN
.SBTTL $RLVCK - Verify processing at RSX level
;++
; FUNCTIONAL DESCRIPTION:
;
; Crash if Comm/Exec is active (not doing RSX stuff).
;
; CALLING SEQUENCE:
;
; CALL $RLVCK
;
; INPUT PARAMETERS:
;
; None
;
; IMPLICIT INPUTS:
;
; .CEXDP = Comm/Exec processing level.
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; None
;--
.PSECT $CODE$,I,RO
.IF NE,D$$BUG
$RLVCK::TST .INTCB ; If in interrupt
BNE 100$ ; or
TST .CEXDP ; not in RSX
BGE 100$ ; then crash.
RETURN
100$: TST (SP)+
CRSH$S RLV ; Routine must be called at RSX level
.ENDC
.SBTTL $SCHED - Queue CCB to destination process
;++
; FUNCTIONAL DESCRIPTION:
;
; Queue the given CCB chain to the specified process.
;
; The following information will be inserted into the
; CCB and may be examined by the destination LLC:
; C.PIX <process index of the source process>
; C.OWN <destination process index> (FC.AST only)
;
; CALLING SEQUENCE:
;
; CALL $SCHED
;
; INPUT PARAMETERS:
;
; R4 = Address of CCB chain, the first containing:
; C.FNC Function code.
; C.MOD Function modifier.
; C.PIX Process index of destination process.
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; None
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; Register R4 is not preserved.
;--
.PSECT $CODE$,I,RO
$SCHED::PLVL$ ; Crash if not at process level.
CCBCK$
PUSH$S R1
MOVB C.PIX(R4),R1
.IF NE,D$$BUG
BEQ 100$ ; If process index
CMPB .PDBNM,R1 ; out of range
BLOS 100$ ; then crash.
.IFTF
ASL R1
MOV .PDBVB(R1),R1
.IFT
BEQ 100$
.IFTF
MOV R1,C.DST(R4) ; Set destination
TSTB C.FNC(R4) ; and if AST function
BNE 10$ ; then
MOVB Z.PIX(R1),C.OWN(R4) ; give CCB to him.
10$: POP$S R1
MOV .CRPDB,C.SRC(R4) ; Set source process descriptor.
MOVB .CRPIX,C.PIX(R4)
JMP $CCBQH ; Queue the CCB.
.IFT
100$: POP$S R1
CRSH$S PIX ; Process index out of range
.ENDC
.SBTTL $SYNDS - SYNCH to a Process
;++
; FUNCTIONAL DESCRIPTION:
;
; Set up the context and dispatch to process servicing the
; given data base.
;
; CALLING SEQUENCE:
;
; CALL $SYNDS
;
; INPUT PARAMETERS:
;
; R2 = Dispatch address.
; R0 = Process descriptor block.
;
; IMPLICIT INPUTS:
;
; None
;
; OUTPUT PARAMETERS:
;
; None
;
; IMPLICIT OUTPUTS:
;
; KISAR5 = mapped to the CEX process.
;
; CONDITION CODES:
;
; None
;
; SIDE EFFECTS:
;
; Registers R0 through R5 and KISAR6 are not preserved.
;--
.PSECT $CODE$,I,RO
$SYNDS::MOV R0,.CRPDB ; Set current process
MOV (R0)+,@#KISAR5 ; process mapping bias,
MOV (R0)+,.CRDSP ; dispatch table,
MAP$ (R0) ; data base bias,
MOV (R0)+,.CRDAT+0
MOV (R0),R5 ; address,
MOV (R0)+,.CRDAT+2
MOVB (R0),.CRPIX ; and index.
CALL (R2) ; let process do its thing,
MOV .CRPDB,R1 ; and
TST (R1)+ ; recover
MOV .CRDSP,(R1)+ ; dispatch address
MOV .CRDAT+0,(R1)+ ; data base
MOV .CRDAT+2,(R1) ; bias/address.
MOV @.PDBVB,@#KISAR5 ; Remap to the CEX process,
RETURN
.END