Google
 

Trailing-Edge - PDP-10 Archives - BB-F494Z-DD_1986 - 10,7/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


	COMMENT	\
COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1984,1986.  ALL RIGHTS RESERVED.


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.

\
	SUBTTL	Version and Revision History

MAJVER==13	;MAJOR VERSION LEVEL
MINVER==0	;MINOR (MAINTENANCE RELEASE) LEVEL
CSTVER==0	;CUSTOMER VERSION (WHO LAST . . .)
EDTVER==1022	;EDIT LEVEL

%%MMNG==:<BYTE (3)CSTVER(9)MAJVER(6)MINVER(18)EDTVER>
%%SWIL==:%%SWIL	;SHOW (AND SYNCHRONIZE) SWIL VERSION

IF2,<	PURGE	CSTVER,MAJVER,MINVER,EDTVER>



;INITIAL CREATION

;1000	RDH	01-Jan-84
;	Incorporate into SWIL %12(1000), sync edit level at 1000.

;1022	LEO	09-Sep-85
;	Do Copyrights.

	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