Google
 

Trailing-Edge - PDP-10 Archives - bb-x130a-sb - whomap.mac
There are 4 other files named whomap.mac in the archive. Click here to see a list.
TITLE	WHOMAP -- Interface to MAP, the DECsystem-10 page mapper

	SEARCH	WHOMAC

	$SETUP	(WHOMAP)

	SUBTTL	MAP interface -- Initialize the page mapper

MAPDEF::MOVE	T1,[MP.JRM##+.MPMON##]	;MONITOR MAPPING
	PUSHJ	P,MAPINI		;INIT MAPPER
	PUSHJ	P,SPYINI##		;AND INITIALIZE SPY ROUTINES
	TLZ	F,(FL.CRASH)		;NOT CRASH FILE READING
	POPJ	P,			;AND RETURN

MAPMON::SKIPE	ONCFLG##		;ONCE-ONLY INITIALIZATION?
	TLNE	F,(FL.LOGIN)		;NO--ARE WE LOGGED IN?
	SKIPA	T1,[MP.JRM##+.MPMON##]	;OK TO USE MONITOR MAPPING
	$FATAL	(LPM,<Login please to use switch MONITOR>)
	PUSHJ	P,MAPINI		;INIT MAPPER
	TLZ	F,(FL.CRASH)		;NOT CRASH FILE READING
	JRST	MAPCOM			;ENTER COMMON CODE

MAPCRS::SKIPE	ONCFLG##		;ONCE-ONLY INITIALIZATION?
	TLNE	F,(FL.LOGIN)		;NO--ARE WE LOGGED IN?
	SKIPA	T1,[MP.EXE##+.MPFIL##]	;OK TO USE CRASH FILE MAPPING
	$FATAL	(LPC,<Login please to use switch CRASH>)
	PUSHJ	P,MAPINI		;INIT MAPPER
	TLO	F,(FL.CRASH)		;FLAG CRASH FILE READING

MAPCOM:	SKIPN	ONCFLG##		;ONCE-ONLY INITIALIZATION?
	POPJ	P,			;YES--DONE
	PUSHJ	P,SPYINI##		;AND INITIALIZE SPY ROUTINES
	$INFO	(SMN,<Status of >,E.SMN);TYPE MONITOR STATUS
	TLNE	F,(FL.CRASH)		;IS THIS A CRASH?
	$INFO	(RCF,<Report from crash file >,E.RCF);TYPE CRASH FILE NAME
	PJRST	.TCRLF##		;CRLF AND RETURN 

MAPINI:	MOVEM	T1,MAPARG##+.MPFNC##	;SAVE THEM
	SKIPN	ONCFLG##		;ONCE-ONLY INITIALIZATION?
	JRST	MAPI.1			;YES
	SKIPG	T1,S.CACHE##		;GET PAGES TO CACHE
	 MOVEI	T1,^D50			;ASSUME 50
	PUSHJ	P,MAPPGS		;NO--RESERVE PAGES FOR THE MAPPER
	JRST	MAPI.2			;ONWARD

MAPI.1:	SETZB	T1,T2			;USE MAPPER DEFAULTS

MAPI.2:	MOVEM	T1,MAPARG##+.MPNPC##	;SAVE NUMBER OF PAGES
	MOVEM	T2,MAPARG##+.MPSPN##	;SAVE STARTING PAGE NUMBER
	SETZM	MAPARG##+.MPDSN##	;DEFAULT SECTION NUMBER IS ZERO
	MOVEI	T1,CRSFIL##		;GET ADDRESS OF FILESPEC BLOCK
	MOVEM	T1,MAPARG##+.MPARG##	;SAVE IT
	MOVEI	T1,MAPARG##		;POINT TO BLOCK
	PUSHJ	P,.MAPI##		;FIREUP THE PAGE MAPPER
	  JRST	MAPI.3			;MAPPING ERROR--LOSE
	MOVEM	T1,MAPPTR		;SAVE ADDRESS OF DATA BLOCK
	SKIPN	.MPSPY##(T1)		;ARE WE SPYING?
	 TLZA	F,(FL.SPY)		;NO--MAKE SURE THE BIT IS OFF
	  TLO	F,(FL.SPY)		;FLAG SPYING (SPY PAGES)
	POPJ	P,			;AND RETURN

MAPI.3:	SKIPN	ONCFLG##		;ONCE-ONLY INITIALIZATION?
	JRST	MAPSTP			;YES--STOPCODE
	JRST	MAPFAT			;ELSE CALL IT A FATAL ERROR

E.SMN:	PUSHJ	P,SB$DVN##		;GET DEC VERSION NUMBER
	LOAD	T1,T1,VR.VER		;GET MAJOR VERSION NUMBER
	PUSHJ	P,.TOCTW##		;TYPE IT
	MOVEI	T1,[ASCIZ | monitor |]	;ASSUME THE RUNNING MONITOR
	TLNE	F,(FL.CRASH)		;CRASH FILE READING?
	MOVEI	T1,[ASCIZ | crash |]	;YES
	PUSHJ	P,.TSTRG##		;TYPE TEXT
	PUSHJ	P,SB$NAM##		;GET MONITOR NAME
	PUSHJ	P,.TSTRG##		;TYPE IT
	$TYPE	< on >
	PUSHJ	P,SB$UDT##		;GET DATE/TIME
	PJRST	.TDTTM##		;TYPE UDT AND RETURN

E.RCF:	MOVE	T1,MAPPTR		;GET MAPPER DATA BLOCK ADDRESS
	MOVEI	T1,.MPAFS##(T1)		;POINT TO THE RETURNED ASCIZ FILESPEC
	PUSHJ	P,.TSTRG##		;TYPE IT
	PUSHJ	P,SB$SCN##		;GET STOPCODE NAME
	JUMPE	T1,.POPJ##		;SKIP IF NO STOPCODE
	PUSH	P,T1			;SAVE STOPCODE NAME
	$TYPE	<, stopcode >
	POP	P,T1			;GET STOPCODE NAME BACK
	PJRST	.TSIXN##		;TYPE IT AND RETURN

SUBTTL	MAP interface -- Allocate pages


; Here to acquire pages for use by the page mapper
; Call:	MOVE	T1, number of pages
;	PUSHJ	P,MAPPGS
;	<RETURN>			;T1 = #PAGES, T2 = STARTING PAGE
;
MAPPGS:	AOS	T2,MAPFLG		;BEEN HERE ALREADY?
	CAIN	T2,1			;FIRST TIME THROUGH?
	JRST	MAPP.1			;YES
	MOVE	T2,MAPPTR		;GET POINTER TO DATA BLOCK
	MOVE	T1,.MPPGS##(T2)		;PAGES AVAILABLE FOR MAPPING
	MOVE	T2,.MPCPN##(T2)		;STARTING PAGE NUMBER
	POPJ	P,			;RETURN

MAPP.1:	PUSHJ	P,.SAVE4##		;SAVE SOME ACS
	MOVE	P1,T1			;GET NUMBER OF PAGES TO ALLOCATE
	MOVE	P3,P1			;MAKE A COPY

MAPP.2:	PUSHJ	P,M$NXPG##		;RESERVE A PAGE
	  $STOP	(FAP,<Failed to reserve a page for SPYing>)
	JUMPN	P2,MAPP.3		;FIRST TIME THROUGH?
	MOVE	P4,T1			;YES--SAVE STARTING PAGE NUMBER
	MOVEI	P2,-1(T1)		;FAKE OUT PREVIOUS PAGE NUMBER

MAPP.3:	CAIE	P2,-1(T1)		;CONSECUTIVE PAGES?
	JRST	MAPP.4			;NO--ALL CAN'T CACHE ANYMORE
	MOVE	P2,T1			;SAVE NEW PREVIOUS PAGE NUMBER
	SOJG	P1,MAPP.2		;LOOP

MAPP.4:	MOVE	T1,P3			;GET REQUESTED NUMBER OF PAGES
	SUB	T1,P1			;GET NUMBER OF PAGES RESERVED
	MOVE	T2,P4			;GET STARTING PAGE NUMBER
	POPJ	P,			;AND RETURN

SUBTTL	MAP interface -- Error handling


; This routine will build an argument block for
; the verbosity controlled error processor.
;
;
MAPFAT::PUSH	P,[CAIA	4,]		;FATAL ERROR
	JRST	MAPERR			;ENTER COMMON CODE
MAPSTP::PUSH	P,[CAIA	5,]		;STOPCODE
MAPERR:	PUSH	P,T1			;SAVE T1
	PUSH	P,T2			;SAVE T2
	MOVE	T1,MAPPTR		;GET POINTER TO DATA BLOCK
	MOVE	T2,[PUSHJ P,.ERROR##]	;INST TO CALL THE ERROR HANDLER
	MOVEM	T2,MPEBLK+0		;SAVE IT
	MOVE	T2,-2(P)		;GET NO-OP AND SEVERITY CODE
	IOR	T2,.MPPFX##(T1)		;INCLUDE THE PREFIX
	MOVEM	T2,MPEBLK+1		;SAVE IT
	MOVE	T2,[-3,,MPEBLK+3]	;POINTER TO ERROR ARGS
	MOVEM	T2,MPEBLK+2		;SAVE IT
	MOVSI	T2,MAPER1		;CONTINUATION ADDRESS
	HRRI	T2,.MPMET##(T1)		;TEXT ADDRESS
	MOVEM	T2,MPEBLK+3		;SAVE IT
	POP	P,T2			;RESTORE T2
	POP	P,T1			;RESTORE T1
	POP	P,(P)			;TRIM STACK
	JRST	MPEBLK			;GENERATE AN ERROR AND RETURN

; Handle extended error text if there is some
;
MAPER1:	MOVE	T4,MAPPTR		;GET MAPPING DATA BLOCK ADDRESS
	SKIPN	.MPXET##(T4)		;HAVE EXTENDED ERROR TEXT?
	POPJ	P,			;NO
	PUSHJ	P,.TCRLF##		;TYPE A CRLF
	MOVEI	T1,.MPXET##(T4)		;GET EXTENDED ERROR TEXT
	PUSHJ	P,.TSTRG##		;TYPE IT
	POPJ	P,			;RETURN

	SUBTTL	Data storage

	$LOW

MAPFLG:	BLOCK	1			;INITIALIZED FLAG
MPEBLK:	BLOCK	6			;MAPPING ERROR BLOCK
MAPPTR::BLOCK	1			;POINTER TO DATA IN THE MAPPER


	END