Google
 

Trailing-Edge - PDP-10 Archives - AP-4178E-RM - swskit-sources/free.mac
There are 49 other files named free.mac in the archive. Click here to see a list.
;<1BOSACK>FREE.ORG.6,  5-Jun-78 18:44:11, EDIT BY BOSACK
;<3A.MONITOR>FREE.MAC.7,  8-Jun-78 11:11:53, EDIT BY MILLER
;CHANGE RESLCK TO USE DIFFERENT THRESHOLD THAN ASGFRE
;<3A.MONITOR>FREE.MAC.6,  8-Jun-78 10:29:05, EDIT BY MILLER
;MAKE NON-PI FUNCTIONS OF RESLCK RESIDENT
;<3.SM10-RELEASE-3>FREE.MAC.5,  6-Jan-78 13:39:49, EDIT BY ENGEL
;fix for tco #1888 - remove entries for current level only
;<3.SM10-RELEASE-3>FREE.MAC.4, 20-Dec-77 15:17:51, EDIT BY MILLER
;FIX TYPEOS
;<3.SM10-RELEASE-3>FREE.MAC.3, 20-Dec-77 15:02:16, EDIT BY MILLER
;FIX BUG IN CODE THAT MOVES THE JSB STACK. MUST PRESERVE ENTRY COUNT
;<ENGEL>FREE.MAC.1, 13-Dec-77 10:37:46, EDIT BY ENGEL
;TCO #1888 - FOR NESTED INTERRUPTS RELEASE ONLY CURRENT OR HIGHER STACK ENTRIES
;<3-MONITOR>FREE.MAC.89,  7-Nov-77 13:02:10, EDIT BY KIRSCHEN
;MORE COPYRIGHT UPDATING...
;<3-MONITOR>FREE.MAC.88, 12-Oct-77 13:47:20, EDIT BY KIRSCHEN
;UPDATE COPYRIGHT FOR RELEASE 3
;<3-MONITOR>FREE.MAC.87, 15-Aug-77 19:29:19, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.86, 23-Jul-77 22:12:02, EDIT BY CROSSLAND
;<3-NSW-MONITOR>FREE.MAC.1, 23-Jul-77 15:53:22, EDIT BY CLEMENTS
;<3-MONITOR>FREE.MAC.85, 30-Jun-77 13:51:50, EDIT BY HURLEY
;MAKE ASGFRE ZERO THE BLOCK CORRECTLY
;<3-MONITOR>FREE.MAC.84,  7-Jun-77 16:40:11, EDIT BY HURLEY
;MAKE ASGRES WORK ON MODEL B
;<3-MONITOR>FREE.MAC.83,  2-May-77 20:32:28, EDIT BY BOSACK
;<3-MONITOR>FREE.MAC.82, 22-Mar-77 11:41:49, EDIT BY HURLEY
;MAKE ASGRES REMEMBER WHICH POOL THE STORAGE CAME FROM
;<3-MONITOR>FREE.MAC.81,  1-Mar-77 11:34:39, EDIT BY HURLEY
;ZERO THE RESIDENT FREE BLOCKS IN ASGRES
;<3-MONITOR>FREE.MAC.80, 24-Feb-77 10:22:37, EDIT BY MILLER
;ADD LOGICAL LINK POOL
;<3-MONITOR>FREE.MAC.79, 23-Feb-77 19:44:53, EDIT BY HALL
;TCO 1740 - ADD UNLOCKING OF TELETYPE LOCKS TO JSB STACK PROCESSING
;<3-MONITOR>FREE.MAC.78, 15-Feb-77 15:02:57, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.77, 15-Feb-77 14:37:18, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.76, 14-Feb-77 14:42:25, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.75, 14-Feb-77 11:25:26, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.74, 11-Feb-77 09:41:52, EDIT BY HURLEY
;ADDED JOB 0 ROUTINE TO GROW AND SHRINK RESIDENT FREE POOL
;<3-MONITOR>FREE.MAC.73, 10-Feb-77 17:28:05, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.72, 10-Feb-77 13:38:31, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.71,  9-Feb-77 18:40:41, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.70,  9-Feb-77 17:07:01, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.69,  8-Feb-77 16:20:14, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.68,  3-Feb-77 15:37:10, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.67,  3-Feb-77 12:20:58, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.66, 28-Jan-77 10:42:54, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.65, 28-Jan-77 10:14:15, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.64, 28-Jan-77 10:00:07, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.63, 27-Jan-77 19:49:17, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.62, 27-Jan-77 17:16:09, EDIT BY HURLEY
;TCO 1729 - ADD ROUTINE TO ASSIGN RESIDENT FREE SPACE
;<3-MONITOR>FREE.MAC.61, 27-Dec-76 17:32:31, EDIT BY HURLEY
;<3-MONITOR>FREE.MAC.60,  1-Dec-76 18:57:44, Edit by MCLEAN
;<3-MONITOR>FREE.MAC.59,  1-Dec-76 01:13:42, Edit by MCLEAN
;<3-MONITOR>FREE.MAC.58, 27-Nov-76 20:27:44, Edit by MCLEAN
;<2-MONITOR>FREE.MAC.56,  5-Nov-76 13:20:11, Edit by HESS
;FIX ASGJFS AND ASGPGS ENTRIES
;<1B-MONITOR>FREE.MAC.2,  8-MAY-76 13:00:46, EDIT BY MILLER
;TCO 1284. CHECK FOR BLOCK OF LENGTH 1 AT ASGFRE
;<1B-MONITOR>FREE.MAC.1,  6-MAY-76 14:59:47, EDIT BY MILLER
;TCO 1280. UNMAP JSB PAGES WHEN RETURNED
;<2MONITOR>FREE.MAC.54, 16-JAN-76 17:47:50, EDIT BY MURPHY
;<2MONITOR>FREE.MAC.53, 23-DEC-75 12:49:16, EDIT BY LEWINE


;THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
;  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
;
;COPYRIGHT (C) 1976, 1977, 1978 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.

	SEARCH PROLOG
	TTITLE FREE		; Storage routines
	SWAPCD

;NO SPECIAL AC DEFINITIONS HEREIN

;LOCAL DEFINITIONS FOR JSBSTK

DEFSTR (JSCOD,,17,18)		;THE CODE
DEFSTR (JSFRK,1,17,18)	;THE FORK HANDLE
DEFSTR (JSLVL,1,35,18)		;THE INTERRUPT LEVEL

; Assign space in free storage region
; Call:	RH(A)		; Location of free storage header
;	B		; Size of block needed
;	CALL ASGFRE
; Return
;	+1	; Not enough space
;	+2	; Ok, in a, the location of the block (absolute)
; Clobbers a,b,c,d
; Calling routine must take measures to prevent loss of free storage
; Space by inhibiting psi's until the space assigned
; Has been accounted for
; Free storage header format is:
;	0	; Lh points to first free block
;	1	; Lock
;	2	; Space counter
;	3	; Most common block size
;	4	; Lh has max top of free storage
				; Rh has min bottom
;	5	; Temp 2
;	6	; Temp 3

ASGFRE::CAMLE B,2(A)		; Any possibility of success?
	RET			; No. return immediately
	LOCK 1(A)		; Lock this free storage list
	PUSH P,B		; Save desired block size
	PUSH P,[0]		; BIGEST BLOCK SEEN SO FAR
	MOVEI B,377777
	MOVEM B,5(A)		; Initial best block size
	SETZM 6(A)		; Initial location of best block
	MOVE B,A		; Start with the header word
ASGFR1:	HLRZ C,0(B)		; Get pointer to next block
	JUMPE C,ASGFR2		; No more free blocks to examine
	HRRZ D,0(C)		; Get size of the block
	CAMLE D,0(P)
	 MOVEM D,0(P)
	CAMN D,-1(P)		; Is it the right size?
	JRST ASGFR3		; Just right use it
	CAML D,-1(P)		; Too small
	CAML D,5(A)		; Or bigger than best?
	JRST ASGFR4		; Yes, ignore it
	MOVEM D,5(A)		; This one is better
	MOVEM B,6(A)
ASGFR4:	MOVE B,C		; Step to next block
	JRST ASGFR1		; And repeat
ASGFR2:	SKIPN B,6(A)		; Did we find anything?
	JRST [	UNLOCK 1(A)	; No. unlock and return
		POP P,B		; FLUSH TEMP
		POP P,B		; Make transparent to b on error
		RET]
	MOVE D,-1(P)		; Get desired size
	HLRZ C,0(B)		; Get pointer to block to be used
	HRRM D,0(C)		; Convert to desired size
	ADD D,C			; Pointer remainder of block
	HRLM D,0(B)		; Point prev to remainder
	HLLZ B,0(C)		; Get next
	HLLM B,0(D)		; Point remainder to it
	MOVE B,5(A)
	SUB B,-1(P)		; Size of remainder
	HRRM B,0(D)		; To header of remainder
ASGFR5:	SUB P,BHC+1
	MOVN B,0(P)
	ADDM B,2(A)		; Reduce count of space left
	UNLOCK 1(A)
	MOVEI A,0(C)		; Get origin of block
	HRROS (A)		; Set lh to ones
	CAMN B,[-1]		;IS THIS A BLOCK OF 1 WORD?
	JRST ASGFR6		;YES. DON'T ZERO ANYTHING THEN
	HRRZ B,(A)		; Get rh
	HRRZI C,2(A)
	SETZM -1(C)		;ZERO FIRST WORD BEFORE SETTING LEFT HALF INDEX
	HRLI C,1(A)
	ADD B,A
	HRRZS B
	CAILE B,(C)
	BLT C,-1(B)		; Zero