Google
 

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


      1						.TITLE	LOADR
      2						.IDENT	/08/
      3
      4					;
      5					; COPYRIGHT (C) 1974, 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 08
     12					;
     13					; D. N. CUTLER 28-OCT-73
     14					;
     15					; PREVIOUSLY MODIFIED BY:
     16					;
     17					;	D. N. CUTLER
     18					;	T. J. MILLER
     19					;
     20					; MODIFIED BY:
     21					;
     22					;	T. J. MILLER 12-MAY-77
     23					;
     24					;		TM083 -- CORRECT BUG WHICH CAN CRASH MAPPED SYSTEMS
     25					;			WITHOUT PLAS WHEN A READ OPERATION FAILS.
     26					;
     27					;	T. J. MILLER 19-MAY-77
     28					;
     29					;		TM084 -- ADDITIONALLY PASS UCB ADDRESS TO TKTN ON
     30					;			CHECKPOINT WRITE FAILURE.
     31					;
     32					;	T. J. MILLER 29-SEP-77
     33					;
     34					;		TM112 -- CLEAR RECEIVE BY REFERENCE CONTROL BLOCK ADDRESS ON
     35					;			LOAD FAILURES.
     36					;
     37					; TASK TO LOAD AND CHECKPOINT ALL NONRESIDENT TASKS
     38					;
     39					; MACRO LIBRARY CALLS
     40					;
     41
     42
     43						.IF NDF	R$$11S
     44
     45						.MCALL	ABODF$,HDRDF$,HWDDF$,PCBDF$,TCBDF$
     46						.MCALL	DIR$,WSIG$S
     47						ABODF$			;DEFINE TASK ABORT CODES
     48						HDRDF$			;DEFINE TASK HEADER OFFSETS
     49						HWDDF$			;DEFINE HARDWARE REGISTERS
     50						PCBDF$			;DEFINE PARTITION CONTROL BLOCK OFFSETS
     51						TCBDF$			;DEFINE TASK CONTROL BLOCK OFFSETS
     52
     53					;
     54					; LOCAL DATA
     55					;
     56					; READ/WRITE I/O DPB
     57					;
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-1


     58
     59					LDRDP:	.BYTE	3,12.		;DIC, DPB SIZE
     60					LDRFC:	.BLKW	1		;FUNCTION CODE
     61						.BYTE	1		;LUN 1
     62						.BLKB	1		;UNUSED BYTE
     63						.BYTE	1		;EFN 1
     64						.BLKB	1		;UNUSED BYTE
     65						.WORD	IOSB		;I/O STATUS DOUBLEWORD ADDRESS
     66						.WORD	0		;NO AST SERVICE ROUTINE
     67					LDRBF:	.BLKW	1		;BUFFER ADDRESS
     68					LDRLN:	.BLKW	1		;BUFFER LENGTH
     69					LDRTK:	.BLKW	1		;POINTER TO REQUEST TASK TCB
     70					LDRBK:	.BLKW	2		;LBN OF I/O TRANSFER
     71					IOSB:	.BLKW	2		;I/O STATUS DOUBLEWORD
     72
     73					;+
     74					; **-$LOADR-NONRESIDENT TASK LOADER
     75					;
     76					; THIS TASK IS CALLED UPON TO:
     77					;
     78					;	1-READ A NONRESIDENT TASK INTO MEMORY AND INITIALIZE IT FOR EXECUTION.
     79					;	2-READ A PREVIOUSLY CHECKPOINTED TASK BACK INTO MEMORY AND RESTART ITS
     80					;		EXECUTION.
     81					;	3-WRITE A CHECKPOINT IMAGE OF A RUNNING TASK AND FREE ITS PARTITION.
     82					;
     83					; INPUT IS RECEIVED VIA THE LOADER QUEUE WHICH CONTAINS A PRIORITY ORDERED
     84					; LIST OF TASK TCB'S. THE FIRST (HIGHEST PRIORITY) TCB IS REMOVED FROM THE
     85					; QUEUE, PROCESSED, AND THEN THE LOADER SELECTS THE NEXT TCB FROM THE LIST.
     86					;-
     87
     88					$LOADR::CALL	$SWSTK,40$	;SWITCH TO SYSTEM STATE
     89						CLR	LDRTK		;INITIALLY CLEAR CURRENT TCB POINTER
     90						MOV	$TKTCB,R0	;PICK UP LOADER TCB ADDRESS
     91						ADD	#T.RCVL,R0	;POINT TO RECEIVE LISTHEAD
     92						CALL	$QRMVF		;REMOVE ENTRY FROM QUEUE
     93						BCC	10$		;IF CC GOT ONE
     94						CALLR	$STPCT		;STOP FOR NOW
     95					10$:	MOV	R1,LDRTK	;SAVE TCB ADDRESS
     96
     97
     98						.IF DF	C$$CKP&D$$ISK&M$$MGE
     99
    100						BIT	#TS.OUT,T.STAT(R1) ;CHECKPOINT WRITE REQUEST?
    101						BNE	30$		;IF NE NO
    102						MOV	T.PCB(R1),R2	;GET ADDRESS OF TASK PCB
    103						MOV	P.HDR(R2),R3	;GET ADDRESS OF TASK HEADER
    104						MOV	P.REL(R2),KISAR6 ;SETUP TO ACCESS TASK PARTITION
    105
    106
    107						.IF DF	P$$LAS
    108
    109						ADD	T.OFF(R1),KISAR6 ;ADD IN OFFSET TO TASK HEADER
    110
    111						.ENDC
    112
    113
    114						MOV	#140000,R2	;SET ADDRESS BIAS OF TASK PARTITION
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-2


    115						MOV	H.WND(R3),R4	;POINT TO NUMBER OF WINDOW BLOCKS
    116						TST	W.BLVR+2(R4)	;TASK MAPPED TO EXEC?
    117						BNE	15$		;IF NE YES
    118						MOV	H.DSW(R2),H.DSW(R3) ;COPY DSW TO REAL TASK HEADER
    119					15$:	MOV	H.HDLN(R3),R4	;GET LENGTH OF HEADER IN BYTES
    120						ASR	R4		;CONVERT TO WORD COUNT
    121					20$:	MOV	(R3)+,(R2)+	;MOVE HEADER INTO TASK PARTITION
    122						DEC	R4		;ANY MORE WORDS TO MOVE?
    123						BGT	20$		;IF GT YES
    124
    125						.ENDC
    126
    127
    128					30$:	RETURN			;RETURN TO TASK STATE
    129					40$:	MOV	LDRTK,R5	;RETRIEVE TCB ADDRESS
    130						BEQ	$LOADR		;IF EQ THERE WAS NONE, TRY AGAIN
    131						MOV	T.PCB(R5),R4	;GET ADDRESS OF TASK PCB
    132						MOV	R5,R3		;CALCULATE ADDRESS OF FIRST TASK STATUS WORD
    133						ADD	#T.STAT,R3	;
    134						MOV	#IO.RLB,LDRFC	;ASSUME READ FUNCTION
    135
    136
    137						.IF DF	C$$CKP&D$$ISK
    138
    139						BIT	#TS.OUT,(R3)	;CHECKPOINT WRITE REQUEST?
    140						BNE	50$		;IF NE NO
    141						MOV	#IO.WLB,LDRFC	;SET WRITE FUNCTION
    142
    143						.ENDC
    144
    145
    146					50$:	MOV	#LDRBF,R0	;POINT TO DPB BUFFER ADDRESS
    147
    148
    149						.IF DF	M$$MGE
    150
    151						MOV	#140000,(R0)+	;SET APR6 LOAD ADDRESS BIAS
    152
    153						.IFF
    154
    155						MOV	P.REL(R4),(R0)+	;SET PARTITION LOAD ADDRESS
    156						MOV	P.SIZE(R4),(R0)	;SET SIZE OF TRANSFER IN BYTES
    157
    158						.IFT
    159
    160
    161						.IF DF	P$$LAS
    162
    163						MOV	P.SIZE(R4),-(SP) ;PUSH SIZE OF TRANSFER
    164						CLR	R2		;INITIALIZE MULTI-TRANSFER COUNT
    165						MOV	#6,R1		;SET COUNT FOR SIX SHIFTS
    166						BIT	#TS.CKP,(R3)	;CHECKPOINT REQUEST?
    167						BNE	55$		;IF NE YES
    168						SUB	T.OFF(R5),(SP)	;ELSE REDUCE TASK SIZE BY OFFSET
    169					55$:	ASL	(SP)		;CONVERT TO DOUBLE PRECISION BYTE COUNT
    170						ROL	R2		;
    171						DEC	R1		;DONE YET?
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-3


    172						BGT	55$		;IF GT NO
    173
    174						.IFF
    175
    176						MOV	P.SIZE(R4),(R0)	;PICK UP TRANSFER SIZE
    177						SWAB	(R0)		;CONVERT TO BYTES
    178						RORB	(R0)		;
    179						ROR	(R0)		;
    180						ROR	(R0)		;
    181
    182						.ENDC
    183
    184
    185						.ENDC
    186
    187
    188						CMP	(R0)+,(R0)+	;POINT TO LBN
    189						MOVB	T.LBN(R5),(R0)+	;INSERT HIGH PART OF LBN
    190						CLRB	(R0)+		;
    191						MOV	T.LBN+1(R5),(R0) ;INSERT LOW PART OF LBN
    192						MOV	T.LDV(R5),-(SP)	;TENTATIVELY PUSH LOAD DEVICE UCB
    193
    194
    195						.IF DF	C$$CKP&D$$ISK
    196
    197						BIT	#TS.CKP,(R3)	;CHECKPOINT REQUEST?
    198						BEQ	60$		;IF EQ NO
    199
    200
    201						.IF DF	D$$YNC
    202
    203						BIT	#T2.CAF,T.ST2(R5) ;DYNAMIC SPACE ALLOCATION FAILURE?
    204						BNE	56$		;IF NE YES
    205						MOV	T.CPCB(R5),R1	;POINT TO CHECKPOINT PCB
    206						MOV	P.REL(R1),(R0)	;SET RELATIVE BLOCK NUMBER IN FILE
    207						MOV	P.MAIN(R1),R1	;POINT TO CHECKPOINT FILE DESCR PCB
    208						TST	(R1)+		;POINT TO UCB ADDRESS
    209						MOV	(R1)+,(SP)	;SET UCB ADDRESS
    210						MOV	(R1)+,-(R0)	;SET HIGH PART OF LBN
    211						ADD	(R1),2(R0)	;ADD IN LOW PART OF LBN
    212						ADC	(R0)		;ADD CARRY
    213						BR	60$		;
    214					56$:				;REF LABEL
    215
    216						.ENDC
    217
    218
    219						MOV	T.MXSZ(R5),R1	;PICK UP PARTITION SIZE
    220						ADD	#7,R1		;ROUND UP TO NEXT 512. BLOCK
    221						ROR	R1		;CONVERT TO 512. WORD BLOCKS
    222						ASR	R1		;
    223						ASR	R1		;
    224						SUB	R1,(R0)		;CALCULATE STARTING LBN OF CKP AREA
    225						SBC	-(R0)		;
    226
    227						.ENDC
    228
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-4


    229
    230					60$:	MOV	$HEADR,R1	;GET ADDRESS OF LOADER HEADER
    231						MOV	(SP)+,H.LUN(R1)	;ASSIGN LUN 1 TO LOAD DEVICE
    232
    233
    234						.IF DF	M$$MGE
    235
    236						MTPS	#PR7		;;;LOCK OUT INTERRUPTS
    237
    238
    239						.IF DF	P$$LAS
    240
    241						MOV	P.REL(R4),R1	;;;PICK UP RELOCATION BIAS OF PARTITION
    242						BIT	#TS.CKP,(R3)	;;;CHECKPOINT REQUEST?
    243						BNE	65$		;;;IF NE YES
    244						ADD	T.OFF(R5),R1	;;;ELSE ADD IN OFFSET TO TASK IMAGE
    245					65$:	MOV	#177000,LDRLN	;;;SET TENTATIVE LENGTH OF TRANSFER
    246						SUB	#177000,(SP)	;;;REDUCE ACTUAL COUNT TO TRANSFER
    247						SBC	R2		;;;
    248						BGE	70$		;;;IF GE FULL TRANSFER
    249						ADD	(SP),LDRLN	;;;ELSE REDUCE SIZE OF TRANSFER
    250						BEQ	80$		;;;IF EQ LAST TRANSFER DID IT
    251					70$:	MOV	R1,UISAR6	;;;SET APR BIAS FOR TRANSFER
    252
    253						.IFF
    254
    255					70$:	MOV	P.REL(R4),UISAR6 ;;;SET RELOCATION BIAS FOR I/O TRANSFER
    256
    257						.ENDC
    258
    259
    260						.IFF
    261
    262					70$:				;;;REFERENCE LABEL
    263
    264						.IFTF
    265
    266						DIR$	#LDRDP		;;;REQUEST I/O TRANSFER
    267
    268
    269						.IF DF	P$$LAS&M$$MGE
    270
    271						BCS	75$		;;;IF CS LOAD FAILURE (NO POOL)
    272						ADD	#1770,R1	;;;UPDATE APR BIAS
    273						ADD	#177,LDRBK+2	;;;UPDATE BLOCK NUMBER
    274						ADC	LDRBK		;;;
    275						TST	R2		;;;WAS IT THE LAST TRANSFER?
    276						BLT	80$		;;;IF LT YES
    277						TSTB	IOSB		;;;WAS TRANSFER SUCCESSFUL?
    278						BPL	65$		;;;IF PL YES
    279						BR	80$		;;;BRANCH ON ERROR
    280
    281						.IFF
    282
    283						BCC	80$		;;;IF CC REQUEST WAS QUEUED
    284
    285						.IFTF
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-5


    286
    287					75$:	WSIG$S			;;;WAIT FOR SIGNIFICANT EVENT
    288						BR	70$		;;;RETRY I/O
    289					80$:				;;;REF LABEL
    290
    291						.IFT
    292
    293						TST	(SP)+		;;;POP LOW-ORDER TRANSFER COUNT
    294
    295						.ENDC
    296
    297
    298						.IFT
    299
    300						CLRB	PS		;;;ALLOW INTERRUPTS
    301
    302						.ENDC
    303
    304
    305					84$:	CALL	$SWSTK,$LOADR	;SWITCH TO SYSTEM STATE
    306
    307
    308						.IF DF	C$$CKP&D$$ISK
    309
    310						BIT	#TS.OUT,(R3)	;TASK IN MEMORY?
    311						BNE	110$		;IF NE NO
    312						TSTB	IOSB		;SUCCESSFUL WRITE?
    313						BMI	90$		;IF MI NO
    314						BIS	#TS.OUT,(R3)	;SET TASK OUT OF MEMORY
    315
    316
    317						.IF DF	M$$MGE
    318
    319						MOV	P.HDR(R4),R0	;GET ADDRESS OF TASK HEADER
    320						MOV	H.HDLN(R0),R1	;GET LENGTH OF HEADER IN BYTES
    321						CALL	$DEACB		;DEALLOCATE HEADER
    322
    323						.ENDC
    324
    325
    326						.IF DF	E$$XPR
    327
    328						BIT	#PS.SYS,P.STAT(R4) ;SYSTEM CONTROLLED PARTITION?
    329						BEQ	85$		;IF EQ NO
    330						MOV	P.SWSZ(R4),P.SIZE(R4) ;SET SIZE FROM SWAP SIZE
    331					85$:				;REF LABEL
    332
    333						.ENDC
    334
    335
    336						MOV	P.MAIN(R4),R0	;CALCULATE ADDRESS OF WAIT QUEUE LISTHEAD
    337						ADD	#P.WAIT,R0	;
    338						MOV	R5,R1		;SET TCB ADDRESS
    339						CALL	$QINSP		;INSERT TASK BACK IN PARTITION WAIT QUEUE
    340						MOV	R5,R0		;SET TCB ADDRESS
    341						CALLR	$RLPAR		;RELEASE PARTITION
    342					90$:	MOV	#T.NCWF,R0	;SET CHECKPOINT WRITE FAILURE
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-6


    343					 									; TM084
    344					 									; TM084
    345						.IF DF	D$$YNC							; TM084
    346					 									; TM084
    347						MOV	$HEADR,R4	;PICK UP PTR TO OWN HEADER		; TM084
    348						MOV	H.LUN(R4),R4	;PICK UP UCB ADDRESS OF WRITE ERROR	; TM084
    349					 									; TM084
    350						.ENDC								; TM084
    351					 									; TM084
    352					 									; TM084
    353						CALL	$DVMSG		;OUTPUT MESSAGE
    354						BIC	#TS.CKP,T.STAT(R5) ;CLEAR CHECKPOINT FLAG
    355
    356
    357						.IF DF	D$$YNC
    358
    359					95$:	BIT	#T2.CAF,T.ST2(R5) ;SPACE ALLOCATED IN CHECKPOINT FILE?
    360						BNE	97$		;IF NE NO
    361						SAVNR			;SAVE R4 AND R5
    362						MOV	T.CPCB(R5),R0	;PICK UP ADDRESS OF CHECKPOINT PCB
    363						MOV	P.MAIN(R0),R2	;POINT TO MAIN PCB
    364						MOV	R2,R4		;COPY POINTER TO MAIN PCB
    365						MOV	P.PRI(R2),R5	;SAVE UCB ADDRESS
    366					96$:	MOV	R2,R1		;COPY LAST SUB PCB ADDRESS
    367						MOV	P.SUB(R1),R2	;POINT TO NEXT SUB PCB
    368						CMP	R2,R0		;POINTING TO PCB TO UNLINK?
    369						BNE	96$		;IF NE NO
    370						MOV	P.SUB(R0),P.SUB(R1) ;UNLINK CHECKPOINT PCB
    371						MOV	#P.SIZE+2,R1	;SET SIZE TO DEALLOCATE
    372						CALL	$DEACB		;DEALLOCATE CHECKPOINT PCB
    373						TST	P.REL(R4)	;CHECKPOINT FILE STILL IN USE?
    374						BEQ	97$		;IF EQ YES
    375						TST	P.SUB(R4)	;CHECKPOINT FILE EMPTY?
    376						BNE	97$		;IF NE NO
    377						MOV	#20,R0		;SET TKTN CODE
    378						CALL	$DVMSG		;QUEUE MESSAGE TO TKTN
    379					97$:				;REF LABEL
    380
    381						.ENDC
    382
    383
    384						RETURN			;
    385
    386						.ENDC
    387
    388
    389					110$:				;REF LABEL
    390
    391
    392						.IF DF	M$$MGE
    393
    394						MOV	P.REL(R4),KISAR6 ;MAP TO TASK PARTITION
    395
    396
    397						.IF DF	P$$LAS
    398
    399						ADD	T.OFF(R5),KISAR6 ;ADD IN OFFSET TO TASK HEADER
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-7


    400
    401						.ENDC
    402
    403
    404						MOV	140000+H.HDLN,R1 ;ASSUME SUCCESSFUL READ
    405						CMPB	#17,140000+H.IPS ;VALID TASK IMAGE?
    406						BNE	115$		;IF NE NO TREAT AS UNSUCCESSFUL READ
    407						TSTB	IOSB		;SUCCESSFUL READ?
    408						BPL	120$		;IF PL YES
    409					115$:	MOV	#H.NLUN+2+W.BLGH+2,R1 ;SET LENGTH OF MINIMUM HEADER
    410						CLR	140000+H.NLUN	;CLEAR NUMBER OF LUNS WORD
    411					120$:	MOV	R1,2(SP)	;SAVE LENGTH OF HEADER
    412						CALL	$ALOCB		;ALLOCATE A BLOCK FOR TASK HEADER
    413						BCC	130$		;IF CC BLOCK ALLOCATED
    414						MOV	@$HEADR,R0	;GET SAVED STACK POINTER
    415						MOV	#84$,4(R0)	;ALTER RETURN ADDRESS
    416						CALLR	$TKWSE		;WAITFOR SIGNIFICANT EVENT
    417					130$:	MOV	R0,P.HDR(R4)	;SAVE ADDRESS OF NEW HEADER
    418						MOV	2(SP),R1	;RETRIEVE LENGTH OF HEADER IN BYTES
    419						MOV	#140000,R2	;SET APR6 ADDRESS BIAS
    420						MOV	R1,H.HDLN(R2)	;SET LENGTH OF HEADER
    421						MOV	R0,R3		;CALCULATE HEADER GUARD WORD POINTER
    422						TST	-(R3)		;
    423						MOV	R3,H.GARD(R2)	;
    424						ADD	R1,H.GARD(R2)	;
    425						MOV	R3,H.WND(R2)	;CALCULATE NUMBER OF WINDOW BLOCKS PTR
    426						MOV	H.NLUN(R2),R3	;CALCULATE NUMBER OF LUN WORDS
    427						ASL	R3		;
    428						ASL	R3		;
    429						ADD	#H.NLUN+4,R3	;FINISH CALCULATION
    430						ADD	R3,H.WND(R2)	;
    431						ASR	R1		;CONVERT LENGTH TO WORDS
    432					140$:	MOV	(R2)+,(R0)+	;MOVE TASK HEADER TO CORE BLOCK
    433						DEC	R1		;ANY MORE WORDS TO MOVE?
    434						BGT	140$		;IF GT YES
    435						MOV	R5,R3		;RESET R3 TO ADDRESS OF FIRST TASK STATUS
    436						ADD	#T.STAT,R3	;WORD
    437
    438						.ENDC
    439
    440
    441						BIC	#TS.OUT,(R3)+	;CLEAR TASK OUT OF MEMORY
    442						MOV	P.HDR(R4),R0	;GET ADDRESS OF TASK HEADER
    443
    444
    445						.IF DF	S$$WPC
    446
    447						MOVB	#S$$WPR,H.SPRI(R0) ;INITIALIZE SWAPPING PRIORITY
    448
    449						.ENDC
    450
    451
    452						.IF DF	M$$MGE
    453
    454						MOV	H.WND(R0),R1	;POINT TO NUMBER OF WINDOW BLOCKS
    455						CALL	$MAPTK		;MAP FIRST TASK ADDRESS WINDOW
    456
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-8


    457						.ENDC
    458
    459
    460						CMPB	#17,H.IPS(R0)	;VALID TASK IMAGE?
    461						BNE	180$		;IF NE NO TREAT AS UNSUCCESSFUL READ
    462						TSTB	IOSB		;READ ERROR?
    463						BMI	180$		;IF MI YES
    464
    465
    466						.IF DF	C$$CKP&D$$ISK
    467
    468						BIT	#TS.CKP,-2(R3)	;CHECKPOINT READ?
    469						BNE	150$		;IF NE YES
    470
    471						.IFTF
    472
    473
    474						.IF DF	P$$LAS&M$$MGE
    475
    476						MOV	H.WND(R0),R0	;POINT TO NUMBER OF WINDOW BLOCKS
    477						MOV	R0,R3		;COPY POINTER TO NUMBER OF WINDOW BLOCKS
    478						MOV	#LDRBK,R1	;POINT TO SAVE AREA
    479						MOV	(R3)+,(R1)+	;SAVE NUMBER OF WINDOW BLOCKS
    480						MOV	R5,R0		;COPY TCB POINTER
    481						ADD	#T.ATT,R0	;POINT TO ATTACHMENT DESCRIPTOR LISTHEAD
    482						MOV	R0,-(SP)	;SAVE LISTHEAD POINTER
    483						MOV	(R0)+,(R1)+	;SAVE FIRST LISTHEAD WORD
    484						MOV	(R0),(R1)	;SAVE SECOND LISTHEAD WORD
    485						MOV	(SP)+,(R0)	;REINITIALIZE SECOND LISTHEAD WORD
    486					145$:	CLR	R1		;CLR NEXT ATTACHMENT DESCRIPTOR ADDRESS
    487						MOV	(R3),R2		;PICK UP NEXT PCB ADDRESS (W.BPCB)
    488						BEQ	148$		;IF EQ THERE IS NONE
    489						MOV	#AS.RED,R4	;SET FOR ATTACH WITH READ ACCESS
    490						BIT	#4,W.BLPD(R3)	;MAPPED WITH WRITE ACCESS?
    491						BEQ	146$		;IF EQ NO
    492						BIS	#AS.WRT,R4	;ADD WRITE ACCESS FOR ATTACH
    493					146$:	CALL	$CRATT		;ATTACH TO REGION
    494						BCC	148$		;IF CC SUCCESSFUL
    495						MOV	@$HEADR,R0	;RETRIEVE SAVED STACK POINTER
    496						MOV	R3,(R0)+	;SAVE WINDOW BLOCK POINTER AS R4
    497						MOV	R5,(R0)+	;SAVE TCB ADDRESS AS R5
    498						MOV	#147$,(R0)	;MODIFY RETURN ADDRESS
    499						CALLR	$TKWSE		;WAIT FOR SIGNIFICANT EVENT
    500					147$:	CALL	$SWSTK,$LOADR	;SWITCH TO SYSTEM STATE
    501						MOV	R4,R3		;RESTORE WINDOW BLOCK POINTER
    502						BR	145$		;REATTEMPT THE ATTACH
    503					148$:	MOV	R1,W.BATT(R3)	;SET ADDRESS OF ATTACHMENT DESCRIPTOR
    504						ADD	#W.BLGH,R3	;POINT TO NEXT WINDOW BLOCK
    505						DEC	LDRBK		;ANY MORE WINDOWS TO PROCESS?
    506						BGT	145$		;IF GT YES
    507						MOV	LDRBK+2,@T.ATT+2(R5) ;ADD ON OLD DESCRIPTORS
    508						BEQ	149$		;IF EQ IT WAS NULL
    509						MOV	LDRBK+4,T.ATT+2(R5) ;POINT TO LAST ORIGINAL DESCRIPTOR
    510					149$:	MOV	R5,R3		;RESTORE POINTER TO SECOND STATUS WORD
    511						ADD	#T.ST2,R3	;
    512
    513						.ENDC
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-9


    514
    515
    516						BIT	#T2.BFX,(R3)	;TASK BEING FIXED?
    517						BNE	170$		;IF NE YES
    518						MOV	R5,R0		;SET ADDRESS OF TASK TCB
    519						CALL	$BILDS		;BUILD A STACK FOR TASK JUST STARTING
    520
    521
    522						.IF DF	D$$YNC
    523
    524						BR	155$		;
    525
    526						.IFTF
    527
    528					150$:				;REF LABEL
    529
    530						.IFT
    531
    532						MOV	R3,-(SP)	;SAVE R3
    533						CALL	95$		;DEALLOCATE CHECKPOINT SPACE
    534						MOV	(SP)+,R3	;RESTORE R3
    535					155$:				;REFERENCE LABEL
    536
    537						.ENDC
    538
    539
    540						.IFT
    541
    542						BIC	#TS.CKP,-(R3)	;CLEAR CHECKPOINT FLAG
    543						BIT	#TS.CKR,(R3)	;CHECKPOINT REQUESTED?
    544						BEQ	160$		;IF EQ NO
    545						BIC	#TS.CKR,(R3)	;CLEAR CHECKPOINT REQUEST FLAG
    546						MOV	R5,R1		;SET ADDRESS OF TASK TCB
    547						CALL	$CHKPT		;CHECKPOINT TASK
    548
    549						.ENDC
    550
    551
    552					160$:				;REF LABEL
    553
    554
    555						.IF DF	R$$SND!P$$SRF
    556
    557
    558						.IF DF	A$$TRP
    559
    560						BIT	#T3.NSD,T.ST3(R5) ;DOES TASK ALLOW SENDS?
    561						BNE	169$		;IF NE NO
    562
    563						.ENDC
    564
    565
    566						.ENDC
    567
    568
    569						.IF DF	R$$SND&A$$TRP
    570
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-10


    571						TST	T.RCVL(R5)	;ANYTHING IN RECEIVE QUEUE?
    572						BEQ	165$		;IF EQ NO
    573						MOV	#H.RCVA,R4	;SET OFFSET TO RECEIVE AST CONTROL BLOCK
    574						CALL	$DASTT		;DECLARE RECEIVE AST
    575					165$:				;REF LABEL
    576
    577						.ENDC
    578
    579
    580						.IF DF	P$$SRF&A$$TRP
    581
    582						TST	T.RRFL(R5)	;ANYTHING IN RECEIVE BY REFERENCE LIST
    583						BEQ	166$		;IF EQ NO
    584						MOV	#H.RRVA,R4	;SET OFFSET TO RECEIVE BY REF BLOCK
    585						CALL	$DASTT		;DECLARE RECEIVE BY REFERENCE AST
    586					166$:				;REFERENCE LABEL
    587
    588						.ENDC
    589
    590
    591					169$:	RETURN			;
    592					170$:	BIC	#T2.BFX,(R3)	;CLEAR BEING FIXED FLAG
    593						BIS	#T2.FXD,(R3)	;SET TASK FIXED IN MEMORY
    594						RETURN			;RETURN TO TASK STATE
    595					180$:	BIC	#T2.BFX,(R3)	;CLEAR BEING FIXED FLAG
    596						BIC	#TS.EXE,-(R3)	;CLEAR NOT IN EXECUTION
    597
    598
    599						.IF DF	M$$MGE							; TM083
    600														;**-1
    601						MOV	#77406,(R1)	;SET ACCESS LAST PDR
    602						MOV	#UISDR0&377+<1*256.>,-(R1) ;SET FIRST PDR AND # PDR'S
    603						CMP	-(R1),-(R1)	;
    604						CLR	-(R1)		;CLEAR ATTACHMENT DESCRIPTOR ADDRESS
    605						CMP	-(R1),-(R1)	;
    606						MOV	R4,-(R1)	;SET PCB ADDRESS
    607						MOV	#1,-(R1)	;INDICATE ONE WINDOW BLOCK
    608
    609						.ENDC
    610
    611
    612					185$:	CLR	H.NLUN(R0)	;CLEAR NUMBER OF LUNS
    613					 									; TM112
    614					 									; TM112
    615						.IF DF	P$$LAS&P$$SRF						; TM112
    616					 									; TM112
    617						CLR	H.RRVA(R0)	;CLEAR REC BY REF CONTROL BLK ADDR	; TM112
    618					 									; TM112
    619						.ENDC								; TM112
    620					 									; TM112
    621					 									; TM112
    622						ADD	#H.FPSA,R0	;POINT TO FLOATING POINT SAVE POINTER
    623						CLR	(R0)		;CLEAR SAVE AREA POINTER
    624						TST	-(R0)		;SKIP EFN SAVE ADDRESS
    625						CLR	-(R0)		;CLEAR ADDRESS OF RECEIVE CONTROL BLOCK
    626						CLR	-(R0)		;CLEAR ADDRESS OF FLOATING POINT CONTROL BLOCK
    627						CLR	-(R0)		;CLEAR ADDRESS OF POWERFAIL CONTROL BLOCK
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-11


    628						MOV	R0,H.GARD-H.PFVA(R0) ;SET GUARD WORD TO DUMMY SAVE AREA
    629
    630
    631						.IF DF	C$$CKP&D$$ISK
    632
    633						BIT	#TS.CKP,(R3)	;CHECKPONT READ?
    634						BNE	187$		;IF NE YES
    635
    636						.IFTF
    637
    638						MOV	R5,R0		;SET ADDRESS OF TASK TCB
    639						CALL	$ACTTK		;PUT TASK IN ACTIVE LIST
    640						MOV	#S.CLRF,R0	;SET LOAD FAILURE
    641
    642						.IFT
    643
    644						BR	190$		;
    645					187$:	BIC	#TS.CKP!TS.CKR,(R3) ;CLEAR CHECKPOINT FLAGS
    646						MOV	#S.CCRF,R0	;SET CHECKPOINT READ FAILURE
    647
    648						.ENDC
    649
    650
    651					190$:	MOV	R5,R1		;SET ADDRESS OF TASK TCB
    652						CALLR	$ABTSK		;ABORT TASK
    653
    654						.ENDC
    655
    656
    657		000001 				.IIF NDF L$$LDR	.END
LOADR	MACRO M1110  22-AUG-79 07:15  PAGE 3-12
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:16
[11,24]LOADR,SY0:[11,34]LOADR/-SP=[1,1]EXEMC/ML,[11,10]RSXMC/PA:1,LOADR