P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3





      1						.TITLE	P4MAL

      2						.IDENT	/21/

      3					                                                                                ;**-1

      4					;

      5					; COPYRIGHT (C) 1976

      6					; COPYRIGHT (C) 1977

      7					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

      8					;

      9					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A

     10					; SINGLE COMPUTER SYSTEM AND MAY  BE  COPIED   ONLY  WITH  THE

     11					; INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE,  OR

     12					; ANY OTHER COPIES THEREOF, MAY NOT BE PROVIDED  OR  OTHERWISE

     13					; MADE AVAILABLE TO ANY OTHER PERSON   EXCEPT FOR  USE ON SUCH

     14					; SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE  TERMS.  TITLE

     15					; TO AND OWNERSHIP OF THE SOFTWARE SHALL AT ALL  TIMES  REMAIN

     16					; IN DEC.

     17					;

     18					; THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT

     19					; NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL

     20					; EQUIPMENT CORPORATION.

     21					;

     22					; DEC ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF

     23					; ITS SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

     24					;

     25					; VERSION 20

     26					; VERSION 21

     27					;                                                                               ;**-1

     28					; D.N. CUTLER 26-OCT-72

     29					;

     30					;

     31					;

     32					; MODIFICATIONS

     33					;

     34					; NO.		DATE		PROGRAMMER

     35					; ---		----		----------

     36					;

     37					; 010		17-AUG-73	C. MONIA

     38					; 014		28-AUG-73	C. MONIA

     39					; 041		15-MAY-75	C. MONIA

     40					; 048		09-FEB-76	C. MONIA

     41					; 050		26-FEB-76	C. MONIA

     42					; 051		02-MAR-76	C. MONIA

     43					; 052		28-MAR-76	C. MONIA

     44					; 058		22-APR-76	C. MONIA

     45					; 062		31-MAY-76	C. MONIA

     46					; JAK100	21-JAN-77	; CHANGES FOR MULTIUSER TASKS

     47					;

     48					; MACRO LIBRARY CALLS

     49					;

     50

     51						.MCALL	CLOSE$

     52

     53					;

     54					;

     55					;

     56					; LOCAL MACROS

     57					;

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-1





     58					; GENERATE PATCH LIST

     59					;

     60					; GPLST	SYMBOL,LIST,SCTNAM

     61					;

     62					; WHERE:

     63					;

     64					;	SYMBOL=SYMBOL NAME. IF DEFINED THEN SECTION IS EXTENDED BY

     65					;	       ONE WORD FOR EACH ENTRY IN THE PATCH LIST.

     66					;

     67					;	LIST=LIST OF ADDRESSES CONTAINING VALUES THAT ARE TO BE

     68					;	     INSERTED INTO THE PATCH LIST.

     69					;

     70					;	SCTNAM=NAME OF SECTION TO CONTAIN SPECIFIED VALUES.

     71					;

     72

     73						.MACRO	GPLST	SYMBOL,LIST,SCTNAM

     74

     75						.PSECT	PLST

     76					$$=.

     77						.BLKW	1

     78						.WORD	0

     79						.WORD	0

     80					$$$=.

     81					.=.-4

     82						.RAD50	/SYMBOL/

     83					.=$$$

     84					NN=0

     85						.IRP	X,<LIST>

     86						.WORD	X

     87					NN=NN+1

     88						.ENDR

     89					$$$=.

     90					.=$$

     91						.WORD	NN

     92					.=$$$

     93						.WORD	0

     94					.=.-2

     95						.PSECT

     96						GSCTM	,0,$$,SCTNAM

     97						.ENDM

     98

     99					;

    100					; GENERATE SECTION MODIFICATION TABLE ENTRY

    101					;

    102					; GSCTM SYMBOL,ADDCON,MULTIP,SCTNAM

    103					;

    104					; WHERE:

    105					;

    106					;	SYMBOL=SYMBOL NAME THAT IF DEFINED THEN SECTION IS TO BE EX-

    107					;		TENDED BY AN AMOUNT EQUAL TO THE VALUE OF THE SYMBOL

    108					;		PLUS THE ADDITIVE CONSTANT MULTIPLIED BY THE MULTIPLI-

    109					;		CATIVE CONSTANT.

    110					;	ADDCON=ADDITIVE CONSTANT.

    111					;	MULTIP=ADDRESS OF MULTIPLICATIVE CONSTANT.

    112					;	SCTNAM=CONTROL SECTION NAME.

    113					;

    114

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-2





    115						.MACRO	GSCTM SYMBOL,ADDCON,MULTIP,SCTNAM

    116						.CSECT	SCTTBL

    117						.IF NB	<SYMBOL>

    118

    119						.RAD50	/SYMBOL/

    120

    121						.IFF

    122

    123						.WORD	-1

    124						.WORD	2

    125

    126						.ENDC

    127						.WORD	ADDCON

    128						.WORD	MULTIP

    129						.RAD50	/SCTNAM/

    130						.WORD	0

    131					.=.-2

    132						.CSECT

    133						.ENDM

    134

    135					;

    136					; GENERATE UNIT MODIFICATION TABLE ENTRY

    137					;

    138					; GUNTM SYMBOL,DEVNAM

    139					;

    140					; WHERE:

    141					;

    142					;	SYMBOL=SYMBOL NAME THAT IF DEFINED THEN THE LOCATION POINTED

    143					;		TO BY THE SYMBOL VALUE IS TO BE MODIFIED WITH THE

    144					;		NUMBER OF LOGICAL UNITS.

    145					;	DEVNAM=A TWO CHARACTER DEVICE NAME. IF THE DEVICE NAME IS

    146					;		BLANK, THEN THE NUMBER OF UNITS IS THE PATCH VALUE

    147					;		AND NO LUN ASSIGNMENT IS GENERATED. ELSE THE NUMBER

    148					;		OF LUNS IS INCREMENTED AND THE UPDATED VALUE IS THE

    149					;		PATCH VALUE. AN ENTRY IS PLACED IN THE ASSIGNMENT LIST

    150					;		FOR THE DEVICE TO THE LUN SPECIFIED BY THE UPDATED

    151					;		NUMBER OF LOGICAL UNITS.

    152					;

    153

    154						.MACRO	GUNTM SYMBOL,DEVNAM

    155						.CSECT	LUNTBL

    156					.=.-2

    157						.RAD50	/SYMBOL/

    158						.WORD	0

    159						.IF NB	DEVNAM

    160					.=.-2

    161						.ASCII	/DEVNAM/

    162						.ENDC

    163						.WORD	0

    164						.CSECT

    165						.ENDM

    166

    167

    168						.IF	DF	R$$11M

    169

    170					;

    171					; ESTABLISH LOW CORE RESERVED SYMBOLS

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-3





    172					;

    173					; LOSAV	VECTOR,LOCOR

    174					;

    175					; WHERE:

    176					;

    177					;	VECTOR=	SYMBOL WHOSE VALUE, IF DEFINED IN THE ROOT SEGMENT

    178					;		IS PLACED IN A SPECIFIED LOW-CORE SAVE LOCATION

    179					;		WITHIN THE TASK HEADER

    180					;

    181					;	LOCOR= TKB STORAGE LOCATION TO RECEIVE THE ABOVE VALUE

    182					;

    183						.MACRO	LOSAV,VECTOR,LOCOR

    184						.PSECT	SVTBL

    185					.=.-2

    186						.WORD	0

    187						.WORD	0

    188					NN=.

    189					.=.-4

    190						.RAD50	/VECTOR/

    191					.=NN

    192						.WORD	LOCOR

    193						.WORD	0

    194						.PSECT

    195						.ENDM

    196

    197						.ENDC

    198

    199					;

    200					; LOCAL DATA

    201					;

    202

    203						.IF	DF	R$$11M

    204

    205					;

    206					; LOW CORE VECTOR TABLE

    207					;

    208

    209	000000					.PSECT	SVTBL

    210	000000	000000 			LOBAS:	.WORD	0		; DUMMY ZERO WORD AT START OF TABLE

    211	000000					.PSECT

    212	000000					LOSAV	.FSRCB,$HFSR

    213	000000					LOSAV	$OTSVA,$HOTV

    214	000000					LOSAV	.NOVLY,$HOVLY

    215	000000					LOSAV	$VEXTA,$HEXT

    216

    217						.ENDC

    218

    219					;

    220					; UNIT MODIFICATION TABLE

    221					;

    222					;		*** NOTE ***

    223					;

    224					; ANY 'AUTOMATIC' LUN/UNIT ASSIGNMENTS MUST BE INSERTED AFTER

    225					; THE ENTRY FOR '.NLUNS'.

    226					;

    227

    228	000000					.CSECT	LUNTBL

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-4





    229	000000	000000 			LUNBAS:	.WORD	0		;DUMMY ZERO WORD AT START OF TBL

    230	000002					GUNTM	.NLUNS

    231

    232						.IF	NDF	R$$11M

    233

    234						GUNTM	.MOLUN,MO

    235

    236						.IFF

    237

    238	000000					GUNTM	.MOLUN,TI

    239

    240						.ENDC

    241

    242	000000					GUNTM	.NOVLY,OV

    243

    244						.IF	NDF	R$$11M

    245

    246						GUNTM	.ODTL1,CI	;++014

    247

    248						.IFF

    249

    250	000000					GUNTM	.ODTL1,TI

    251

    252						.ENDC

    253

    254	000000					GUNTM	.ODTL2,CL	;++014

    255	000000					GUNTM	.TRLUN,CL

    256

    257					;

    258					; SECTION MODIFICATION TABLE

    259					;

    260

    261	000000					.CSECT	SCTTBL

    262	000000				SCTBAS:				; REF LABEL

    263	000000					GSCTM	F.FDB,0,$NUNIT,$$DEVT

    264	000000					GSCTM	F.BFHD,512.,$ACTFL,$$FSR1

    265

    266					;

    267					; PATCH LIST

    268					;

    269					;		*** NOTE ***

    270					;

    271					; PATCH LIST ENTRIES MUST BE DEFINED AFTER THE SECTION

    272					; MODIFICATION TABLE.

    273					;

    274

    275	000000					.PSECT	PLST

    276

    277	000000				PLBAS:				; REFERENCE LABEL

    278	000000					GPLST	$TSKP,<$APRMP,$LBOFF,$MXLGH,$MXLGH+2,$LBEXT>,$$TSKP

    279	000000					GPLST	.NSZSG,<$SZSEG>,$$OVRS

    280

    281

    282					;

    283					; HIGHEST USABLE TASK IMAGE VIRTUAL ADDRESS

    284					;

    285

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-5





    286						.IIF  NDF	R$$11M, $HGHAD::	.BLKW	1

    287

    288					;

    289					; RELATIVE DISK BLOCK ADDRESS OF OVERLAY SEGMENT LOAD LIST

    290					;

    291

    292	000000				$LBSGL::.BLKW	1		;

    293

    294

    295					;+

    296					; **-$P4MAL-PHASE 4 MEMORY ALLOCATION

    297					;

    298					; THIS ROUTINE IS CALLED AT THE END OF PHASE 3 TO ALLOCATE BOTH PHY-

    299					; SICAL AND VIRTUAL MEMORY FOR THE TASK. RESIDENT COMMON AND LIBRARY

    300					; ROUTINES ARE PROCESSED FIRST FOLLOWED BY EACH SEGMENT IN THE ALLOC-

    301					; ATION. AS EACH SEGMENT IS CONSIDERED, EACH CONTROL SECTION FOR THAT

    302					; SEGMENT IS ALLOCATED AN ABSOLUTE ADDRESS RELATIVE TO ZERO. AT THE

    303					; END OF MEMORY ALLOCATION, ABSOLUTE ADDRESSES (RELATIVE TO ZERO) ARE

    304					; ASSIGNED TO ALL RELOCATABLE SYMBOLS. THE AUTOLOAD LIST FOR EACH SEG-

    305					; MENT IS THEN PROCESSED AND ABSOLUTE ADDRESSES ARE ASSIGNED TO AUTO-

    306					; LOAD VECTORS. THE FINAL STEP IS THE ALLOCATION AND ZEROING OF THE

    307					; DISK SPACE FOR THE TASK IMAGE.

    308					;

    309					; INPUTS:

    310					;

    311					;	TABLES CONTRUCTED BY PHASE 3.

    312					;

    313					; OUTPUTS:

    314					;

    315					;	PHYSICAL AND VIRTUAL MEMORY IS ALLOCATED, ABSOLUTE ADDRESSES

    316					;	ARE ASSIGNED TO RELOCATABLE SYMBOLS, ABSOLUTE ADDRESSES ARE AS-

    317					;	SIGNED TO AUTOLOAD VECTORS, AND THE TASK IMAGE DISK SPACE IS

    318					;	ALLOCATED AND ZEROED.

    319					;-

    320

    321	000002				$P4MAL::SAVRG			;SAVE NONVOLITILE REGISTERS

    322	000006	016700 	000000G			MOV	$TSKPT,R0	; GET TASK RECORD BLOCK

    323	000012					CALL	$STRCB		; SETUP FILE-NAME BLOCK

    324

    325					;

    326					; PROCESS SECTION MODIFICATION TABLE

    327					;

    328

    329	000016	012705 	000000'			MOV	#SCTBAS,R5	;GET ADDRESS OF MODIFICATION TABLE

    330	000022	005715 			P4MAL1:	TST	(R5)		;ANY MORE ENTRIES?

    331	000024	001461 				BEQ	P4MAL2		;IF EQ NO

    332	000026	016500 	000002 			MOV	2(R5),R0	; GET DUMMY VALUE

    333	000032	021527 	177777 			CMP	(R5),#-1	; DUMMY SYMBOL?

    334	000036	001411 				BEQ	5$		; IF EQ YES

    335	000040					CALL	SYMSR		;SEARCH FOR SYMBOL

    336	000044	103444 				BCS	10$		;IF CS NOT FOUND

    337	000046	132760 	000000G	000000G		BITB	#SY$REL,S$YFLG(R0);ABS SYMBOL?

    338	000054	001040 				BNE	10$		;IF NE NO

    339	000056	016000 	000000G			MOV	S$YVAL(R0),R0	;GET SYMBOL VALUE

    340	000062				5$:				;

    341	000062	022525 				CMP	(R5)+,(R5)+	;POINT TO ADDITIVE CONSTANT

    342	000064	062500 				ADD	(R5)+,R0	;ADD IN ADDITIVE CONSTANT

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-6





    343	000066	013501 				MOV	@(R5)+,R1	;GET MULTIPLICATIVE CONSTANT

    344

    345

    346						.IF	NDF	V1145

    347

    348	000070					CALL	$MUL		;

    349

    350						.ENDC

    351

    352

    353						.IF	DF	V1145

    354

    355						MUL	R0,R1		;

    356

    357						.ENDC

    358

    359

    360	000074	010104 				MOV	R1,R4		;SAVE RESULT

    361	000076	012700 	000000G			MOV	#$SCTHD,R0	;GET ADDR OF SECTION EXTENSION HEADER

    362	000102	010501 				MOV	R5,R1		;POINT TO SECTION NAME

    363	000104	162701 	000000G			SUB	#S$YM,R1	;CALCULATE PROPER OFFSET

    364	000110					CALL	$SRCHR		; SEARCH FOR SECTION

    365	000114	103023 				BCC	20$		;IF CC ALREADY THERE

    366	000116	012701 	000002G			MOV	#C$SBSE+2,R1	;GET SIZE OF BLOCK NEEDED

    367	000122					CALL	$ALBLK		;ALLOCATE STORAGE

    368	000126	012560 	000000G			MOV	(R5)+,S$YM(R0)	;INSERT SECTION NAME

    369	000132	012560 	000002G			MOV	(R5)+,S$YM+2(R0);

    370	000136	010460 	000000G			MOV	R4,C$SBSE(R0)	;INSERT EXTENSION LENGTH

    371	000142	010001 				MOV	R0,R1		;COPY ENTRY ADDRESS

    372	000144	012700 	000000G			MOV	#$SCTHD,R0	;GET ADDR OF SECTION EXTENSION HEADER

    373	000150					CALL	$ISYMR		; INSERT SECTION IN EXTENSION LIST

    374	000154	000722 				BR	P4MAL1		;GO AGAIN

    375	000156	062705 	000014 		10$:	ADD	#14,R5		;ADVANCE TO NEXT ENTRY

    376	000162	000717 				BR	P4MAL1		;GO AGAIN

    377	000164	022525 			20$:	CMP	(R5)+,(R5)+	;POINT TO NEXT ENTRY

    378	000166	000715 				BR	P4MAL1		;GO AGAIN

    379

    380					;

    381					; PROCESS UNIT MODIFICATION TABLE

    382					;

    383

    384	000170	012705 	000000'		P4MAL2:	MOV	#LUNBAS,R5	;GET ADDRESS OF UNIT MODIFICIATION TBL

    385	000174	005715 			10$:	TST	(R5)		;ANY MORE TO PROCESS?

    386	000176	001450 				BEQ	P4MAL3		;IF EQ NO

    387	000200	022715 				CMP	(PC)+,(R5)	;OVERLAY PATCH?

    388	000202	130477 				.RAD50	/.NO/		;

    389	000204	001004 				BNE	15$		;IF NE NO

    390	000206	022767 	000001 	000000G		CMP	#1,$NUMSG	;MORE THAN ONE SEGMENT?

    391	000214	001436 				BEQ	30$		;IF EQ NO

    392	000216				15$:	CALL	SYMSR		;SEARCH FOR SYMBOL

    393	000222	103433 				BCS	30$		;IF CS NOT FOUND

    394	000224	012704 	000001 			MOV	#1,R4		; GET PATCH COUNT

    395	000230					CALL	IPATCH		;INITIALIZE PATCH

    396	000234	012504 				MOV	(R5)+,R4	;GET DEVICE NAME

    397	000236	001402 				BEQ	20$		;IF EQ NO UPDATE OF UNITS

    398	000240	005267 	000000G			INC	$NUNIT		;INCREMENT NUMBER OF UNITS

    399	000244	016710 	000000G		20$:	MOV	$NUNIT,(R0)	;SET PATCH VALUE

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-7





    400	000250	005704 				TST	R4		;ANY DEVICE?

    401	000252	001750 				BEQ	10$		;IF EQ NO

    402	000254	012701 	000010 			MOV	#10,R1		;GET SIZE OF BLOCK NEEDED

    403	000260					CALL	$ALBLK		;ALLOCATE STORAGE

    404	000264	010077 	000002G			MOV	R0,@$LUNHD+2	;LINK TO OLD LAST

    405	000270	010067 	000002G			MOV	R0,$LUNHD+2	;SET NEW LAST

    406	000274	005720 				TST	(R0)+		;POINT TO DEVICE NAME

    407	000276	010420 				MOV	R4,(R0)+	;SET DEVICE NAME

    408	000300	012720 				MOV	(PC)+,(R0)+	;SET UNIT 0 AND ONE ASSIGNMENT

    409	000302	   000 	   001 			.BYTE	0,1		;

    410	000304	016710 	000000G			MOV	$NUNIT,(R0)	;SET LUN NUMBER

    411	000310	000731 				BR	10$		;

    412	000312	062705 	000006 		30$:	ADD	#6,R5		;ADVANCE TO NEXT ENTRY

    413	000316	000726 				BR	10$		;

    414

    415					;

    416					; CALCULATE HEADER SIZE

    417					;

    418

    419	000320				P4MAL3:				;

    420	000320	016700 	000000G			MOV	$NUNIT,R0	; GET NUMBER OF UNITS

    421	000324	012703 	000000'			MOV	#$LBSGL,R3	; GET ADDRESS OF LOAD LIST DISK BLOCK

    422	000330	005013 				CLR	(R3)		; ASSUME NO DISK ALLOCATION MADE

    423	000332	012701 	000000G			MOV	#$LBLSZ,R1	; POINT TO SIZE OF LABEL

    424	000336	012711 	002000 			MOV	#512.*2,(R1)	; SET LABEL SIZE

    425	000342	012702 	000002 			MOV	#2,R2		; SET NUMBER OF BLOCKS IN LABEL

    426	000346	020027 	000200 			CMP	R0,#128.	; CHECK NUMBER OF LUNS

    427	000352	003403 				BLE	5$		; IF LE ALL SET

    428	000354	005202 				INC	R2		; ELSE INCREMENT NUMBER OF LABEL BLOCKS

    429	000356	062711 	001000 			ADD	#512.,(R1)	; ADD ANOTHER BLOCK TO SIZE

    430	000362				5$:

    431	000362	016704 	000000G			MOV	$TSKPT,R4	; GET ADDRESS OF TASK FILE RECORD BLOCK

    432	000366	032764 	000000G	000000G		BIT	#SW$NH,R$SWTH(R4) ; BUILDING RESIDENT LIBRARY?

    433	000374	001410 				BEQ	6$		; IF EQ NO

    434	000376	026727 	000000G	000001 		CMP	$NUMSG,#1	; TASK OVERLAID

    435	000404	001404 				BEQ	6$		; IF EQ NO

    436	000406	010213 				MOV	R2,(R3)		; SET RELATIVE BLOCK NUMBER OF SEGMENT LIST

    437	000410	005202 				INC	R2		; ADD ANOTHER BLOCK TO LABEL SIZE

    438	000412	062711 	001000 			ADD	#512.,(R1)	; ADD ONE BLOCK TO LABEL SIZE IN BYTES

    439	000416				6$:				;

    440	000416	010267 	000000G			MOV	R2,$LBBLK	; SET NUMBER OF LABEL BLOCKS

    441	000422	010267 	000000G			MOV	R2,$HDRBN	; RELATIVE BLOCK NUMBER OF HEADER

    442

    443	000426	006300 				ASL	R0		;MULTIPLY BY 4

    444	000430	006300 				ASL	R0		;

    445

    446						.IF	NDF	R$$11M

    447

    448						ADD	#H$DLUT+77+2,R0 ; ADD LENGTH OF HEADER AND ROUND

    449						ADD	$LBLSZ,R0	; ADD SIZE OF LABEL

    450						MOV	$TSKPT,R2	;GET TASK IMAGE RECORD BLOCK

    451						BIT	#SW$FP,R$SWTH(R2);FLOATING POINT SPECIFIED?

    452						BEQ	10$		;IF EQ NO

    453						ADD	#25.*2,R0	;ADD IN 25. MORE WORDS

    454					10$:	BIC	#77,R0		;CLEAR EXCESS BITS

    455

    456						.IFF

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-8





    457

    458	000432	016702 	000000G			MOV	$TSKPT,R2

    459	000436	016202 	000000G			MOV	R$SWTH(R2),R2	; FETCH TASK IMAGE FLAGS

    460	000442	005067 	000000G			CLR	$HDSIZ		; ASSUME TASK IMAGE HAS NO HEADER

    461	000446	032702 	000000G			BIT	#SW$NH,R2	 ; TEST FOR HEADER

    462	000452	001020 				BNE	P4MAL4		; BUILD WITHOUT HEADER IF NE

    463	000454	062700 	000000C			ADD	#<H$LUN-H$CSP>+2,R0 ; ADD LENGTH OF FIXED PART OF HEADER

    464	000460	032702 	000000C			BIT	#<SW$FP!SW$EA>,R2  ; FLOATING POINT OR EAE SPECIFIED?

    465	000464	001407 				BEQ	10$		; IF EQ NO

    466	000466	062700 	000006 			ADD	#6,R0		; ASSUME EAE

    467	000472	032702 	000000G			BIT	#SW$FP,R2	; SEE IF F/P

    468	000476	001402 				BEQ	10$		; IF EQ NO

    469	000500	062700 	000054 			ADD	#<25.*2-6>,R0	; YES ALLOCATE MORE SPACE

    470	000504				10$:

    471	000504	062700 	000022 			ADD	#22,R0		; ALLOCATE REGISTER SAVE AREA,PS AND GUARD

    472

    473						.ENDC

    474

    475	000510	010067 	000000G			MOV	R0,$HDSIZ	;SET HEADER SIZE

    476

    477					;

    478					; ALLOCATE CHECKPOINT AREA ON DISK

    479					;

    480

    481	000514				P4MAL4:				;

    482

    483						.IF	DF	R$$11M

    484

    485	000514					CALL	$DSALO		; ALLOCATE DESCRIPTORS

    486	000520					CALL	$ALALO		; ASSIGN ADDRESSES TO AUTLOAD VECTORS

    487	000524					CALL	$SGALO		;++041 ALLOCATE VIRTUAL MEMORY

    488	000530	016700 	000000G			MOV	$PARSZ,R0	;++041 GET PARTITION SIZE

    489	000534	016702 	000000G			MOV	$TSKPT,R2	;++041 GET TASK FILE FLAGS

    490	000540	016202 	000000G			MOV	R$SWTH(R2),R2	;++041 ...

    491	000544	032767 	000000G	000000G		BIT	#MP$SY,$SWTCH	;++041 MAPPED SYSTEM?

    492	000552	001453 				BEQ	5$		;++041 IF EQ NO

    493	000554	012701 	000000G			MOV	#$MXLGH,R1	; POINT TO MAX LENGTH

    494	000560	005700 				TST	R0		;++041 SYSTEM CONTROLLED PARTITION?

    495	000562	001412 				BEQ	1$		; IF EQ YES

    496	000564	010203 				MOV	R2,R3		; SAVE SWITCHES

    497	000566	012102 				MOV	(R1)+,R2	; GET MAX LENGTH

    498	000570	061102 				ADD	(R1),R2		; ADD R/O ALLOCATION

    499	000572	010001 				MOV	R0,R1		; COPY PARTITION SIZE

    500	000574	160201 				SUB	R2,R1		; SUBTRACT TASK SIZE FROM PARTITION SIZE

    501	000576	103415 				BLO	2$		; IF LO ERROR

    502	000600	010167 	000000G			MOV	R1,$LBEXT	; SET EXTEND SIZE

    503	000604	010302 				MOV	R3,R2		; RESTORE SWITCHES

    504	000606	000435 				BR	5$		; ALLOCATE CHECKPOINT SPACE

    505	000610				1$:				;

    506	000610	012100 				MOV	(R1)+,R0	; GET LENGTH OF TASK IMAGE

    507	000612	066700 	000000G			ADD	$LBEXT,R0	; INCLUDE TASK EXTENSION

    508	000616	103405 				BCS	2$		; IF C/S PHYSICAL ADDRESS OVERFLOW

    509	000620	061100 				ADD	(R1),R0		; INCLUDE R/O ALLOCATION

    510	000622	103403 				BCS	2$		; IF C/S PHYSICAL ADDRESS OVERFLOW

    511	000624	066700 	000000G			ADD	$LBOFF,R0	; ADD TASK OFFSET INTO PARTITION

    512	000630	103022 				BCC	4$		; IF C/C OK

    513	000632				2$:				;

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-9





    514	000632	042767 	000000G	000000G		BIC	#TS$KF,$SWTCH	; CANCEL TASK IMAGE OUTPUT

    515	000640	016746 	000000G			MOV	$LBEXT,-(SP)	; PUSH TASK EXTEND SIZE

    516	000644	016746 	000000G			MOV	$MXLGH,-(SP)	; PUSH TASK IMAGE LENGTH

    517	000650	016746 	000000G			MOV	$LBOFF,-(SP)	; PUSH TASK OFFSET

    518	000654	010602 				MOV	SP,R2		; SET ADDRESS OF PARAMETER LIST

    519	000656	012701 	000000C			MOV	#<S$V0*400!E$R87>,R1 ; GET ERROR/SEVERITY

    520	000662					CALL	$ERMSG		; REPORT DIAGNOSTIC

    521	000666	062706 	000006 			ADD	#6,SP		; CLEAN STACK

    522	000672	012700 	177777 			MOV	#177777,R0	; SET PARTITION SIZE TO MAX

    523	000676				4$:				;

    524	000676	010067 	000000G			MOV	R0,$PARSZ	;++041 SAVE TOTAL TASK SIZE

    525	000702				5$:				;++041

    526	000702	032702 	000000C			BIT	#<SW$ALO!SW$CP>,R2 ; ALLOCATE CHECKPOINT SPACE ON DISK?

    527	000706	001011 				BNE	10$		; IF NE NO

    528	000710	062700 	000007 			ADD	#7,R0		; ROUND TO MULTIPLE OF 256W

    529	000714	042700 	000007 			BIC	#7,R0		; CLEAR EXTRANEOUS BITS

    530	000720	006000 				ROR	R0		; CONVERT TO BLOCKS

    531	000722	006000 				ROR	R0		; ...

    532	000724	006000 				ROR	R0		; ...

    533	000726	060067 	000000G			ADD	R0,$HDRBN	; SET RELATIVE BLOCK NUMBER OF HEADER

    534	000732				10$:				; REF LABEL

    535

    536						.IFF

    537

    538					;

    539					; ALLOCATE PHYSICAL AND VIRTUAL MEMORY

    540					;

    541

    542						CALL	$PRALO		; ALLOCATE PAR'S

    543						CALL	$SGALO		; ALLOCATE VIRTUAL MEMORY

    544

    545					;

    546					; CALCULATE OFFSET BIAS

    547					;

    548

    549					P4MAL5:	MOV	$OFFST,R0	;GET BASE OR TOP

    550						BGE	10$		;IF GE BASE

    551						NEG	R0		;MAKE POSITIVE

    552					10$:	SWAB	R0		;MULTIPLY BY 256.

    553						ASL	R0		;FINISH ADJUST TO 4K MULTIPLE WITH SHIFT

    554						ASL	R0		;

    555						ASL	R0		;

    556						TST	$OFFST		;TOP OR BASE?

    557						BGE	30$		;IF GE BASE

    558						ADD	#20000,R0	;MAKE 4K BIGGER

    559						BCS	20$		;IF CS NO NEED TO CHECK

    560						CMP	R0,$HVRTL	;LEGAL TOP VALUE?

    561						BLO	40$		;IF LO NO

    562					20$:	SUB	$HVRTL,R0	;CALCULATE DIFFERENCE

    563						BIC	#17777,R0	;CLEAR EXCESS BITS

    564						BR	50$		;

    565					30$:	MOV	R0,R1		;COPY BASE ADDRESS

    566						ADD	$HVRTL,R1	;ADD IN VIRTUAL LENGTH

    567						BCC	50$		;IF CC OKAY

    568					40$:	MOV	#$OFFST,R2	;GET ADDRESS OF OFFSET WORD

    569						MOV	(PC)+,R1	;ILLEGAL OFFSET ADDRESS

    570						.BYTE	E$R47,S$V0	;DIAGNOSTIC

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-10





    571						CALL	$ERMSG		;++010 SEND ERROR MESSAGE

    572						CLR	R0		;CLEAR OFFSET BIAS

    573					50$:	MOV	R0,$OFFST	;SET OFFSET BIAS

    574

    575						.ENDC

    576

    577

    578					;

    579					; NOW FINISH ALLOCATION

    580					;

    581

    582	000732				P4MAL6:				;

    583	000732					CALL	$SYALO		;ASSIGN ABSOLUTE ADDRESSES TO SYMS

    584	000736					CALL	$DKALO		;ALLOCATE TASK IMAGE DISK SPACE

    585

    586					;

    587					; PROCESS PATCH LIST TABLE

    588					;

    589

    590	000742				P4MAL7:				;

    591	000742	012705 	000000'			MOV	#PLBAS,R5	; GET ADDRESS OF PATCH LIST TABLE

    592	000746				10$:				;

    593	000746	012504 				MOV	(R5)+,R4	; GET NUMBER OF PATCHES

    594	000750	001415 				BEQ	P4MAL8		; IF EQ AT END OF LIST

    595	000752					CALL	SYMSR		; SEARCH FOR SYMBOL

    596	000756	103406 				BCS	30$		; IF C/S NOT FOUND

    597	000760					CALL	IPATCH		; INITIALIZE PATCH LIST

    598	000764				20$:				;

    599	000764	013520 				MOV	@(R5)+,(R0)+	; INSERT ENTRIES IN LIST

    600	000766					SOB	R4,20$		; ...

    601	000772	000765 				BR	10$		; PROCESS NEXT ENTRY

    602	000774				30$:				;

    603	000774	006304 				ASL	R4		; CONVERT COUNT TO BYTES

    604	000776	060405 				ADD	R4,R5		; ADD TO TABLE POINTER

    605	001000	022525 				CMP	(R5)+,(R5)+	; POINT TO NEXT ENTRY

    606	001002	000761 				BR	10$		; GO AGAIN

    607

    608

    609						.IF	DF	R$$11M

    610

    611					;

    612					; SETUP LOW CORE POINTERS

    613					;

    614

    615

    616	001004				P4MAL8:				;

    617	001004	012705 	177772'			MOV	#LOBAS-6,R5	; FETCH TABLE POINTER LESS OFFSET

    618	001010				20$:

    619	001010	062705 	000006 			ADD	#6,R5		; OFFSET TO NEXT ENTRY

    620	001014	005715 				TST	(R5)		; ANY MORE TO PROCESS

    621	001016	001420 				BEQ	40$		; IF EQ NO

    622	001020	005075 	000004 			CLR	@4(R5)		; ASSUME VECTOR NOT DEFINED IN ROOT

    623	001024					CALL	SYMSR		; SEARCH ROOT FOR DEFINITION

    624	001030	103767 				BCS	20$		; IF C/S NOT DEFINED

    625	001032	132760 	000000G	000000G		BITB	#SY$REL,S$YFLG(R0) ; TEST IF RELOCATABLE

    626	001040	001403 				BEQ	30$		; IF EQ NO

    627	001042	016775 	000000G	000004 		MOV	$OFFST,@4(R5)	; SETUP RELOCATION BIAS

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-11





    628	001050				30$:

    629	001050	066075 	000000G	000004 		ADD	S$YVAL(R0),@4(R5) ; RELOCATE DEFINITION

    630	001056	000754 				BR	20$		; GO AGAIN

    631	001060				40$:				; REF. LABEL

    632

    633						.ENDC

    634

    635	001060	016767 	000000G	000000G		MOV	$RLBLK,$ROBLK	; GET RELATIVE BLK NUMBER OF R-O		;JAK100

    636	001066	005267 	000000G			INC	$ROBLK		;						;JAK100

    637	001072					CALL	$HEADR		;OUTPUT TASK HEADER

    638	001076	032767 	000000G	000000G		BIT	#TS$KF,$SWTCH	; TASK FILE SPECIFIED ?

    639	001104	001427 				BEQ	50$		; IF EQ NO

    640	001106	016701 	000000G			MOV	$TSKNM,R1	; GET TASK NAME BLOCK

    641	001112					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    642	001116					CALL	$WRMPG		; WRITE MARK THE PAGE

    643	001122	010001 				MOV	R0,R1		; COPY REAL ADDRESS

    644	001124	005061 	000000G			CLR	E$LNUM(R1)	; CLEAR HIGHEST SECTION NUMBER

    645	001130	016700 	000000G			MOV	$TSKPT,R0	; GET TASK RECORD BLOCK POINTER

    646	001134	062701 	000014G			ADD	#E$LMND+14,R1	; POINT TO VERSION

    647	001140	016021 	000120 			MOV	F.FNB+N.FVER(R0),(R1)+ ; SAVE VERSION NUMBER

    648	001144	016021 	000102 			MOV	F.FNB+N.FID(R0),(R1)+ ; REPLACE DIRECTORY I/D WITH FILE I/D

    649	001150	016021 	000104 			MOV	F.FNB+N.FID+2(R0),(R1)+ ;

    650	001154	016021 	000106 			MOV	F.FNB+N.FID+4(R0),(R1)+ ;

    651	001160					CLOSE$	R0		; CLOSE TASK FILE

    652	001164				50$:				;

    653	001164					RETURN			;

    654

    655					;

    656					; SUBROUTINE TO ALLOCATE AND INITIALIZE PATCH LIST ENTRY

    657					;

    658

    659	001166				IPATCH:				;

    660	001166	012701 	000020 			MOV	#2+2+4+2+4+2,R1	; GET SIZE OF PATCH LIST HEADER

    661	001172	060401 				ADD	R4,R1		; ADD IN NUMBER OF PATCHES

    662	001174	060401 				ADD	R4,R1		; CONVERT NUMBER TO BYTES

    663	001176					CALL	$ALBLK		;ALLOCATE STORAGE

    664	001202	012701 	000000G			MOV	#$PATHD,R1	;GET ADDRESS OF PATCH LISTHEAD

    665	001206	005721 				TST	(R1)+		;ANYTHING IN LIST?

    666	001210	001403 				BEQ	10$		;IF EQ NO

    667	001212	014110 				MOV	-(R1),(R0)	;LINK OLD FIRST TO NEW FIRST

    668	001214	010011 				MOV	R0,(R1)		;SET NEW FIRST

    669	001216	000402 				BR	20$		;

    670	001220	010031 			10$:	MOV	R0,@(R1)+	;SET ADDRESS OF FIRST

    671	001222	010041 				MOV	R0,-(R1)	;SET ADDRESS OF LAST

    672	001224	005720 			20$:	TST	(R0)+		;POINT TO NUMBER OF PATCHES

    673	001226	010420 				MOV	R4,(R0)+	; SET PATCH COUNT

    674	001230					CALL	CVROOT		; GET REAL ADDRESS OF ROOT IN R1

    675	001234	016120 	000000G			MOV	S$GNME(R1),(R0)+;SET SEGMENT NAME OF PATCH

    676	001240	016120 	000002G			MOV	S$GNME+2(R1),(R0)+;

    677	001244	012720 	000002 			MOV	#2,(R0)+	;TYPE EQUAL GLOBAL PATCH

    678	001250	012520 				MOV	(R5)+,(R0)+	;INSERT SYMBOL NAME

    679	001252	012520 				MOV	(R5)+,(R0)+	;

    680	001254	005020 				CLR	(R0)+		;CLEAR OFFSET VALUE

    681	001256					RETURN			;

    682

    683					;

    684					; SUBROUTINE TO SEARCH ROOT SEGMENT FOR SYMBOL DEFINITION

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-12





    685					;

    686

    687	001260				SYMSR:				;

    688	001260					CALL	CVROOT		; GET REAL ADDRESS OF ROOT IN R1

    689	001264	010100 				MOV	R1,R0		; COPY REAL ADDRESS

    690	001266	062700 	000000G			ADD	#S$GSTB,R0	;POINT TO SYMBOL TABLE

    691	001272	010501 				MOV	R5,R1		;COPY TABLE ENTRY ADDRESS

    692	001274	162701 	000000G			SUB	#S$YM,R1	;CALCULATE PROPER OFFSET

    693	001300					CALL	$SRCH		;SEARCH SYMBOL TABLE

    694	001304	103413 				BCS	20$		;IF CS NO FIND EM

    695	001306	132760 	000000G	000000G		BITB	#SY$DEF,S$YFLG(R0);SYMBOL DEFINITION?

    696	001314	001406 				BEQ	10$		;IF EQ NO

    697	001316	132760 	000000G	000000G		BITB	#SY$IND,S$YFLG(R0);INDIRECT REFERENCE?

    698	001324	001002 				BNE	10$		;IF NE YES

    699	001326	000241 				CLC			;CLEAR CARRY

    700	001330	000401 				BR	20$		;

    701	001332	000261 			10$:	SEC			;SET CARRY

    702	001334				20$:	RETURN			;

    703

    704					;

    705					; CONVERT VIRTUAL ADDRESS OF ROOT TO REAL ADDRESS IN R1

    706					;

    707

    708	001336				CVROOT:				;

    709	001336	010046 				MOV	R0,-(SP)	; SAVE R0

    710	001340	016701 	000000G			MOV	$RTSEG,R1	; GET VIRTUAL ADDRESS OF ROOT SEGMENT

    711	001344					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    712	001350					CALL	$WRMPG		; WRITE-MARK PAGE

    713	001354	010001 				MOV	R0,R1		; COPY REAL ADDRESS

    714	001356	012600 				MOV	(SP)+,R0	; RESTORE R0

    715	001360					RETURN			;

    716

    717

    718		000001 				.END

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-13

SYMBOL TABLE



B.BBFS= 000010   	FD.TTY= 000004   	F.NREC= 000030   	P4MAL1  000022R  	$DKALO= ****** GX

B.BFST= 000015   	FD.WBH= 000002   	F.OVBS= 000030   	P4MAL2  000170R  	$DSALO= ****** GX

B.NXBD= 000012   	FF    = 000014   	F.RACC= 000016   	P4MAL3  000320R  	$ERMSG= ****** GX

B.VBN = 000004   	FF.CHR= 000005   	F.RATT= 000001   	P4MAL4  000514R  	$HDRBN= ****** GX

CH.AND= 000001   	FF.NV = 000003   	F.RCNM= 000034   	P4MAL6  000732R  	$HDSIZ= ****** GX

CR    = 000015   	FF.POE= 000002   	F.RCTL= 000017   	P4MAL7  000742R  	$HEADR= ****** GX

CVROOT  001336R  	FF.RWD= 000001   	F.RSIZ= 000002   	P4MAL8  001004R  	$HEXT = ****** GX

C$SBSE= ****** GX	FF.RWF= 000006   	F.RTYP= 000000   	R$SWTH= ****** GX	$HFSR = ****** GX

E$LMND= ****** GX	FF.SPC= 000004   	F.SEQN= 000100   	R$$11M= 000000   	$HOTV = ****** GX

E$LNUM= ****** GX	FO.APD= 000106   	F.SPDV= 000072   	R.FIX = 000001   	$HOVLY= ****** GX

E$R87 = ****** GX	FO.MFY= 000002   	F.SPUN= 000074   	R.SEQ = 000003   	$ISYMR= ****** GX

FA.APD= 000100   	FO.RD = 000001   	F.STBK= 000036   	R.VAR = 000002   	$LBBLK= ****** GX

FA.CRE= 000010   	FO.UPD= 000006   	F.UNIT= 000136   	SCTBAS  000000R     004	$LBEXT= ****** GX

FA.DLK= 001000   	FO.WRT= 000016   	F.URBD= 000020   	SPA   = 000040   	$LBLSZ= ****** GX

FA.ENB= 100000   	F.ACTL= 000076   	F.VBN = 000064   	SW$ALO= ****** GX	$LBOFF= ****** GX

FA.EXC= 002000   	F.ALOC= 000040   	F.VBSZ= 000060   	SW$CP = ****** GX	$LBSGL  000000RG

FA.EXT= 000004   	F.BBFS= 000062   	HT    = 000011   	SW$EA = ****** GX	$LUNHD= ****** GX

FA.NSP= 000100   	F.BDB = 000070   	H$CSP = ****** GX	SW$FP = ****** GX	$MUL  = ****** GX

FA.POS= 010000   	F.BGBC= 000057   	H$LUN = ****** GX	SW$NH = ****** GX	$MXLGH= ****** GX

FA.RD = 000001   	F.BKDN= 000026   	IPATCH  001166R  	SYMSR   001260R  	$NUMSG= ****** GX

FA.RWD= 004000   	F.BKDS= 000020   	LF    = 000012   	SY$DEF= ****** GX	$NUNIT= ****** GX

FA.SEQ= 040000   	F.BKEF= 000050   	LOBAS   000000R     002	SY$IND= ****** GX	$OFFST= ****** GX

FA.SHR= 000040   	F.BKP1= 000051   	LUNBAS  000000R     003	SY$REL= ****** GX	$PARSZ= ****** GX

FA.TMP= 000020   	F.BKST= 000024   	MP$SY = ****** GX	S$GNME= ****** GX	$PATHD= ****** GX

FA.WCK= 020000   	F.BKVB= 000064   	NB.DEV= 000200   	S$GSTB= ****** GX	$P4MAL  000002RG

FA.WRT= 000002   	F.CHR = 000075   	NB.DIR= 000100   	S$V0  = ****** GX	$RLBLK= ****** GX

FD.BLK= 000010   	F.CNTG= 000034   	NB.NAM= 000004   	S$YFLG= ****** GX	$ROBLK= ****** GX

FD.CCL= 000002   	F.DFNB= 000046   	NB.SD1= 000400   	S$YM  = ****** GX	$RTSEG= ****** GX

FD.COM= 020000   	F.DSPT= 000044   	NB.SD2= 001000   	S$YVAL= ****** GX	$SAVRG= ****** GX

FD.CR = 000002   	F.DVNM= 000134   	NB.SNM= 000040   	S.BFHD= 000020   	$SCTHD= ****** GX

FD.DIR= 000010   	F.EFBK= 000010   	NB.STP= 000020   	S.FATT= 000016   	$SGALO= ****** GX

FD.FTN= 000001   	F.EFN = 000050   	NB.SVR= 000010   	S.FDB = 000140   	$SRCH = ****** GX

FD.F11= 040000   	F.EOBB= 000032   	NB.TYP= 000002   	S.FNAM= 000006   	$SRCHR= ****** GX

FD.INS= 000010   	F.ERR = 000052   	NB.VER= 000001   	S.FNB = 000036   	$STRCB= ****** GX

FD.ISP= 002000   	F.FACC= 000043   	NN    = 000001   	S.FNBW= 000017   	$SWTCH= ****** GX

FD.MNT= 100000   	F.FFBY= 000014   	N.DID = 000024   	S.FNTY= 000004   	$SYALO= ****** GX

FD.OSP= 004000   	F.FNAM= 000110   	N.DVNM= 000032   	S.FTYP= 000002   	$SZSEG= ****** GX

FD.PLC= 000004   	F.FNB = 000102   	N.FID = 000000   	S.NFEN= 000020   	$TSKNM= ****** GX

FD.PRN= 000004   	F.FTYP= 000116   	N.FNAM= 000006   	TS$KF = ****** GX	$TSKPT= ****** GX

FD.PSE= 010000   	F.FVER= 000120   	N.FTYP= 000014   	VT    = 000013   	$WRMPG= ****** GX

FD.RAH= 000001   	F.HIBK= 000004   	N.FVER= 000016   	$ACTFL= ****** GX	$$    = 000001

FD.RAN= 000002   	F.LUN = 000042   	N.NEXT= 000022   	$ALALO= ****** GX	$$$   = 000030R     005

FD.REC= 000001   	F.MBCT= 000054   	N.STAT= 000020   	$ALBLK= ****** GX	.CLOSE= ****** G

FD.RWM= 000001   	F.MBC1= 000055   	N.UNIT= 000034   	$APRMP= ****** GX	...GBL= 000000

FD.SDI= 000020   	F.MBFG= 000056   	PAR$$$= 000000   	$CVRL = ****** GX	...TPC= 000140

FD.SQD= 000040   	F.NRBD= 000024   	PLBAS   000000R     005



. ABS.	000000	   000

      	001362	   001

SVTBL 	000032	   002

LUNTBL	000046	   003

SCTTBL	000062	   004

PLST  	000032	   005

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  2753 WORDS  ( 11 PAGES)

DYNAMIC MEMORY:  3828 WORDS  ( 14 PAGES)

ELAPSED TIME:  00:00:27

P4MAL	MACRO M1110  22-AUG-78 01:53  PAGE 3-14

SYMBOL TABLE



OBJ$:P4MAL,LIS$:P4MAL/-SP=SRC$:MACFLM,FCSPR,P4MAL

