Google
 

Trailing-Edge - PDP-10 Archives - BB-P363B-SM_1985 - mcb/cex/cexsyn.m11
There are no other files named cexsyn.m11 in the archive.
	.TITLE	CEXSYN - Synchronous Interface Services
	.IDENT	/003190/
	.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 dispatch synchronous
;	interface calls.
;
; ENVIRONMENT: RSX kernel mode with EIS
;
; AUTHOR: Alan D. Peckham, CREATION DATE: 27-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	- Correct PDT references.
; 04	- Pick up PIX from right stack offset in both routines.
; 05	- Add new synchronous extension call for BLISS.
;	  Pull in BLISS support routine $CALL.
; 06	- Update CRSH$S contexts.
; 07	- Do process mapping during SIGNAL processing.
; 08	- Update signal processing.
;	  Add conditional process activation signal to
;	    $CALLB, $CALLE, $CALLP.
; 09	- Take advantage of process descriptor re-organization.
;	  Fix signal status code for process activation.
; 10	- Remove process activation signals.
;	Alan D. Peckham, 9-Dec-80: VERSION 3.1
; 11	- Update for MCB V3.1
; 12	- Add support for data base words in $CALLP.
;	Alan D. Peckham, 30-Jan-80: VERSION 3.2
; 13	- Support .CRPDB as current process descriptor.
;	  Fix discovered bugs in unwind handlers.
;	  Alter access to process descriptor blocks to go
;	  through .PDBVB - PDB vector.
; 14	- BIG bug in signalling through $CALLP. Do context switch
;	  only during unwind; otherwise only do remap.
;	  Disallow PIX #0 in $CALLE and $CALLP.
; 15	- Correct APR5 mapping bug in $CALLP.
; 16	- Add $CALLI routine to indexed CEX process calling.
;	  Add signal status return to $CALLC and $CALLI.
; 17	- Remove $CALLC.
; 18	- Add common register save/restore routines SAVEXT and SAVPRC.
; 19	- Fix mechanism vector access in condition handling routines.
;	  Add commenting.
;--
	.SBTTL	DECLARATIONS

;
; INCLUDE FILES:
;

	.MCALL	CRSH$S
	.GLOBL	$IGNAL,KISAR5
	.GLOBL	$CALL		; B16FTN module

;
; MACROS:
;
;	None
;
; EQUATED SYMBOLS:
;
;	None
;
; OWN STORAGE:
;
;	None
;
; VALIDATION DECLARATIONS:
;

	.IIF	NE,<Z.DSP>,.ERROR Z.DSP; Must be zero
	.SBTTL	$CALLE - BLISS Call Extension Routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Activate a routine within another process.
;
; CALLING SEQUENCE:
;
;	$CALLE (data_base_index, routine_address[, parameters]);
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	On the stack:
;	    2(SP) = data base index.
;	    4(SP) = routine address.
;	    6(SP) = parameters.
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
$CALLE::PLVL$			; Crash if not at process level.

	.IF	NE,D$$BUG
	TST	2+0(SP)		; If data base index
	BEQ	STOP		; is
	CMP	.PDBNM,2+0(SP)	; out of range
	BLOS	STOP		; then crash about it.
	.IFTF

	JSR	R1,SAVEXT	; Save context for extension call.
	MOV	(R5)+,R1	; Pick up destination PIX
	ASL	R1		; and
	MOV	@.PDBVB(R1),@#KISAR5 ; map to code.
	CALL	@(R5)+		; Hello !
	BR	RESEXT		; Restore extension context.

	.IFT
STOP:	CRSH$S	PIX		; Destination process index out of range
	.ENDC
	.SBTTL	$CALLI - Call CEX Process for System Function
;++
; FUNCTIONAL DESCRIPTION:
;
;	Activate a routine within the CEX process.
;
; CALLING SEQUENCE:
;
;	$CALLC (request_index[, parameters]);
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	On the stack:
;	    2(SP) = request index.
;	    4(SP) = parameters.
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
$CALLI::PLVL$			; Crash if not at process level.
	CALL	CALLI
	TST	.CEXST		; If there was an error
	BEQ	90$		; then
	PUSH$S	<.CEXST,#1>	; signal it now.
	CLR	.CEXST
	CALL	$IGNAL
	POP$S	,2
90$:	RETURN

CALLI:	JSR	R1,SAVEXT	; Save context for extension call.
	TST	(R5)+		; (adjust for extra return PC)
	MOV	(R5)+,R0	; Pick up index,
	MOV	@.PDBVB,@#KISAR5 ; map to CEX process
	ADD	@#PHDCTB,R0	; and
	CALL	@(R0)+		; call the requested function.
	BR	RESEXT		; Restore extension context.
	.SBTTL	$CALLP - Call Process Routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Activate another process at the specified address.
;
; CALLING SEQUENCE:
;
;	$CALLP (data_base_index, routine_address[, parameters]);
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	On the stack:
;	    2(SP) = data base index.
;	    4(SP) = routine address.
;	    6(SP) = parameters.
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
$CALLP::PLVL$			; Crash if not at process level.

	.IF	NE,D$$BUG
	TST	2+0(SP)		; If data base index
	BEQ	STOP		; is
	CMP	.PDBNM,2+0(SP)	; out of range
	BLOS	STOP		; then crash about it.
	.ENDC

	JSR	R1,SAVPRC	; Save context for process call.
	MOV	(R5)+,R0	; Pick up process index
	ASL	R0		; to
	MOV	.PDBVB(R0),R0	; set up
	MOV	R0,.CRPDB	; as current process.
	MOV	(R0)+,@#KISAR5
	MOV	(R0)+,.CRDSP
	MOV	(R0)+,.CRDAT+0
	MOV	(R0)+,.CRDAT+2
	MOVB	(R0),.CRPIX
	CALL	@(R5)+		; Let him do his thing.
	MOV	.CRPDB,R1	; Save his context
	TST	(R1)+
	MOV	.CRDSP,(R1)+	; and
	MOV	.CRDAT+0,(R1)+
	MOV	.CRDAT+2,(R1)
	BR	RESPRC		; restore previous context.
	.SBTTL	RESEXT - Register Restore Routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Restore the user context after a call to an extension process.
;
; CALLING SEQUENCE:
;
;	JMP	RESEXT
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
RESEXT:	POP$S	$IGREG		; Clean up
	POP$S	,2		; condition handling block
	BR	RESREG		; and volatile registers.
	.SBTTL	RESPRC - Register Restore Routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Restore the user context after a call to a process.
;
; CALLING SEQUENCE:
;
;	JMP	RESPRC
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
RESPRC:	POP$S	$IGREG		; Clean up
	POP$S	,2		; condition handling block,
	POP$S	R1		; and
	MOV	R1,.CRPDB	; restore previous process context.
	TST	(R1)+
	MOV	(R1)+,.CRDSP
	MOV	(R1)+,.CRDAT+0
	MOV	(R1)+,.CRDAT+2
	MOVB	(R1),.CRPIX
	BR	RESREG		; Restore volatile registers.
	.SBTTL	RESREG - Register Restore Routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Restore the user register after a synchronous call.
;
; CALLING SEQUENCE:
;
;	JMP	RESREG
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	None
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
RESREG:	POP$S	@#KISAR5	; Restore code bias
	POP$S	<R5,R4,R3,R2,R1> ; and registers.
	RETURN			; Back to caller !
	.SBTTL	SAVEXT - Register Save/Restore Co-routine
;++
; FUNCTIONAL DESCRIPTION:
;
;	Save the registers for a synchronous call and restore
;	them on return.
;
; CALLING SEQUENCE:
;
;	JSR	R1,SAVEXT
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	R5 = pointer to parameter area.
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
SAVEXT:	JSR	R2,SAVREG	; Save registers (as co-routine)
	PUSH$S	<@#KISAR5>	; and the code bias.
	JSR	PC,(R5)		; Set up CHF block and call caller.
				; Condition Handler:
	MOV	$HANSP,R0	;  Get to our parameters
	ADD	SP,R0		;  and
	PUSH$S	<6(R0),#1>	;  pass code bias.
	CALL	SIGNAL
	MOV	2(SP),R0	; Pick up the enable vector
	MOV	2(R0),@#KISAR5	; and map to this code.
	RETURN			; (low bit is clear = FALSE)
	.SBTTL	SAVPRC - Register Save/Restore Co-routines
;++
; FUNCTIONAL DESCRIPTION:
;
;	Save the registers for a synchronous call and restore
;	them on return.
;
; CALLING SEQUENCE:
;
;	JSR	R1,SAVPRC
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	R5 = pointer to parameter area.
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
SAVPRC:	JSR	R2,SAVREG	; Save registers (as co-routine)
	MOV	.CRPDB,R0	; and
	PUSH$S	<@#KISAR5,R0>	; code bias and PDB.
	TST	(R0)+		; Save current process context.
	MOV	.CRDSP,(R0)+
	MOV	.CRDAT+0,(R0)+
	MOV	.CRDAT+2,(R0)
	JSR	PC,(R5)		; Set up CHF block and call caller.
				; Condition Handler:
10$:	MOV	$HANSP,R0	;  Get to our parameters
	ADD	SP,R0		;  and
	PUSH$S	<6(R0),10(R0),#2> ;pass bias and PDB.
	CALL	SIGNAL
	MOV	6(SP),R0	; Get signal vector address
	TST	(R0)+		; and if there is a status
	BEQ	80$		; then
	CMP	#SS$.UN,(R0)	; handle the unwind case.
	BNE	80$
	MOV	2(SP),R0	; Pick up the enable vector
	MOV	2(R0),@#KISAR5	; map the code,
	MOV	4(R0),R0	; and set it up as the current process.
	MOV	R0,.CRPDB
	TST	(R0)+
	MOV	(R0)+,.CRDSP
	MOV	(R0)+,.CRDAT+0
	MOV	(R0)+,.CRDAT+2
	MOVB	(R0),.CRPIX
	RETURN			; (low bit is clear = FALSE)
80$:	MOV	2(SP),R0	; Pick up the enable vector
	MOV	2(R0),@#KISAR5	; and map to code.
	RETURN			; (low bit is clear = FALSE)
	.SBTTL	SAVREG - Register Save/Restore Co-routines
;++
; FUNCTIONAL DESCRIPTION:
;
;	Save the registers for a synchronous call and restore
;	them on return.
;
; CALLING SEQUENCE:
;
;	JSR	R2,SAVREG
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	R5 = pointer to parameter area.
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
SAVREG:	PUSH$S	<R3,R4>		; Save some more registers (1,2,3,4)
	MOV	SP,R4		; (this is used later)
	JSR	R5,(R2)		; and call-specific info (1,2,3,4,5,?).
	PUSH$S	<#0,$IGREG>	; Put up CHF block (rtn adr already pushed)
	ADD	SP,2(SP)
	MOV	SP,$IGREG	; and
	MOV	#12,R5		; set up argument pointer.
	ADD	R4,R5
	JMP	(R1)		; All set for call.
	.SBTTL	SIGNAL - Execute a Signal
;++
; FUNCTIONAL DESCRIPTION:
;
;	Please fill this in
;
; CALLING SEQUENCE:
;
;	CALL	SIGNAL
;
; INPUT PARAMETERS:
;
;	None
;
; IMPLICIT INPUTS:
;
;	None
;
; OUTPUT PARAMETERS:
;
;	None
;
; IMPLICIT OUTPUTS:
;
;	R5 = pointer to parameter area.
;
; CONDITION CODES:
;
;	None
;
; SIDE EFFECTS:
;
;	The condition codes are not preserved.
;--

	.PSECT	$CODE$,I,RO
SIGNAL:	CALL	$HANDL
	HALT

	.END