

; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 1

; Digital Equipment Corporation

;

;	0001	MODULE ALLOCM (

;	0002			LANGUAGE (BLISS32),

;	0003			IDENT = 'X0001'

;	0004			) =

;	0005	BEGIN

;	0006	

;	0007	!

;	0008	! Copyright (c) 1977

;	0009	! Digital Equipment Corporation, Maynard, Massachusetts 01754

;	0010	!

;	0011	! This software is furnished  under a license for use only on a single

;	0012	! computer  system and  may be  copied only with  the inclusion of the

;	0013	! above copyright notice.  This software, or any other copies thereof,

;	0014	! may not be provided or  otherwise made available to any other person

;	0015	! except for use on such system and to one who agrees to these license

;	0016	! terms.  Title to and  ownership of the  software  shall at all times

;	0017	! remain in DEC.

;	0018	!

;	0019	! The information in this software is subject to change without notice

;	0020	! and should  not be construed  as a commitment  by Digital  Equipment

;	0021	! Corporation.

;	0022	!

;	0023	! DEC assumes  no  responsibility  for  the use or  reliability of its

;	0024	! software on equipment which is not supplied by DEC.

;	0025	

;	0026	!++

;	0027	!

;	0028	! FACILITY:  MOUNT Utility Structure Levels 1 & 2

;	0029	!

;	0030	! ABSTRACT:

;	0031	!

;	0032	!	This routine allocates dynamic memory from the selected allocation pool.

;	0033	!

;	0034	! ENVIRONMENT:

;	0035	!

;	0036	!	STARLET operating system, including privileged system services

;	0037	!	and internal exec routines.

;	0038	!

;	0039	!--

;	0040	!

;	0041	!

;	0042	! AUTHOR:  Andrew C. Goldstein,	 CREATION DATE:  19-Oct-1977 8:49

;	0043	!

;	0044	! REVISION HISTORY:

;	0045	!

;	0046	!**

;	0047	

;	0048	

;	0049	LIBRARY 'SYS$LIBRARY:LIB.L32';

;	0050	REQUIRE 'SRC$:MOUDEF.B32';

;	0357	REQUIRE 'LIBD$:[VMSLIB.OBJ]MOUNTMSG.B32';



; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 2

; Digital Equipment Corporation

;

;	0457	GLOBAL ROUTINE ALLOCATE_MEM (SIZE_NEEDED, AREA) =

;	0458	

;	0459	!++

;	0460	!

;	0461	! FUNCTIONAL DESCRIPTION:

;	0462	!

;	0463	!	This routine allocates dynamic memory from the selected allocation pool.

;	0464	!

;	0465	!

;	0466	! CALLING SEQUENCE:

;	0467	!	ALLOCATE_MEM (ARG1, ARG2)

;	0468	!

;	0469	! INPUT PARAMETERS:

;	0470	!	ARG1: size needed in bytes

;	0471	!	ARG2: code of area to allocate from:

;	0472	!		0 = non-paged system pool

;	0473	!		1 = paged system pool

;	0474	!		2 = process allocation region

;	0475	!

;	0476	! IMPLICIT INPUTS:

;	0477	!	NONE

;	0478	!

;	0479	! OUTPUT PARAMETERS:

;	0480	!	NONE

;	0481	!

;	0482	! IMPLICIT OUTPUTS:

;	0483	!	NONE

;	0484	!

;	0485	! ROUTINE VALUE:

;	0486	!	address of block allocated

;	0487	!

;	0488	! SIDE EFFECTS:

;	0489	!	memory allocated, zeroed, and size word inited

;	0490	!

;	0491	!--

;	0492	

;	0493	BEGIN

;	0494	

;	0495	LINKAGE

;	0496		EXE_ALLOC0	= JSB :

;	0497				NOPRESERVE (3, 4, 5)

;	0498				GLOBAL (SIZE = 1, ADDRESS = 2),

;	0499	

;	0500		EXE_ALLOC1	= JSB (REGISTER = 3) :

;	0501				NOPRESERVE (4, 5)

;	0502				GLOBAL (SIZE = 1, ADDRESS = 2);

;	0503	

;	0504	LOCAL

;	0505		STATUS,				! status return of allocator

;	0506		BLOCK_SIZE,			! local copy of size allocated

;	0507		BLOCK_ADDRESS	: REF VECTOR [,WORD]; ! local copy of address

;	0508	

;	0509	EXTERNAL

;	0510		CTL$GQ_ALLOCREG	: ADDRESSING_MODE (ABSOLUTE);

;	0511						! process allocation region listhead



; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 2-1

; Digital Equipment Corporation

;

;	0512	

;	0513	BEGIN					! nested block to avoid scope conflicts

;	0514	

;	0515	GLOBAL REGISTER

;	0516		SIZE		= 1,		! rounded up allocation size

;	0517		ADDRESS		= 2 : REF VECTOR [,WORD]; ! address returned by exec routines

;	0518	

;	0519	EXTERNAL ROUTINE

;	0520		EXE$ALONONPAGED	: EXE_ALLOC0 ADDRESSING_MODE (ABSOLUTE),

;	0521		EXE$ALOPAGED	: EXE_ALLOC0 ADDRESSING_MODE (ABSOLUTE),

;	0522		EXE$ALLOCATE	: EXE_ALLOC1 ADDRESSING_MODE (ABSOLUTE);

;	0523	

;	0524	

;	0525	! Simply compute the size needed rounded up to the next quadword and call the

;	0526	! appropriate exec allocation routine.

;	0527	!

;	0528	

;	0529	SIZE = .SIZE_NEEDED;

;	0530	

;	0531	STATUS = (

;	0532	CASE .AREA FROM 0 TO 2 OF

;	0533	SET

;	0534	    [0]:	EXE$ALONONPAGED ();

;	0535	    [1]:	EXE$ALOPAGED ();

;	0536	    [2]:	EXE$ALLOCATE (CTL$GQ_ALLOCREG);

;	0537	TES

;	0538	);

;	0539	

;	0540	! Copy the block size and address into locals to dodge the MOVC5.

;	0541	!

;	0542	

;	0543	BLOCK_SIZE = .SIZE;

;	0544	BLOCK_ADDRESS = .ADDRESS;

;	0545	END;

;	0546	

;	0547	IF NOT .STATUS THEN ERR_EXIT (SS$_INSFMEM);

;	0548	

;	0549	CH$FILL (0, .BLOCK_SIZE, .BLOCK_ADDRESS);

;	0550	BLOCK_ADDRESS[4] = .BLOCK_SIZE;

;	0551	RETURN .BLOCK_ADDRESS;

;	0552	

;	0553	END;					! end of routine ALLOCATE_MEM





							    .TITLE  ALLOCM

							    .IDENT  \X0001\



							    .GLOBL  CTL$GQ_ALLOCREG, EXE$ALONONPAGED, EXE$ALOPAGED

							    .GLOBL  EXE$ALLOCATE



							    .PSECT  $CODE$,NOWRT,2



					 0FFC 00000 	    .ENTRY  ALLOCATE_MEM, Save R2,R3,R4,R5,R6,R7,R8,R9,R10,R11	      ; 0457

		         51	  04   AC  D0 00002 	    MOVL    SIZE_NEEDED, SIZE					      ; 0529

	   02	         00	  08   AC  CF 00006 	    CASEL   AREA, #0, #2					      ; 0531



; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 2-2

; Digital Equipment Corporation

;

	 0016	       000E	     0006     0000B 1$:     .WORD   2$-1$,-						      ;

								    3$-1$,-						      ;

								    4$-1$						      ;

			    00000000G  9F  16 00011 2$:     JSB     @#EXE$ALONONPAGED					      ; 0534

				       15  11 00017 	    BRB     5$							      ;

			    00000000G  9F  16 00019 3$:     JSB     @#EXE$ALOPAGED					      ; 0535

				       0D  11 0001F 	    BRB     5$							      ;

		         53 00000000G  8F  D0 00021 4$:     MOVL    #CTL$GQ_ALLOCREG, R3				      ; 0536

			    00000000G  9F  16 00028 	    JSB     @#EXE$ALLOCATE					      ;

		         53	       50  D0 0002E 5$:     MOVL    R0, STATUS						      ;

		         57	       51  D0 00031 	    MOVL    SIZE, BLOCK_SIZE					      ; 0543

		         56	       52  D0 00034 	    MOVL    ADDRESS, BLOCK_ADDRESS				      ; 0544

		         0C	       53  E8 00037 	    BLBS    STATUS, 6$						      ; 0547

		         7E	0124   8F  3C 0003A 	    MOVZWL  #292, -(SP)						      ;

	      00000000G  00	       01  FB 0003F 	    CALLS   #1, LIB$STOP					      ;

	   00	         6E	       00  2C 00046 6$:     MOVC5   #0, (SP), #0, BLOCK_SIZE, (BLOCK_ADDRESS)		      ; 0549

		         66	       57     0004A									      ;

		    08   A6	       57  B0 0004C 	    MOVW    BLOCK_SIZE, 8(BLOCK_ADDRESS)			      ; 0550

		         50	       56  D0 00050 	    MOVL    BLOCK_ADDRESS, R0					      ; 0551

					   04 00053 	    RET     							      ; 0457



; Routine Size:  84 bytes







; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 3

; Digital Equipment Corporation

;

;	0554	GLOBAL ROUTINE DEALLOCATE_MEM (ADDRESS, AREA) : NOVALUE =

;	0555	

;	0556	!++

;	0557	!

;	0558	! FUNCTIONAL DESCRIPTION:

;	0559	!

;	0560	!	This routine deallocates dynamic memory to the selected allocation pool.

;	0561	!

;	0562	!

;	0563	! CALLING SEQUENCE:

;	0564	!	DEALLOCATE_MEM (ARG1, ARG2)

;	0565	!

;	0566	! INPUT PARAMETERS:

;	0567	!	ARG1: address of block to deallocate

;	0568	!	ARG2: code of area to deallocate to:

;	0569	!		0 = non-paged system pool

;	0570	!		1 = paged system pool

;	0571	!		2 = process allocation region

;	0572	!

;	0573	! IMPLICIT INPUTS:

;	0574	!	NONE

;	0575	!

;	0576	! OUTPUT PARAMETERS:

;	0577	!	NONE

;	0578	!

;	0579	! IMPLICIT OUTPUTS:

;	0580	!	NONE

;	0581	!

;	0582	! ROUTINE VALUE:

;	0583	!	NONE

;	0584	!

;	0585	! SIDE EFFECTS:

;	0586	!	memory deallocated

;	0587	!

;	0588	!--

;	0589	

;	0590	BEGIN

;	0591	

;	0592	MAP

;	0593		ADDRESS		: REF VECTOR [,WORD];

;	0594	

;	0595	LINKAGE

;	0596		EXE_DEALLOC0	= JSB (REGISTER = 0) :

;	0597				NOPRESERVE (2, 3, 4, 5),

;	0598	

;	0599		EXE_DEALLOC1	= JSB (REGISTER = 0, REGISTER = 1, REGISTER = 3) :

;	0600				NOPRESERVE (2, 4, 5);

;	0601	

;	0602	EXTERNAL

;	0603		CTL$GQ_ALLOCREG	: ADDRESSING_MODE (ABSOLUTE);

;	0604						! process allocation region listhead

;	0605	

;	0606	EXTERNAL ROUTINE

;	0607		EXE$DEANONPAGED	: EXE_DEALLOC0 ADDRESSING_MODE (ABSOLUTE),

;	0608		EXE$DEAPAGED	: EXE_DEALLOC0 ADDRESSING_MODE (ABSOLUTE),



; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 3-1

; Digital Equipment Corporation

;

;	0609		EXE$DEALLOCATE	: EXE_DEALLOC1 ADDRESSING_MODE (ABSOLUTE);

;	0610	

;	0611	

;	0612	! Just return the block to the appropriate area.

;	0613	!

;	0614	

;	0615	CASE .AREA FROM 0 TO 2 OF

;	0616	SET

;	0617	    [0]:	EXE$DEANONPAGED (ADDRESS[0]);

;	0618	    [1]:	EXE$DEAPAGED (ADDRESS[0]);

;	0619	    [2]:	EXE$DEALLOCATE (ADDRESS[0], .ADDRESS[4], CTL$GQ_ALLOCREG);

;	0620	TES;

;	0621	END;					! end of routine DEALLOCATE_MEM







							    .GLOBL  EXE$DEANONPAGED, EXE$DEAPAGED, EXE$DEALLOCATE



					 0FFC 00054 	    .ENTRY  DEALLOCATE_MEM, Save R2,R3,R4,R5,R6,R7,R8,R9,R10,R11      ; 0554

		         56	  04   AC  D0 00056 	    MOVL    ADDRESS, R6						      ; 0617

	   02	         00	  08   AC  CF 0005A 	    CASEL   AREA, #0, #2					      ; 0615

	 001A	       0010	     0006     0005F 1$:     .WORD   2$-1$,-						      ;

								    3$-1$,-						      ;

								    4$-1$						      ;

		         50	       56  D0 00065 2$:     MOVL    R6, R0						      ; 0617

			    00000000G  9F  16 00068 	    JSB     @#EXE$DEANONPAGED					      ;

					   04 0006E 	    RET     							      ; 0615

		         50	       56  D0 0006F 3$:     MOVL    R6, R0						      ; 0618

			    00000000G  9F  16 00072 	    JSB     @#EXE$DEAPAGED					      ;

					   04 00078 	    RET     							      ; 0615

		         50	       56  D0 00079 4$:     MOVL    R6, R0						      ; 0619

		         51	  08   A6  3C 0007C 	    MOVZWL  8(R6), R1						      ;

		         53 00000000G  8F  D0 00080 	    MOVL    #CTL$GQ_ALLOCREG, R3				      ;

			    00000000G  9F  16 00087 	    JSB     @#EXE$DEALLOCATE					      ;

					   04 0008D 	    RET     							      ; 0554



; Routine Size:  58 bytes





;	0622	

;	0623	END

;	0624	ELUDOM









							    .GLOBL  LIB$STOP



;				       PSECT SUMMARY

;

;	Name		 Bytes			       Attributes

;

;  $CODE$         	   142  NOWRT,  RD ,  EXE,NOSHR,  LCL,  REL,  CON,NOPIC,ALIGN(2)







; Bliss-32 7.352	Saturday 21-AUG-1978 23:48:56	DBB3:[MOUNT.SRC]ALLOCM.B32;8					Page 3-2

; Digital Equipment Corporation

;





;				LIBRARY STATISTICS

;

;					     -------- Symbols --------    Blocks

;	File				     Total    Loaded   Percent      Read

;

;  DBA4:[SYSLIB]LIB.L32;1		      5582         5         0       224











; Size:		142 code + 0 data bytes

; Run Time:	00:12.9

; Elapsed Time:	00:30.9

; Memory Used:	267 pages

; Compilation Complete

