VMUTL	MACRO M1110  22-AUG-78 02:02  PAGE 2





      1						.TITLE	VMUTL

      2						.IDENT	/03/                                                            ;**NEW**

      3					                                                                                ;**-1

      4					;

      5					; COPYRIGHT   1974,  DIGITAL  EQUIPMENT  CORP.,  MAYNARD,   MASS.

      6					;

      7					; THIS SOFTWARE IS FURNISHED TO PURCHASER UNDER A LICENSE FOR USE

      8					; ON A  SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSION

      9					; OF DEC'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH SYSTEM, EXCEPT

     10					; AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC.

     11					;

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

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

     14					; EQUIPMENT CORPORATION.

     15					;

     16					; DEC  ASSUMES NO  RESPONSIBILITY  FOR  THE  USE  OR RELIABILITY

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

     18					;

     19					; VERSION 03                                                                    ;**NEW**

     20					;                                                                               ;**-1

     21					; C. MONIA 03-MAR-74

     22					;

     23					; VIRTUAL MEMORY UTILITIES

     24					;

     25					;+

     26					; **-$CVLOK-SUBROUTINE TO CONVERT AND LOCK A PAGE IN MEMORY

     27					;

     28					; INPUTS:

     29					;

     30					;	R1=VIRTUAL ADDRESS TO BE CONVERTED

     31					;

     32					; OUTPUTS:

     33					;

     34					;	R0=CONVERTED (REAL) ADDRESS

     35					;	R1=VIRTUAL ADDRESS

     36					;	   SPECIFIED PAGE IS LOCKED IN CORE

     37					;

     38					; THE CONTENTS OF R2 ARE PRESERVED

     39					;-

     40

     41	000000				$CVLOK::			;

     42	000000	010246 				MOV	R2,-(SP)	; SAVE R2

     43	000002					CALL	$CVRL		; CONVERT TO REAL ADDRESS

     44	000006					CALL	$LCKPG		; LOCK PAGE IN MEMORY

     45	000012	012602 				MOV	(SP)+,R2	; RESTORE R2

     46	000014					RETURN			;

     47

     48					;+

     49					; **-$LNKVM-SUBROUTINE TO LINK AN ITEM TO A LIST IN VIRTUAL STORE

     50					;

     51					;

     52					; THIS ROUTINE IS CALLED TO LINK AN ITEM TO A LIST IN VIRTUAL STORE.

     53					; THE LISTHEAD IS ASSUMED TO HAVE THE FOLLOWING FORMAT:

     54					;

     55					;	LSTHD:	.WORD	FIRST	; POINTER TO FIRST (0 IF NONE)

     56					;		.WORD	LAST	; POINTER TO LAST (LISTHEAD IF NONE)

     57					;

VMUTL	MACRO M1110  22-AUG-78 02:02  PAGE 2-1





     58					; INPUTS:

     59					;

     60					;	R0=VIRTUAL LISTHEAD ADDRESS

     61					;	R1=VIRTUAL ADDRESS OF ITEM TO BE LINKED

     62					;	R2=REAL OFFSET OF LINK TO NEXT

     63					;

     64					; OUTPUTS:

     65					;

     66					;	THE ITEM IS LINKED AT THE END OF THE SPECIFIED

     67					;	LIST. THE OLD LAST ITEM IS WRITE MARKED.

     68					;

     69					; ALL REGISTER CONTENTS ARE PRESERVED

     70					;-

     71

     72	000016				$LNKVM::			;

     73	000016					SAVVR			; SAVE VOLATILE REGISTERS

     74

     75					;

     76					; AT THIS POINT THE STACK CONTAINS THE FOLLOWING:

     77					;

     78					;	SP:	ADDRESS OF REGISTER RESTORE ROUTINE

     79					;	SP+2:	SAVED R0-VIRTUAL ADDRESS OF LISTHEAD

     80					;	SP+4:	SAVED R1-VIRTUAL ADDRESS OF NEW LAST

     81					;	SP+6:	SAVED R2-REAL OFFSET OF LINK-TO-NEXT

     82					;

     83

     84	000022	005200 				INC	R0		; POINT TO SECOND WORD OF VIRTUAL LISTHEAD

     85	000024	010001 				MOV	R0,R1		; SET VIRTUAL ADDRESS

     86	000026					CALL	$CVRL		; CONVERT TO REAL ADDRESS

     87	000032					CALL	$WRMPG		; WRITE MARK THE PAGE

     88	000036	011001 				MOV	(R0),R1		; GET VIRTUAL ADDRESS OF LAST

     89	000040	016610 	000004 			MOV	4(SP),(R0)	; SET NEW LAST

     90	000044	020166 	000002 			CMP	R1,2(SP)	; LIST EMPTY?

     91	000050	001003 				BNE	10$		; IF NE NO

     92	000052	016640 	000004 			MOV	4(SP),-(R0)	; SET THIS ENTRY AS FIRST

     93	000056	000410 				BR	20$		;

     94	000060				10$:				;

     95	000060					CALL	$CVRL		; CONVERT OLD LAST TO REAL

     96	000064					CALL	$WRMPG		; WRITE-MARK PAGE

     97	000070	066600 	000006 			ADD	6(SP),R0	; POINT TO REAL ADDRESS OF NEXT LINK

     98	000074	016610 	000004 			MOV	4(SP),(R0)	; SET NEW LAST

     99	000100				20$:				;

    100	000100					RETURN			;

    101

    102					;+

    103					; **-$GNVI-SUBROUTINE TO FETCH NEXT ITEM FROM A LINKED LIST IN VIRTUAL STORE

    104					;

    105					; INPUTS:

    106					;

    107					;	R1=VIRTUAL ADDRESS OF CURRENT ITEM

    108					;	R2=REAL OFFSET OF LINK TO NEXT.

    109					;

    110					; OUTPUTS:

    111					;

    112					;	C-CLEAR

    113					;	R0=REAL ADDRESS OF NEXT ITEM

    114					;	R1=VIRTUAL ADDRESS OF NEXT ITEM

VMUTL	MACRO M1110  22-AUG-78 02:02  PAGE 2-2





    115					;

    116					;	C-SET

    117					;

    118					;	NO MORE ITEMS IN LIST

    119					;	R0,R1 CLEARED

    120					;-

    121

    122	000102				$GNVI::				;

    123	000102	000241 				CLC			; CLEAR CARRY                                   ;**NEW**

    124	000104	006002 				ROR	R2		; CONVERT REAL OFFSET TO VIRTUAL                ;**NEW**

    125	000106	060201 				ADD	R2,R1		; COMPUTE VIRTUAL ADDRESS OF LINK NEXT          ;**-1

    126	000110					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    127	000114	011001 				MOV	(R0),R1		; GET VIRTUAL ADDRESS OF NEXT

    128	000116	000261 				SEC			; ASSUME NO MORE ENTRIES

    129	000120	010100 				MOV	R1,R0		; COPY VIRTUAL ADDRESS (MAY BE ZERO)

    130	000122	001403 				BEQ	10$		; IF EQ, NO MORE ENTRIES

    131	000124					CALL	$CVRL		; CONVERT TO REAL ADDRESS

    132	000130	000241 				CLC			; SET SUCCESS

    133	000132				10$:				;

    134	000132					RETURN			;

    135

    136		000001 				.END

VMUTL	MACRO M1110  22-AUG-78 02:02  PAGE 2-3

SYMBOL TABLE



CR    = 000015   	LF    = 000012   	VT    = 000013   	$GNVI   000102RG 	$SAVVR= ****** GX

FF    = 000014   	R$$11M= 000000   	$CVLOK  000000RG 	$LCKPG= ****** GX	$WRMPG= ****** GX

HT    = 000011   	SPA   = 000040   	$CVRL = ****** GX	$LNKVM  000016RG 	$$    = 000001



. ABS.	000000	   000

      	000134	   001

ERRORS DETECTED:  0



VIRTUAL MEMORY USED:  590 WORDS  ( 3 PAGES)

DYNAMIC MEMORY:  2772 WORDS  ( 10 PAGES)

ELAPSED TIME:  00:00:06

OBJ$:VMUTL,LIS$:VMUTL/-SP=SRC$:MACFLM,VMUTL

