ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   1

A0001                                                                                                                            (1)



                                     0000     1 	.TITLE	ALLOCB - ALLOCATE DYNAMIC MEMORY

                                     0000     2 	.IDENT	"A0001"

                                     0000     3 

                                     0000     4 ;

                                     0000     5 ; COPYRIGHT (C) 1976

                                     0000     6 ; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS 01754

                                     0000     7 ;

                                     0000     8 ; THIS SOFTWARE IS FURNISHED  UNDER A LICENSE FOR USE ONLY ON A SINGLE

                                     0000     9 ; COMPUTER  SYSTEM AND  MAY BE  COPIED ONLY WITH  THE INCLUSION OF THE

                                     0000    10 ; ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE, OR ANY OTHER COPIES THEREOF,

                                     0000    11 ; MAY NOT BE PROVIDED OR  OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON

                                     0000    12 ; EXCEPT FOR USE ON SUCH SYSTEM AND TO ONE WHO AGREES TO THESE LICENSE

                                     0000    13 ; TERMS.  TITLE TO AND  OWNERSHIP OF THE  SOFTWARE  SHALL AT ALL TIMES

                                     0000    14 ; REMAIN IN DEC.

                                     0000    15 ;

                                     0000    16 ; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE

                                     0000    17 ; AND SHOULD  NOT BE CONSTRUED  AS A COMMITMENT  BY DIGITAL  EQUIPMENT

                                     0000    18 ; CORPORATION.

                                     0000    19 ;

                                     0000    20 ; DEC ASSUMES  NO  RESPONSIBILITY  FOR  THE USE OR  RELIABILITY OF ITS

                                     0000    21 ; SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DEC.

                                     0000    22 

                                     0000    23 ;++

                                     0000    24 ;

                                     0000    25 ; FACILITY:  MTAACP

                                     0000    26 ;

                                     0000    27 ; ABSTRACT:

                                     0000    28 ;

                                     0000    29 ;	THESE ROUTINES ALLOCATE AND DEALLOCATE SYSTEM NON-PAGED

                                     0000    30 ;	DYNAMIC MEMORY FOR ACP CONTROL BLOCKS.

                                     0000    31 ;

                                     0000    32 ; ENVIRONMENT:

                                     0000    33 ;

                                     0000    34 ;	STARLET OPERATING SYSTEM, INCLUDING PRIVILEGED SYSTEM SERVICES

                                     0000    35 ;	AND INTERNAL EXEC ROUTINES. NOTE THAT THIS ROUTINE MUST BE

                                     0000    36 ;	CALLED IN KERNEL MODE.

                                     0000    37 ;

                                     0000    38 ; AUTHOR:  ANDREW C. GOLDSTEIN, CREATION DATE:  14-DEC-1976  16:25

                                     0000    39 ;

                                     0000    40 ; MODIFIED BY:

                                     0000    41 ;

                                     0000    42 ; DEBORAH H. GILLESPIE, VERSION X0003  , 09-JUL-1977 15:00

                                     0000    43 ; X0003	- ADD MTAACP CONTROL BLOCKS

                                     0000    44  

                                     0000    45 ; DEBORAH H. GILLESPIE, VERSION A0001  , 11-MAY-1978 15:00

                                     0000    46 ; A0003 - remove block type codes

                                     0000    47 ;--

                                     0000    48 

                                     0000    49 ;

                                     0000    50 ; INCLUDE FILES:

                                     0000    51 ;

                                     0000    52 

                                     0000    53 ;

                                     0000    54 ; EQUATED SYMBOLS:

                                     0000    55 ;

                                     0000    56 ; ARG LIST OFFSETS

                                     0000    57 ;

ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   2

A0001                                                                                                                            (1)



                           00000004  0000    58 BYTES	= 4				; BYTE COUNT DESIRED

                           00000004  0000    59 ADDRESS	= 4				; ADDRESS OF BLOCK BEING DEALLOCATED

                                     0000    60 

                                     0000    61 	$IPLDEF				; DEFINE SYSTEM IPL NAMES

                                     0000    62 	$PRDEF				; DEFINE PROCESSOR REGISTER NAMES

                                     0000    63 	$RSNDEF				; DEFINE RESOURCE NAMES

                                     0000    64 	$WCBDEF				; DEFINE WINDOW BLOCK FORMAT

                                     0000    65 					; USED ONLY FOR TAGS TO THE BLOCK TYPE

                                     0000    66 					; AND SIZE FIELDS

                                     0000    67 

                                 00000000    68 	.PSECT	$LOCKEDC1$,NOWRT,LONG

                                     0000    69 ;

                                     0000    70 ; OWN STORAGE:

                                     0000    71 ;

                                     0000    72 

                                     0000    73 	.ALIGN	2

ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   3

A0001                                                                                                                            (2)



                                     0000    75 ;++

                                     0000    76 ;

                                     0000    77 ; FUNCTIONAL DESCRIPTION:

                                     0000    78 ;

                                     0000    79 ; THIS ROUTINE ALLOCATES THE REQUESTED BLOCK SIZE FROM SYSTEM

                                     0000    80 ; NON-PAGED DYNAMIC MEMORY. THE BLOCK IS CLEARED, AND THE STANDARD

                                     0000    81 ; SIZE.

                                     0000    82 ;

                                     0000    83 ; CALLING SEQUENCE:

                                     0000    84 ;	CALL	ALLOCATE (ARG1)

                                     0000    85 ;

                                     0000    86 ; INPUT PARAMETERS:

                                     0000    87 ;	ARG1: NUMBER OF BYTES TO ALLOCATE

                                     0000    88 ;

                                     0000    89 ; IMPLICIT INPUTS:

                                     0000    90 ;	NONE

                                     0000    91 ;

                                     0000    92 ; OUTPUT PARAMETERS:

                                     0000    93 ;	NONE

                                     0000    94 ;

                                     0000    95 ; IMPLICIT OUTPUTS:

                                     0000    96 ;	NONE

                                     0000    97 ;

                                     0000    98 ; ROUTINE VALUE:

                                     0000    99 ;	ADDRESS OF BLOCK

                                     0000   100 ;

                                     0000   101 ; SIDE EFFECTS:

                                     0000   102 ;	BLOCK ALLOCATED

                                     0000   103 ;

                                     0000   104 ;--

                                     0000   105 

                                     0000   106 ALLOCATE::

                               003C  0000   107 	.WORD	^M<R2,R3,R4,R5>		; SAVE THE USUAL REGISTERS

            51         04 AC     D0  0002   108 10$:	MOVL	BYTES(AP),R1		; GET SIZE ARGUMENT

                          7E     DC  0006   109 	MOVPSL	-(SP)			; SAVE THE PSL FOR WAIT CALL BELOW

                                     0008   110 	DSBINT	#IPL$_SYNCH,R2		; RAISE IPL TO SYNCHRONIZE

                 00000000'9F     16  000E   111 	JSB	@#EXE$ALONONPAGED	; GET BLOCK FROM EXEC

            16            50     E9  0014   112 	BLBC	R0,20$			; BRANCH ON FAILURE

                                     0017   113 	ENBINT	#0			; RESTORE IPL

                                     001A   114 					; CLEAN PSL OFF STACK AND

            6E            51     D0  001A   115 	MOVL	R1,(SP)			; SAVE RETURNED BYTE COUNT

                          52     DD  001D   116 	PUSHL	R2			; AND ADDRESS

            62            00     2C  001F   117 	MOVC5	#0,(R2),#0,R1,(R2)	; ZERO OUT THE BLOCK

            51            00         0022       

                          62         0024       

                                     0025   118 

            50            8E     D0  0025   119 	MOVL	(SP)+,R0		; GET BLOCK ADDRESS

         08 A0            8E     F7  0028   120 	CVTLW	(SP)+,WCB$W_SIZE(R0)	; PUT IN SIZE WORD

                                 04  002C   121 	RET				; AND RETURN

                                     002D   122 ;

                                     002D   123 ; WE GET HERE IF MEMORY IS NOT AVAILABLE

                                     002D   124 ;

            50            03     3C  002D   125 20$:	MOVZWL	#RSN$_NPDYNMEM,R0	; GET APPROPRIATE RESOURCE CODE

            54   00000000'9F     D0  0030   126 	MOVL	@#SCH$GL_CURPCB,R4	; AND PROCESS PCB ADDRESS

                 00000000'9F     16  0037   127 	JSB	@#SCH$RWAIT		; AND WAIT FOR POOL TO APPEAR

                          C3     11  003D   128 	BRB	10$			; TRY AGAIN

ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   4

A0001                                                                                                                            (3)



                                     003F   130 ;++

                                     003F   131 ;

                                     003F   132 ; FUNCTIONAL DESCRIPTION:

                                     003F   133 ;

                                     003F   134 ;	THIS ROUTINE DEALLOCATES THE INDICATED BLOCK OF MEMORY BACK

                                     003F   135 ;	TO THE SYSTEM POOL OF NON-PAGED DYNAMIC MEMORY.

                                     003F   136 ;

                                     003F   137 ; CALLING SEQUENCE:

                                     003F   138 ;	CALL	DEALLOCATE (ARG1)

                                     003F   139 ;

                                     003F   140 ; INPUT PARAMETERS:

                                     003F   141 ;	ARG1: ADDRESS OF BLOCK BEING DEALLOCATED

                                     003F   142 ;

                                     003F   143 ; IMPLICIT INPUTS:

                                     003F   144 ;	NONE

                                     003F   145 ;

                                     003F   146 ; OUTPUT PARAMETERS:

                                     003F   147 ;	NONE

                                     003F   148 ;

                                     003F   149 ; IMPLICIT OUTPUTS:

                                     003F   150 ;	NONE

                                     003F   151 ;

                                     003F   152 ; ROUTINE VALUE:

                                     003F   153 ;	NONE

                                     003F   154 ;

                                     003F   155 ; SIDE EFFECTS:

                                     003F   156 ;	BLOCK DEALLOCATED

                                     003F   157 ;

                                     003F   158 ;--

                                     003F   159 

                                     003F   160 DEALLOCATE::

                               003C  003F   161 	.WORD	^M<R2,R3,R4,R5>		; SAVE REGISTERS

            50         04 AC     D0  0041   162 	MOVL	ADDRESS(AP),R0		; GET ADDRESS OF BLOCK

            51         08 A0     3C  0045   163 	MOVZWL	WCB$W_SIZE(R0),R1	; GET BLOCK SIZE

                                     0049   164 	DSBINT	#IPL$_SYNCH,R2		; RAISE IPL TO SYNCHRONIZE

                 00000000'9F     16  004F   165 	JSB	@#EXE$DEANONPAGED	; AND DEALLOCATE THRU EXEC

                                     0055   166 	ENBINT	#0			; RESTORE IPL

                                 04  0058   167 	RET

                                     0059   168 

                                     0059   169 

                                     0059   170 

                                     0059   171 	.END

ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   5

SYMBOL TABLE                                                                                                                     (3)



ADDRESS        = 00000004            PR$_TXDB       = 00000023            WCB_TYPE       = 00000001            

ALLOCATE         00000000 RG    03   PR$_USP        = 00000003            

AQB_TYPE       = 00000005            PR$_WCSA       = 0000002C            

BIT...         = 0000000C            PR$_WCSD       = 0000002D            

BYTES          = 00000004            RSN$_ASTWAIT   = 00000001            

DEALLOCATE       0000003F RG    03   RSN$_BRKTHRU   = 00000006            

EXE$ALONONPAGED  ********   X   03   RSN$_IACLOCK   = 00000007            

EXE$DEANONPAGED  ********   X   03   RSN$_MAILBOX   = 00000002            

FCB_TYPE       = 00000000            RSN$_NPDYNMEM  = 00000003            

GBL...         = 00000000            RSN$_PGDYNMEM  = 00000005            

IPL$_ASTDEL    = 00000002            RSN$_PGFILE    = 00000004            

IPL$_HWCLK     = 00000018            RVT_TYPE       = 00000003            

IPL$_IOPOST    = 00000004            SCH$GL_CURPCB    ********   X   03   

IPL$_MAILBOX   = 0000000B            SCH$RWAIT        ********   X   03   

IPL$_POWER     = 0000001F            VCB_TYPE       = 00000002            

IPL$_QUEUEAST  = 00000006            WCB$B_ACCESS     0000000B            

IPL$_SCHED     = 00000003            WCB$B_TYPE       0000000A            

IPL$_SYNCH     = 00000007            WCB$C_LENGTH     00000024            

IPL$_TIMER     = 00000007            WCB$C_MAP        00000024            

MVL_TYPE       = 00000004            WCB$K_LENGTH     00000024            

PR$_ACCR       = 00000029            WCB$K_MAP        00000024            

PR$_ACCS       = 00000028            WCB$L_FCB        00000018            

PR$_ASTLVL     = 00000013            WCB$L_LBN        00000002            

PR$_ESP        = 00000001            WCB$L_ORGUCB     00000010            

PR$_ICCS       = 00000018            WCB$L_P1_LBN     00000026            

PR$_ICR        = 0000001A            WCB$L_P2_LBN     0000002C            

PR$_IPL        = 00000012            WCB$L_PID        0000000C            

PR$_ISP        = 00000004            WCB$L_PREVLBN    FFFFFFFC            

PR$_KSP        = 00000000            WCB$L_RVT        0000001C            

PR$_MAPEN      = 00000038            WCB$L_STVBN      00000020            

PR$_NICR       = 00000019            WCB$L_WLBL       00000004            

PR$_P0BR       = 00000008            WCB$L_WLFL       00000000            

PR$_P0LR       = 00000009            WCB$M_NOTFCP   = 00000004            

PR$_P1BR       = 0000000A            WCB$M_READ     = 00000001            

PR$_P1LR       = 0000000B            WCB$M_SHRWCB   = 00000008            

PR$_PCBB       = 00000010            WCB$M_WRITE    = 00000002            

PR$_PME        = 0000003D            WCB$V_DLOCK    = 00000001            

PR$_RXCS       = 00000020            WCB$V_NOREAD   = 0000000A            

PR$_RXDB       = 00000021            WCB$V_NOTFCP   = 00000002            

PR$_SBIER      = 00000034            WCB$V_NOTRUNC  = 0000000B            

PR$_SBIFS      = 00000030            WCB$V_NOWRITE  = 00000000            

PR$_SBIMT      = 00000033            WCB$V_READ     = 00000000            

PR$_SBIQC      = 00000036            WCB$V_READCK   = 00000009            

PR$_SBIS       = 00000031            WCB$V_SEQONLY  = 00000006            

PR$_SBISC      = 00000032            WCB$V_SHRWCB   = 00000003            

PR$_SBITA      = 00000035            WCB$V_SPOOL    = 00000004            

PR$_SBR        = 0000000C            WCB$V_WRITE    = 00000001            

PR$_SCBB       = 00000011            WCB$V_WRITEAC  = 00000008            

PR$_SID        = 0000003E            WCB$V_WRITECK  = 00000005            

PR$_SIRR       = 00000014            WCB$W_ACON       00000014            

PR$_SISR       = 00000015            WCB$W_COUNT      00000000            

PR$_SLR        = 0000000D            WCB$W_NMAP       00000016            

PR$_SSP        = 00000002            WCB$W_P1_COUNT   00000024            

PR$_TBIA       = 00000039            WCB$W_P2_COUNT   0000002A            

PR$_TBIS       = 0000003A            WCB$W_PREVCOUNT  FFFFFFFA            

PR$_TODR       = 0000001B            WCB$W_REFCNT     0000000E            

PR$_TXCS       = 00000022            WCB$W_SIZE       00000008            

ALLOCB          - ALLOCATE DYNAMIC MEMORY                        21-AUG-1978 23:23:39   VAX-11 MACRO X0.3-11               Page   6

PROGRAM SECTION SYNOPSIS                                                                                                         (3)







PROGRAM SECTION SYNOPSIS



.  ABS  .        00000000      00     NOPIC   USR   CON   ABS   LCL NOSHR NOEXE NORD  NOWRT BYTE  

. BLANK .        00000000      01     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD    WRT BYTE  

$ABS$            FFFFFFFC      02     NOPIC   USR   CON   ABS   LCL NOSHR   EXE   RD    WRT BYTE  

$LOCKEDC1$       00000059      03     NOPIC   USR   CON   REL   LCL NOSHR   EXE   RD  NOWRT LONG  





THERE WERE NO ERRORS OR WARNINGS.

21600. BYTES LEFT IN FREE MEMORY POOL.

1020. BYTES OF RECLAIMED MEMORY.

OBJ$:ALLOCB,LIS$:ALLOCB/-SP=EXECML$/ML,SRC$:MTADEF,ALLOCB

2 MLB DIR RDS - 259 GETS TO DEFINE 15 MACROS. 14 INTER. FILE WRITES. 

