Trailing-Edge
-
PDP-10 Archives
-
BB-X116A-BB_1984
-
swimem.mac
There are 4 other files named swimem.mac in the archive. Click here to see a list.
TITLE .MMNGR SWIL memory management routines
SUBTTL Robert Houk/RDH
SEARCH SWIDEF, SWIL ;SWIL PACKAGE DEFINITIONS
SEARCH JOBDAT, MACTEN, UUOSYM ;STANDARD DEFINITIONS
SALL ;PRETTY LISTINGS
.DIREC FLBLST ;PRETTIER LISTINGS
TWOSEG 400000
Copyright (C) Digital Equipment Corporation 1984.
COMMENT \
Copyright (C) 1984
Digital Equipment Corporation, Maynard, Massachusetts, U.S.A.
This software is furnished under a license and may be used and copied only
in accordance with the terms of such license and 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. No title to
and ownership of the software is hereby transferred.
The information in this software is subject to change without notice and
should not be construed as a commitment by Digital Equipment Corporation.
Digital assumes no responsibility for the use or reliability of its
software on equipment which is not supplied by Digital.
\
;SWIMEM VERSION IDENTIFICATION
MAJVER==1 ;MAJOR VERSION LEVEL
MINVER==0 ;MINOR (MAINTENANCE RELEASE) LEVEL
CSTVER==0 ;CUSTOMER VERSION (WHO LAST . . .)
EDTVER==0 ;EDIT LEVEL
%%LMEM==:<BYTE (3)CSTVER(9)MAJVER(6)MINVER(18)EDTVER>
IF2,< PURGE CSTVER,MAJVER,MINVER,EDTVER>
SUBTTL Revision history
SUBTTL Memory allocation
;CALL WITH DESIRED SIZE IN T1.
;RETURNS START ADDRESS IN T2 (T1 PRESERVED)
ENTRY .MMGWD
.MMGWD: PUSHJ P,TSAV11## ;PRESERVE T1
CAIG T1,0 ;*** CALLED FOR REASONABLE ACTIVITY?
STOPCD <MMGWD: 0-length allocation>
CAILE T1,17777 ;*** ASKING FOR [PROBABLY] TOO MUCH?
STOPCD <MMGWD: Excessive allocation>
HLRZ T2,.JBSA ;BASE VALUE OF ALLOCATION START
CAIL T2,.JBDA ;CAN'T BE BEFORE THE LOW SEG EVEN STARTS
CAILE T2,400000 ;AND SHOULD BE BEFORE 128K
STOPCD <MMGWD: .JBSA trashed>
CAMLE T2,.JBFF ;WITHIN REALM OF LIKELIHOOD?
STOPCD <MMGWD: .JBFF trashed>
MOVE T2,.JBFF ;ALLOCATION START ADDRESS
ADDB T1,.JBFF ;ALLOCATE THE SPACE
SUBI T1,1 ;(POINT TO LAST REAL ADDRESS)
CAMG T1,.JBREL ;ADDRESSABLE?
JRST MMGWD4 ;YES
MOVE M0,T1 ;NO, POSITION REQUEST TO PROTECT T1
CORE M0, ;NO, ASK MONITOR
POPJ P, ;OOPS
;HAVE MEMORY, INITIALIZE (ZERO) IT AND GIVE IT TO CALLER
MMGWD4: SETZM (T2) ;ZERO START OF MEMORY HUNK
HRLZ M0,T2 ;CONCOCT A
HRRI M0,1(T2) ; BLT POINTER
BLT M0,(T1) ;CLEAR OUT NEWLY-ALLOCATED MEMORY
JRST .POPJ1## ;SUCCESSFUL RETURN
SUBTTL Memory deallocation
;CALL WITH SIZE IN T1, START ADDRESS IN T2.
ENTRY .MMFWD
.MMFWD: PUSHJ P,TSAV13## ;NEED A T AC
CAIG T1,0 ;*** RETURNING SOMETHING?
STOPCD <MMFWD: 0-length deallocation>
CAILE T1,17777 ;*** RETURNING [PROBABLY] TOO MUCH
STOPCD <MMFWD: Excessive deallocation>
HLRZ T3,.JBSA ;BASE VALUE OF ALLOCATION START
CAIL T3,.JBDA ;CAN'T BE BEFORE THE LOW SEG EVEN STARTS
CAILE T3,400000 ;AND SHOULD BE BEFORE 128K
STOPCD <MMFWD: .JBSA trashed>
CAMLE T3,T2 ;DEALLOCATION LOOK GOOD?
STOPCD <MMFWD: Attempt to deallocate program memory>
CAMLE T2,.JBFF ;DOES THIS LOOK ALLOCATED?
STOPCD <MMFWD: Attempt to deallocate past .JBFF>
ADD T1,T2 ;POINT TO FIRST "FREE" PAST ALLOCATION
CAMN T1,.JBFF ;LAST THING IN MEMORY?
MOVEM T2,.JBFF ;YES, THEN WE CAN RECLAIM IT
JRST .POPJ1## ;HO HUM
END