Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/nmumem.lst
There are no other files named nmumem.lst in the archive.
24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 1
3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (1)
; 0001 ! <BRANDT.DEVELOPMENT>NMUMEM.BLI.1 2-Sep-82 11:41:23, Edit by BRANDT
; 0002 !
; 0003 ! Ident 18.
; 0004 ! Change TASK_ERRORS in MEMORY_GET to PROGRAM_ERRORS so NML dies
; 0005 ! rather than trying to limp along. This change is useful for the
; 0006 ! MCB environment where a sick NML is difficult to detect.
; 0007 !
; 0008 ! NET:<BRANDT.DEVELOPMENT>NMUMEM.BLI.1 21-Jun-82 13:14:32, Edit by BRANDT
; 0009 !
; 0010 ! Ident 17.
; 0011 ! Change "terminator" so that it is an "addressable unit"
; 0012 !
; 0013 ! NET:<BRANDT.DEVELOPMENT>NMUMEM.BLI.1 9-Jun-82 16:12:32, Edit by BRANDT
; 0014 !
; 0015 ! Ident 16.
; 0016 ! 1) Add a new field MB_LIMIT to the MEMORY_BLOCK. This field
; 0017 ! contains the address of the unit beyond the last unit requested
; 0018 ! by the user. This "terminator" is initialized to a special
; 0019 ! value in MEMORY_GET and verified in MEMORY_RELEASE.
; 0020 ! 2) Add information to error message that reports an inconsistency
; 0021 ! in the memory database during MEMORY_RELEASE.
; 0022 ! This is now a fatal program error.
; 0023 !
; 0024 ! NET:<BRANDT.DEVELOPMENT>NMUMEM.BLI.1 9-Jun-82 10:21:38, Edit by BRANDT
; 0025 !
; 0026 ! Ident 15.
; 0027 ! Interlock critical regions from interrupts since these routines
; 0028 ! can be called at interrupt level, and it is possible that the memory
; 0029 ! database is being modified when the interrupt occurs. When the
; 0030 ! database is being modified, the semaphore for the memory list will
; 0031 ! be locked (not -1). No processing can take place on a memory list
; 0032 ! until its semaphore is unlocked. If the interrupt routine needs
; 0033 ! that particular memory list, we loop forever waiting for the unlock.
; 0034 !
; 0035 ! NET:<PECKHAM.DEVELOPMENT>NMUMEM.BLI.8 17-Feb-82 17:06:38, Edit by PECKHAM
; 0036 !
; 0037 ! Ident 14.
; 0038 ! Fix ambitious memory clear in MEMORY_GET.
; 0039 ! Add globals to own variables for MCBDA access.
; 0040 !
; 0041 ! NET:<PECKHAM.DEVELOPMENT>NMUMEM.BLI.3 17-Feb-82 11:02:11, Edit by PECKHAM
; 0042 !
; 0043 ! Ident 13.
; 0044 ! Change reference from MEMTOP back to MEMSIZE.
; 0045 !
; 0046 ! NET:<PECKHAM.DEVELOPMENT>NMUMEM.BLI.7 17-Feb-82 09:20:05, Edit by PECKHAM
; 0047 !
; 0048 ! Ident 12.
; 0049 ! Add MB_* variables to data structure.
; 0050 ! Optimize header data structure.
; 0051 ! Make sure all address comparisons use address comparison operators.
; 0052 ! Save task name and allocation length on MEMORY_GET and
24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 2
3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (1)
; 0053 ! verify release length on MEMORY_RELEASE.
; 0054 ! Change MEMSIZE reference to MEMTOP.
; 0055 !
; 0056 ! NET:<PECKHAM.DEVELOPMENT>NMUMEM.BLI.2 5-Feb-82 09:02:03, Edit by GROSSMAN
; 0057 ! for PECKHAM
; 0058 ! Ident 11.
; 0059 ! Add code to NMU$MEMORY_GET to complain when memory cannot be gotten. This
; 0060 ! is to help us find TASKs that blindly expect memory_get to always work.
; 0061 !
; 0062 ! NET:<PECKHAM.DEVELOPMENT>NMUMEM.BLI.2 4-Feb-82 08:44:00, Edit by PECKHAM
; 0063 !
; 0064 ! Ident 10.
; 0065 ! Fix loop limit in NMU$MEMORY_RESET to use INDEX_LIMIT instead of SIZEINDEX.
; 0066 !
; 0067 ! NET:<GROSSMAN>NMUMEM.BLI.2 3-Dec-81 03:30:34, Edit by GROSSMAN
; 0068 !
; 0069 ! Put a $TOPS10 conditional around the UNDECLARE of POINTR in order to
; 0070 ! prevent a nasty message from being printed out while doing TOPS20
; 0071 ! compilations.
; 0072 !
; 0073 ! 14-Nov-81 19:43:45, Edit by GROSSMAN
; 0074 !
; 0075 ! Make changes so that this module compiles correctly under Tops-10.
; 0076 ! Undefine the macro POINTR which gets defined in TENDEF.R36, and remove
; 0077 ! the COMMON bliss attribute in the MODULE statement. This module is not
; 0078 ! common bliss under Tops-10 becase the CORE_GET macro includes a CORE
; 0079 ! UUO under Tops-10.
; 0080 !
; 0081 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.15 30-Apr-81 14:58:17, Edit by GUNN
; 0082 !
; 0083 ! Fix bug in BUDDY_ADDRESS routine. Buddy index for a right self block
; 0084 ! was being calculated incorrectly.
; 0085 !
; 0086 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.14 30-Apr-81 12:05:22, Edit by GUNN
; 0087 !
; 0088 ! Change debug output to use both MEMORY_TRACE and MEMORY_CONSISTENCY.
; 0089 !
; 0090 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.6 27-Apr-81 17:04:48, Edit by GUNN
; 0091 !
; 0092 ! Add debug output for buddy calculations and pairings.
; 0093 !
; 0094 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.5 27-Apr-81 11:09:39, Edit by GUNN
; 0095 !
; 0096 ! Check to make sure block being released is actually allocated.
; 0097 ! Check status of queue extraction of buddy when releasing a block
; 0098 ! to ensure against internal corruption of free list.
; 0099 !
; 0100 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.4 24-Apr-81 14:33:17, Edit by GUNN
; 0101 !
; 0102 ! Set TAG to AVAILABLE in block being released when there is no buddy.
; 0103 !
; 0104 ! Debugging extensions to memory block header caused polynomial to become
24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 3
3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (1)
; 0105 ! invalidated; comment out the extra fields for now.
; 0106 !
; 0107 ! Update copyright date to 1981.
; 0108 !
; 0109 ! NET:<DECNET20-V3P1.BASELEVEL-2.SOURCES>NMUMEM.BLI.11 25-Mar-81 11:14:21, Edit by SROBINSON
; 0110 ! Make incr be unsigned for zeroing memory
; 0111 ! <DECNET20-V3P1.BASELEVEL-2.MCB>NMUMEM.BLI.2 16-Mar-81 11:08:25, Edit by SROBINSON
; 0112 ! Ensure Address Comparisons are Unsigned
; 0113 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.2 10-Mar-81 10:54:24, Edit by JENNESS
; 0114 ! Add code to improve debuggability and robustness in development.
; 0115 ! NET:<DECNET20-V3P1.NMU>NMUMEM.BLI.3 3-Feb-81 10:10:08, Edit by JENNESS
; 0116 ! Move memory block definition back into this module for ease of reading.
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 4
3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (2)
; 0117 module NMUMEM ( !Storage Management Module
; 0118 ident = 'X00.18'
; 0119 ) =
; 0120 begin
; 0121 !
; 0122 ! COPYRIGHT (c) 1980, 1981, 1982
; 0123 ! DIGITAL EQUIPMENT CORPORATION
; 0124 ! Maynard, Massachusetts
; 0125 !
; 0126 ! This software is furnished under a license and may be used
; 0127 ! and copied only in accordance with the terms of such license
; 0128 ! and with the inclusion of the above copyright notice. This
; 0129 ! software or any other copies thereof may not be provided or
; 0130 ! otherwise made available to any other person. No title to
; 0131 ! and ownership of the software is hereby transferred.
; 0132 !
; 0133 ! The information in this software is subject to change
; 0134 ! without notice and should not be construed as a commitment
; 0135 ! by DIGITAL EQUIPMENT CORPORATION.
; 0136 !
; 0137 ! DIGITAL assumes no responsibility for the use or reliability
; 0138 ! of its software on equipment which is not supplied by
; 0139 ! DIGITAL.
; 0140 !
; 0141
; 0142 !++
; 0143 ! Facility: LSG DECnet Network Management
; 0144 !
; 0145 ! Abstract:
; 0146 !
; 0147 ! This module offers the storage management functions used for
; 0148 ! dynamic memory allocation. The alogrithm employed is based upon
; 0149 ! the article "Buddy Systems" by James L. Peterson and Theodore
; 0150 ! A. Norman published in Communications of the ACM Volume 20,
; 0151 ! Number 6 - June 1977.
; 0152 !
; 0153 ! Environment: TOPS10 and TOPS20 user mode, MCB RSX task mode
; 0154 !
; 0155 ! Author: Scott G. Robinson, Creation date: 13-DEC-78
; 0156 !
; 0157 ! Modified by:
; 0158 !
; 0159 ! Scott G. Robinson, 15-JUL-79 : Version X00.01
; 0160 ! - Convert to XPORT interfaces and make transportable.
; 0161 ! Steven M. Jenness, 21-Feb-80 : Version X00.02
; 0162 ! - Change to conform to NM coding standards and needs.
; 0163 !
; 0164 !--
; 0165 !<BLF/PAGE>
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 5
X00.18 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (3)
; 0166
; 0167 !
; 0168 ! Include files
; 0169 !
; 0170
; 0171 library 'NMULIB'; ! All required definitions
; 0172
; 0173 !
; 0174 ! Undefine TENDEFs POINTR macro
; 0175 !
; 0176
; U 0177 %if $TOPS10 %then
; U 0178 undeclare %quote POINTR;
; 0179 %fi
; 0180
; 0181 !
; 0182 ! Global routines
; 0183 !
; 0184
; 0185 forward routine
; 0186 NMU$MEMORY_MANAGER; ! Define global entry points
; 0187
; 0188 !
; 0189 ! Local routines
; 0190 !
; 0191
; 0192 forward routine
; 0193 BUDDY_ADDRESS; ! Calculate buddy address of memory block
; 0194
; 0195 !
; 0196 ! Memory block format
; 0197 !
; 0198 ! macro: MEMORY_BLOCK Defines header for memory block
; 0199 !
; 0200
; L 0201 %if not $MCB
; U 0202 %then macro $index = $tiny_integer %;
; 0203 %else macro $index = $short_integer %;
; 0204 %fi
; 0205
; 0206 $field
; 0207 MEMORY_BLOCK_FIELDS =
; 0208 set
; 0209 QUEUE_INFO = [$sub_block (Q_HEADER_SIZE)], ! Storage list queue linkages
; 0210 INDEX = [$index], ! The SIZEINDEX for this block
; 0211 TAG = [$bit], ! Indicates ALLOCATED or AVAILABLE
; 0212 SELF = [$bit], ! Indicates LEFT or RIGHT Buddy
; 0213 PARENT = [$bit], ! Indicates LEFT or RIGHT of The Parent
; 0214 $align (FULLWORD)
; 0215 MB_TASK = [$address], ! Address of allocating task
; 0216 MB_LIMIT = [$address], ! Address of last unit of memory block
; 0217 MB_ALLOCATION = [$short_integer], ! Number of addressable units
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 6
X00.18 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (3)
; 0218 $align (FULLWORD)
; 0219 DATA = [$sub_block (0)] ! Start of useable data portion
; 0220 tes;
; 0221
; 0222 literal
; 0223 MB_LENGTH = $field_set_size,
; 0224 ALLOC_OVERHEAD = $field_set_units + 1; ! The length of the block header
; 0225 ! plus the terminator
; 0226
; 0227 macro
; 0228 MEMORY_BLOCK = BLOCK [MB_LENGTH] FIELD (MEMORY_BLOCK_FIELDS)%;
; 0229
; 0230 literal
; 0231 TERMINATOR = ! Value for limit word
; L 0232 %if $MCB ! of memory block
; 0233 %then
; 0234 %O'125'; ! 8 bit value for MCB
; U 0235 %else
; U 0236 %O'252525252525'; ! 36 bit value for KL
; 0237 %fi
; 0238
; 0239 literal
; 0240 AVAILABLE = 0, ! Values for TAG field
; 0241 ALLOCATED = 1;
; 0242
; 0243 literal
; 0244 LEFT = 0, ! Values for SELF and PARENT
; 0245 RIGHT = 1;
; 0246
; 0247 !
; 0248
; 0249 literal
; 0250 SIZEINDEX = 29, ! Number of Buddy Slots
; 0251 INDEX_LIMIT = SIZEINDEX - 1; ! Number of elements to search
; 0252
; 0253 !
; 0254 ! Own storage
; 0255 !
; 0256
; 0257 macro
; M 0258 SIZE_INIT =
; M 0259 0,0,4,4,4,8,12,16,24,36,52,76,112,164,240,352,
; M 0260 516,756,1108,1624,2380,3488,5112,7492,10980,16092,
; 0261 23584,34564,50656 %,
; 0262
; M 0263 BUDDY_INDEX_INIT =
; M 0264 0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
; 0265 18,19,20,21,22,23,24,25 %;
; 0266
; 0267 $field
; 0268 ASL_FIELD =
; 0269 set
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 7
X00.18 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (3)
; 0270 ASL_QUEUE = [$sub_block (Q_HEADER_SIZE)]
; 0271 tes;
; 0272
; 0273 $literal
; 0274 ASL_FIELD_SIZE = $field_set_size;
; 0275
; 0276 own
; 0277 SIZE : vector [SIZEINDEX] INITIAL (SIZE_INIT),
; 0278 BUDDY_INDEX : vector [SIZEINDEX] INITIAL (BUDDY_INDEX_INIT),
; 0279 ASL_LST : blockvector [SIZEINDEX, ASL_FIELD_SIZE] field (ASL_FIELD);
; 0280
; 0281 global bind
; 0282 BLKSIZ = SIZE,
; 0283 BLKBDY = BUDDY_INDEX,
; 0284 BLKLST = ASL_LST;
; 0285
; 0286 !
; 0287 ! External references
; 0288 !
; 0289
; 0290 external routine
; 0291 NMU$QUEUE_MANAGER; ! Queue management routines
; 0292
; 0293 !
; 0294 ! Definitions used when debugging
; 0295 !
; 0296
; 0297 external
; 0298 %debug_data_base;
; 0299
; 0300 %module_name ('NMUMEM');
; 0301
; 0302 !<BLF/SYNONYM %UNQUOTE =>
; 0303
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 8
X00.18 NMU$MEMORY_RESET as UM_RESET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (4)
; 0304 %global_routine ('NMU$MEMORY_RESET') : novalue =
; 0305
; 0306 !++
; 0307 ! Functional description:
; 0308 !
; 0309 ! This routine resets the free pool data base to empty.
; 0310 !
; 0311 ! Formal parameters: none
; 0312 !
; 0313 ! Routine value: none
; 0314 ! Side effects:
; 0315 !
; 0316 ! All queues on the ASL_LST are cleared.
; 0317 !
; 0318 !--
; 0319
; 0320 begin
; 0321
; 0322 local
; 0323 ASL : ref block field (ASL_FIELD);
; 0324
; P 0325 %debug (MEMORY_CONSISTENCY,
; 0326 (TRACE_INFO ('Available storage list reset')));
; 0327
; 0328 ASL = ASL_LST [0, ASL_QUEUE];
; 0329
; 0330 INTERRUPT_OFF; ! Disable interrupts
; 0331
; 0332 decru COUNT from SIZEINDEX to 1 do
; 0333 begin
; 0334 NMU$QUEUE_RESET (ASL [ASL_QUEUE]);
; 0335 ASL = vector [ASL [ASL_QUEUE], ASL_FIELD_SIZE];
; 0336 end;
; 0337
; 0338 INTERRUPT_ON; ! Allow interrupts now
; 0339
; 0340 end; ! End of NMU$MEMORY_RESET
.TITLE NMUMEM
.IDENT /X00.18/
000000 .PSECT $OWN$, D
000000 000000 SIZE: .WORD 0
000002 000000 .WORD 0
000004 000004 .WORD 4
000006 000004 .WORD 4
000010 000004 .WORD 4
000012 000010 .WORD 10
000014 000014 .WORD 14
000016 000020 .WORD 20
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 9
X00.18 NMU$MEMORY_RESET as UM_RESET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (4)
000020 000030 .WORD 30
000022 000044 .WORD 44
000024 000064 .WORD 64
000026 000114 .WORD 114
000030 000160 .WORD 160
000032 000244 .WORD 244
000034 000360 .WORD 360
000036 000540 .WORD 540
000040 001004 .WORD 1004
000042 001364 .WORD 1364
000044 002124 .WORD 2124
000046 003130 .WORD 3130
000050 004514 .WORD 4514
000052 006640 .WORD 6640
000054 011770 .WORD 11770
000056 016504 .WORD 16504
000060 025344 .WORD 25344
000062 037334 .WORD 37334
000064 056040 .WORD 56040
000066 103404 .WORD -74374
000070 142740 .WORD -35040
000072 000000 BUDDY.INDEX:
.WORD 0
000074 000000 .WORD 0
000076 000000 .WORD 0
000100 000000 .WORD 0
000102 000001 .WORD 1
000104 000002 .WORD 2
000106 000003 .WORD 3
000110 000004 .WORD 4
000112 000005 .WORD 5
000114 000006 .WORD 6
000116 000007 .WORD 7
000120 000010 .WORD 10
000122 000011 .WORD 11
000124 000012 .WORD 12
000126 000013 .WORD 13
000130 000014 .WORD 14
000132 000015 .WORD 15
000134 000016 .WORD 16
000136 000017 .WORD 17
000140 000020 .WORD 20
000142 000021 .WORD 21
000144 000022 .WORD 22
000146 000023 .WORD 23
000150 000024 .WORD 24
000152 000025 .WORD 25
000154 000026 .WORD 26
000156 000027 .WORD 27
000160 000030 .WORD 30
000162 000031 .WORD 31
000164 ASL.LST:.BLKW 127
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 10
X00.18 NMU$MEMORY_RESET as UM_RESET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (4)
.GLOBL UQ.RESET, UQ.INSERT, UQ.REMOVE
.GLOBL UQ.EXTRACT, UQ.LENGTH, UQ.SCAN
.GLOBL UQ.SEXTRACT, DEBUG, INTNST
000000' BLKSIZ== SIZE
000072' BLKBDY== BUDDY.INDEX
000164' BLKLST== ASL.LST
.SBTTL UM.RESET NMU$MEMORY_RESET as UM_RESET
000000 .PSECT $CODE$, RO
000000 004167 000000G UM.RESET::
JSR R1,$SAVE2 ; 0304
000004 012702 000164' MOV #ASL.LST,R2 ; *,ASL 0328
000010 012746 000543 MOV #543,-(SP)
000014 104377 EMT 377
000016 005267 000000G INC INTNST
000022 012701 000035 MOV #35,R1 ; *,COUNT 0332
000026 010246 1$: MOV R2,-(SP) ; ASL,* 0334
000030 004767 000000G JSR PC,UQ.RESET
000034 062702 000006 ADD #6,R2 ; *,ASL 0335
000040 005726 TST (SP)+ ; 0333
000042 077107 SOB R1,1$ ; COUNT,* 0000
000044 012746 000543 MOV #543,-(SP) ; 0336
000050 104377 EMT 377
000052 005367 000000G DEC INTNST
000056 000243 .WORD CLV!CLC
000060 003005 BGT 2$
000062 005067 000000G CLR INTNST
000066 012746 000545 MOV #545,-(SP)
000072 104377 EMT 377
000074 000207 2$: RTS PC ; 0304
; Routine Size: 31 words, Routine Base: $CODE$ + 0000
; Maximum stack depth per invocation: 6 words
; 0341
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 11
X00.18 NMU$MEMORY_INITIALIZE as UM_INITIALIZE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (5)
; 0342 %global_routine ('NMU$MEMORY_INITIALIZE', AMOUNT) : novalue =
; 0343
; 0344 !++
; 0345 ! Functional description
; 0346 !
; 0347 ! Add the specified amount of memory to the free pool
; 0348 ! of the storage manager.
; 0349 !
; 0350 ! Formal parameters
; 0351 !
; 0352 ! AMOUNT - the initial amount of storage to allocate
; 0353 !
; 0354 ! Implicit inputs
; 0355 !
; 0356 ! SIZE - the block size array
; 0357 ! ASL - the Available storage list
; 0358 !
; 0359 ! Implicit outputs
; 0360 !
; 0361 ! ASL - the Available storage list
; 0362 !
; 0363 ! Routine value: none
; 0364 !
; 0365 ! Side effects: none
; 0366 !
; 0367 !--
; 0368
; 0369 begin
; 0370
; 0371 local
; 0372 P : ref MEMORY_BLOCK, ! Allocated block
; 0373 I; ! Size index for "P"
; 0374
; P 0375 %debug (MEMORY_CONSISTENCY,
; 0376 (TRACE_INFO ('Initializing %D. (%O) units in free pool', .AMOUNT, .AMOUNT)));
; 0377
; 0378 !
; 0379 ! Find size index for AMOUNT
; 0380 !
; 0381 I = -1;
; 0382
; 0383 incr POINTR from 1 to INDEX_LIMIT do
; 0384
; 0385 if ((.AMOUNT + ALLOC_OVERHEAD) lequ .SIZE [.POINTR])
; 0386 then
; 0387 begin
; 0388 I = .POINTR;
; 0389 exitloop;
; 0390 end;
; 0391
; 0392 if (.I lss 0)
; 0393 then
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 12
X00.18 NMU$MEMORY_INITIALIZE as UM_INITIALIZE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (5)
; 0394 begin
; 0395 PROGRAM_ERROR ('Memory block too large to initialize');
; 0396 return ;
; 0397 end;
; 0398
; 0399 !
; 0400 ! Now allocate the block
; 0401 !
; 0402 if (P = CORE_GET (.SIZE [.I])) eqla 0
; 0403 then
; 0404 begin
; 0405 PROGRAM_ERROR ('Operating system refused memory request');
; 0406 return ;
; 0407 end;
; 0408
; 0409 P [INDEX] = .I;
; 0410 P [TAG] = AVAILABLE;
; 0411 P [SELF] = LEFT;
; 0412 P [PARENT] = LEFT;
; 0413 ! %debug (always,(
; 0414 ! begin
; 0415 ! P [MB_ALLOCATION] = .SIZE [.I];
; 0416 ! P [MB_TASK] = 0;
; 0417 ! end));
; 0418
; P 0419 %debug (MEMORY_CONSISTENCY,
; P 0420 (TRACE_INFO_C ('Adding %D. (%O) units at %O to free pool',
; 0421 .SIZE [.I], .SIZE [.I], .P)));
; 0422
; 0423 INTERRUPT_OFF;
; 0424 NMU$QUEUE_INSERT (ASL_LST [.I, ASL_QUEUE], .P);
; 0425 INTERRUPT_ON;
; 0426 end; ! End of NMU$MEMORY_INITIALIZE
.GLOBL NMU$FA, SS$COR
.SBTTL UM.INITIALIZE NMU$MEMORY_INITIALIZE as UM_INITIALIZE
000000 004167 000000G UM.INITIALIZE::
JSR R1,$SAVE3 ; 0342
000004 012701 177777 MOV #-1,R1 ; *,I 0381
000010 016602 000012 MOV 12(SP),R2 ; AMOUNT,* 0385
000014 062702 000021 ADD #21,R2
000020 012703 000001 MOV #1,R3 ; *,POINTR 0383
000024 010300 1$: MOV R3,R0 ; POINTR,* 0385
000026 006300 ASL R0
000030 020260 000000' CMP R2,SIZE(R0)
000034 101002 BHI 2$
000036 010301 MOV R3,R1 ; POINTR,I 0388
000040 000405 BR 3$ ; 0389
000042 005203 2$: INC R3 ; POINTR 0383
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 13
X00.18 NMU$MEMORY_INITIALIZE as UM_INITIALIZE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (5)
000044 020327 000034 CMP R3,#34 ; POINTR,*
000050 003765 BLE 1$
000052 005701 TST R1 ; I 0392
000054 002411 3$: BLT 4$ ; 0395
000056 010100 MOV R1,R0 ; I,* 0402
000060 006300 ASL R0
000062 016046 000000' MOV SIZE(R0),-(SP)
000066 004767 000000G JSR PC,SS$COR
000072 005726 TST (SP)+
000074 010002 MOV R0,R2 ; *,P
000076 001003 BNE 5$
000100 004767 000000G 4$: JSR PC,NMU$FA ; 0405
000104 000207 RTS PC ; 0404
000106 010162 000006 5$: MOV R1,6(R2) ; I,*(P) 0409
000112 012700 000010 MOV #10,R0 ; 0410
000116 060200 ADD R2,R0 ; P,*
000120 142710 000007 BICB #7,(R0) ; 0412
000124 012746 000543 MOV #543,-(SP) ; 0421
000130 104377 EMT 377
000132 005267 000000G INC INTNST
000136 070127 000006 MUL #6,R1 ; 0424
000142 062701 000164' ADD #ASL.LST,R1
000146 010146 MOV R1,-(SP)
000150 010246 MOV R2,-(SP) ; P,*
000152 004767 000000G JSR PC,UQ.INSERT
000156 012746 000543 MOV #543,-(SP)
000162 104377 EMT 377
000164 022626 CMP (SP)+,(SP)+
000166 005367 000000G DEC INTNST
000172 000243 .WORD CLV!CLC
000174 003005 BGT 6$
000176 005067 000000G CLR INTNST
000202 012746 000545 MOV #545,-(SP)
000206 104377 EMT 377
000210 000207 6$: RTS PC ; 0342
; Routine Size: 69 words, Routine Base: $CODE$ + 0076
; Maximum stack depth per invocation: 9 words
; 0427
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 14
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
; 0428 %global_routine ('NMU$MEMORY_GET', AMOUNT) =
; 0429
; 0430 !++
; 0431 ! Functional description
; 0432 !
; 0433 ! Get a block of storage from dynamic memory.
; 0434 ! Return its address.
; 0435 !
; 0436 ! Formal parameters
; 0437 !
; 0438 ! AMOUNT - Number of words to allocate
; 0439 !
; 0440 ! Implicit inputs
; 0441 !
; 0442 ! ASL - Available Storage List
; 0443 ! Dynamic Memory
; 0444 !
; 0445 ! Implicit outputs
; 0446 !
; 0447 ! ASL - Available Storage List
; 0448 !
; 0449 ! Routine value
; 0450 !
; 0451 ! The address of the storage block or 0 if no memory available
; 0452 !
; 0453 ! Side effects: none
; 0454 !
; 0455 !--
; 0456
; 0457 begin
; 0458
; 0459 local
; 0460 P : ref MEMORY_BLOCK, ! Allocated block
; 0461 Q : ref MEMORY_BLOCK, ! Buddy to allocated block
; 0462 I, ! Exact index for "AMOUNT"
; 0463 J; ! Index actually used from ASL
; 0464
; P 0465 %debug (MEMORY_TRACE,
; 0466 (TRACE_INFO ('Request for %D. units', .AMOUNT)));
; 0467
; 0468 !
; 0469 ! Start off with no block allocated
; 0470 !
; 0471 P = 0;
; 0472 !
; 0473 ! Calculate index for block of size AMOUNT
; 0474 !
; 0475 I = -1;
; 0476
; 0477 incr POINTR from 1 to INDEX_LIMIT do
; 0478
; 0479 if ((.AMOUNT + ALLOC_OVERHEAD) lequ .SIZE [.POINTR])
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 15
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
; 0480 then
; 0481 begin
; 0482 I = .POINTR;
; 0483 exitloop;
; 0484 end;
; 0485
; 0486 if (.I lss 0)
; 0487 then
; 0488 begin
; 0489 PROGRAM_ERROR ('Size of Memory Block Requested is too large');
; 0490 return 0
; 0491 end;
; 0492
; 0493 !
; 0494 ! Find first non-empty ASL entry, starting with
; 0495 ! entry pointed to by I (exact index).
; 0496 !
; 0497
; 0498 INTERRUPT_OFF; ! Lock out interrupts
; 0499
; 0500 incr TEST_INDEX from .I to INDEX_LIMIT do
; 0501
; 0502 if (P = NMU$QUEUE_REMOVE (ASL_LST [.TEST_INDEX, ASL_QUEUE])) neq 0
; 0503 then
; 0504 begin
; 0505 J = .TEST_INDEX;
; 0506 exitloop;
; 0507 end;
; 0508
; 0509 !
; 0510 ! If no memory already available .. try to initialize
; 0511 ! the appropriate amount from the operating system.
; 0512 !
; 0513
; 0514 if .P eqla 0
; 0515 then
; 0516 begin
; 0517 NMU$MEMORY_INITIALIZE (.AMOUNT);
; 0518 P = NMU$QUEUE_REMOVE (ASL_LST [.I, ASL_QUEUE]);
; 0519 J = .I;
; 0520 end;
; 0521
; 0522 !
; 0523 ! Allocate memory and (optionally) split off buddy
; 0524 !
; 0525
; 0526 while (.J gtr .I) do
; 0527 begin
; 0528
; 0529 if (.SIZE [.BUDDY_INDEX [.J]] neq 0)
; 0530 then
; 0531 begin
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 16
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
; 0532 Q = .P + .SIZE [.BUDDY_INDEX [.J]];
; 0533 Q [TAG] = AVAILABLE;
; 0534 Q [PARENT] = .P [PARENT];
; 0535 Q [SELF] = RIGHT;
; 0536 Q [INDEX] = .J - 1;
; 0537 P [TAG] = AVAILABLE;
; 0538 P [PARENT] = .P [SELF];
; 0539 P [SELF] = LEFT;
; 0540 P [INDEX] = .BUDDY_INDEX [.J];
; 0541
; P 0542 %debug (MEMORY_CONSISTENCY,
; P 0543 (begin
; P 0544 TRACE_INFO_C (' Block at %O Index %O Self= ',.P,.P[INDEX]) ;
; P 0545
; P 0546 if .P [SELF] eql LEFT
; P 0547 then TRACE_INFO_CL ('LEFT ')
; P 0548 else TRACE_INFO_CL ('RIGHT ') ;
; P 0549
; P 0550 if .P [PARENT] eql LEFT
; P 0551 then TRACE_INFO_CL ('Parent=LEFT split with')
; P 0552 else TRACE_INFO_CL ('Parent=RIGHT split with') ;
; P 0553
; P 0554 TRACE_INFO_C (' buddy at %O Index %O Self=',.Q,.Q[INDEX]) ;
; P 0555
; P 0556 if .Q [SELF] eql LEFT
; P 0557 then TRACE_INFO_CL ('LEFT ')
; P 0558 else TRACE_INFO_CL ('RIGHT ') ;
; P 0559
; P 0560 if .Q [PARENT] eql LEFT
; P 0561 then TRACE_INFO_CL ('Parent=LEFT')
; P 0562 else TRACE_INFO_CL ('Parent=RIGHT') ;
; P 0563
; 0564 end));
; 0565
; 0566 if (.I leq .BUDDY_INDEX [.J])
; 0567 then
; 0568 NMU$QUEUE_INSERT (ASL_LST [.Q [INDEX], ASL_QUEUE], .Q)
; 0569 else
; 0570 begin
; 0571 NMU$QUEUE_INSERT (ASL_LST [.P [INDEX], ASL_QUEUE], .P);
; 0572 P = .Q;
; 0573 end;
; 0574
; 0575 J = .P [INDEX];
; 0576 end
; 0577 else
; 0578 exitloop;
; 0579
; 0580 end;
; 0581
; 0582 INTERRUPT_ON; ! Allow interrupts again
; 0583
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 17
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
; 0584 P [TAG] = ALLOCATED;
; 0585 !
; 0586 ! Return 0 if no memory allocated.
; 0587 ! Return address of zeroed data portion of allocated
; 0588 ! block if allocation was successful.
; 0589 !
; P 0590 %debug (MEMORY_TRACE,
; P 0591 (if (.P eqla 0)
; P 0592 then TRACE_INFO_C ('Allocation failure')
; P 0593 else TRACE_INFO_C ('Allocated %D. units at %O',
; 0594 .SIZE [.P[INDEX]], P [DATA])));
; 0595
; 0596 (if (.P eqla 0) then
; 0597 begin
; 0598 PROGRAM_ERROR ('Memory request failed');
; 0599 0
; 0600 end
; 0601 else
; 0602 begin
; 0603 local
; 0604 A : ref block,
; 0605 CNT;
; 0606
; 0607 CNT = .AMOUNT;
; 0608 P [MB_TASK] = CURRENT_TASK;
; 0609 P [MB_ALLOCATION] = .CNT;
; 0610 P [MB_LIMIT] = P [DATA] + .CNT; ! Address of terminator
; 0611 P = P [DATA];
; 0612 A = .P;
; 0613
; 0614 do (A [0, 0, %bpunit, 0] = 0; A = .A + 1) while (CNT = .CNT - 1) neq 0;
; 0615
; 0616 A [0, 0, %bpunit, 0] = TERMINATOR; ! Mark end of block
; 0617 .P
; 0618 end
; 0619 )
; 0620 end; !End of NMU$MEMORY_GET
.GLOBL CURTSK
.SBTTL UM.GET NMU$MEMORY_GET as UM_GET
000000 004167 000000G UM.GET::JSR R1,$SAVE5 ; 0428
000004 024646 CMP -(SP),-(SP)
000006 005005 CLR R5 ; P 0471
000010 012703 177777 MOV #-1,R3 ; *,I 0475
000014 016666 000022 000002 MOV 22(SP),2(SP) ; AMOUNT,* 0479
000022 016602 000002 MOV 2(SP),R2
000026 062702 000021 ADD #21,R2
000032 012701 000001 MOV #1,R1 ; *,POINTR 0477
000036 010100 1$: MOV R1,R0 ; POINTR,* 0479
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 18
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
000040 006300 ASL R0
000042 020260 000000' CMP R2,SIZE(R0)
000046 101002 BHI 2$
000050 010103 MOV R1,R3 ; POINTR,I 0482
000052 000405 BR 3$ ; 0483
000054 005201 2$: INC R1 ; POINTR 0477
000056 020127 000034 CMP R1,#34 ; POINTR,*
000062 003765 BLE 1$
000064 005703 TST R3 ; I 0486
000066 002002 3$: BGE 4$ ; 0489
000070 000167 000430 JMP 15$
000074 012746 000543 4$: MOV #543,-(SP) ; 0491
000100 104377 EMT 377
000102 005267 000000G INC INTNST
000106 010302 MOV R3,R2 ; I,TEST.INDEX 0500
000110 005302 DEC R2 ; TEST.INDEX
000112 000415 BR 6$
000114 010201 5$: MOV R2,R1 ; TEST.INDEX,* 0502
000116 070127 000006 MUL #6,R1
000122 062701 000164' ADD #ASL.LST,R1
000126 010146 MOV R1,-(SP)
000130 004767 000000G JSR PC,UQ.REMOVE
000134 005726 TST (SP)+
000136 010005 MOV R0,R5 ; *,P
000140 001402 BEQ 6$
000142 010204 MOV R2,R4 ; TEST.INDEX,J 0505
000144 000404 BR 7$ ; 0506
000146 005202 6$: INC R2 ; TEST.INDEX 0500
000150 020227 000034 CMP R2,#34 ; TEST.INDEX,*
000154 003757 BLE 5$
000156 005705 7$: TST R5 ; P 0514
000160 001017 BNE 8$
000162 016646 000002 MOV 2(SP),-(SP) ; 0517
000166 004767 177374 JSR PC,UM.INITIALIZE
000172 010301 MOV R3,R1 ; I,* 0518
000174 070127 000006 MUL #6,R1
000200 062701 000164' ADD #ASL.LST,R1
000204 010116 MOV R1,(SP)
000206 004767 000000G JSR PC,UQ.REMOVE
000212 010005 MOV R0,R5 ; *,P
000214 010304 MOV R3,R4 ; I,J 0519
000216 005726 TST (SP)+ ; 0516
000220 020403 8$: CMP R4,R3 ; J,I 0526
000222 003517 BLE 13$
000224 010400 MOV R4,R0 ; J,* 0529
000226 006300 ASL R0
000230 016001 000072' MOV BUDDY.INDEX(R0),R1
000234 010100 MOV R1,R0
000236 006300 ASL R0
000240 016000 000000' MOV SIZE(R0),R0
000244 001506 BEQ 13$
000246 010002 MOV R0,R2 ; *,Q 0532
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 19
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
000250 060502 ADD R5,R2 ; P,Q
000252 012700 000010 MOV #10,R0 ; 0533
000256 060200 ADD R2,R0 ; Q,*
000260 012716 000010 MOV #10,(SP) ; 0534
000264 060516 ADD R5,(SP) ; P,*
000266 117646 000000 MOVB @0(SP),-(SP)
000272 142710 000005 BICB #5,(R0)
000276 032726 000004 BIT #4,(SP)+
000302 001402 BEQ 9$
000304 152710 000004 BISB #4,(R0)
000310 152710 000002 9$: BISB #2,(R0) ; 0535
000314 010462 000006 MOV R4,6(R2) ; J,*(Q) 0536
000320 005362 000006 DEC 6(R2) ; *(Q)
000324 142776 000001 000000 BICB #1,@0(SP) ; 0537
000332 142776 000004 000000 BICB #4,@0(SP) ; 0538
000340 132776 000002 000000 BITB #2,@0(SP)
000346 001403 BEQ 10$
000350 152776 000004 000000 BISB #4,@0(SP)
000356 142776 000002 000000 10$: BICB #2,@0(SP) ; 0539
000364 010165 000006 MOV R1,6(R5) ; *,*(P) 0540
000370 020301 CMP R3,R1 ; I,* 0566
000372 003013 BGT 11$
000374 016201 000006 MOV 6(R2),R1 ; *(Q),* 0568
000400 070127 000006 MUL #6,R1
000404 062701 000164' ADD #ASL.LST,R1
000410 010146 MOV R1,-(SP)
000412 010246 MOV R2,-(SP) ; Q,*
000414 004767 000000G JSR PC,UQ.INSERT
000420 000414 BR 12$ ; 0566
000422 016501 000006 11$: MOV 6(R5),R1 ; *(P),* 0571
000426 070127 000006 MUL #6,R1
000432 010100 MOV R1,R0
000434 062700 000164' ADD #ASL.LST,R0
000440 010046 MOV R0,-(SP)
000442 010546 MOV R5,-(SP) ; P,*
000444 004767 000000G JSR PC,UQ.INSERT
000450 010205 MOV R2,R5 ; Q,P 0572
000452 016504 000006 12$: MOV 6(R5),R4 ; *(P),J 0575
000456 022626 CMP (SP)+,(SP)+ ; 0531
000460 000657 BR 8$ ; 0529
000462 012746 000543 13$: MOV #543,-(SP) ; 0580
000466 104377 EMT 377
000470 005367 000000G DEC INTNST
000474 000243 .WORD CLV!CLC
000476 003005 BGT 14$
000500 005067 000000G CLR INTNST
000504 012746 000545 MOV #545,-(SP)
000510 104377 EMT 377
000512 152765 000001 000010 14$: BISB #1,10(R5) ; *,*(P) 0584
000520 005705 TST R5 ; P 0596
000522 001004 BNE 16$
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 20
X00.18 NMU$MEMORY_GET as UM_GET 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (6)
000524 004767 000000G 15$: JSR PC,NMU$FA ; 0598
000530 005000 CLR R0 ; 0596
000532 000426 BR 18$
000534 016601 000002 16$: MOV 2(SP),R1 ; *,CNT 0607
000540 016765 000000G 000012 MOV CURTSK,12(R5) ; *,*(P) 0608
000546 010165 000016 MOV R1,16(R5) ; CNT,*(P) 0609
000552 010100 MOV R1,R0 ; CNT,* 0602
000554 060500 ADD R5,R0 ; P,*
000556 010065 000014 MOV R0,14(R5) ; *,*(P) 0610
000562 062765 000020 000014 ADD #20,14(R5) ; *,*(P)
000570 062705 000020 ADD #20,R5 ; *,P 0611
000574 010500 MOV R5,R0 ; P,A 0612
000576 105020 17$: CLRB (R0)+ ; A 0614
000600 077102 SOB R1,17$ ; CNT,*
000602 112710 000125 MOVB #125,(R0) ; *,A 0616
000606 010500 MOV R5,R0 ; P,* 0596
000610 022626 18$: CMP (SP)+,(SP)+ ; 0428
000612 000207 RTS PC
; Routine Size: 198 words, Routine Base: $CODE$ + 0310
; Maximum stack depth per invocation: 11 words
; 0621
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 21
X00.18 NMU$MEMORY_RELEASE as UM_RELEASE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (7)
; 0622 %global_routine ('NMU$MEMORY_RELEASE', P, AMOUNT) : novalue =
; 0623
; 0624 !++
; 0625 ! Functional description
; 0626 !
; 0627 ! Returns a block of memory to the ASL.
; 0628 !
; 0629 ! Formal parameters
; 0630 !
; 0631 ! P - address of memory block to return
; 0632 ! AMOUNT - Size of memory block
; 0633 !
; 0634 ! Implicit inputs
; 0635 !
; 0636 ! ASL - the Available Storage List
; 0637 !
; 0638 ! Implicit outputs
; 0639 !
; 0640 ! ASL - the Available Storage List
; 0641 !
; 0642 ! Routine value: none
; 0643 ! Side effects: none
; 0644 !
; 0645 !--
; 0646
; 0647 begin
; 0648
; 0649 map
; 0650 P : ref MEMORY_BLOCK;
; 0651
; 0652 local
; 0653 Q : ref MEMORY_BLOCK,
; 0654 R,
; 0655 T : ref MEMORY_BLOCK;
; 0656
; P 0657 %debug (MEMORY_TRACE,
; P 0658 (TRACE_INFO ('Releasing %D. units at %O',
; 0659 .AMOUNT,.P)));
; 0660
; 0661 !
; 0662 ! Remove Allocation Overhead amount to obtain real MEMORY_BLOCK address
; 0663 !
; 0664 T = .P - (ALLOC_OVERHEAD - 1);
; 0665
; 0666 !
; 0667 ! Check to make sure block is actually allocated and not corrupted.
; 0668 !
; 0669
; 0670 if (.T [TAG] neq ALLOCATED) or
; 0671 (.T [MB_ALLOCATION] nequ .AMOUNT) or
; 0672 (.T [MB_LIMIT] neqa (T [DATA] + .T [MB_ALLOCATION])) or
; 0673 (.(.T [MB_LIMIT])<0,%bpunit,0> neq TERMINATOR)
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 22
X00.18 NMU$MEMORY_RELEASE as UM_RELEASE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (7)
; 0674 then
; 0675 begin
; L 0676 %if not $MCB
; U 0677 %then
; U 0678 TRACE_INFO ('Error detected while releasing %D. units of memory',
; U 0679 .AMOUNT);
; U 0680 TRACE_INFO_C ('Block begins at %O; header starts at %O',
; U 0681 T [DATA],
; U 0682 .T);
; U 0683 TRACE_INFO_C ('Header shows %D. units',
; U 0684 .T [MB_ALLOCATION]);
; U 0685 TRACE_INFO_C ('Allocation flag is %O (1=allocated, 0=available)',
; U 0686 .T [TAG]);
; U 0687 TRACE_INFO_C ('Header shows units were allocated by task at %O',
; U 0688 .T [MB_TASK]);
; U 0689 TRACE_INFO_C ('Header shows limit word: %O / %O',
; U 0690 .T [MB_LIMIT],
; U 0691 ..T [MB_LIMIT]);
; U 0692 TRACE_INFO_C ('Limit word should contain: %O',
; U 0693 TERMINATOR);
; 0694 %fi
; 0695 PROGRAM_ERROR ('Memory database inconsistency');
; 0696 return ;
; 0697 end;
; 0698
; 0699 !
; 0700 ! Tag this block as available now.
; 0701 !
; 0702
; 0703 T [TAG] = AVAILABLE;
; 0704
; 0705 !
; 0706 ! Try to find Buddy and form with it
; 0707 !
; 0708 Q = BUDDY_ADDRESS (.T);
; 0709
; 0710 INTERRUPT_OFF; ! Disable interrupts
; 0711
; 0712 while (.Q neqa 0) do
; 0713 begin
; 0714
; 0715
; P 0716 %debug (MEMORY_CONSISTENCY,
; P 0717 (begin
; P 0718
; P 0719 TRACE_INFO_C (' Block at %O Index %O Self= ',.T,.T [INDEX]) ;
; P 0720
; P 0721 if .T [SELF] eql LEFT
; P 0722 then TRACE_INFO_CL ('LEFT ')
; P 0723 else TRACE_INFO_CL ('RIGHT ') ;
; P 0724
; P 0725 if .T [PARENT] eql LEFT
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 23
X00.18 NMU$MEMORY_RELEASE as UM_RELEASE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (7)
; P 0726 then TRACE_INFO_CL ('Parent=LEFT merged with')
; P 0727 else TRACE_INFO_CL ('Parent=RIGHT merged with') ;
; P 0728
; P 0729 TRACE_INFO_C (' buddy at %O Index %O Self=',.Q,.Q[INDEX]) ;
; P 0730
; P 0731 if .Q [SELF] eql LEFT
; P 0732 then TRACE_INFO_CL ('LEFT ')
; P 0733 else TRACE_INFO_CL ('RIGHT ') ;
; P 0734
; P 0735 if .Q [PARENT] eql LEFT
; P 0736 then TRACE_INFO_CL ('Parent=LEFT')
; P 0737 else TRACE_INFO_CL ('Parent=RIGHT');
; P 0738
; 0739 end));
; 0740 if not NMU$QUEUE_EXTRACT (ASL_LST [.Q [INDEX], ASL_QUEUE], .Q)
; 0741 then
; 0742 begin
; 0743 PROGRAM_ERROR ('Available storage list corrupted');
; 0744 INTERRUPT_ON; ! Interrupts on again
; 0745 return ;
; 0746 end;
; 0747
; 0748 if (.T gtra .Q)
; 0749 then
; 0750 begin
; 0751 R = .T;
; 0752 T = .Q;
; 0753 Q = .R
; 0754 end;
; 0755
; 0756 T [TAG] = AVAILABLE;
; 0757 T [SELF] = .T [PARENT];
; 0758 T [PARENT] = .Q [PARENT];
; 0759 T [INDEX] = 1 + .Q [INDEX];
; 0760 Q = BUDDY_ADDRESS (.T);
; 0761 end;
; 0762
; 0763 NMU$QUEUE_INSERT (ASL_LST [.T [INDEX], ASL_QUEUE], .T);
; 0764
; 0765 INTERRUPT_ON; ! Interrupts on
; 0766
; 0767 end; ! End of NMU$MEMORY_RELEASE
.SBTTL UM.RELEASE NMU$MEMORY_RELEASE as UM_RELEASE
000000 004167 000000G UM.RELEASE::
JSR R1,$SAVE4 ; 0622
000004 016603 000016 MOV 16(SP),R3 ; P,T 0664
000010 162703 000020 SUB #20,R3 ; *,T
000014 132763 000001 000010 BITB #1,10(R3) ; *,*(T) 0670
000022 001420 BEQ 1$
000024 026366 000016 000014 CMP 16(R3),14(SP) ; *(T),AMOUNT 0671
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 24
X00.18 NMU$MEMORY_RELEASE as UM_RELEASE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (7)
000032 001014 BNE 1$
000034 010301 MOV R3,R1 ; T,* 0672
000036 066301 000016 ADD 16(R3),R1 ; *(T),*
000042 062701 000020 ADD #20,R1
000046 026301 000014 CMP 14(R3),R1 ; *(T),*
000052 001004 BNE 1$
000054 127327 000014 000125 CMPB @14(R3),#125 ; *(T),* 0673
000062 001403 BEQ 2$
000064 004767 000000G 1$: JSR PC,NMU$FA ; 0695
000070 000207 RTS PC ; 0675
000072 142763 000001 000010 2$: BICB #1,10(R3) ; *,*(T) 0703
000100 010346 MOV R3,-(SP) ; T,* 0708
000102 004767 000000V JSR PC,BUDDY.ADDRESS
000106 010002 MOV R0,R2 ; *,Q
000110 012746 000543 MOV #543,-(SP)
000114 104377 EMT 377
000116 005726 TST (SP)+
000120 005267 000000G INC INTNST
000124 005702 3$: TST R2 ; Q 0712
000126 001472 BEQ 8$
000130 016201 000006 MOV 6(R2),R1 ; *(Q),* 0740
000134 070127 000006 MUL #6,R1
000140 062701 000164' ADD #ASL.LST,R1
000144 010146 MOV R1,-(SP)
000146 010246 MOV R2,-(SP) ; Q,*
000150 004767 000000G JSR PC,UQ.EXTRACT
000154 022626 CMP (SP)+,(SP)+
000156 006000 ROR R0
000160 103412 BLO 4$
000162 004767 000000G JSR PC,NMU$FA ; 0743
000166 012746 000543 MOV #543,-(SP)
000172 104377 EMT 377
000174 005367 000000G DEC INTNST
000200 000243 .WORD CLV!CLC
000202 003073 BGT 10$
000204 000465 BR 9$
000206 020302 4$: CMP R3,R2 ; T,Q 0748
000210 101403 BLOS 5$
000212 010304 MOV R3,R4 ; T,R 0751
000214 010203 MOV R2,R3 ; Q,T 0752
000216 010402 MOV R4,R2 ; R,Q 0753
000220 012700 000010 5$: MOV #10,R0 ; 0756
000224 060300 ADD R3,R0 ; T,*
000226 142710 000003 BICB #3,(R0) ; 0757
000232 132710 000004 BITB #4,(R0)
000236 001402 BEQ 6$
000240 152710 000002 BISB #2,(R0)
000244 116201 000010 6$: MOVB 10(R2),R1 ; *(Q),* 0758
000250 142710 000004 BICB #4,(R0)
000254 032701 000004 BIT #4,R1
000260 001402 BEQ 7$
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 25
X00.18 NMU$MEMORY_RELEASE as UM_RELEASE 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (7)
000262 152710 000004 BISB #4,(R0)
000266 016263 000006 000006 7$: MOV 6(R2),6(R3) ; *(Q),*(T) 0759
000274 005263 000006 INC 6(R3) ; *(T)
000300 010346 MOV R3,-(SP) ; T,* 0760
000302 004767 000000V JSR PC,BUDDY.ADDRESS
000306 010002 MOV R0,R2 ; *,Q
000310 005726 TST (SP)+ ; 0713
000312 000704 BR 3$ ; 0712
000314 016301 000006 8$: MOV 6(R3),R1 ; *(T),* 0763
000320 070127 000006 MUL #6,R1
000324 062701 000164' ADD #ASL.LST,R1
000330 010146 MOV R1,-(SP)
000332 010346 MOV R3,-(SP) ; T,*
000334 004767 000000G JSR PC,UQ.INSERT
000340 012746 000543 MOV #543,-(SP)
000344 104377 EMT 377
000346 022626 CMP (SP)+,(SP)+
000350 005367 000000G DEC INTNST
000354 000243 .WORD CLV!CLC
000356 003005 BGT 10$
000360 005067 000000G 9$: CLR INTNST
000364 012746 000545 MOV #545,-(SP)
000370 104377 EMT 377
000372 000207 10$: RTS PC ; 0622
; Routine Size: 126 words, Routine Base: $CODE$ + 1124
; Maximum stack depth per invocation: 10 words
; 0768
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 26
X00.18 BUDDY_ADDRESS 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (8)
; 0769 %routine ('BUDDY_ADDRESS', P) =
; 0770
; 0771 !++
; 0772 ! Functional description
; 0773 !
; 0774 ! Calculate and return address of buddy of Memory block at address P.
; 0775 !
; 0776 ! Formal parameters
; 0777 !
; 0778 ! P - Address of a memory block
; 0779 !
; 0780 ! Implicit inputs
; 0781 !
; 0782 ! SIZE - size of various memory blocks
; 0783 ! Dynamic Memory
; 0784 !
; 0785 ! Implicit outputs: none
; 0786 !
; 0787 ! Routine value:
; 0788 !
; 0789 ! The address of the buddy to P or 0 if none
; 0790 !
; 0791 ! Side effects: none
; 0792 !
; 0793 !--
; 0794
; 0795 begin
; 0796
; 0797 map
; 0798 P : ref MEMORY_BLOCK; ! Designated block
; 0799
; 0800 local
; 0801 Q : ref MEMORY_BLOCK, ! Buddy block
; 0802 J; ! Size index for buddy
; 0803
; 0804 !
; 0805 ! Process according to whether block is a LEFT
; 0806 ! or RIGHT buddy.
; 0807 !
; 0808
; 0809 if (.P [SELF] eql LEFT)
; 0810 then
; 0811 begin
; 0812 Q = .P + .SIZE [.P [INDEX]];
; 0813
; 0814 if ((.Q geqa .MEMSIZE) or (.Q [SELF] eql LEFT)) then return 0;
; 0815
; 0816 end
; 0817 else
; 0818 begin
; 0819 J = .BUDDY_INDEX [.P [INDEX] + 1];
; 0820 Q = .P - .SIZE [.J];
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 27
X00.18 BUDDY_ADDRESS 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (8)
; 0821
; 0822 if (.Q [INDEX] neq .J) then return 0;
; 0823
; 0824 end;
; 0825
; 0826 if (.Q [TAG] eql ALLOCATED) then return 0;
; 0827
; 0828 .Q
; 0829 end; ! End of BUDDY_ADDRESS
.GLOBL MEMTOP
.SBTTL BUDDY.ADDRESS BUDDY_ADDRESS
000000 004167 000000G BUDDY.ADDRESS:
JSR R1,$SAVE3 ; 0769
000004 016603 000012 MOV 12(SP),R3 ; P,* 0809
000010 132763 000002 000010 BITB #2,10(R3)
000016 001016 BNE 1$
000020 016300 000006 MOV 6(R3),R0 ; 0812
000024 006300 ASL R0
000026 010302 MOV R3,R2 ; *,Q
000030 066002 000000' ADD SIZE(R0),R2 ; *,Q
000034 020267 000000G CMP R2,MEMTOP ; Q,* 0814
000040 103026 BHIS 3$
000042 132762 000002 000010 BITB #2,10(R2) ; *,*(Q)
000050 001016 BNE 2$
000052 000421 BR 3$
000054 016300 000006 1$: MOV 6(R3),R0 ; 0819
000060 006300 ASL R0
000062 016001 000074' MOV BUDDY.INDEX+2(R0),R1 ; *,J
000066 010100 MOV R1,R0 ; J,* 0820
000070 006300 ASL R0
000072 010302 MOV R3,R2 ; *,Q
000074 166002 000000' SUB SIZE(R0),R2 ; *,Q
000100 026201 000006 CMP 6(R2),R1 ; *(Q),J 0822
000104 001004 BNE 3$
000106 132762 000001 000010 2$: BITB #1,10(R2) ; *,*(Q) 0826
000114 001402 BEQ 4$
000116 005000 3$: CLR R0
000120 000207 RTS PC
000122 010200 4$: MOV R2,R0 ; Q,* 0769
000124 000207 RTS PC
; Routine Size: 43 words, Routine Base: $CODE$ + 1520
; Maximum stack depth per invocation: 5 words
; 0830 end ! End of module MEMORY
; 0831
; 0832 eludom
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 28
X00.18 BUDDY_ADDRESS 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (8)
; OTS external references
.GLOBL $SAVE5, $SAVE4, $SAVE3, $SAVE2
; PSECT SUMMARY
;
; Psect Name Words Attributes
; $OWN$ 145 RW , D , LCL, REL, CON
; $CODE$ 467 RO , I , LCL, REL, CON
; LIBRARY STATISTICS
;
; -------- Symbols -------- Blocks
; File Total Loaded Percent Read
;
; DNET61:<MCB.NML>NMULIB.L16.1 2716 91 3 0
NMUMEM 24-May-1985 13:28:25 TOPS-20 Bliss-16 2A(530) Page 29
X00.18 BUDDY_ADDRESS 3-Jan-1983 17:09:13 DNET61:<MCB.NML>NMUMEM.BLI.1 (9)
; 0833
; 0834 ! Local Modes:
; 0835 ! Mode:Fundamental
; 0836 ! Comment Start:!
; 0837 ! Comment Column:40
; 0838 ! Comment Rounding:+1
; 0839 ! Auto Save Mode:2
; 0840 ! End:
; Size: 467 code + 145 data words
; Run Time: 00:12.0
; Elapsed Time: 00:17.6
; Memory Used: 57 pages
; Compilation Complete
A 604 612# 614# 616#
ALLOCATED 241# 584 670 826
ALLOC_OVERHEAD 224# 385 479 664
AMOUNT 342 376 385 428 466 479 517 607 622 659 671 679
ASL 323 328# 334 335#
ASL_FIELD 268# 279 323
ASL_FIELD_SIZE 274# 279 335
ASL_LST 279 284 328 424 502 518 568 571 740 763
ASL_QUEUE 270# 328 334 335 424 502 518 568 571 740 763
AVAILABLE 240# 410 533 537 703 756
BLKBDY 283#
BLKLST 284#
BLKSIZ 282#
BUDDY_ADDRESS 193 708 760
BUDDY_INDEX 278 283 529 532 540 566 819
BUDDY_INDEX_INIT 263# 278
CNT 605 607# 609 610 614#
CORE_GET 402
COUNT 332
CURRENT_TASK 608
DATA 219# 594 610 611 672 681
FULLWORD 214 218
I 373 381# 388# 392 402 409 421 424 462 475# 482# 486
500 518 519 526 566
INDEX_LIMIT 251# 383 477 500
INDEX 210# 409 536 540 544 554 568 571 575 594 719 729
740 759 763 812 819 822
INTERRUPT_OFF 330 423 498 710
INTERRUPT_ON 338 425 582 744 765
J 463 505# 519# 526 529 532 536 540 566 575# 802 819#
820 822
LEFT 244# 411 412 539 546 550 556 560 721 725 731 735
809 814
MB_ALLOCATION 217# 609 671 672 684
MB_LENGTH 223# 228
MB_LIMIT 216# 610 672 673 690 691
MB_TASK 215# 608 688
MEMORY_BLOCK 228# 372 460 461 650 653 655 798 801
MEMORY_BLOCK_FIELDS 207# 228
MEMORY_CONSISTENCY 325 375 419 542 716
MEMORY_TRACE 465 590 657
MEMSIZE 814
NMU$MEMORY_INITIALIZE 517
NMU$MEMORY_MANAGER 186
NMU$QUEUE_EXTRACT 740
NMU$QUEUE_INSERT 424 568 571 763
NMU$QUEUE_MANAGER 291*
NMU$QUEUE_REMOVE 502 518
NMU$QUEUE_RESET 334
NMUMEM 117#
P 372 402# 409# 410# 411# 412# 421 424 460 471# 502# 514
518# 532 534 537# 538# 539# 540# 544 546 550 571 572#
575 584# 591 594 596 608# 609# 610# 611# 612 617 622
650 659 664 769 798 809 812 819 820
PARENT 213# 412 534 538 550 560 725 735 757 758
POINTR 178 383 385 388 477 479 482
PROGRAM_ERROR 395 405 489 598 695 743
Q 461 532# 533# 534# 535# 536# 554 556 560 568 572 653
708# 712 729 731 735 740 748 752 753# 758 759 760#
801 812# 814 820# 822 826 828
QUEUE_INFO 209#
Q_HEADER_SIZE 209 270
R 654 751# 753
RIGHT 245# 535
SELF 212# 411 535 538 539 546 556 721 731 757 809 814
SIZE 277 282 385 402 421 479 529 532 594 812 820
SIZEINDEX 250# 251 277 278 279 332
SIZE_INIT 258# 277
T 655 664# 670 671 672 673 681 682 684 686 688 690
691 703# 708 719 721 725 748 751 752# 756# 757# 758#
759# 760 763
TAG 211# 410 533 537 584 670 686 703 756 826
TERMINATOR 231# 616 673 693
TEST_INDEX 500 502 505
TRACE_INFO_C 420 544 554 592 593 680 683 685 687 689 692 719
729
TRACE_INFO_CL 547 548 551 552 557 558 561 562 722 723 726 727
732 733 736 737
TRACE_INFO 326 376 466 658 678
$ADDRESS 215 216
$ALIGN 214 218
$BIT 211 212 213
$FIELD 206 267
$FIELD_SET_SIZE 223 274
$FIELD_SET_UNITS 224
$INDEX 202# 203# 210
$LITERAL 273
$MCB 201 232 676
$SHORT_INTEGER 203 217
$SUB_BLOCK 209 219 270
$TINY_INTEGER 202
$TOPS10 177
%DEBUG 325 375 419 465 542 590 657 716
%DEBUG_DATA_BASE 298
%GLOBAL_ROUTINE 304# 342# 428# 622#
%MODULE_NAME 300
%ROUTINE 769#