Google
 

Trailing-Edge - PDP-10 Archives - decnet_mcb_cusps_703a - 10,7/dcnmcb/cexlib.m11
There are 15 other files named cexlib.m11 in the archive. Click here to see a list.
; [Beginning of CEXLIB]
;
;                    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 Comm/Exec specific macros
;
; ENVIRONMENT: RSX kernel mode with EIS
;
; AUTHOR: Alan D. Peckham, CREATION DATE: 20-MAR-80
;
; MODIFIED BY:
;
; 01	- Use macros from MCBLIB.
; 02	- Add CCB length variable.
;	  Add CE$CLN status code.
; 03	- Add SF.ACT flag to SYNCH block.
;	  Add CE$SYN status code.
; 04	- Add CF.ACT flag for active CCBs.
;	  Add SDB header definitions and CE$SBO status code.
; 05	- Add status codes.
;	  Alter CRSH$S macro to call $CRSH
; 06	- Reorder status codes and create macros
;	  to define them globally.
; 07	- Alter PS access.
; 08	- PDT re-ordered.
; 09	- SYNCH block augmented for LLC use.
; 10	- Add CCBCK$ macro for CCB/RDB verification.
;	Alan D. Peckham, 9-Dec-80: VERSION 3.1
; 11	- Rework PDT, SLT, PHD, CETAB macros.
;	Alan D. Peckham, 21-Jan-81: VERSION 3.2
; 12	- Update to use process descriptor block addresses internally.
; 13	- Add partition size to process header.
; 14	- Add RSX dispatch address to process header.
;--
;
; CONFIGURATION VARIABLES
;

C$$QUE	= 1			; Free pool queues instead of stacks.
D$$BUG	= 0			; Debugging code disabled.
M$$MGE	= 1			; Memory management present.
P$$BPS	= 1			; Processor status is byte in I/O page
P$$MAX	= 64.			; Maximum number of processes.
P$$WPS	= 1			; Processor status is word in I/O page

;
; INCLUDE FILES:
;

	.MCALL	CCBDF$,TMBDF$
	.MCALL	MAP$,MAP$S,POP$S,PUSH$S,SMAP$,SMAP$S

;
; MACROS:
;

	.IF	NE,P$$WPS+P$$BPS
	.MACRO	MFPS dst
	.GLOBL	PS
	.IF	NE,P$$BPS
	MOVB	@#PS,dst
	.IFF
	MOV	@#PS,dst
	.ENDC
	.ENDM	MFPS

	.MACRO	MTPS src
	.GLOBL	PS
	.IF	NE,P$$BPS
	MOVB	src,@#PS
	.IFF
	MOV	src,@#PS
	.ENDC
	.ENDM	MTPS
	.ENDC

	.MACRO	DSABL$
	MFPS	-(SP)
	.IF	NE,P$$WPS
	.GLOBL	PS
	MOVB	#340,@#PS
	.IFF
	MTPS	#340
	.ENDC
	.ENDM	DSABL$

	.MACRO	ENABL$
	MTPS	(SP)+
	.ENDM	ENABL$

	.MACRO	ILVL$
	.IF	NE,D$$BUG
	CALL	$ILVCK		; Crash if not at interrupt level.
	.ENDC
	.ENDM	ILVL$

	.MACRO	PLVL$
	.IF	NE,D$$BUG
	CALL	$PLVCK		; Crash if not at process level.
	.ENDC
	.ENDM	PLVL$

	.MACRO	RLVL$
	.IF	NE,D$$BUG
	CALL	$RLVCK		; Crash if not at RSX level.
	.ENDC
	.ENDM	RLVL$

	.MACRO	CCBCK$
	.IF	NE,D$$BUG
	CALL	$CCBCK		; Crash if not at RSX level.
	.ENDC
	.ENDM	CCBCK$

	.MACRO	CRSH$S	code
	.GLOBL	$CRSH
	CALL	$CRSH		; MCB will NOT return !
	.iif	ndf,CE$'code, .globl CE$'code
	.WORD	CE$'code
	.ENDM	CRSH$S

;
; EQUATED SYMBOLS:
;

	MCBDF$			; MCB status definitions.
	CCBDF$			; CCB symbol definitions.
	SYNDF$			; SYNCH block symbol definitions.
	TMBDF$			; TMB symbol definitions.

	.ASECT

;
; data base descriptor table
;

.	= 0
Z.DSP:	.BLKW	1		; Relocation bias of process
	.BLKW	1		; Dispatch table address
Z.DAT:	.BLKW	2		; Bias/Address of data base
Z.PIX:	.BLKB	0		; Process index
Z.FLG:	.BLKW	1		; Flags word:
 ZF.DTM =	100000		;  Data base timer enabled
 ZF.RDB	=	040000		;  RDB has been requested
 ZF.CCB	=	010000		;  CCB has been requested
 ZF.KIL	=	004000		;  Process destruction requested
 ZF.DAT	=	001000		;  Data base included
 ZF.UCB	=	000400		;  UCB address included
;	  000377		;  (process index)

Z.UCB:	.BLKW	1		; Address of RSX driver UCB
Z.LEN:	.BLKW	0

;
; System line table
;

.	= 0
L.DDM:	.BLKB	1		; DDM process descriptor block
L.LIX:	.BLKB	1		; Line index
L.DLC:	.BLKB	1		; DLC process descriptor block
L.CTL:	.BLKB	1		; Controller number
L.LLC:	.BLKB	1		; LLC process descriptor block
L.UNT:	.BLKB	1		; Unit number
L.DEV:	.BLKW	1		; Pointer to device name
L.LEN:	.BLKW	0

;
; Interrupt transfer block
;

.	= 0
X.JSR:	.BLKW	2		; "JSR R5,@#$INTCn" instruction
X.PDB:	.BLKW	1		; Address of process descriptor block
X.DSP:	.BLKW	1		; Address of interrupt dispatch
X.LEN:	.BLKW	0

;
; Process header
;

.	= 120000
PHDNAM:	.BLKW	1	; Process name in Radix-50
PHDMCB:	.BLKB	2	; MCB version number
PHDBLK:	.BLKW	1	; Number of blocks in partition
PHDPAT:	.BLKW	1	; Next available patch location
			; or zero if none available.
PHDSIG:	.BLKW	1	; SIGNAL handling routine adr
PHDLLC:	.BLKW	1	; LLC dispatch vector adr
PHDDLC:	.BLKW	1	; DLC dispatch vector adr
PHDDDM:	.BLKW	1	; DDM dispatch vector adr
PHDCEX:	.BLKW	2	; Comm/Exec identification
			; in Radix-50
PHDIDN:	.BLKW	2	; Process identification
			; in Radix-50
PHDFLG:	.BLKW	1	; Process flags:
 PFLBLI	=	000400		;  Process written in BLISS
 PFLRSX	=	001000		;  RSX dispatch vector included

PHDRSX:	.BLKW	1	; RSX dispatch vector adr
PHDCTB:	.BLKW	1	; CEX process dispatch vector adr
	.BLKW	1	; (reserved)

;
; CCB extensions
;

.	= C.OWN
C.FLG:	.BLKW	1		; Flags:
 CF.USE	=	002000		;  CCB has been used
 CF.ACT	=	001000		;  CCB is allocated
 CF.RDB =	000400		;  CCB has attached RDB
;	=	000377		; (Process index of CCB owner)

.	= C.PRM5+2
C.DST:	.BLKW	1		; Destination process descriptor block
C.SRC:	.BLKW	1		; Source process descriptor block
	.EVEN
C.LEN:	.BLKW	0

;
; CCB pool entry.
;

.	= 0
P.CSIZ:	.BLKW	1		; Size of attached buffer.
P.CNUM:	.BLKW	1		; Number of CCBs allocated.
P.CALF:	.BLKW	1		; Number of allocation failures.
	.IF	NE,C$$QUE
P.CQUE:	.BLKW	2		; Free CCB queue.
	.IFF
P.CSTK:	.BLKW	1		; Free CCB stack.
	.ENDC
P.CCNT:	.BLKW	1		; Number of CCBs free.
P.CREQ:	.BLKW	1		; Number of CCB requests.
P.CPDB:	.BLKW	1		; Last process serviced.
P.CFLG:	.BLKW	1		; PDB request flag.
P.CFNC:	.BLKB	1		; Request dispatch function.
P.CMOD:	.BLKB	1		; Request dispatch modifier.
P.CACB:	.BLKW	1		; Allocated core bias.
P.CACL:	.BLKW	1		; Allocated core length (in blocks).
P.CADA:	.BLKW	1		; Allocated DSR address.
P.CADL:	.BLKW	1		; Allocated DSR length (in bytes).
P.CLEN:	.BLKW	0		; Length of entry.

;
; Buffer pool entry.
;

.	= 0
P.BSIZ:	.BLKW	1		; Size of this buffer.
P.BCNT:	.BLKW	1		; Number of available buffers.
P.BQUE:	.BLKW	4		; Queue of buffers.
P.BALF:	.BLKW	1		; Number of allocation failures.
P.BNUM:	.BLKW	1		; Number of pre-allocated buffers.
P.BACB:	.BLKW	1		; Allocated core bias.
P.BACL:	.BLKW	1		; Allocated core length (in blocks).
P.BLEN:	.BLKW	0		; Length of entry.

;
; Exception vector
;
.	= 0
E.LVL:	.BLKW	1		; Exception level.
E.PDB:	.BLKW	1		; Address of process descriptor block.
E.DSP:	.BLKW	1		; Dispatch address.
E.ENA:	.BLKW	1		; Enable vector address.
E.LEN:	.BLKW	0		; Length of exception vector.
.	= 0
	.PSECT

;
; CE: Data base creation
;

	.MACRO	SYS$DF	sysnam,sysnum

	.MACRO	BFP$CK	siz,max,min
BFPNUM	= BFPNUM+1
	UCB$P	INI5
	.WORD	siz,0
	.WORD	0,0,0,0
	.WORD	0
	.WORD	0
	.IF	NB,<min>
	.WORD	max,min
	.IFF
	.WORD	max,max
	.ENDC
	UCB$E
	.ENDM	BFP$CK

	.MACRO	BUF$DF	ccbn,ccbl,rdbn,rdbl,sdbn,sdbl,ldbt
	.IF	NE,<ccbl-C.LEN>
	.ERROR	C.LEN; CCB size skew (ccbl)
	.ENDC
	.IF	NE,<rdbl-RDB.sz>
	.ERROR	RDB.sz; RDB size skew (rdbl)
	.ENDC
	.IF	GT,<sdbl-RDB.sz>
	.ERROR	RDB.sz; SDB size too large (sdbl)
	.ENDC
	CE.CBL	= ccbn
	CE.CBH	= ccbn
	CE.RBL	= rdbn
	CE.RBH	= rdbn
	.ENDM	BUF$DF

	.MACRO	CBP$CK	siz,max,min,flg,mod
	.IF	EQ,siz
	CE.CBL	= max
	.IF	NB,<min>
	CE.CBH	= min
	.IFF
	CE.CBH	= max
	.ENDC
	.IFF
	.IF	EQ,<siz-RDB.sz>
	CE.RBL	= max
	.IF	NB,<min>
	CE.RBH	= min
	.IFF
	CE.RBH	= max
	.ENDC
	.IFF
	.ERROR	siz; Unsupported CCB/buffer size
	.ENDC
	.ENDC
	.ENDM	CBP$CK

	.MACRO	CTL$DF	num,csradr,vecadr,pri
	.ENDM	CTL$DF

	.MACRO	DEV$DF	nam,numvec
	.ENDM	DEV$DF

	.MACRO	DRV$DF	nam
	.ENDM	DRV$DF

	.MACRO	END$DF
	CE$cbb	CBP$CK
	UCB$P	BDAT
	.WORD	CE.CBH,CE.CBL
	.WORD	RDB.sz
	.WORD	CE.RBH,CE.RBL
	UCB$E
	CE$buf	BFP$CK
	UCB$P	INI5
	.WORD	177777,0
	UCB$E
	UCB$P	BDAT
	.IRP	n,<\PDBNUM+1>
	.WORD	n		; Number of pre-defined processes
	.ENDM
	.IRP	n,<\PNMNUM>
	.WORD	n		; Number of process directory entries
	.ENDM
	.IIF	LT,<SLTNUM>,SLTNUM=0
	.IRP	n,<\SLTNUM>
	.IF	NE,<n-CE.lix>
	.ERROR	CE.lix; Does not reflect number of system lines (n)
	.ENDC
	.WORD	n		; Number of system lines
	.ENDM
	.IRP	n,<\BFPNUM>
	.WORD	n		; Number of buffer pools
	.ENDM
	UCB$E

	UCB$P	AUCB
	.GLOBL	UC.PWF
CEUCB:	.WORD	CEDCB		; Back pointer to DCB
	.WORD	.-2		; Redirect UCB pointer
	.BYTE	UC.PWF		; Call on power failure
	.BYTE	0		; Unit status
	.BYTE	0		; Physical unit number
	.BYTE	0		; Unit status
	.WORD	0		; Characteristics word 1
	.WORD	0		; Characteristics word 2
	.WORD	0		; Characteristics word 3
	.WORD	0		; Characteristics word 4
	.WORD	CESCB		; Pointer to SCB
	.WORD	0		; TCB address of
				; attached task
	.WORD	0,0		; Buffer address doubleword
	.WORD	0		; Buffer byte count
	UCB$E

	.PSECT	ADCB,D
	.GLOBL	$CETBL
$CEDAT::
CEDCB:	.WORD	0		; Link to next DCB
	.WORD	CEUCB		; Pointer to first UCB
	.ASCII	/CE/		; Device name
	.BYTE	0,0		; Low and high unit numbers
	.WORD	CELNG		; Length of UCB
	.WORD	$CETBL		; Address of driver dispatch table
	.WORD	0,0,0,0		; Masks for bits  0.-15.
	.WORD	0,0,0,0		; Masks for bits 16.-31.
	.WORD	0		; Address of PCB

	.PSECT	ZSCB,D
CESCB:	.WORD	0,.-2		; Device I/O queue listhead
	.BYTE	0*40		; Device priority
	.BYTE	0/4		; Device vector
	.BYTE	0		; Current timeout count
	.BYTE	1		; Initial timeout count
	.BYTE	0*2		; Controller index
	.BYTE	0		; Controller status
	.WORD	0		; Device CSR address
	.BLKW	1		; Address of current I/O packet
	.BLKW	5		; Fork block
$CEEND::
	.PSECT
	.ENDM	END$DF

	.MACRO	LLC$DF	nam
nam'FLG	= nam'FLG!ZF.DAT
	.ENDM	LLC$DF

	.MACRO	MEM$DF	a0,a1,a2,a3,a4,a5,a6,a7,a8,a9
	.ENDM	MEM$DF

	.MACRO	NOD$CK	nam
	.IF	DIF,sysnam,nam
	.PRINT	; System name (sysnam) not the node name (nam)
	.ENDC
	.IF	NE,<sysnum-NS.slf>
	.PRINT	NS.slf; System number (sysnum) not the node number
	.ENDC
	.ENDM	NOD$CK

	.MACRO	PDB$	pix,flgs,pnm,dsp,dat,unm
	.IF	IDN,<pnm>,<CEX>
pix	=	0
	.IFF
PDBNUM	= PDBNUM+1
pix	= PDBNUM
	.ENDC
	UCB$P	INI1
	.RAD50	\pnm\		; Relocation bias of process
	.WORD	dsp		; Address of dispatch table
	.IF	NB,<dat>
dat::.WORD	0,0		; Bias/address of data base
	.IFF
	.WORD	0,0		; No data base
	.ENDC
	.IRP	n,<\flgs+pix>
	.WORD	n		; Process index and flags
	.ENDM
	.IF	NB,<unm>
unm::.WORD	0		; Address of RSX driver UCB
	.ENDC
	UCB$E
	.ENDM	PDB$

	.MACRO	PRC$DF	nam,dvc
	.IF	LT,SLTNUM
	.IF	B,<dvc>
	.IIF	NDF,nam'FLG,nam'FLG=0
	PDB$	nam'PIX,\nam'FLG,nam,PHDLLC,LLC'nam
	.IFF
	.IIF	NDF,nam'FLG,nam'FLG=ZF.UCB
	PDB$	nam'PIX,\nam'FLG,nam,PHDLLC,LLC'nam,UCB'nam
	.ENDC
PNMNUM	= PNMNUM+1
	UCB$P	INI2
	.WORD	nam'PIX
	.RAD50	\nam\
	UCB$E
	.ENDC
	.ENDM	PRC$DF

	.MACRO	SLT$DF	llcnm,dlcnm,ddmnm,ctln,unt,trb,devnm,enb
	.IIF	LT,<SLTNUM>,SLTNUM=0
SLTNUM	= SLTNUM+1
	SLT$	\SLTNUM,llcnm,dlcnm,ddmnm,ctln,unt,trb,devnm,enb
	.ENDM	SLT$DF

	.MACRO	SLT$D	nam,ctl,unt
	.IF	IDN,<nam>,<DTE>
	SLT$N	<nam-unt-ctl>
	.IFF
	.IF	NB,<unt>
	SLT$N	<nam-ctl-unt>
	.IFF
	SLT$N	<nam-ctl>
	.ENDC
	.ENDC
	.ENDM	SLT$D

	.MACRO	SLT$N nam
	.NCHR	SLTLNG,<nam>
	.IRP	lng,<\SLTLNG>
	.ASCII	<lng>/nam/
	.ENDM
	.ENDM	SLT$N

	.MACRO	SLT$	lix,llcnm,dlcnm,ddmnm,ctl,unt,trb,devnm,enb
SLTLLC	= llcnm'PIX
	PDB$	SLTDLC,ZF.DTM,dlcnm,\PHDDLC,DLC'lix
	.IF	NDF,dlcnm'ctl
dlcnm'ctl = SLTDLC
	.ENDC
	.IF	NB,<ddmnm>
	.IF	B,<trb>
	PDB$	SLTDDM,ZF.DTM,ddmnm,\PHDDDM,DDM'lix
	.IF	NDF,ddmnm'ctl
ddmnm'ctl = SLTDDM
	.ENDC
	.IFF
	.IF	EQ,<trb>
	PDB$	SLTDDM,ZF.DTM,ddmnm,\PHDDDM,DDM'lix
	.IF	NDF,ddmnm'ctl
ddmnm'ctl = SLTDDM
	.ENDC
	.IFF
	.IRP	plix,<\<lix-1>>
DDM'lix	== DDM'plix
	.ENDM
	.ENDC
	.ENDC
	.IFF
SLTDDM	= 0
	.ENDC
	UCB$P	INI3
	.IRP	num,<\SLTDDM>
	.BYTE	num		; DDM data base index
	.ENDM
	.IRP	n,<\lix>
	.BYTE	n		; Flags and line index
	.ENDM
	.IRP	num,<\SLTDLC>
	.BYTE	num		; DLC data base index
	.ENDM
	.BYTE	ctl		; Controller number
	.IRP	num,<\SLTLLC>
	.BYTE	num		; LLC data base index
	.ENDM
	.BYTE	unt		; Unit number
	.WORD	0
	UCB$E
	UCB$P	INI4
	.IF	NB,<devnm>
	SLT$N	<devnm>		; Device name
	.IFF
	.IF	NB,<ddmnm>
	SLT$D	ddmnm,ctl,unt	; Device name
	.IFF
	.IF	NB,<dlcnm>
	SLT$D	dlcnm,ctl,unt	; Device name
	.IFF
	SLT$D	llcnm,ctl,unt	; Device name
	.ENDC
	.ENDC
	.ENDC
	UCB$E
	.ENDM	SLT$

	.MACRO	TRB$DF	trb,ch0,ch1,ch2,ch3,ch4,ch5,ch6,ch7
	.ENDM	TRB$DF

	.MACRO	TSK$DF	nam,rsi
	.ENDM	TSK$DF

	.MACRO	UCB$E	nam
CELNG	= .-CEADR+CELNG
	.PSECT	nam
	.ENDM	UCB$E

	.MACRO	UCB$P	pre
	.PSECT	pre,D
CEADR	= .
	.ENDM	UCB$P

	.MACRO	UNT$DF	unt,ch0,ch1,ch2,ch3,ch4,ch5,ch6,ch7
	.ENDM	UNT$DF

BFPNUM	= 0
PDBNUM	= 0
PNMNUM	= 0
SLTNUM	= -1
CELNG	= 0

	CE$NOD	NOD$CK

	.ENDM	SYS$DF

;
; [End of CEXLIB]