Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/listings/rsx11s/drmap.list
There are no other files named drmap.list in the archive.
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 3


      1						.TITLE	DRMAP
      2						.IDENT	/01/
      3
      4					;
      5					; COPYRIGHT (C) 1976, 1978
      6					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
      7					;
      8					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
      9					; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
     10					;
     11					; VERSION 01
     12					;
     13					; T. J. MILLER 8-MAR-76
     14					;
     15					; MODIFIED BY:
     16					;
     17					;	T. J. MILLER 5-JAN-77
     18					;
     19					;		TM071 -- CORRECT ERROR IN MAP ALGORITHM.
     20					;
     21					;	T. J. MILLER 20-APR-77
     22					;
     23					;		TM076 -- CORRECT BUG IN GET MAPPING CONTEXT DIRECTIVE.
     24					;
     25					;	T. J. MILLER 26-MAY-77
     26					;
     27					;		TM086 -- UTILIZE COMMON EVENT FLAG SETTING ROUTINE IN
     28					;			RECEIVE BY REFERENCE.
     29					;
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4


     31					;
     32					; THE FOLLOWING DIRECTIVES RECEIVE AS INPUT POINTERS TO A WINDOW DEFINITION
     33					; BLOCK, WHICH SERVES AS A COMMUNICATION AREA BETWEEN THE ISSUING TASK AND
     34					; THE EXECUTIVE. THE FORMAT OF THE WINDOW DEFINITION BLOCK IS:
     35					;
     36					;		-------------------------------------------------
     37					;	W.NID	!			!			!
     38					;	W.NAPR	!	BASE APR	!	WINDOW ID	!
     39					;		!			!			!
     40					;		!-----------------------------------------------!
     41					;		!						!
     42					;	W.NBAS	!	VIRTUAL BASE ADDRESS (BYTES)		!
     43					;		!						!
     44					;		!-----------------------------------------------!
     45					;		!						!
     46					;	W.NSIZ	!	WINDOW SIZE (32W BLOCKS)		!
     47					;		!						!
     48					;		!-----------------------------------------------!
     49					;		!						!
     50					;	W.NRID	!	REGION ID				!
     51					;		!						!
     52					;		!-----------------------------------------------!
     53					;		!						!
     54					;	W.NOFF	!	OFFSET IN PARTITION (32W BLOCKS)	!
     55					;		!						!
     56					;		!-----------------------------------------------!
     57					;		!						!
     58					;	W.NLEN	!	LENGTH TO MAP (32W BLOCKS)		!
     59					;		!						!
     60					;		!-----------------------------------------------!
     61					;		!						!
     62					;	W.NSTS	!	STATUS WORD				!
     63					;		!						!
     64					;		!-----------------------------------------------!
     65					;		!						!
     66					;	W.NSRB	!	SEND/RECEIVE BUFFER ADDR (BYTES)	!
     67					;		!						!
     68					;		-------------------------------------------------
     69					;
     70					; MACRO LIBRARY CALLS
     71					;
     72
     73
     74						.IF DF	P$$LAS
     75
     76						.MCALL	HDRDF$,PCBDF$,TCBDF$,WDBDF$
     77						HDRDF$			;DEFINE HEADER AND WINDOW BLOCK OFFSETS
     78						PCBDF$			;DEFINE PCB AND ATTACHMENT DESCR OFFSETS
     79						TCBDF$			;DEFINE TCB OFFSETS
     80						WDBDF$			;DEFINE WINDOW DEFINITION BLOCK OFFSETS
     81
     82					;+
     83					; **-$DRCRW-CREATE ADDRESS WINDOW
     84					;
     85					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO ALLOCATE AN ADDRESS WINDOW IN THE
     86					; HEADER OF THE ISSUING TASK, UNMAPPING AND ELIMINATING ANY OVERLAPPING
     87					; ADDRESS WINDOWS, AND OPTIONALLY TO MAP THE NEW WINDOW.
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-1


     88					;
     89					; DPB FORMAT:
     90					;
     91					;	WD. 00 -- DIC(117.),DPB SIZE(2.)
     92					;	WD. 01 -- ADDRESS OF WINDOW DEFINITION BLOCK
     93					;
     94					; INPUTS:
     95					;
     96					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
     97					;	R3=ADDRESS OF THE WINDOW DEFINITION BLOCK.
     98					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
     99					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    100					;
    101					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    102					;		W.NAPR=BASE APR OF REGION.
    103					;		W.NSIZ=DESIRED SIZE OF ADDRESS WINDOW.
    104					;		W.NRID=ID OF REGION TO MAP OR 0 FOR TASK REGION (IF WS.MAP=1).
    105					;		W.NOFF=OFFSET WITHIN REGION TO MAP (IF WS.MAP=1).
    106					;		W.NLEN=LENGTH TO MAP OR 0 TO DEFAULT TO SMALLER OF WINDOW SIZE
    107					;			OR SIZE LEFT IN PARTITION (IF WS.MAP=1).
    108					;		W.NSTS=CONTROL INFORMATION.
    109					;			WS.MAP=1 IF MAPPING IS TO OCCUR.
    110					;			WS.WRT=1 IF MAPPING IS TO OCCUR WITH WRITE ACCESS.
    111					;
    112					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    113					;
    114					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    115					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    116					;	C=1 IF DIRECTIVE IS REJECTED.
    117					;		DIRECTIVE STATUS OF 'D.RS16' IS RETURNED IF THE SPECIFIED
    118					;			ACCESS IS DENIED IN THE MAPPING STAGE.
    119					;		DIRECTIVE STATUS OF 'D.RS84' IS RETURNED IF AN INVALID APR-
    120					;			WINDOW SIZE COMBINATION IS SPECIFIED OR IF AN
    121					;			INVALID REGION OFFSET-LENGTH COMBINATION IS SPECIFIED
    122					;			IN THE MAPPING STAGE.
    123					;		DIRECTIVE STATUS OF 'D.RS85' IS RETURNED IF THERE ARE NO
    124					;			AVAILABLE WINDOW BLOCKS.
    125					;		DIRECTIVE STATUS OF 'D.RS86' IS RETURNED IF AN INVALID REGION
    126					;			ID IS SPECIFIED IN THE MAPPING STAGE.
    127					;
    128					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    129					;		W.NID=ASSIGNED WINDOW ID.
    130					;		W.NBAS=VIRTUAL BASE ADDRESS OF WINDOW.
    131					;		W.NLEN=LENGTH ACTUALLY MAPPED.
    132					;		W.NSTS=INDICATION OF ANY CHANGES IN MAPPING STATUS.
    133					;			WS.CRW=1 IF ADDRESS WINDOW SUCCESSFULLY ESTABLISHED.
    134					;			WS.ELW=1 IF ANY ADDRESS WINDOWS WERE ELIMINATED.
    135					;			WS.UNM=1 IF ANY ADDRESS WINDOWS WERE UNMAPPED.
    136					;-
    137
    138					$DRCRW::MOV	R4,-(SP)	;SAVE ADDRESS OF TASK HEADER
    139						MOV	H.WND(R4),R4	;POINT TO NUMBER OF WINDOW BLOCKS
    140						MOV	(R4)+,R1	;PICK UP NUMBER OF WINDOW BLOCKS
    141						MOV	(R3)+,R2	;PICK UP APR NUMBER IN HIGH BYTE (W.NID)
    142						CLRB	R2		;CLEAR OUT LOW BYTE
    143						CMP	R2,#7*256.	;LEGAL APR NUMBER?
    144						BHI	40$		;IF HI NO
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-2


    145						ASR	R2		;CONVERT TO BASE ADDRESS IN 32W BLOCKS
    146						MOV	R2,(R3)		;STORE VIRTUAL BASE ADDRESS (W.NBAS)
    147						ASR	(R3)		;CONVERT TO BYTES (W.NBAS)
    148						ASR	(R3)		;
    149						SWAB	(R3)+		;
    150						MOV	R2,-(SP)	;CALCULATE HIGH ADDRESS
    151						ADD	(R3),(SP)	;(W.NSIZ)
    152						BCS	40$		;IF CS ILLEGAL SIZE
    153						CMP	(SP),#2000	;LEGAL TOP ADDRESS?
    154						BHI	40$		;IF HI NO
    155						MOV	R1,-(SP)	;SAVE NUMBER OF WINDOWS
    156						CMP	-(R3),-(R3)	;POINT TO START OF WINDOW BLOCK (W.NBAS)(W.NID)
    157					10$:	TST	W.BSIZ(R4)	;POINTING TO AN ESTABLISHED ADDRESS WINDOW?
    158						BEQ	20$		;IF EQ NO
    159						MOV	W.BLVR(R4),R0	;PICK UP LOW VIRTUAL ADDRESS
    160						SWAB	R0		;CONVERT TO 32W BLOCKS
    161						ASL	R0		;
    162						ASL	R0		;
    163						CMP	2(SP),R0	;POSSIBLE VIRTUAL ADDRESS OVERLAP?
    164						BLOS	30$		;IF LOS NO
    165						ADD	W.BSIZ(R4),R0	;CALCULATE HIGH ADDRESS
    166						CMP	R2,R0		;VIRTUAL ADDRESS OVERLAP?
    167						BHIS	30$		;IF HIS NO
    168						CMP	R1,(SP)		;OVERLAPPING WINDOW 0?
    169						BEQ	40$		;IF EQ YES
    170						CALL	ELAW		;ELIMINATE ADDRESS WINDOW
    171					20$:	TST	(SP)		;HAS A WINDOW BEEN ESTABLISHED?
    172						BEQ	30$		;IF EQ YES
    173						CMP	(R3)+,(R3)+	;POINT TO WINDOW SIZE IN BLOCK (W.NID)(W.NBAS)
    174						MOV	(R3),W.BSIZ(R4)	;STORE SIZE, ESTABLISHING WINDOW (W.NSIZ)
    175						MOV	-(R3),W.BLVR(R4) ;SET LOW VIRTUAL ADDRESS (W.NBAS)
    176						MOVB	-(R3),R0	;PICK UP FIRST APR NUMBER (W.NAPR)
    177						ASL	R0		;CONVERT APR NUMBER TO WORD OFFSET
    178						ADD	#UISDR0,R0	;POINT TO FIRST PDR
    179						MOVB	R0,W.BFPD(R4)	;SET FIRST PDR ADDRESS
    180						MOVB	(SP),-(R3)	;PICK UP TOTAL NUMBER OF WINDOWS (W.NID)
    181						SUB	R1,(R3)		;SET ADDRESS WINDOW ID (W.NID)
    182						CLR	(SP)		;INDICATE WINDOW HAS BEEN ESTABLISHED
    183					30$:	ADD	#W.BLGH,R4	;POINT TO NEXT WINDOW BLOCK
    184						DEC	R1		;MORE WINDOW BLOCKS?
    185						BGT	10$		;IF GT YES
    186						TST	(SP)+		;WAS AN ADDRESS WINDOW ESTABLISHED?
    187						BNE	50$		;IF NE NO
    188						TST	(SP)+		;POP CALCULATED HIGH ADDRESS
    189						MOV	(SP)+,R4	;RESTORE TASK HEADER ADDRESS
    190						BIS	#WS.CRW,W.NSTS(R3) ;INDICATE ADDRESS WINDOW WAS CREATED
    191						BIT	#WS.MAP,W.NSTS(R3) ;IS WINDOW TO BE MAPPED?
    192						BNE	$DRMAP		;MAP ADDRESS WINDOW AND EXIT
    193						RETURN			;
    194					40$:	DRSTS	D.RS84		;ALIGNMENT ERROR
    195					50$:	DRSTS	D.RS85		;NO AVAILABLE WINDOWS
    196
    197					;+
    198					; **-$DRELW-ELIMINATE ADDRESS WINDOW
    199					;
    200					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO ELIMINATE THE SPECIFIED ADDRESS
    201					; WINDOW, UNMAPPING IT FIRST IF NECESSARY.
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-3


    202					;
    203					; DPB FORMAT:
    204					;
    205					;	WD. 00 -- DIC(119.),DPB SIZE(2.)
    206					;	WD. 01 -- ADDRESS OF WINDOW DEFINITION BLOCK
    207					;
    208					; INPUTS:
    209					;
    210					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    211					;	R3=ADDRESS OF THE WINDOW DEFINITION BLOCK.
    212					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    213					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    214					;
    215					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    216					;		W.NID=ID OF ADDRESS WINDOW TO ELIMINATE.
    217					;
    218					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    219					;
    220					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    221					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    222					;	C=1 IF DIRECTIVE IS REJECTED.
    223					;		DIRECTIVE STATUS OF 'D.RS87' IS RETURNED IF AN INVALID
    224					;			ADDRESS WINDOW WAS SPECIFIED.
    225					;
    226					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    227					;		W.NSTS=INDICATION OF ANY CHANGES IN MAPPING STATUS.
    228					;			WS.ELW=1 IF ADDRESS WINDOW SUCCESSFULLY ELIMINATED.
    229					;			WS.UNM=1 IF THE ADDRESS WINDOW WAS UNMAPPED.
    230					;-
    231
    232					$DRELW::CALL	$SRWND		;SEARCH FOR AND VERIFY SPECIFIED WINDOW
    233					ELAW:	CALL	$UNMAP		;UNMAP IF NECESSARY
    234						BCC	10$		;IF CC UNMAPPING WAS NOT PERFORMED
    235						BIS	#WS.UNM,W.NSTS(R3) ;INDICATE A WINDOW WAS UNMAPPED
    236					10$:	CLR	W.BSIZ(R4)	;INDICATE ADDRESS WINDOW IS ELIMINATED
    237						BIS	#WS.ELW,W.NSTS(R3) ;INDICATE ADDRESS WINDOW ELIMINATED
    238						RETURN			;
    239
    240					;+
    241					; **-$DRMAP-MAP WINDOW TO REGION
    242					;
    243					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO MAP THE SPECIFIED ADDRESS
    244					; WINDOW TO AN OFFSET IN THE SPECIFIED REGION, UNMAPPING IF NECESSARY.
    245					;
    246					; DPB FORMAT:
    247					;
    248					;	WD. 00 -- DIC(121.),DPB SIZE(2.)
    249					;	WD. 01 -- ADDRESS OF WINDOW DEFINITION BLOCK
    250					;
    251					; INPUTS:
    252					;
    253					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    254					;	R3=ADDRESS OF THE WINDOW DEFINITION BLOCK.
    255					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    256					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    257					;
    258					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-4


    259					;		W.NID=ID OF WINDOW TO MAP.
    260					;		W.NRID=ID OF REGION TO MAP TO OR 0 TO DEFAULT TO TASK REGION.
    261					;		W.NOFF=OFFSET WITHIN REGION TO MAP TO.
    262					;		W.NLEN=LENGTH TO MAP OR 0 TO DEFAULT TO SMALLER OF WINDOW
    263					;			SIZE OR SIZE LEFT IN PARTITION.
    264					;		W.NSTS=CONTROL INFORMATION.
    265					;			WS.WRT=1 IF WRITE ACCESS IS DESIRED.
    266					;
    267					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    268					;
    269					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    270					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    271					;	C=1 IF DIRECTIVE IS REJECTED.
    272					;		DIRECTIVE STATUS OF 'D.RS16' IS RETURNED IF THE DESIRED
    273					;			ACCESS TO THE REGION IS DENIED.
    274					;		DIRECTIVE STATUS OF 'D.RS84' IS RETURNED IF AN INVALID
    275					;			REGION OFFSET-SIZE COMBINATION IS SPECIFIED.
    276					;		DIRECTIVE STATUS OF 'D.RS86' IS RETURNED IF AN INVALID
    277					;			REGION ID IS SPECIFIED.
    278					;		DIRECTIVE STATUS OF 'D.RS87' IS RETURNED IF AN INVALID
    279					;			ADDRESS WINDOW ID IS SPECIFIED.
    280					;
    281					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    282					;		W.NLEN=LENGTH ACTUALLY MAPPED.
    283					;		W.NSTS=INDICATION OF ANY CHANGES IN MAPPING STATUS.
    284					;			WS.UNM=1 IF THE WINDOW WAS UNMAPPED FIRST.
    285					;
    286					; THIS DIRECTIVE FIRST BUILDS AN IMAGE OF A MAPPED WINDOW BLOCK ON THE
    287					; STACK.  THEN IF NO ERRORS ARE ENCOUNTERED, THE CORRESPONDING WINDOW IS
    288					; UNMAPPED, IF NECESSARY, AND SET UP FROM THE STACK IMAGE.
    289					;-
    290
    291					$DRMAP::CALL	$SRWND		;SEARCH FOR AND VERIFY ADDRESS WINDOW ID
    292						ADD	#W.NRID,R3	;POINT TO SPECIFIED REGION ID
    293						CALL	$SRATT		;SEARCH FOR MATCHING ATTACHMENT DESCRIPTOR
    294						MOV	A.PCB(R5),R2	;POINT TO ATTACHED PCB
    295						MOV	R2,-(SP)	;SET PCB ADDRESS (W.BPCB)
    296						MOV	W.BLVR(R4),-(SP) ;COPY LOW VIRTUAL ADDRESS (W.BLVR)
    297						TST	(R3)+		;POINT TO OFFSET (W.NRID)
    298						MOV	(R3)+,R0	;PICK UP SPECIFIED OFFSET (W.NOFF)
    299						CMP	R0,P.SIZE(R2)	;WITHIN PARTITION?
    300						BHIS	70$		;IF HIS NO
    301						MOV	(R3),R1		;PICK UP LENGTH TO MAP (W.NLEN)
    302						BNE	20$		;IF NE ONE WAS SPECIFIED
    303						MOV	P.SIZE(R2),R1	;CALCULATE SIZE TO END OF PARTITION
    304						SUB	R0,R1		;
    305						CMP	R1,W.BSIZ(R4)	;SIZE TO END GREATER THAN WINDOW SIZE? (W.BSIZ)
    306						BLOS	20$		;IF LOS NO
    307						MOV	W.BSIZ(R4),R1	;DEFAULT TO WINDOW SIZE (W.BSIZ)
    308					20$:	MOV	R1,(R3)+	;PASS BACK SIZE USED (W.NLEN)
    309						MOV	R1,-(SP)	;CALCULATE HIGH VIRTUAL ADDRESS (W.BHVR)
    310						SWAB	(SP)		;MULTIPLY BY 64
    311						RORB	(SP)		;
    312						ROR	(SP)		;
    313						ROR	(SP)		;
    314						DEC	(SP)		;POINT TO LAST ADDRESSABLE BYTE
    315						ADD	2(SP),(SP)	;
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-5


    316						MOV	R5,-(SP)	;STORE ADDR OF ATTACHMENT DESCRIPTOR (W.BATT)
    317						MOV	W.BSIZ(R4),-(SP) ;COPY WINDOW SIZE (W.BSIZ)
    318						CMP	R1,(SP)		;LEGAL SIZE? (W.BSIZ)
    319						BHI	70$		;IF HI NO
    320						BIT	#7,R0		;64-BYTE ALIGNMENT?
    321						BEQ	30$		;IF EQ NO
    322						BIT	#WS.64B,(R3)	;64-BYTE ALIGNMENT BEING ALLOWED?
    323						BEQ	70$		;IF EQ NO
    324					30$:	MOV	R0,-(SP)	;SET OFFSET IN PARTITION (W.BOFF)
    325						ADD	R1,R0		;POINT PAST LAST 32W BLOCK MAPPED TO
    326						CMP	R0,P.SIZE(R2)	;WITHIN PARTITION?
    327						BHI	70$		;IF HI NO
    328						MOV	W.BFPD(R4),-(SP) ;SAVE FIRST PDR ADDRESS (W.BFPD)
    329						BITB	#AS.RED!AS.WRT,A.STAT(R5) ;READ ACCESS ALLOWED?
    330						BEQ	80$		;IF NE NO
    331						MOV	#77402,-(SP)	;SET FOR READ ACCESS, 4K SIZE (W.BLPD)
    332						BIT	#WS.WRT,(R3)	;WRITE ACCESS DESIRED? (W.NSTS)
    333						BEQ	40$		;IF EQ NO
    334						BIT	#AS.WRT,A.STAT(R5) ;WRITE ACCESS ALLOWED?
    335						BEQ	80$		;IF NE NO
    336						MOV	#77406,(SP)	;SET FOR 4K SIZE, READ/WRITE ACCESS (W.BLPD)
    337					40$:	INCB	A.MPCT(R5)	;INC MAP COUNT IN ATTACHMENT DESCRIPTOR
    338						CALL	$UNMAP		;UNMAP WINDOW IF NECESSARY
    339						BCC	45$		;IF CC WINDOW WAS NOT MAPPED
    340						BIS	#WS.UNM,(R3)	;INDICATE A WINDOW WAS UNMAPPED (W.NSTS)
    341					45$:	MOVB	W.BFPD(R4),R0	;POINT TO FIRST PDR
    342						MOV	P.REL(R2),R2	;CALCULATE OFFSET FOR FIRST PDR
    343						ADD	4(SP),R2	;(W.BOFF)
    344						CLRB	3(SP)		;INIT NUMBER OF PDR'S (W.BNPD)
    345					50$:	INCB	3(SP)		;INC NUMBER OF PDR'S (W.BNPD)
    346						MOV	R2,UISAR0-UISDR0(R0) ;SET UP USER APR
    347						MOV	(SP),(R0)+	;SET UP NEXT USER PDR
    348						ADD	#200,R2		;ADVANCE APR OFFSET			; TM071
    349						SUB	#200,R1		;DONE YET?
    350						BGT	50$		;IF GT NO
    351						SWAB	R1		;SHIFT UNUSED SIZE TO HIGH BYTE
    352						CLRB	R1		;CLEAR LOW BYTE
    353						ADD	R1,(SP)		;CALCULATE SIZE IN LAST PDR
    354						ADD	R1,-(R0)	;SET LAST PDR
    355						MOV	R4,R3		;COPY POINTER TO WINDOW BLOCK
    356						ADD	#W.BLGH,R3	;POINT PAST END OF WINDOW BLOCK
    357					60$:	MOV	(SP)+,-(R3)	;COPY IMAGE OF WINDOW BLOCK INTO REAL BLOCK
    358						CMP	R3,R4		;DONE YET?
    359						BHI	60$		;IF HI NO
    360						RETURN			;
    361					70$:	DRSTS	D.RS84		;INVALID OFFSET-LENGTH COMBINATION
    362					80$:	DRSTS	D.RS16		;DESIRED ACCESS TO REGION DENIED
    363
    364					;+
    365					; **-$DRUNM-UNMAP ADDRESS WINDOW
    366					;
    367					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO UNMAP THE SPECIFIED ADDRESS
    368					; WINDOW.
    369					;
    370					; DPB FORMAT:
    371					;
    372					;	WD. 00 -- DIC(123.),DPB SIZE(2.)
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-6


    373					;	WD. 01 -- ADDRESS OF WINDOW DEFINITION BLOCK
    374					;
    375					; INPUTS:
    376					;
    377					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    378					;	R3=ADDRESS OF THE WINDOW DEFINITION BLOCK.
    379					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    380					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    381					;
    382					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    383					;		W.NID=ID OF WINDOW TO UNMAP.
    384					;
    385					; OUTPUTS: (DIRECTIVE STATUS AND PS WORD RETURNED TO TASK)
    386					;
    387					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    388					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    389					;	C=1 IF DIRECTIVE IS REJECTED.
    390					;		DIRECTIVE STATUS OF 'D.RS8' IS RETURNED IF THE SPECIFIED
    391					;			ADDRESS WINDOW NOT MAPPED.
    392					;		DIRECTIVE STATUS OF 'D.RS87' IS RETURNED IF AN INVALID
    393					;			ADDRESS WINDOW ID IS SPECIFIED.
    394					;
    395					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    396					;		W.NSTS=INDICATION OF ANY CHANGES IN MAPPING STATUS.
    397					;			WS.UNM=1 IF THE WINDOW WAS SUCCESSFULLY UNMAPPED.
    398					;-
    399
    400					$DRUNM::CALL	$SRWND		;SEARCH FOR AND VERIFY WINDOW ID
    401						CALL	$UNMAP		;UNMAP IF NECESSARY
    402						BCC	10$		;IF CC WINDOW WAS NOT MAPPED
    403						BIS	#WS.UNM,W.NSTS(R3) ;INDICATE ADDRESS WINDOW WAS UNMAPPED
    404						RETURN			;
    405					10$:	DRSTS	D.RS8		;ADDRESS WINDOW WAS NOT MAPPED
    406
    407					;+
    408					; **-$DRSRF-SEND BY REFERENCE
    409					;
    410					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO CREATE A SPECIALLY FORMATTED
    411					; PACKET INCLUDING A REFERENCE TO A SPECIFIED REGION WITH ADDITIONAL
    412					; OPTIONAL INFORMATION SUPPLIED BY THE ISSUING TASK.  THE SENDER TASK
    413					; MUST ITSELF HAVE THE ACCESS SPECIFIED IN THE REFERENCE.  THE REFERENCED
    414					; REGION IS ATTACHED TO THE RECEIVING TASK.
    415					;
    416					; DPB FORMAT:
    417					;
    418					;	WD. 00 -- DIC(69.),DPB SIZE(5.)
    419					;	WD. 01 -- FIRST HALF OF RECEIVER TASK NAME
    420					;	WD. 02 -- SECOND HALF OF RECEIVER TASK NAME
    421					;	WD. 03 -- OPTIONAL EVENT FLAG TO SET WHEN RECEIVE OCCURS
    422					;	WD. 04 -- ADDRESS OF WINDOW DEFINITION BLOCK
    423					;
    424					; INPUTS:
    425					;
    426					;	R0=ADDRESS OF THE TCB OF THE RECEIVER TASK
    427					;	R1=ADDRESS OF THE TASK STATUS WORD OF THE RECEIVER TASK
    428					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    429					;	R3=ADDRESS OF THE EFN NUMBER IN THE DPB.
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-7


    430					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    431					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    432					;
    433					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    434					;		W.NRID=ID OF REGION TO BE SENT BY REFERENCE.
    435					;		W.NOFF=OFFSET WORD PASSED WITHOUT CHECKING.
    436					;		W.NLEN=LENGTH WORD PASSED WITHOUT CHECKING.
    437					;		W.NSTS=ALLOWED ACCESS (DEFAULTS TO ACCESS OF SENDER TASK).
    438					;			WS.RED=1 IF READ ACCESS IS TO BE ALLOWED.
    439					;			WS.WRT=1 IF WRITE ACCESS IS TO BE ALLOWED.
    440					;			WS.EXT=1 IF EXTEND ACCESS IS TO BE ALLOWED.
    441					;			WS.DEL=1 IF DELETE ACCESS IS TO BE ALLOWED.
    442					;		W.NSRB=OPTIONAL ADDRESS OF 8 WORD BUFFER OF ADDITIONAL INFO.
    443					;
    444					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    445					;
    446					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    447					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    448					;	C=1 IF DIRECTIVE IS REJECTED.
    449					;		DIRECTIVE STATUS OF 'D.RS1' IS RETURNED IF A SEND PACKET
    450					;			OR ATTACHMENT DESCRIPTOR COULD NOT BE ALLOCATED.
    451					;		DIRECTIVE STATUS OF 'D.RS2' IS RETURNED IF AN ATTEMPT IS
    452					;			MADE TO SEND TO AN ACP TASK.
    453					;		DIRECTIVE STATUS OF 'D.RS16' IS RETURNED IF THE DESIRED
    454					;			ACCESS TO THE REGION IS DENIED.
    455					;		DIRECTIVE STATUS OF 'D.RS86' IS RETURNED IF AN INVALID
    456					;			REGION ID WAS SPECIFIED.
    457					;		DIRECTIVE STATUS OF 'D.RS97' IS RETURNED IF AN INVALID EFN
    458					;			NUMBER IS SPECIFIED.
    459					;		DIRECTIVE STATUS OF 'D.RS98' IS RETURNED IF THE ADDRESS
    460					;			CHECK OF THE WINDOW DEF BLOCK OR SEND BUFFER FAILS.
    461					;
    462					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    463					;		NONE.
    464					;
    465					;	THE FORMAT OF THE SEND BY REFERENCE PACKET IS:
    466					;		WD. 00 -- RECEIVE QUEUE THREAD.
    467					;		WD. 01 -- TCB ADDRESS IF EFN SPECIFIED / 0 IF NOT.
    468					;		WD. 02 -- EFN MASK / FIRST WORD OF SENDER TASK NAME.
    469					;		WD. 03 -- EFN ADDRESS / SECOND WORD OF SENDER TASK NAME.
    470					;		WD. 04 -- REGION ID (ATTACHMENT DESCRIPTOR ADDRESS).
    471					;		WD. 05 -- OFFSET IN REGION WORD.
    472					;		WD. 06 -- LENGTH OF MAP WORD.
    473					;		WD. 07 -- STATUS WORD.
    474					;		WD. 08 THRU WD. 017 -- CONTENTS OF SEND BUFFER.
    475					;-
    476
    477
    478						.IF DF	P$$SRF
    479
    480					$DRSRF::BIT	#T3.ACP!T3.NSD,T.ST3(R0) ;SENDS LEGAL TO RECEIVER?
    481						BNE	60$		;IF NE NO
    482						MOV	R0,-(SP)	;SAVE RECEIVER TASK TCB ADDRESS
    483						CALL	$CEFN		;CONVERT EFN NUMBER TO MASK AND ADDRESS
    484						BCS	4$		;IF CS NO EFN WAS SPECIFIED
    485						MOV	R5,-(SP)	;SAVE SENDER TCB ADDRESS
    486						MOV	R0,-(SP)	;SAVE EFN MASK
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-8


    487						MOV	R1,-(SP)	;SAVE EFN ADDRESS
    488						BR	5$		;
    489					4$:	CLR	-(SP)		;INDICATE NO EFN SPECIFIED
    490						MOV	T.NAM(R5),-(SP)	;SAVE SENDER TASK NAME
    491						MOV	T.NAM+2(R5),-(SP) ;
    492					5$:	MOV	(R3),R3		;PICK UP ADDRESS OF WINDOW DEF BLOCK
    493						MOV	#8.*2,R1	;SET SIZE TO ADDRESS CHECK
    494						CALL	$ACHKP		;ADDRESS CHECK AND MAP WINDOW DEF BLOCK
    495						ADD	#W.NRID,R3	;POINT TO REGION ID IN BLOCK
    496						CALL	$SRATT		;SEARCH FOR SPECIFIED ATTACHMENT DESCRIPTOR
    497						CMP	(R3)+,-(SP)	;BUMP POINTERS FOR REGION ID (W.NRID)
    498						MOV	(R3)+,-(SP)	;SAVE OFFSET WORD (W.NOFF)
    499						MOV	(R3)+,-(SP)	;SAVE LENGTH WORD (W.NLEN)
    500						MOV	(R3)+,-(SP)	;SAVE STATUS WORD (W.NSTS)
    501						BIC	#^C17,(SP)	;CLEAR ALL BUT ACCESS
    502						BNE	6$		;IF NE ACCESS SPECIFIED
    503						MOVB	A.STAT(R5),(SP)	;DEFAULT TO ACCESS OF SENDER TASK
    504					6$:	MOVB	A.STAT(R5),-(SP) ;PUSH ATTACHMENT DESCRIPTOR ADDRESS
    505						COMB	(SP)		;COMPUTE ACCESS DENIED MASK
    506						BITB	(SP)+,(SP)	;CHECK SPECIFIED ACCESS AGAINST SENDER TASK
    507						BNE	70$		;IF NE ACCESS DENIED
    508						MOV	(R3),R3		;POINT TO SEND BUFFER
    509						BEQ	10$		;IF EQ THERE IS NONE
    510						MOV	#8.*2,R1	;SET SIZE TO ADDRESS CHECK
    511						CALL	$ACHKP		;ADDRESS CHECK AND MAP SEND BUFFER
    512						ADD	#8.*2,R3	;POINT TO END OF SEND BUFFER
    513					10$:	CALL	$ALPKT		;ALLOCATE A SEND PACKET
    514						ADD	#16.*2,R0	;POINT PAST END OF SEND BY REFERENCE DATA
    515						MOV	#8.,R1		;SET LOOP COUNT FOR COPY
    516						MOV	R1,R2		;COPY LOOP COUNT
    517					20$:	MOV	R3,-(R0)	;WAS A SEND BUFFER SPECIFIED?
    518						BEQ	30$		;IF EQ NO
    519						MOV	-(R3),(R0)	;ELSE COPY NEXT WORD
    520					30$:	DEC	R2		;DONE YET?
    521						BGT	20$		;IF GT NO
    522						MOV	(SP),R4		;PICK UP STATUS WORD
    523					40$:	MOV	(SP)+,-(R0)	;INSERT SAVED WORDS ON STACK
    524						DEC	R1		;DONE YET?
    525						BGT	40$		;IF GT NO
    526						MOV	A.PCB(R5),R2	;PICK UP PCB ADDRESS FROM ATT DESCRIPTOR
    527						BIT	#PS.COM,P.STAT(R2) ;COMMON PARTITION?
    528						BEQ	90$		;IF EQ NO, TASK PARTITION IS ILLEGAL
    529						MOV	(R0),R5		;PICK UP SAVED RECEIVER TASK ADDRESS
    530						MOV	R0,-(SP)	;SAVE ADDRESS OF SEND PACKET
    531						CALL	$CRATT		;ATTACH RECEIVER TASK TO REGION
    532						MOV	(SP)+,R0	;RETRIEVE ADDRESS OF PACKET
    533						BCS	80$		;IF CS ALLOCATION FAILURE
    534						MOV	R1,10(R0)	;SET REGION ID IN PACKET
    535						MOV	R0,R1		;COPY POINTER TO PACKET
    536						TST	(R0)+		;POINT TO TCB ADDRESS
    537						TST	(R0)+		;EFN SPECIFIED?
    538						BEQ	50$		;IF EQ NO
    539						BIC	(R0)+,@(R0)+	;CLEAR SPECIFIED EVENT FLAG NOW
    540					50$:	MOV	R5,R0		;POINT TO RECEIVE BY REFERENCE LISTHEAD
    541						ADD	#T.RRFL,R0	;
    542
    543
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-9


    544						.IF DF	A$$TRP
    545
    546						CALL	$QINSF		;INSERT IN RECEIVE QUEUE
    547						MOV	#H.RRVA,R4	;SET OFFSET TO RECEIVE BY REF AST BLOCK
    548						CALL	$DASTT		;DECLARE RECEIVE BY REFERENCE AST
    549						CALLR	$DRDSE		;DECLARE A SIGNIFICANT EVENT
    550
    551						.IFF
    552
    553						CALLR	$QINSF		;INSERT IN RECEIVE QUEUE AND EXIT
    554
    555						.ENDC
    556
    557
    558					60$:	DRSTS	D.RS2		;ATTEMPT TO SEND TO AN ACP TASK
    559					70$:	DRSTS	D.RS16		;PRIVILEGE VIOLATION
    560					80$:	CALL	$DEPKT		;DEALLOCATE SEND PACKET
    561						DRSTS	D.RS1		;ALLOCATION FAILURE
    562					90$:	CALL	$DEPKT		;DEALLOCATE SEND PACKET
    563						DRSTS	D.RS86		;INVALID REGION ID (NOT COMMON BLOCK)
    564
    565					;+
    566					; **-$DRRRF-RECEIVE BY REFERENCE
    567					;
    568					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO DEQUEUE THE NEXT RECEIVE BY
    569					; REFERENCE PACKET IN THE RECEIVE QUEUE, OPTIONALLY EXITING IF THERE IS
    570					; NOT ONE THERE.
    571					;
    572					; DPB FORMAT:
    573					;
    574					;	WD. 00 -- DIC(81.),DPB SIZE(2.)
    575					;	WD. 01 -- ADDRESS OF WINDOW DEFINITION BLOCK
    576					;
    577					; INPUTS:
    578					;
    579					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    580					;	R3=ADDRESS OF THE WINDOW DEFINITION BLOCK.
    581					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    582					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    583					;
    584					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
    585					;		W.NSTS=CONTROL INFORMATION.
    586					;			WS.MAP=1 IF RECEIVED REFERENCE IS TO BE MAPPED.
    587					;			WS.RCX=1 IF TASK EXIT DESIRED IF NO PACKET FOUND.
    588					;		W.NSRB=OPTIONAL ADDRESS OF 10 WORD BUFFER FOR ADDITIONAL INFO.
    589					;
    590					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    591					;
    592					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    593					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    594					;	C=1 IF DIRECTIVE IS REJECTED.
    595					;		DIRECTIVE STATUS OF 'D.RS8' IS RETURNED IF THERE IS NO
    596					;			RECEIVE BY REFERENCE ENTRY IN THE QUEUE.
    597					;		DIRECTIVE STATUS OF 'D.RS98' IS RETURNED IF THE ADDRESS
    598					;			CHECK OF THE RECEIVE BUFFER FAILS.
    599					;
    600					;	OUTPUT FIELDS IN THE WINDOW DEFINITION BLOCK ARE:
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-10


    601					;		W.NRID=ASSIGNED REGION ID OF THE REFERENCED REGION.
    602					;		W.NOFF=OFFSET WORD SPECIFIED BY SENDER TASK.
    603					;		W.NLEN=LENGTH WORD SPECIFIED BY SENDER TASK.
    604					;		W.NSTS=STATUS WORD SPECIFIED BY SENDER TASK.
    605					;			WS.RED=1 IF ATTACHED WITH READ ACCESS.
    606					;			WS.WRT=1 IF ATTACHED WITH WRITE ACCESS.
    607					;			WS.EXT=1 IF ATTACHED WITH EXTEND ACCESS.
    608					;			WS.DEL=1 IF ATTACHED WITH DELETE ACCESS.
    609					;			WS.RRF=1 IF RECEIVE WAS SUCCESSFUL.
    610					;-
    611
    612					$DRRRF::MOV	KISAR6,-(SP)	;SAVE APR6 BIAS
    613						MOV	R3,-(SP)	;SAVE WINDOW DEFINITION BLOCK POINTER
    614						MOV	T.RRFL(R5),R2	;PICK UP FIRST RECEIVE BY REF PACKET
    615						BEQ	60$		;IF EQ THERE IS NONE
    616						CLR	-(SP)		;INIT EFN ADDRESS
    617						CLR	-(SP)		;INIT EFN MASK
    618						TST	(R2)+		;POINT TO RECEIVER TCB ADDRESS IN PACKET
    619						MOV	(R2)+,R0	;PICK UP TCB ADDRESS
    620						BEQ	20$		;IF EQ NONE SPECIFIED
    621						MOV	(R2),(SP)	;SET REAL EFN MASK			;**-2
    622						MOV	2(R2),2(SP)	;SET REAL EFN ADDRESS
    623					20$:	MOV	R0,-(SP)	;SAVE TCB ADDRESS			; TM086
    624						CMP	(R2)+,(R2)+	;SKIP TO REGION ID			; TM086
    625						ADD	#W.NRID,R3	;POINT TO REGION ID WORD IN DEF BLOCK	;**-2
    626						MOV	(R2)+,(R3)+	;STORE REGION ID
    627						MOV	(R2)+,(R3)+	;STORE OFFSET
    628						MOV	(R2)+,(R3)+	;STORE LENGTH
    629						BIS	(R2)+,(R3)+	;STORE ACCESS
    630						MOV	(R3),R3		;PICK UP VIRTUAL ADDR OF EXTENDED INFO BUFFER
    631						BEQ	40$		;IF EQ THERE ONE WAS NOT SPECIFIED
    632						MOV	#10.*2,R1	;SET SIZE TO ADDRESS CHECK
    633						MOV	R2,-(SP)	;SAVE R2
    634						CALL	$ACHKP		;ADDRESS CHECK THE BUFFER
    635						MOV	(SP)+,R2	;RESTORE R2
    636						MOV	-14(R2),(R3)+	;STORE THE TASK NAME IN THE BUFFER
    637						MOV	-12(R2),(R3)+	;
    638						MOV	-16(R2),R0	;PICK UP SENDER TCB ADDRESS
    639						BEQ	25$		;IF EQ THERE IS NONE
    640						MOV	T.NAM+2(R0),-(R3) ;SET REAL TASK NAME
    641						MOV	T.NAM(R0),-(R3)	;
    642						CMP	(R3)+,(R3)+	;POINT PAST TASK NAME
    643					25$:	MOV	#8.,R0		;SET LOOP COUNT FOR REST OF INFO
    644					30$:	MOV	(R2)+,(R3)+	;MOVE REST OF EXTRA INFO
    645						DEC	R0		;DONE YET?
    646						BGT	30$		;IF GT NO
    647					40$:	MOV	R5,R3		;SAVE RECEIVER TASK TCB ADDRESS		; TM086
    648						MOV	(SP)+,R5	;RETRIEVE SENDER TASK TCB ADDRESS	; TM086
    649						MOV	(SP)+,R0	;RETRIEVE EVENT FLAG MASK		; TM086
    650						MOV	(SP)+,R1	;RETRIEVE EVENT FLAG WORD ADDRESS	; TM086
    651						BEQ	50$		;IF EQ NO FLAG TO SET			; TM086
    652						CALL	$SETM		;SET THE EVENT FLAG			; TM086
    653					50$:	MOV	R3,R5		;RESTORE TCB ADDRESS			; TM086
    654						MOV	R5,R0		;POINT TO RECEIVE BY REFERENCE LISTHEAD	; TM086
    655						ADD	#T.RRFL,R0	;					;**-2
    656						CALL	$QRMVF		;REMOVE PROCESSED PACKET
    657						MOV	R1,R0		;COPY POINTER TO PACKET
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-11


    658						CALL	$DEPKT		;DEALLOCATE PACKET
    659						MOV	(SP)+,R3	;RESTORE WINDOW DEFINITION POINTER
    660						MOV	(SP)+,KISAR6	;RESTORE KERNAL APR6 BIAS
    661						BIS	#WS.RRF,W.NSTS(R3) ;INDICATE SUCCESSFUL RECEIVE BY REFERENCE
    662						BIT	#WS.MAP,W.NSTS(R3) ;WINDOW MAP DESIRED?
    663						BEQ	80$		;IF EQ NO
    664						CALLR	$DRMAP		;MAP WINDOW
    665					60$:	BIT	#WS.RCX,W.NSTS(R3) ;DOES TASK WISH TO EXIT?
    666						BEQ	70$		;IF EQ NO
    667						CMP	(SP)+,(SP)+	;CLEAN STACK
    668						JMP	$DREXT		;PERFORM TASK EXIT
    669					70$:	DRSTS	D.RS8		;NO REFERENCES IN QUEUE
    670					80$:	RETURN			;
    671
    672						.ENDC
    673
    674
    675					;+
    676					; **-$DRGMX-GET MAPPING CONTEXT
    677					;
    678					; THIS DIRECTIVE INSTRUCTS THE SYSTEM TO RETURN THE MAPPING CONTEXT OF
    679					; THE TASK, I.E. TO FILL IN UP TO N WINDOW DEFINITION BLOCKS,
    680					; WHERE N IS THE TOTAL NUMBER OF WINDOW BLOCKS IN THE TASK HEADER.
    681					; NO INFORMATION IS RETURNED ON UNUSED WINDOW BLOCKS.
    682					;
    683					; DPB FORMAT:
    684					;
    685					;	WD. 00 -- DIC(113.),DPB SIZE(2.)
    686					;	WD. 01 -- ADDRESS OF THE N WINDOW DEFINITION BLOCKS
    687					;
    688					; INPUTS:
    689					;
    690					;	R2=ADDRESS OF THE TASK STATUS WORD OF THE CURRENT TASK.
    691					;	(R3)=ADDRESS OF N WINDOW DEFINITION BLOCKS
    692					;	R4=ADDRESS OF THE HEADER OF THE CURRENT TASK.
    693					;	R5=ADDRESS OF THE TCB OF THE CURRENT TASK.
    694					;
    695					;	INPUT FIELDS IN THE WINDOW DEFINITION BLOCKS ARE:
    696					;		NONE.
    697					;
    698					; OUTPUTS: (DIRECTIVE STATUS AND PS RETURNED TO TASK)
    699					;
    700					;	C=0 IF DIRECTIVE IS SUCCESSFULLY COMPLETED.
    701					;		DIRECTIVE STATUS OF +1 IS RETURNED.
    702					;	C=1 IF DIRECTIVE IS REJECTED.
    703					;		DIRECTIVE STATUS OF 'D.RS98' IS RETURNED IF THE ADDRESS
    704					;			CHECK OF THE N WINDOW BLOCKS PLUS TERMINATOR WORD
    705					;			FAILS.
    706					;
    707					;	OUTPUT FIELDS IN EACH WINDOW DEFINITION BLOCK ARE:
    708					;		W.NID=ADDRESS WINDOW ID OF NEXT ESTABLISHED ADDRESS WINDOW.
    709					;		W.NAPR=BASE APR OF THE WINDOW.
    710					;		W.NBAS=VIRTUAL BASE ADDRESS OF THE WINDOW.
    711					;		W.NSIZ=SIZE OF THE ADDRESS WINDOW.
    712					;		W.NRID=REGION ID IF MAPPED OR UNMODIFIED.
    713					;		W.NOFF=OFFSET IN REGION IF MAPPED OR UNMODIFIED.
    714					;		W.NLEN=LENGTH OF MAP IF MAPPED OR UNMODIFIED.
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-12


    715					;		W.NSTS=NECESSARY BITS TO RESTORE MAPPING OR 0 IF NOT MAPPED.
    716					;			WS.MAP=1 IF WINDOW IS MAPPED.
    717					;			WS.WRT=1 IF WINDOW IS MAPPED WITH WRITE ACCESS.
    718					;-
    719
    720
    721						.IF DF	P$$GMX
    722
    723					$DRGMX::MOV	H.WND(R4),R4	;POINT TO NUMBER OF WINDOW BLOCKS IN HEADER
    724						MOV	(R4)+,R1	;PICK UP NUMBER OF WINDOW BLOCKS
    725						MOV	R1,-(SP)	;SAVE NUMBER OF WINDOW BLOCKS
    726						ASL	R1		;CONVERT TO BYTES TO ADDRESS CHECK
    727						ASL	R1		;
    728						ASL	R1		;
    729						INC	R1		;(INCLUDE WORD FOR TERMINATOR)
    730						ASL	R1		;
    731						MOV	(R3),R3		;PICK UP VIRTUAL ADDRESS OF WINDOW BLOCKS
    732						CALL	$ACHKP		;ADDRESS CHECK AND MAP TO WINDOW BLOCKS
    733						CLR	-(SP)		;INITIALIZE WINDOW ID COUNTER
    734					10$:	TST	W.BSIZ(R4)	;IS NEXT BLOCK AN ESTABLISHED WINDOW?
    735						BNE	11$		;IF NE YES				; TM076
    736						ADD	#W.BLGH,R4	;POINT TO NEXT WINDOW BLOCK		; TM076
    737						BR	40$		;BRANCH TO DETERMINE IF MORE BLOCKS	; TM076
    738					11$:	MOVB	(SP),(R3)+	;SET WINDOW ID (W.NID)			; TM076
    739						MOV	(R4)+,-(SP)	;SAVE PCB ADDRESS (W.BPCB)		;**-2
    740						MOV	(R4)+,R1	;PICK UP LOW VIRTUAL ADDRESS (W.BLVR)
    741						MOVB	-1(R4),(R3)	;GET ITS HIGH BYTE (W.BLVR+1)(W.NAPR)
    742						ASLB	(R3)		;SHIFT TO FORM APR NUMBER (W.NAPR)
    743						ROLB	(R3)		;
    744						ROLB	(R3)		;
    745						ROLB	(R3)+		;
    746						MOV	R1,(R3)+	;SET VIRTUAL BASE ADDRESS (W.NBAS)
    747						MOV	(R4)+,R2	;PICK UP HIGH VIRTUAL ADDRESS (W.BHVR)
    748						MOV	(R4)+,R0	;PICK ATT DESCRIPTOR ADDRESS (W.BATT)
    749						MOV	(R4)+,(R3)+	;SET WINDOW SIZE (W.BSIZ)(W.NSIZ)
    750						TST	(SP)+		;IS THIS WINDOW MAPPED?
    751						BEQ	20$		;IF EQ NO
    752						MOV	R0,(R3)+	;SET REGION ID (W.NRID)
    753						MOV	T.ATT(R5),-(SP)	;PUSH ADDRESS OF FIRST ATTACHMENT DESCRIPTOR
    754						SUB	#A.TCBL,(SP)	;POINT TO FIRST WORD
    755						CMP	R0,(SP)+	;TASK REGION?
    756						BNE	15$		;IF NE NO
    757						CLR	-2(R3)		;SET IT TO DEFAULT TO TASK REGION (W.NRID)
    758					15$:	MOV	(R4)+,(R3)+	;SET OFFSET (W.BOFF)(W.NOFF)
    759						SUB	R1,R2		;CALCULATE LENGTH
    760						ADD	#1,R2		;
    761						ROL	R2		;CONVERT TO 32W BLOCKS
    762						ROL	R2		;
    763						ROLB	R2		;
    764						SWAB	R2		;
    765						MOV	R2,(R3)+	;SET THE LENGTH (W.NLEN)
    766						TST	(R4)+		;ADVANCE TO LAST PDR IMAGE (W.BFPD)
    767						MOV	(R4)+,(R3)	;PICK UP LAST PDR IMAGE (W.BLPD)(W.NSTS)
    768						BIC	#^C4,(R3)	;CLEAR ALL BUT WRITE ACCESS BIT (W.NSTS)
    769						ASR	(R3)		;SHIFT INTO PLACE (W.NSTS)
    770						BIS	#WS.MAP,(R3)+	;INDICATE WINDOW IS MAPPED (W.NSTS)
    771						BR	30$		;
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-13


    772					20$:	ADD	#W.NSTS-W.NRID,R3 ;POINT TO NEXT WINDOW ID BLOCK
    773						ADD	#W.BLGH-W.BOFF,R4 ;POINT TO NEXT WINDOW BLOCK		; TM076
    774						CLR	(R3)+		;CLEAR STATUS WORD
    775					30$:	TST	(R3)+		;SKIP OVER SEND/RECEIVE BUFFER ADDRESS (W.NSRB)
    776					40$:	INC	(SP)		;BUMP WINDOW ID
    777						CMP	(SP),2(SP)	;DONE YET?
    778						BLO	10$		;IF LO NO
    779						MOV	(SP)+,(R3)	;STORE NUMBER OF HEADER SLOTS AS TERMINATOR
    780						NEG	(R3)		;AND NEGATE
    781						TST	(SP)+		;CLEAN STACK
    782						RETURN			;
    783
    784						.ENDC
    785
    786
    787						.ENDC
    788
    789
    790		000001 				.END
DRMAP	MACRO M1110  22-AUG-79 07:00  PAGE 4-14
SYMBOL TABLE

A$$CHK= 000000   	I$$RDN= 000000   	L$$ASG= 000000   	N$$LDV= 000001   	R$$11M= 000000
A$$CPS= 000000   	K$$CNT= 177546   	L$$DRV= 000000   	P$$RTY= 000000   	R$$11S= 000000
A$$TRP= 000000   	K$$CSR= 177546   	M$$CRB= 000124   	P$$TPT= 000000   	S$$YSZ= 001740
C$$ORE= 002000   	K$$IEN= 000115   	M$$MGE= 000000   	R$$DER= 000000   	V$$CTR= 001200
G$$TPP= 000000   	K$$LDC= 000001   	M$$NET= 000000   	R$$EXV= 000000   	V$$RSN= 000031
G$$TTK= 000000   	K$$TPS= 000074   	M$$NT2= 000000   	R$$SND= 000000   	X$$DBT= 000000
H$$RTZ= 000074

. ABS.	000000	   000
      	000000	   001
ERRORS DETECTED:  0

VIRTUAL MEMORY USED:  1140 WORDS  ( 5 PAGES)
DYNAMIC MEMORY:  2980 WORDS  ( 11 PAGES)
ELAPSED TIME:  00:00:23
[11,24]DRMAP,SY0:[11,34]DRMAP/-SP=[1,1]EXEMC/ML,[11,10]RSXMC/PA:1,DRMAP