Google
 

Trailing-Edge - PDP-10 Archives - cuspbinsrc_2of2_bb-fp63b-sb - 10,7/rms10/rmssrc/rmsots.mac
There are 6 other files named rmsots.mac in the archive. Click here to see a list.
	TITLE	RMSOTS -- GET AND FREE MEMORY FROM OTS's
	TWOSEG	
	RELOC	400000


REPEAT 0,<

THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
  OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.

;COPYRIGHT (C) 1979, 1980 BY DIGITAL EQUIPMENT CORPORATION


NAME:		RMSOTS
AUTHOR:		A. UDDIN
EDIT DATE:	20-DEC-79
FUNCTION:	CALL ON THE OTS's MEMORY MANAGER TO GET MEM AND FREE MEM

	THIS MODULE CONTAINS THE FOLLOWING ROUTINES:


	FGPAGE		GET PAGES. CALLED ONLY FROM GPAGE
			IN MODULE 'RMSFSM.B36'. 
	FGMEM		GET BLOCK OF MEMORY (LESS THAN A PAGE).
			CALLED ONLY FROM ROUTINE GMEM IN MODULE
			'RMSFSM.B36'
	FPMEM		RETURN MEMORY. CALLED ONLY FROM ROUTINES
			PMEM, PPAGE  IN MODULE 'RMSFSM.B36'



REVISION HISTORY:

EDIT	DATE		WHO	PURPOSE
====	====		===	=======


*************************************************
*						*
*		NEW REVISION HISTORY		*
*						*
*************************************************

PRODUCT	MODULE	 SPR
 EDIT	 EDIT	 QAR		DESCRIPTION
======	======	=====		===========
1A(123)			(asp 1/28/88) Remove SEARCH MONSYM,MACSYM

	***** END OF REVISION HISTORY *****

>;;END OF REPEAT 0

;	SOME DEFINITIONS:
;
AC1==1
AC2==2
AC3==3
AC4==4
SP==17
AP==16
;
;	DEFINE FUNCTIONS CODES FOR FUNCT.
;
ILL==0		;ILLEGAL FUNCTION
GAD==1		;GET A SPECIFIC SEGMENT OF MEMORY
COR==2		;GET CORE FROM ANY ADDRESS
RAD==3		;RETURN CORE AT ADDRESS
GCH==4		;GET AN I/O CHANNEL
RCH==5		;RETURN AN I/O CHANNEL
GOT==6		;GET CORE FROM OTS LIST
ROT==7		;RETURN CORE TO OTS LIST
RNT==10		;GET RUNTIME FROM OTS
IFS==11		;GET DEV:FILE[PPN] FROM OTS
CBC==12		;CUT BACK CORE
RRS==13		;READ RETAIN STATUS
WRS==14		;WRITE RETAIN STATUS
PAG==15		;GET CORE ON PAGE BOUNDARY
SUCC==0		;SUCCESS STATUS

; FUNCT. ARG LIST CAN BE HERE BECAUSE READ ONLY
;
	-5,,0
ARGLST:
	FUNC##
	ERRCOD##
	STAT##
	ARG1##
	ARG2##

;	MEMORY MANAGER CALLING SEQUENCE
;
;	MOVEI	16,arglist
;	PUSHJ	17,FUNCT.
;
;FORMAT OF THE ARGUMENT LIST:
;
;	
;ARGLST:Z	2,[FUNCTION]
;	Z	2,[ERROR CODE]
;	Z	2,[STAT]
;	Z	code,[ARG1]
;	Z	code,[ARG2]
;		.
;		.
;
;THE VARIABLES FUNC, STAT, ARG1, ARG2 ARE DEFINED IN RMSGLB.B36
;
;

	PAGE
	SUBTTL	GET BLOCK OF MEMORY ON PAGE BOUNDARY


;THIS ROUTINE GETS A BLOCK OF WORDS FROM THE OTS'S MEMORY MANAGER.
;THE BLOCK OF WORDS ARE, HOPEFULLY, WORD ALIGNED.
;INPUT:		NUMBER OF WORDS REQUESTED IN MULTIPLES OF 512
;OUTPUT:	PAGE NUMBER OF 1ST PAGE OF BLOCK
;FUNCTIONS:
;	
;	1. SAVE RMS ACCUMULATORS
;	2. SET UP ARG LIST
;	3. PUSHJ  17,FUNCT.
;	4. ON SUCCESS, RETURN PAGE NUMBER IN AC1. ELSE RETURN
;	   0 IN AC 1.
;
;
FGPAGE::
	MOVEM	17,RMSAC##+17		;SAVE RMS ACCUMULATORS
	MOVEI	17,RMSAC##
	BLT	17,RMSAC##+16
	MOVE	17,RMSAC##+17		;RESTORE STACK ADDR
;
;	SET UP ARG LIST
;
	HRRZ	AC1,-1(SP)		;GET ARGUMENT IN AC1
	MOVEM	AC1,ARG2##		;NO.OF WORDS TO ARG.LIST
	MOVEI	AC1,PAG			;FUNCTION CODE
	MOVEM	AC1,FUNC##		;TO ARGLST
;
;	CALL FUNCT.
;
	MOVEI	AP,ARGLST		;SET UP PARAM FOR CALL
	PUSHJ	SP,FUNCT.##		;CALL THE ROUTINE
;
;	CHECK STATUS
;
	MOVSI	17,RMSAC##		;RESTORE AC'S
	BLT	17,17
	MOVE	AC1,STAT##		;GET STATUS RETURNED
	CAIN	AC1,SUCC		;SUCCESSFUL?
	JRST	FGPAG1			;YES
	SETZ	AC1,			;RETURN ERROR STATUS
	POPJ	SP,
;
;	CONVERT ADDR TO PAGE NUMBER
;
FGPAG1:
	MOVE	AC1,ARG1##		;GET ADDR OF BLOCK
	ASH	AC1,^D-9		;CONVERT TO PAGE NUMBER
	POPJ	SP,			;RETURN

	PAGE
	SUBTTL	GET A BLOCK OF MEMORY


;ROUTINE FGMEM:
;THIS ROUTINE CALLS FUNCT. TO GET A BLOCK OF MEMORY AT ANY ADDRESS.
;INPUT:		SIZE, IN WORDS, OF BLOCK OF MEMORY
;OUTPUT:	ADDRESS OF BLOCK ALLOCATED
;
;FUNCTION:
;	1. SAVE REGISTERS
;	2. SET UP ARG LIST
;	3. CALL FUNCT.
;	4. ON SUCCESS, RETURN VALUE IN AC1. ELSE RETURN 0 IN AC1
;
;
FGMEM::
	MOVEM	17,RMSAC##+17		;SAVE RMS ACS
	MOVEI	17,RMSAC##
	BLT	17,RMSAC##+16
	MOVE	17,RMSAC##+17		;RESTORE SP
;
;	SET UP ARG LIST
;
	HRRZ	AC1,-1(SP)		;GET THE ARGUMENT
	MOVEM	AC1,ARG2##		;NO.OF WORDS TO ARG.LIST
	MOVEI	AC1,GOT			;FUNCTION CODE
	MOVEM	AC1,FUNC##
;
;	CALL FUNCT.
;
	MOVEI	AP,ARGLST		;SET UP PARAM FOR CALL
	PUSHJ	SP,FUNCT.##
;
;	CHECK STATUS ETC.
;
	MOVSI	17,RMSAC##		;FIRST RESTORE ACS
	BLT	17,17
	MOVE	AC1,STAT##		;GET THE STATUS
	CAIN	AC1,SUCC		;WAS IT A SUCCESS?
	JRST	FGMEM1
	SETZ	AC1,			;RETURN ERROR
	POPJ	SP,			;GET BACK
;
;	RETURN ADDR IN AC1
;
FGMEM1:
	MOVE	AC1,ARG1##
	POPJ	SP,			;RETURN TO GMEM





	PAGE
	SUBTTL 	FREE MEMORY

;
;
;ROUTINE: FPMEM
;THIS ROUTINE FREES A BLOCK OF MEMORY. IT IS CALLED FROM PPAGE AND
;PMEM IN THE MODULE 'RMSFSM.B36'
;INPUT:		FIRST ARG IS ADDRESS OF MEMORY BLOCK
;		SECOND ARG IS BLOCK OF WORDS TO DEALLOCATE
;OUTPUT:	SUCCESS RETURN -1 IN AC1. ELSE ERROR RETURN 0 IN AC1
;
;FUNCTION:
;	1. SAVE REGS.
;	2. SET UP ARG LIST
;	3. CALL FUNCT.
;	4. RETURN
;
FPMEM::
	MOVEM	17,RMSAC##+17		;SAVE ACS
	MOVEI	17,RMSAC##
	BLT	17,RMSAC##+16
	MOVE	17,RMSAC##+17		;RESTORE SP
;
;	SET UP ARG LIST
;
	HRRZ	AC1,-1(SP)		;GET BLOCK OF WORDS
	MOVEM	AC1,ARG2##		;TO ARG LIST
	HRRZ	AC1,-2(SP)		;GET ADDR OF BLOCK TO BE RETURNED
	MOVEM	AC1,ARG1##		;TO ARG LIST
	MOVEI	AC1,ROT			;FUNCTION CODE
	MOVEM	AC1,FUNC##
;
;	CALL FUNC.
;
	MOVEI	AP,ARGLST		;PARAM FOR CALL
	PUSHJ	SP,FUNCT.##
;
;	CHECK STATUS ETC.
;
	MOVSI	17,RMSAC##		;RESTORE ACS
	BLT	17,17
	MOVE	AC1,STAT##		;GET STATUS
	CAIN	AC1,SUCC
	JRST	FPMEM1
	SETZ	AC1,
	POPJ	SP,			;ERROR. RETURN
;
FPMEM1:
;
	SETO	AC1,			;SUCCESS RETURN
	POPJ	SP,			;RETURN



	END