Google
 

Trailing-Edge - PDP-10 Archives - BB-H311B-RM - swskit-utilities/rstrsh.mac
There is 1 other file named rstrsh.mac in the archive. Click here to see a list.
	TITLE	RSTRSH  PROGRAM TO COMPARE REGION OF A DUMP AGAINST MONITOR
	SUBTTL	J. G. ZIMA/JGZ  SEPTEMBER 1979

	SEARCH	MACSYM,MONSYM
	.REQUIRE SYS:MACREL
	.DIRECT	FLBLST
	SALL

COMMENT \
     The purpose of this program is to compare the RSCOD area of the unrun
monitor against a dump to detect any trashing of the resident code.  Of
course, there are areas in RSCOD containing variables, and BOOT currently
overruns several pages, but these can be accounted for for a given monitor.
The normal entry prompts for the necessary parameters, and the REENTER entry
point assumes a set of assembled-in defaults to avoid some of the typing.
The output is a simple list of address, monitor word, dump word, and XOR.
\

;ACCUMULATORS:

	F=0			;FLAGS
	T1=1			;TEMP ACS
	T2=2
	T3=3
	T4=4
	Q1=5			;PRESERVED Q ACS
	Q2=6
	Q3=7
	P1=10			;PRESERVED P ACS
	P2=11
	P3=12
	P4=13
	P5=14
	P6=15
	CX=16			;USED BY MACSYM MACROS...
	P=17			;STACK POINTER

;CONSTANTS:

	PDLSIZ==30		;STACK SIZE

	PGSIZ==1000		;SIZE OF A PAGE
	PGSHFT==^D9		;NUMBER OF BITS IN A PAGE FOR SHIFTING

	MONPAG==100		;PAGE FOR MAPPING THE MONITOR
	MONADR==MONPAG*PGSIZ	;ADDRESS OF THE PAGE

	DMPPAG==101		;PAGE FOR MAPPING THE DUMP
	DMPADR==DMPPAG*PGSIZ	;ADDRESS OF THE PAGE
	SUBTTL	ENTRY POINT AND INITIALIZATION


;ENTRY VECTOR

ENTVEC:	JRST	RSTRSH		;START
	JRST	RETRSH		;REENTER - USE DEFAULTS
	EXP	0		;VERSION NUMBER




;INITIALIZATION ON NORMAL STARTUP

RSTRSH:	RESET			;RESET THE WORLD
	MOVE	P,[IOWD PDLSIZ,PDL] ;SETUP STACK
	TMSG	<
Monitor File: >			;PROMPT
	MOVX	T1,GJ%FNS+GJ%OLD+GJ%SHT+GJ%CFM	;SETUP FOR GTJFN
	MOVE	T2,[.PRIIN,,.PRIOU]
	GTJFN			;GET A HANDLE ON THE MONITOR FILE
	 ERJMP	[PERSTR	<? Error on Monitor File GTJFN - >
		 JRST	RSTRSH]	;AND TRY AGAIN
	MOVEM	T1,JFNM		;SAVE MONITOR JFN

RSTRS1:	TMSG	<
Dump File: >			;PROMPT
	MOVX	T1,GJ%FNS+GJ%OLD+GJ%SHT+GJ%CFM	;SETUP FOR GTJFN
	MOVE	T2,[.PRIIN,,.PRIOU]
	GTJFN			;GET A HANDLE ON THE DUMP FILE
	 ERJMP	[PERSTR	<? Error on Dump File GTJFN - >
		 JRST	RSTRS1]	;AND TRY AGAIN
	MOVEM	T1,JFND		;AND SAVE DUMP FILE JFN

RSTRS2:	TMSG	<
Beginning Page Number (octal): > ;PROMPT
	MOVX	T1,.PRIIN	;FROM THE TERMINAL
	MOVX	T3,^D8		;IN OCTAL
	NIN			;GET THE NUMBER
	 ERJMP	[PERSTR	<? Error on NIN for Starting Page - >
		 JRST	RSTRS2]	;TRY AGAIN
	MOVEM	T2,SPAGE	;SAVE STARTING PAGE

RSTRS3:	TMSG	<
Ending Page Number (octal): >	;PROMPT
	MOVX	T1,.PRIIN	;TERMINAL
	MOVX	T3,^D8		;STILL OCTAL
	NIN			;READ A NUMBER
	 ERJMP	[PERSTR	<? Error on NIN for Ending Page - >
		 JRST	RSTRS3]	;TRY AGAIN
	MOVEM	T2,EPAGE	;SAVE ENDING PAGE NUMBER

RSTRS4:	TMSG	<
Output Differences to File: >	;PROMPT
	MOVX	T1,GJ%FNS+GJ%SHT+GJ%FOU ;OUTPUT JFN
	MOVE	T2,[.PRIIN,,.PRIOU]
	GTJFN			;GET THE FILE
	 ERJMP	[PERSTR	<? Error on GTJFN for Output File - >
		 JRST	RSTRS4]	;TRY AGAIN

	JRST	RSMAIN		;AND ENTER THE MAINLINE CODE
	SUBTTL	REENTER INITIALIZATION

;RETRSH - HERE ON A REENTER TO USE ASSEMBLED-IN DEFAULT PARAMETERS
;WHICH ARE:
;MONITOR: = PS:<SYSTEM>MONITR.EXE
;DUMP: = PS:<SYSTEM>DUMP.EXE
;OUTPUT: = TTY:
;STARTING PAGE: = 14
;ENDING PAGE: = 67


RETRSH:	RESET			;THE WORLD
	MOVE	P,[IOWD	PDLSIZ,PDL] ;INIT STACK
	MOVX	T1,GJ%SHT+GJ%OLD ;GET THE MONITOR
	HRROI	T2,[ASCIZ/PS:<SYSTEM>MONITR.EXE/]
	GTJFN			;GET THE FILE
	 ERMSG	<GTJFN for Monitor Failed>
	MOVEM	T1,JFNM		;STORE THE JFN

	MOVX	T1,GJ%SHT+GJ%OLD ;NOW THE DUMP
	HRROI	T2,[ASCIZ/PS:<SYSTEM>DUMP.EXE/]
	GTJFN			;GET IT
	 ERMSG	<GTJFN for Dump Failed>
	MOVEM	T1,JFND		;STORE THE JFN

	MOVE	T1,DEFSRT	;GET DEFAULT STARTING PAGE
	MOVEM	T1,SPAGE	;STORE IT
	MOVE	T1,DEFEND	;GET DEFAULT ENDING PAGE
	MOVEM	T1,EPAGE	;STORE IT

	MOVX	T1,GJ%SHT	;GET THE TTY:
	HRROI	T2,[ASCIZ/TTY:/] 
	GTJFN			;DO IT
	 ERMSG	<GTJFN of TTY: Failed>
	MOVEM	T1,OJFN		;SAVE THE JFN

	JRST	RSMAIN		;AND ENTER MAINLINE
	SUBTTL	MAIN PROGRAM CODE

;HERE WITH THE JFNS AND PAGE NUMBERS SET UP FROM INITIALIZATION
;GET THE MONITOR AND DUMP INTO INFERIORS AND OPEN THE OUTPUT


RSMAIN:	MOVEM	T1,OJFN		;SAVE THE OUTPUT JFN FOR USE
	MOVX	T2,7B5+OF%WR	;OPEN THE OUTPUT FILE
	OPENF
	 ERMSG	<Cannot OPENF Output File>

	SETZ	T1,		;NOTHING SPECIAL
	CFORK			;BUT GET A FORK
	 ERMSG	<Cannot create an inferior for Monitor>
	MOVEM	T1,HNDLM	;SAVE THE HANDLE
	MOVSS	T1		;FORK HANDLE IN LH
	HRR	T1,JFNM		;AND JFN FOR MONITOR IN RH
	GET			;DO THE GET
	 ERMSG	<GET on Monitor Failed>

	SETZ	T1,		;STILL NOTHING SPECIAL
	CFORK			;GET A FORK FOR THE DUMP
	 ERMSG	<Cannot create an inferior for Dump>
	MOVEM	T1,HNDLD	;SAVE THE HANDLE
	MOVSS	T1		;TO LH
	HRR	T1,JFND		;AND DUMP JFN TO RH
	GET			;GET THE DUMP
	 ERMSG	<GET on Dump Failed>

	MOVE	T1,SPAGE	;GET FIRST PAGE
	SUB	T1,EPAGE	;GET MINUS NUMBER OF PAGES
	HRLZ	P1,T1		;COUNT TO LH OF P1
	HRR	P1,SPAGE	;AND OFFSET TO RH FOR AOBJN

	;...

;NOW DO THE COMPARES

	SETZM	DIFCNT		;START WITH NO DIFFERENCES
	HRRZ	T1,OJFN		;OUTPUT A HEADER LINE
	FMSG	<
Address    Monitor         Dump       XOR of Values
>

	CALL	DIFERS		;OUTPUT THE DIFFERENCES
	AOBJN	P1,.-1		;LOOP FOR ALL REQUESTED PAGES

	TMSG	<
>				;CRLF
	HRRZ	T1,OJFN		;OUTPUT DESIGNATOR
	FMSG	<
>				;TERMINATING BOTH OUTPUTS
	MOVX	T1,.PRIOU	;OUTPUT TO TERMINAL
	MOVE	T2,DIFCNT	;COUNT OF DIFFERENCES
	MOVX	T3,^D10		;DECIMAL
	NOUT			;DO THE NUMBER
	 ERMSG
	TMSG	<  Differences Encountered
>				;GIVE THE TOTAL
	HRRZ	T1,OJFN		;GET THE OUTPUT FILE
	CLOSF			;CLOSE IT OFF
	 ERMSG
	HALTF			;AND STOP
	JRST	RSTRSH		;RESTART ON CONTINUE
	SUBTTL	DIFERS - ROUTINE TO OUTPUT DIFFERENCES FOR A PAGE

;DIFERS - ROUTINE TO MAP AND COMPARE TWO PAGES, OUTPUTTING THE DIFFERENCES
;ACCEPTS
;  P1/	PAGE OFFSET IN INFERIORS IN RH
;	CALL	DIFERS
;RETURNS  +1:	ALWAYS AFTER OUTPUTTING ANY DIFFERENCES
;USES T1-T4.

DIFERS:	HRLZ	T1,HNDLM	;MONITOR FORK
	HRR	T1,P1		;PAGE NUMBER
	RPACS			;CHECK IT OUT
	 ERMSG
	TXNN	T2,PA%PEX	;PAGE EXIST?
	 RET			;NO, SO FORGET DIFFERENCES
	HRLZ	T1,HNDLM	;FIRST SOURCE IS MONITOR
	HRR	T1,P1		;GET PAGE NUMBER
	MOVE	T2,[.FHSLF,,MONPAG] ;DESTINATION
	MOVX	T3,PM%RD	;JUST TO READ
	PMAP			;DO THE MAPPING
	 ERMSG

	HRLZ	T1,HNDLD	;DUMP FORK
	HRR	T1,P1		;PAGE NUMBER
	RPACS			;CHECK IT OUT
	 ERMSG
	TXNN	T2,PA%PEX	;PAGE EXIST?
	 RET			;NO, SO FORGET DIFFERENCES
	HRLZ	T1,HNDLD	;SECOND SOURCE IS DUMP
	HRR	T1,P1		;PAGE NUMBER
	MOVE	T2,[.FHSLF,,DMPPAG] ;DESTINATION
	MOVX	T3,PM%RD	;READING ONLY
	PMAP			;MAP THE PAGE
	 ERMSG

	MOVSI	T4,-PGSIZ	;BUILD AOBJN POINTER FOR PAGE

DIFERL:	MOVE	T1,MONADR(T4)	;GET MONITOR COPY
	CAME	T1,DMPADR(T4)	;MATCH?
	CALL	PDIFER		;NO, PRINT OUT SOME DATA
	AOBJN	T4,DIFERL	;LOOP ACROSS ALL THE PAGE
	RET			; AND RETURN
	SUBTTL	PDIFER - ROUTINE TO PRINT THE WORD DIFFERENCES

;PDIFER - ROUTINE CALLED WHEN DIFERS NOTES A DIFFERENCE IN TWO WORDS
;OUTPUTS THE ADDRESS/ WORD-1  WORD-2  XOR OF VALUES
;INCREMENTS DIFFERENCE COUNT.
;ACCEPTS
;  T4/	OFFSET INTO THE MAPPING PAGES FOR THE WORD IN RH
;  P1/	PAGE PART OF ADDRESS IN RH
;	CALL	PDIFER
;RETURNS  +1:	ALWAYS AFTER OUTPUTTING LINE TO OJFN

PDIFER:	AOS	DIFCNT		;COUNT UP ANOTHER ONE
	HRRZ	T1,OJFN		;OUTPUT DESIGNATOR
	FMSG	<
>				;START ON A NEW LINE
	HRRZ	T2,P1		;PAGE ADDRESS
	LSH	T2,PGSHFT	;SHIFT TO ADDRESS RANGE
	ADDI	T2,0(T4)	;MAKE AN ADDRESS
	MOVX	T3,NO%MAG+NO%LFL+FLD(6,NO%COL)+^D8 ;SIX OCTAL DIGITS
	NOUT			;OUTPUT THE ADDRESS
	 ERMSG
	FMSG	</	>	;SLASH TAB
	MOVE	T2,MONADR(T4)	;THE MONITOR VALUE
	MOVX	T3,NO%MAG+NO%LFL+FLD(^D12,NO%COL)+^D8 ;12 OCTAL DIGITS
	NOUT			;OUTPUT THE VALUE
	 ERMSG
	FMSG	<   >		;SPACING
	MOVE	T2,DMPADR(T4)	;THE DUMP VALUE
	MOVX	T3,NO%MAG+NO%LFL+FLD(^D12,NO%COL)+^D8 ;12 OCTAL DIGITS
	NOUT			;SAME FORMAT
	 ERMSG
	FMSG	<   >		;MORE SPACING
	MOVE	T2,DMPADR(T4)	;CREATE
	XOR	T2,MONADR(T4)	; THE XOR'ED VALUE
	MOVX	T3,NO%MAG+NO%LFL+FLD(^D12,NO%COL)+^D8 ;12 OCTAL DIGITS
	NOUT			;OUTPUT THE VALUE
	 ERMSG
	RET			; AND RETURN
	SUBTTL	DATA AREA

DEFSRT:	EXP	14		;DEFAULT STARTING PAGE ON REENTER
DEFEND:	EXP	67		;DEFAULT ENDING PAGE ON REENTER

JFNM:	BLOCK	1		;MONITOR FILE JFN
JFND:	BLOCK	1		;DUMP FILE JFN
OJFN:	BLOCK	1		;OUTPUT JFN
HNDLM:	BLOCK	1		;FORK HANDLE FOR MONITOR
HNDLD:	BLOCK	1		;FORK HANDLE FOR DUMP

SPAGE:	BLOCK	1		;STARTING PAGE NUMBER
EPAGE:	BLOCK	1		;ENDING PAGE NUMBER

DIFCNT:	BLOCK	1		;NUMBER OF DIFFERENCES NOTED

PDL:	BLOCK	PDLSIZ		;PUSHDOWN STACK


	END	<3,,ENTVEC>