.NLIST TOC,SYM .TITLE $ALVRT .SBTTL ULBLIB 022 - Allocate Virtual Storage .IDENT \V01.00\ .PSECT .LIBC. .ENABL LC,GBL ; Copyright (c) 1998 by Mentec, Inc., Nashua, NH. ; All rights reserved ; ; This software is furnished under a license for use only on a ; single computer system and may be copied only with the ; inclusion of the above copyright notice. This software, or ; any other copies thereof, may not be provided or otherwise ; made available to any other person except for use on such ; system and to one who agrees to these license terms. Title ; to and ownership of the software shall at all times remain ; in Mentec, Inc. ; ; The information in this document is subject to change without ; notice and should not be construed as a commitment by Digital ; Equipment Corporation, or Mentec, Inc. ; ; Digital and Mentec assume no responsibility for the use or ; reliability of its software on equipment which is not supplied ; by Digital or Mentec, and listed in the Software Product ; Description. ;+ ; $ALVRT ; This routine determines whether a page block of virtual storage can be ; allocated on the user's disk work file. If so, the $ALVRT routine ensures ; that an equal amount of memory storage is allocated, updates page control ; and address tables, and returns the disk and memory addresses of the ; allocated page blocks. ; ; R1 = the size of the request (<= 512.) ; ; CALL $ALVRT ; ; R0 = memory address of the allocated page block ; R1 = disk address of the allocated page block ; R2 = random ; ; On error, user routine $ERMSG is entered with E$R76 in R1 ; No return. ;- $ALVRT:: JSR R5,$SAVRG ;Save non-volatile registers CALL $RQVCB ;Request virtual core block BCS 4$ ;Branch if no virtual space left MOV R1,R5 ;Save virtual address SWAB R5 ;Put relative block in low byte TSTB R1 ;Is request on block boundry? BNE 2$ ;Branch if not block already exists MOV #P$GSIZ,R1 ;R1 = size of a page CALL $ALBLK ;Allocate storage space MOV $PAGLS,R2 ;Get address of page list BEQ 1$ ;Branch if none CLR R1 ;Set for MOVB without extend BISB R5,R1 ;Get relative block number ASL R1 ;Convert to word offset ADD R1,R2 ;Compute address in list MOV R0,@R2 ;Store address 1$: MOV $PAGHD,@R0 ;Link old first to new first MOV R0,$PAGHD ;Set new first MOVB R5,P$GBLK(R0) ;Set relative block number of page MOV R5,R1 ;Restore swapped virtual address SWAB R1 ;Straighten it 2$: CALL $CVRL ;Convert to real address 3$: JMP $WRMPG ;Write-mark page; Return from there 4$: MOV #E$R76,R1 ;Indicate failure CLR R2 ;Set dummy parameter block address JMP $ERMSG ;Call user error message routine (no return) .END