Trailing-Edge
-
PDP-10 Archives
-
tops10_tools_bb-fp64a-sb
-
10,7/maksym/maksym.mac
There are 5 other files named maksym.mac in the archive. Click here to see a list.
TITLE MAKSYM - Program to Create Symbols for Monitor Data Structures
SUBTTL J. Dziedzic /JAD 13-Jan-85
SEARCH JOBDAT, MACTEN, UUOSYM, SCNMAC
SALL ;SUPPRESS MACRO EXPANSIONS
.TEXT "/SEGMENT:LOW /SEARCH REL:SCAN, REL:HELPER"
;This program reads a monitor file (or the running monitor) and
;creates a DDT file usable with the $Y command in DDT to define
;the various data structures such as UDBs, KDBs, etc.
;Version information
MKSVER==2 ;MAJOR VERSION
MKSMIN==0 ;MINOR VERSION
MKSEDT==5 ;EDIT NUMBER
MKSWHO==0 ;WHO LAST EDITTED
LOC .JBVER
VRSN. MKS ;STORE VERSION NUMBER
RELOC ;BACK TO RELOCATABLE
SUBTTL Revision History
COMMENT |
Edit Motivation
1 JAD, 12-Jul-84. Create first version to facilitate looking at
7.02 crash dumps from auto configure monitors.
2 JAD, 31-Jul-84. Add the code to read crash files.
Not yet complete.
3 JAD, 4-Dec-84. Since I didn't bump the monitor version
for the CI LIR monitor, use a different test to see if the
monitor supports the new disk KDB format.
4 JAD, 13-Jan-85. Update for tools tape.
5 JAD, 25-Mar-85. Add /CACHESIZE: switch, fix magtape KDB
names so they are more reasonable.
|; END OF COMMENT
SUBTTL Standard Definitions
;AC's
FL=0 ;FLAGS REGISTER
T1=1 ;4 TEMPORARY AC'S
T2=2
T3=3
T4=4
P1=5 ;4 PRESERVED AC'S
P2=6
P3=7
P4=10
N==P3 ;.SCAN'S WORD INPUT AC
C==P4 ;.SCAN'S CHARACTER INPUT AC
F=14 ;DDB POINTER
J=15 ;KDB POINTER
U=16 ;UDB POINTER
P=17 ;PDL POINTER
;Flags in FL (36-bit definitions)
FL.KLP==1 ;SYSTEM USES KL PAGING (FOR CRASH FILE CODE)
;I/O channels
DI==1 ;INPUT
DO==2 ;OUTPUT
;Feature tests
ND FTSA1D,0 ;SA10 DISK SUPPORT
;Cache data
CS.HIT==37B4 ;HIT COUNT
CS.PPN==17777B17 ;PHYSICAL PAGE NUMBER
CS.VPN==777777B35 ;VIRTUAL PAGE NUMBER
;Miscellanous
.LNPDL==100 ;SIZE OF STACK
.PGSIZ==1000 ;SIZE OF A PAGE
KONTBP==1 ;OFFSET IN KDB FOR KONTBP
TKBKDB==2 ;LINK IN TAPE KDB TO NEXT KDB
TKBIUN==3 ;POINTER TO UNITS ON TAPE KDB
ABSTAB==410 ;ABSOLUTE ADDRESS OF GETTAB IMMEDIATE TABLE
%LDSEB==140,,16 ;[3] LEVEL D TABLE GETTAB WHICH EXISTS IN CI LIR
; AND IS GUARANTEED NON-ZERO IF IT EXISTS
DEFINE PG2BLK(AC),<
LSH AC,2 ;;CONVERT FROM PAGE NUMBER TO BLOCK NUMBER
>; END DEFINE PG2BLK
DEFINE ADR2PG(AC),<
LSH AC,-^D9 ;;CONVERT FROM ADDRESS TO PAGE NUMBER
>; END DEFINE ADR2PG
DEFINE PG2ADR(AC),<
LSH AC,^D9 ;;CONVERT FROM PAGE NUMBER TO ADDRESS
>; END DEFINE ADRP2G
SUBTTL Initialization
MAKSYM: JFCL ;NO CCL ENTRY
RESET ;RESET ALL I/O
MOVE P,[IOWD .LNPDL, PDLIST] ;SET UP THE STACK
SETZM ZCORE ;ZERO OUT IMPURE STORAGE
MOVE T1,[XWD ZCORE, ZCORE+1] ;...
BLT T1,EZCORE ;ZEROES TO END
HLRZ T1,.JBSA ;GET FIRST FREE ADDRESS PAST LOW SEGMENT
HRRZM T1,.JBFF ;START CORE ALLOCATOR THERE
HRRZM T1,PAGSTA ;...
MOVE T1,[XWD .LNISC, ISCARG] ;POINT AT SCANNER ARGUMENTS
PUSHJ P,.ISCAN## ;INITIALIZE COMMAND SCANNER PACKAGE
SUBTTL Ready the Input File
MAINLP: MOVE T1,PAGSTA ;START OF PAGE ALLOCATOR
SUBI T1,1 ;BACK OFF BY ONE
CAMLE T1,.JBREL ;NEED TO GIVE SOME BACK?
CORE T1, ;YES, DO SO
JFCL ;WE TRIED
SETOM S.MIN ;PRESET SWITCH AREA
MOVE T1,[XWD S.MIN,S.MIN+1] ;...
BLT T1,S.EMIN ;-1 TO END
RELEAS DI, ;CLOSE DOWN OPEN FILES
RELEAS DO, ;...
PUSHJ P,.RUNCM## ;HANDLE /RUN IF SET
SETZM SPEC ;ZERO OUT FILE SPEC BLOCK
MOVE T1,[XWD SPEC, SPEC+1] ;...
BLT T1,SPEC+.FXLEN-1 ;ZEROES TO END
MOVE T1,[XWD .LNPSC, PSCARG] ;POINT AT ARGUMENT BLOCK
PUSHJ P,.PSCAN## ;CALL PARTIAL MODE SCANNER
OUTSTR [ASCIZ |File: |]
;SEE IF USER TYPED AN END OF FILE AND HANDLE AS APPROPRIATE
CAXG C,.CHEOF ;SEE IF EOF
JRST [PUSHJ P,.ALDON## ;YES, HANDLE NORMAL CASES
CAXG C,.CHEOF ;THEN CHECK AGAIN
PUSHJ P,.MNRET## ;YES, RETURN TO MONITOR
JRST MAINLP] ;THEN START OVER AGAIN
;READ THE FILE SPEC FROM THE USER
PUSHJ P,.FILIN## ;GET FILE SPEC
JUMPN T1,GETOPT ;JUMP IF SOMETHING INPUT
;HERE IF NOTHING TYPED BEFORE THE SEPARATOR. THE ONLY LEGAL
;CASES ARE /RUN AND INDIRECT COMMAND FILES.
CAIN C,"@" ;SEE IF INDIRECT
PUSHJ P,.GTIND## ;YES, SETUP INDIRECT
JUMPLE C,MAINLP ;IF END OF LINE, GO DO MORE
PJRST E.ILSC## ;OTHERWISE, GIVE ERROR
;HERE TO CHECK OPTIONS FILE AND READ THE USER FILE SPEC
GETOPT: JUMPG C,E.INCL## ;ERROR IF MORE ON LINE
MOVEI T1,SPEC ;POINT TO SPEC AREA
MOVEI T2,.FXLEN ;...
PUSHJ P,.GTSPC## ;COPY IT IN
SKIPLE S.MON ;/MONITOR?
JRST DOIT ;YES, SKIP ALL THE INPUT FILE STUFF
SKIPN SPEC+.FXNAM ;MAKE SURE A NAME SPECIFIED
JRST MAINLP ;NOT, ASK AGAIN
HRLOI T1,'EXE' ;GET DEFAULT EXTENSION
SKIPN SPEC+.FXEXT ;ANYTHING SPECIFIED?
MOVEM T1,SPEC+.FXEXT ;NO, DEFAULT IT
;CALL THE .SCAN UTILITY ROUTINE TO CONVERT THE SCAN BLOCK INTO
;AN OPEN AND LOOKUP/ENTER BLOCK
MOVE T1,[XWD .FXLEN, SPEC] ;LENGTH,,ADDRESS OF FILE SPEC
MOVEI T2,DIOPBK ;OPEN BLOCK ADDRESS
MOVE T3,[XWD .RBMAX, LOKBLK] ;LENGTH,,ADDRESS OF LOOKUP BLOCK
PUSHJ P,.STOPN## ;SET UP OPEN BLOCKS
JRST BADFIL ;IMPROPERLY FORMATTED FILE SPEC
;OPEN THE INPUT FILE
MOVEI T1,.IODMP ;DATA MODE
MOVEM T1,DIOPBK+.OPMOD ;SAVE I/O MODE WORD
OPEN DI,DIOPBK ;OPEN THE FILE
JRST DIOERR ;ERROR
MOVEI T1,.RBPRV ;DON'T NEED A LONG LOOKUP
MOVEM T1,LOKBLK+.RBCNT ;SAVE COUNT
LOOKUP DI,LOKBLK ;LOOKUP THE FILE
JRST DILERR ;ERROR
;READ THE FIRST PAGE OF THE FILE AND MAKE SURE IT'S AN .EXE FILE
SKIPG T1,S.CACH ;GET /CACHESIZE: VALUE
MOVX T1,AD.CSZ ;NOT SPECIFIED, GET DEFAULT
MOVNS T1 ;MAKE AN AOBJN WORD
HRLZM T1,CSHPTR ;STORE IT FOR LATER
PUSHJ P,CSHINI ;INITIALIZE THE CACHE
SETZ T1, ;ASK FOR PAGE 0
PUSHJ P,REDPAG ;...
JRST RIOERR ;ERROR
HLRZ T2,(T1) ;GET CODE WORD
CAIE T2,.SVDIR ;DIRECTORY?
JRST NOTEXE ;NO
MOVE T2,(T1) ;GET WORD COUNT
TRNN T2,1 ;ODD COUNT?
JRST NOTEXE ;NO, NOT .EXE FORMAT
MOVNI T2,-1(T2) ;GET -VE WORD COUNT FOR DIRECTORY
HRLI T2,EXEDIR ;WHERE DIRECTORY WILL BE STORED
MOVSM T2,DIRPTR ;SAVE POINTER TO DIRECTORY
HRRES T2 ;GET -VE COUNT AGAIN
MOVMS T2 ;MAKE IT POSITIVE
MOVSI T1,1(T1) ;SET TO BLT PAGE TO DIRECTORY BUFFER
HRRI T1,EXEDIR ;WHERE TO BLT TO
BLT T1,EXEDIR-1(T2) ;MOVE THE DIRECTORY
;CHECK FILE CONSISTANCY AND SET UP FOR GETTAB AND PEEK SIMULATION
PUSHJ P,SETDSK ;SET FOR GETTAB AND PEEK SIMULATION
SUBTTL Ready the Output File
DOIT: OPEN DO,DOPNBK ;OPEN THE OUTPUT CHANNEL
JRST DOOERR ;ERROR
HLLZS DENTBK+1 ;CLEAR RH OF DATE
SETZM DENTBK+2 ;CLEAR PRIVILEGE
SETZM DENTBK+3 ;CLEAR PPN/PATH POINTER
ENTER DO,DENTBK ;ENTER THE OUTPUT FILE
JRST DOEERR ;ERROR
OUTBUF DO,2 ;JUST NEED 2 BUFFERS
MOVEI T1,TYPOUT ;NOW SET UP NEW OUTPUT ROUTINE ADDRESS
PUSHJ P,.TYOCH## ;CALL .TOUTS
;Defeat echo of $Y files as the first command in the file
MOVEI T1,[ASCIZ |"" Turning off echo of a long command file"
1M[Q<FOO:4000000+FOO1M
|]
PUSHJ P,.TSTRG## ;SAVE OLD $1M MASK, SET NEW
SUBTTL Perform ONCE-Only Initialization
REPEAT 0,< ;DOESN'T WORK
MOVX T1,%CNVER ;GET THE MONITOR VERSION
PUSHJ P,DOGTAB ;DO THE GETTAB
HRRZS T1 ;KEEP JUST RH
CAIGE T1,70201 ;7.02 CI LIR OR LATER?
>; END REPEAT 0
MOVX T1,%LDSEB ;SEE IF THIS GETTAB WORKS
PUSHJ P,DOGTAB ;...
;(ZERO IF NON CI LIR, NON-ZERO IF CI LIR)
MOVEM T1,NEWKDB ;STORE NEW KDB FORMAT FLAG
SUBTTL Process Disk Data Structures
DODISK: MOVX T1,%LDKON ;GET THE KONTROLLER INFORMATION
PUSHJ P,DOGTAB ; FROM WHOMEVER
HRRM T1,KONNXT ;SET THE LINK TO NEXT KDB WORD
HLRZ J,T1 ;GET ADDRESS OF FIRST KDB
DISK.1: SKIPN NEWKDB ;NEW KDB FORMAT?
JRST [HRRZ P1,J ;NO, GET KDB ADDRESS
HRLI P1,-10 ;MAXIMUM OF 8 UNITS PER KDB
JRST DISK.2] ;CONTINUE
MOVEI T1,KONTBP(J) ;(KNOWN) OFFSET FOR AOBJN POINTER TO UNITS
PUSHJ P,DOPEEK ;ASK THE MONITOR
MOVE P1,T1 ;COPY THE POINTER
DISK.2: SETZ U, ;FLAG NO UNITS SEEN YET
DISK.3: HRRZ T1,P1 ;GET ADDRESS OF NEXT UNIT'S ADDRESS
PUSHJ P,DOPEEK ;ASK THE MONITOR
JUMPE T1,DISK.5 ;JUMP IF NOTHING THERE
EXCH T1,U ;SWAP NEW AND PREVIOUS UDB ADDRESSES
JUMPN T1,DISK.4 ;PROCEED IF WE KNOW KONTROLLER NAME
HRRZ T1,J ;GET THE KDB ADDRESS
PUSHJ P,.TOCTW## ;TYPE IN OCTAL
MOVEI T1,"<" ;GET THE SYMBOL DEFINITION CHARACTER
PUSHJ P,.TCHAR## ;TYPE IT
HRRZ T1,U ;GET THE UDB ADDRESS
PUSHJ P,DOPEEK ;SEE WHAT THE NAME IS
LDB T2,[POINT 12, T1, 11] ;GET THE FIRST TWO CHARACTERS
IFN FTSA1D,< ;IF SA10 DISK SUPPORT
CAIN T2,' SP' ;SA10 DISK?
TROA T1,' KD' ;YES, KDB NAMES ARE DIFFERENT
>; END IFN FTSA1D
HRRI T1,'KDB' ;NO, MAKE A BETTER (SHORTER) NAME
PUSHJ P,.TSIXN## ;TYPE IN SIXBIT
PUSHJ P,.TCOLN## ;TYPE A COLON
PUSHJ P,.TCRLF## ;TYPE A CARRIAGE RETURN-LINE FEED
DISK.4: HRRZ T1,U ;GET THE UDB ADDRESS
PUSHJ P,.TOCTW## ;TYPE IN OCTAL
MOVEI T1,"<" ;GET THE SYMBOL DEFINITION CHARACTER
PUSHJ P,.TCHAR## ;TYPE IT
HRRZ T1,U ;GET THE UDB ADDRESS AGAIN
PUSHJ P,DOPEEK ;SEE WHAT THE NAME IS
PUSHJ P,.TSIXN## ;TYPE IN SIXBIT
PUSHJ P,.TCOLN## ;TYPE A COLON
PUSHJ P,.TCRLF## ;TYPE A CARRIAGE RETURN-LINE FEED
DISK.5: AOBJN P1,DISK.3 ;LOOP FOR REMAINING UNITS
KONNXT:!MOVEI T1,0(J) ;ADDRESS OF LINK TO NEXT KDB
PUSHJ P,DOPEEK ;ASK THE MONITOR
HLRZ J,T1 ;GET THE NEXT KDB ADDRESS
JUMPN J,DISK.1 ;LOOP FOR ANY OTHERS
SUBTTL Process Magtape Data Structures
DOTAPE: MOVX T1,%CNMTK ;ADDRESS OF FIRST MAGTAPE KDB
PUSHJ P,DOGTAB ;DO THE GETTAB
SKIPN J,T1 ;ARE THERE ANY TAPES?
JRST DONE ;NO, THEN WE'RE DONE
MOVX T1,%CNTDB ;POINTER TO DDB IN TUB
PUSHJ P,DOGTAB ;DO THE GETTAB
HRRM T1,TUBDDB ;SET THE LINK TO DDB WORD
TAPE.1: HRRZ T1,J ;GET KDB ADDRESS
PUSHJ P,.TOCTW## ;TYPE IN OCTAL
MOVEI T1,"<" ;GET THE SYMBOL DEFINITION CHARACTER
PUSHJ P,.TCHAR## ;TYPE IT
HRRZ T1,J ;GET THE KDB ADDRESS AGAIN
PUSHJ P,DOPEEK ;SEE WHAT THE NAME IS
ADD T1,['A'-'0',,0] ;MAKE IT ALPHABETIC
LDB P2,[POINT 6,T1,17] ;SAVE FOR LATER USE
HRRI T1,'KDB' ;MAKE THE NAME THE SAME AS DISK KDBS
PUSHJ P,.TSIXN## ;TYPE IN SIXBIT
PUSHJ P,.TCOLN## ;TYPE A COLON
PUSHJ P,.TCRLF## ;TYPE A CARRIAGE RETURN-LINE FEED
MOVEI T1,TKBIUN(J) ;ADDRESS OF AOBJN POINTER TO UNITS
PUSHJ P,DOPEEK ;SNEAK A PEEK
MOVE P1,T1 ;SAVE THE POINTER IN P1
TAPE.2: HRRZ T1,P1 ;GET ADDRESS OF NEXT UNIT'S ADDRESS
PUSHJ P,DOPEEK ;SNEAK A LOOK
SKIPN U,T1 ;IS THERE A UNIT?
JRST TAPE.3 ;NO
HRRZ T1,U ;GET UDB ADDRESS
PUSHJ P,.TOCTW## ;TYPE IN OCTAL
MOVEI T1,"<" ;GET THE SYMBOL DEFINITION CHARACTER
PUSHJ P,.TCHAR## ;TYPE IT
HRRZ T1,U ;GET THE UDB ADDRESS AGAIN
PUSHJ P,DOPEEK ;GET THE UNIT NAME
TRNE T1,77 ;MAKE SURE UNIT NUMBER LEFT JUSTIFIED
LSH T1,^D6 ;...
TRNE T1,7700 ;DO IT AGAIN
LSH T1,^D6 ;...
HRLI T1,'MT '(P2) ;BUILD UDB NAME
PUSHJ P,.TSIXN## ;TYPE IN SIXBIT
PUSHJ P,.TCOLN## ;TYPE A COLON
PUSHJ P,.TCRLF## ;TYPE A CARRIAGE RETURN-LINE FEED
TUBDDB:!MOVEI T1,0(U) ;ADDRESS OF LINK TO DDB
PUSHJ P,DOPEEK ;SNEAK A PEEK
SKIPN F,T1 ;SAVE DDB ADDRESS IN F
JRST TAPE.3 ;NO DDB, SKIP ON
HRRZ T1,F ;GET DDB ADDRESS
PUSHJ P,.TOCTW## ;TYPE IN OCTAL
MOVEI T1,"<" ;GET THE SYMBOL DEFINITION CHARACTER
PUSHJ P,.TCHAR## ;TYPE IT
HRRZ T1,F ;GET THE DDB ADDRESS AGAIN
PUSHJ P,DOPEEK ;GET NAME FROM DDB
TRNE T1,777700 ;IF STATION NUMBER IN NAME,
LSH T1,^D12 ; DROP IT
HRLI T1,'MD '(P2) ;BUILD DDB NAME
PUSHJ P,.TSIXN## ;TYPE IN SIXBIT
PUSHJ P,.TCOLN## ;TYPE A COLON
PUSHJ P,.TCRLF## ;TYPE A CARRIAGE RETURN-LINE FEED
TAPE.3: AOBJN P1,TAPE.2 ;LOOP FOR REMAINING UNITS
MOVEI T1,TKBKDB(J) ;ADDRESS OF LINK TO NEXT KDB
PUSHJ P,DOPEEK ;TAKE A LOOK
HRRZ J,T1 ;GET THE NEXT KDB ADDRESS
JUMPN J,TAPE.1 ;LOOP IF ANOTHER KDB
JRST DONE ;ALL DONE
SUBTTL Here When Done
DONE: MOVEI T1,[ASCIZ |FOO1MFOOK
"" Command file has completed"
|]
PUSHJ P,.TSTRG## ;TURN $Y ECHO BACK THE WAY IT WAS
CLOSE DO, ;CLOSE THE OUTPUT CHANNEL
RELEAS DO, ;RELEASE THE OUTPUT CHANNEL
EXIT ;EXIT
SUBTTL Set to Simulate GETTAB and PEEK for Crash File
;Routine to set up variables needed to simulate GETTABs and PEEKs
;on the crash file.
;Call:
; PUSHJ P,SETDSK
;Return:
; CPOPJ always
SETDSK: MOVEI T1,340000 ;INIT START OF PER-PROCESS AREA
MOVEM T1,PERPRB ;SAVE FOR SIMPEK
MOVEI T1,ABSTAB ;ADDRESS OF GETTAB IMMEDIATE TABLE
PUSHJ P,DOPEEK ;SNEAK A PEEK
TLNE T1,-1 ;MAKE SURE LH IS ZERO
JRST CFIGET ;NO, ERROR
JUMPE T1,CFIGET ;DITTO IF ZERO
PUSH P,T1 ;SAVE ADDRESS FOR A BIT
ADDI T1,.GTSLF ;ADD IN OFFSET TO GETTAB IMMEDIATE
PUSHJ P,DOPEEK ;SNEAK A PEEK
POP P,T2 ;RESTORE REMEMBERED ADDRESS
CAIE T2,(T1) ;SEE IF IT MATCHES
JRST CFIGET ;NO
HRRZM T1,OFSGTB ;SAVE OFFSET FOR LATER USE
LDB T1,[POINTR T1,SL.MAX] ;GET MAXIMUM ITEM
MOVEM T1,MAXGTB ;SAVE IT
MOVX T1,%CNST2 ;GET SECOND STATES WORD
PUSHJ P,DOGTAB ;DO THE GETTAB
TXNE T1,ST%KLP ;SYSTEM USE KL PAGING?
TXOA FL,FL.KLP ;YES, SET FLAG AND SKIP
TXZ FL,FL.KLP ;NO, CLEAR FLAG
MOVX T1,%CNBCP ;GET BOOT CPU NUMBER
PUSHJ P,DOGTAB ;SIMULATE GETTAB
LSH T1,1 ;TIMES TWO
ADDX T1,%CCTOS ;GET HIS EXEC MAP ADDRESS
PUSHJ P,DOGTAB ;SIMULATE GETTAB
TXNE FL,FL.KLP ;KL PAGING?
ADDI T1,.PGSIZ ;YES, MAP IS IN FOLLOWING PAGE
MOVEM T1,.CPMAP ;SAVE ADDRESS OF BOOT CPU'S EXEC MAP
MOVX T1,%VMPPB ;START OF PER-PROCESS AREA
PUSHJ P,DOGTAB ;SIMULATE GETTAB
SKIPE T1 ;KNOWN?
MOVEM T1,PERPRB ;YES, RESET BEGINNING OF PER-PROCESS AREA
POPJ P, ;RETURN
SUBTTL Data Retrieval Routines
;Routine to perform a GETTAB on the running monitor or a crash file.
;Call:
; T1/ Item to GETTAB
; PUSHJ P,DOGTAB
;Return:
; CPOPJ always, with:
; T1/ Returned value or zero
DOGTAB: SKIPG S.MON ;/MONITOR?
JRST SIMTAB ;NO, SIMULATE GETTAB
GETTAB T1, ;ASK THE MONITOR
SETZ T1, ;WON'T TELL US!
POPJ P, ;RETURN
;Routine to perform a PEEK on the running monitor or a crash file.
;Call:
; T1/ Address to peek at
; PUSHJ P,DOPEEK
;Return:
; CPOPJ always, with:
; T1/ Contents of that address or zero
DOPEEK: SKIPG S.MON ;/MONITOR?
JRST SIMPEK ;NO, SIMULATE PEEK
PEEK T1, ;ASK THE MONITOR
POPJ P, ;RETURN
;Routine to simulate a GETTAB on a crash file.
;Call:
; T1/ Item to GETTAB
; PUSHJ P,SIMTAB
;Return:
; CPOPJ always, with:
; T1/ Returned value or zero
SIMTAB: PUSHJ P,.SAVE1## ;SAVE P1
MOVE P1,T1 ;COPY DESIRED ITEM TO P1
HRRZS T1 ;KEEP JUST TABLE NUMBER
CAMLE T1,MAXGTB ;IN RANGE OF MAXIMUM?
JRST RETZER ;NO, RETURN A ZERO
ADD T1,OFSGTB ;GET CORE ADDRESS
PUSHJ P,SIMPEK ;SNEAK A PEEK AT IT
LDB T2,[POINTR T1,SL.MAX] ;GET MAXIMUM ITEM
HLRZ T3,P1 ;GET REQUESTED ITEM
CAMLE T3,T2 ;REQUESTED ITEM WITHIN TABLE?
JRST RETZER ;NO, RETURN A ZERO
LDB T1,[POINTR T1,SL.ADR] ;GET ADDRESS
ADD T1,T3 ;ADD IN OFFSET TO DESIRED ITEM
PJRST SIMPEK ;SNEAK A PEEK AT IT AND RETURN
RETZER: SETZ T1, ;GET A ZERO
POPJ P, ;RETURN
;Routine to simulate a PEEK on a crash file.
;Call:
; T1/ Address to peek at
; PUSHJ P,SIMPEK
;Return:
; CPOPJ always, with:
; T1/ Contents or address of zero
SIMPEK: TLZ T1,-1 ;CLEAR JUNK
CAMGE T1,PERPRB ;ADDRESS IN MONITOR LOW SEGMENT?
PJRST REDADR ;YES, RETURN CONTENTS OF THAT PHYSICAL ADDRESS
CAIGE T1,400000 ;ADDRESS IN MONITOR HIGH SEGMENT?
PJRST RETZER ;NO, RETURN A ZERO
PUSH P,T1 ;SAVE REQUESTED ADDRESS
ADR2PG T1 ;CONVERT TO A PAGE NUMBER
TXNN FL,FL.KLP ;KL PAGING?
ROT T1,-1 ;NO, MAP SLOTS ARE HALF-WORDS, DIVIDE BY TWO
PUSH P,T1 ;SAVE THE FLAG
HRRZS T1 ;KEEP JUST THE OFFSET IN EXEC MAP
ADD T1,.CPMAP ;ADD IN ADDRESS OF EXEC MAP
PUSHJ P,SIMPEK ;GET RECURSIVE
POP P,T2 ;RESTORE FLAG
TXNN FL,FL.KLP ;KL PAGING?
SKIPGE T2 ;NO, WHICH HALF-WORD OF MAPPING DID WE WANT?
SKIPA ;KL PAGING, OR RIGHT HALF-WORD
HLRZS T1 ;WE WANT THE LEFT HALF-WORD
ANDI T1,17777 ;KEEP JUST 13-BIT PHYSICAL PAGE NUMBER
PG2ADR T1 ;CONVERT TO AN ADDRESS
POP P,T2 ;RESTORE ORIGINAL ADDRESS
ANDI T2,.PGSIZ-1 ;KEEP JUST IN-PAGE PORTION
ADD T1,T2 ;COMPUTE PHYSICAL ADDRESS
PJRST REDADR ;READ THAT ADDRESS AND RETURN
;Routine to read a physical address from the .EXE file.
;Call:
; T1/ Address
; PUSHJ P,REDADR
;Return:
; CPOPJ if address not contained in file
; CPOPJ1 if address contained in file, with:
; T1/ Contents of address
REDADR: PUSH P,T1 ;SAVE THE ENTIRE ADDRESS
ADR2PG T1 ;CONVERT ADDRESS TO A PAGE NUMBER
MOVE T2,DIRPTR ;GET AOBJN POINTER TO EXE DIRECTORY
REDA.1: LDB T3,[POINTR .SVPPC(T2),SV%PPN] ;GET PROCESS PAGE NUMBER
LDB T4,[POINTR .SVPPC(T2),SV%REP] ;GET REPEAT COUNT
ADD T4,T3 ;COMPUTE RANGE OF PAGES IN THIS DIRECTORY ENTRY
CAMGE T1,T3 ;STILL A CHANCE OF FINDING THIS PAGE?
JRST REDA.3 ;NO, SINCE DIRECTORY IS MONOTONICALLY INCREASING,
; THIS PAGE ISN'T CONTAINED IN THE FILE
CAML T1,T3 ;WITHIN RANGE OF THIS DIRECTORY ENTRY?
CAMLE T1,T4 ;...
JRST REDA.2 ;NO, KEEP LOOKING
SUB T1,T3 ;YES, COMPUTE PAGE OFFSET FROM START
LDB T3,[POINTR .SVFPF(T2),SV%FPN] ;GET FILE PAGE NUMBER
JUMPE T3,REDA.4 ;GO IF ALLOCATED BUT ZERO
ADD T1,T3 ;COMPUTE FILE PAGE NUMBER
PUSHJ P,REDPAG ;READ THAT PAGE INTO CORE
JRST RETZER ;ERROR
POP P,T2 ;RESTORE ENTIRE ADDRESS
DPB T2,[POINT 9,T1,35] ;SET LINE NUMBER IN PAGE
MOVE T1,(T1) ;GET THE CONTENTS
POPJ P, ;RETURN THEM TO CALLER
REDA.2: AOBJN T2,.+1 ;ADJUST DIRECTORY POINTER
AOBJN T2,REDA.1 ;LOOP FOR REMAINING ENTRIES
REDA.3: SOS -1(P) ;DIDN'T FIND THIS ADDRESS, SET FOR NON-SKIP RETURN
REDA.4: POP P,T1 ;CLEAN UP THE STACK
SETZ T1, ;GET A ZERO
JRST .POPJ1## ;RETURN TO CALLER
;Routine to read a page from the EXE file.
;Call:
; T1/ File page number
; PUSHJ P,REDPAG
;Return:
; CPOPJ always
REDPAG: PUSHJ P,.SAVE2## ;SAVE P1-P2
MOVE P1,T1 ;COPY PAGE NUMBER
MOVE P2,CSHPTR ;GET POINTER TO CACHE
LDB T1,[POINTR CACHE(P2),CS.PPN] ;GET PHYSICAL PAGE NUMBER
CAME T1,P1 ;MATCH?
AOBJN P2,.-2 ;NO, LOOP
JUMPGE P2,REDP.1 ;JUMP IF NOT FOUND IN CACHE
LDB T1,[POINTR CACHE(P2),CS.HIT] ;GET HIT COUNT
ADDI T1,1 ;BUMP IT
CAXGE T1,1_WID(CS.HIT) ;EXCEEDED FIELD SIZE?
DPB T1,[POINTR CACHE(P2),CS.HIT] ;NO, STORE IT BACK
LDB T1,[POINTR CACHE(P2),CS.VPN] ;GET VIRTUAL PAGE NUMBER
PG2ADR T1 ;CONVERT TO AN ADDRESS
JRST .POPJ1## ;SKIP RETURN
REDP.1: MOVE P2,CSHPTR ;NOW FIND AN ENTRY TO RE-USE
MOVX P3,.INFIN ;GREATEST HIT COUNT
SETO P4, ;INDEX INTO CACHE
REDP.2: LDB T1,[POINTR CACHE(P2),CS.HIT] ;GET HIT COUNT
CAML T1,P3 ;LESS THAN BEST SO FAR?
JRST REDP.3 ;NO
MOVE P3,T1 ;YES, REMEMBER LOWEST
HRRZ P4,P2 ;AND COUNT
REDP.3: AOBJN P2,REDP.2 ;LOOP THROUGH REST OF CACHE
;HERE WITH P4 = POINTER TO BEST SLOT TO RE-USE IN CACHE
LDB T1,[POINTR CACHE(P4),CS.VPN] ;GET OUR PAGE NUMBER
JUMPN T1,REDP.4 ;JUMP IF IT EXISTS
PUSHJ P,CREPAG ;CREATE A PAGE
HALT . ;ERROR
DPB T1,[POINTR CACHE(P4),CS.VPN] ;STORE PAGE NUMBER
REDP.4: DPB P1,[POINTR CACHE(P4),CS.PPN] ;STORE PHYSICAL PAGE NUMBER
MOVEI T2,1 ;INIT THE HIT COUNT
DPB T2,[POINTR CACHE(P4),CS.HIT] ;...
PG2BLK P1 ;CONVERT TO A BLOCK NUMBER
USETI DI,1(P1) ;POSITION FOR INPUT
PG2ADR T1 ;CONVERT VIRTUAL PAGE NUMBER TO AN ADDRESS
SUBI T1,1 ;MAKE IT ADDRESS-1
HRLI T1,-.PGSIZ ;MAKE IT AN IOWD
SETZ T2, ;TERMINATE I/O LIST
IN DI,T1 ;READ THE PAGE
JRST REDP.5 ;NO ERRORS
SETO T1,1 ;GET -1
DPB T1,[POINTR CACHE(P4),CS.PPN] ;MAKE THIS ENTRY LOOK INVALID
JRST RIOERR ;REPORT I/O ERROR AND RETURN
REDP.5: MOVEI T1,1(T1) ;IOWD BACK TO AN ADDRESS
JRST .POPJ1## ;SKIP RETURN
SUBTTL Cache Routines
;Routine to initialize the cache. Returns any pages already used
;for stuff and zeroes the database.
;Call:
; PUSHJ P,CSHINI
;Return:
; CPOPJ ALWAYS
CSHINI: PUSHJ P,.SAVE1## ;SAVE P1
MOVSI P1,-MX.CSZ ;MAXIMUM SIZE OF CACHE
CSHI.1: LDB T1,[POINTR CACHE(P1),CS.VPN] ;GET VIRTUAL PAGE NUMBER
JUMPE T1,CSHI.2 ;JUMP IF THIS ENTRY NOT USED
PUSHJ P,RELPAG ;RELEASE THAT PAGE
CSHI.2: SETO T1, ;GET -1
DPB T1,[POINTR CACHE(P1),CS.PPN] ;MAKE TESTS ON PAGE NUMBER FAIL
AOBJN P1,CSHI.1 ;LOOP FOR REMAINING PAGES
POPJ P, ;RETURN
;Routine to create a page.
;Call:
; PUSHJ P,CREPAG
;Return:
; CPOPJ IF ERROR
; CPOPJ1 IF SUCCESS WITH:
; T1/ Virtual page number
CREPAG: MOVE T3,.JBREL ;WHERE NEXT PAGE WILL COME FROM
MOVEI T4,.PGSIZ(T3) ;UPDATE .JBFF
MOVEM T4,.JBFF ;...
ADDI T3,.PGSIZ-1 ;...
ADR2PG T3 ;CONVERT TO PAGE NUMBER
MOVEI T2,1 ;JUST ONE PAGE
MOVE T1,[.PAGCD,,T2] ;POINT AT ARGUMENTS
PAGE. T1, ;CREATE THE PAGE
POPJ P, ;ERROR, RETURN
HRRZ T1,T3 ;GET PAGE NUMBER
JRST .POPJ1## ;SKIP RETURN
;Routine to destroy a page.
;Call:
; T1/ Virtual page number
; PUSHJ P,RELPAG
;Return:
; CPOPJ ALWAYS
RELPAG: MOVE T3,T1 ;COPY PAGE NUMBER HERE
TXO T3,PA.GAF ;SET THE "DESTROY" FLAG
MOVEI T2,1 ;JUST ONE PAGE
MOVE T1,[.PAGCD,,T2] ;POINT AT ARGUMENTS
PAGE. T1, ;DESTROY IT
JFCL ;WE DID OUR BEST
POPJ P, ;RETURN
SUBTTL Miscellaneous
;Routine to output one character to the output file.
;Call:
; T1/ Character to output
; PUSHJ P,TYPOUT
;Return:
; CPOPJ always
TYPOUT: SOSGE OBUF+.BFCTR ;STILL ROOM?
JRST TYPO.1 ;NO
IDPB T1,OBUF+.BFPTR ;YES, STORE THE BYTE
POPJ P, ;RETURN
TYPO.1: OUT DO, ;FLUSH THIS BUFFER
JRST TYPOUT ;NO ERRORS, PROCEED
OUTSTR [ASCIZ /
?Output error for MAKSYM.DDT
/]
EXIT ;CROAK
SUBTTL Error Routines
DOOERR: OUTSTR [ASCIZ |
?OPEN failed for device DSK:
|]
EXIT ;CROAK
DOEERR: OUTSTR [ASCIZ |
?ENTER failed for DSK:MAKSYM.DDT
|]
EXIT ;CROAK
DIOERR: OUTSTR [ASCIZ |
?OPEN failed for input file device
|]
JRST MAINLP ;TRY AGAIN
DILERR: OUTSTR [ASCIZ |
?LOOKUP failure for input file
|]
JRST MAINLP ;TRY AGAIN
BADFIL: OUTSTR [ASCIZ |
?Incorrectly formatted file specification
|]
JRST MAINLP ;TRY AGAIN
RIOERR: OUTSTR [ASCIZ |
?Read error for input file
|]
EXIT ;CROAK
NOTEXE: OUTSTR [ASCIZ |
?Input file not in .EXE format
|]
JRST MAINLP ;TRY AGAIN
CFIGET: OUTSTR [ASCIZ |
?Can't find GETTAB information in crash file
|]
JRST MAINLP ;TRY AGAIN
SUBTTL .SCAN argument blocks
;For call to .ISCAN
ISCARG: XWD 0, 0 ;NO MONITOR COMMANDS
XWD 0, 0 ;NO CCL ENTRY
XWD 0, 0 ;CHARACTER OUTPUT ROUTINE
.LNISC==.-ISCARG ;LENGTH OF .ISCAN ARGUMENT BLOCK
;For call to .PSCAN
PSCARG: IOWD SWTCHL, SWTCHN ;IOWD POINTER TO SWITCH NAMES
XWD SWTCHD, SWTCHM ;
XWD 0, SWTCHP ;ETC
XWD 1, HLPTXT ;ADDRESS OF HELP MESSAGE
.LNPSC==.-PSCARG ;LENGTH OF .PSCAN ARGUMENT BLOCK
DM CSZ,^D100,^D25,^D50
DEFINE SWTCHS,<
SP *CACHESIZE,S.CACH,.SWDEC##,CSZ,
SN *MONITOR,S.MON
>; END DEFINE SWTCHS
DOSCAN (SWTCH) ;INVOKE THE SWITCH TABLE MACROS
DEFINE HLPMSG,<
XLIST ;TURN OFF LISTING
ASCIZ |
Type the name of a monitor crash dump file, or /MONITOR to extract
information from the running monitor.
Optional switches which may be specified with a crash dump file are:
/CACHESIZE:n Cache the "n" most recently used pages from the
crash dump file; default for "n" is 25.
|
LIST
>; END HLPMSG
HLPTXT: HLPMSG ;GENERATE HELP TEXT
SUBTTL Impure Storage
PDLIST: BLOCK .LNPDL ;THE PDL
NEWKDB: BLOCK 1 ;NON-ZERO IF NEW (7.02 CI LIR) KDB FORMAT
S.MIN:! ;START OF SWITCH AREA
S.CACH: BLOCK 1 ;CACHE SIZE
S.MON: BLOCK 1 ;+1 IF /MONITOR TYPED
S.EMIN==.-1 ;END OF SWITCH AREA
SPEC: BLOCK .FXLEN ;SCANNER FILE SPEC
DOPNBK: .IOASC ;CHANNEL DO OPEN BLOCK
SIXBIT /DSK/ ;LOGICAL DSK:
XWD OBUF, 0 ;OUTPUT ONLY
DENTBK: SIXBIT /MAKSYM/ ;FILE
SIXBIT /DDT/ ;EXTENSION
0 ;PROTECTION
0 ;PPN
OBUF: BLOCK 3 ;OUTPUT BUFFER CONTROL BLOCK
DIOPBK: .IODMP ;CHANNEL DI OPEN BLOCK
SIXBIT /DSK/ ;FILLED IN BY WILD
0 ;DUMP MODE I/O
ZCORE:! ;START OF ZEROED AREA
LOKBLK: BLOCK .RBMAX ;LOOKUP BLOCK
DIRPTR: BLOCK 1 ;AOBJN POINTER TO EXE FILE DIRECTORY
EXEDIR: BLOCK .PGSIZ ;WHERE THE DIRECTORY IS STORED
OFSGTB: BLOCK 1 ;OFFSET FOR GETTAB INFORMATION
MAXGTB: BLOCK 1 ;MAXIMUM GETTAB TABLE
.CPMAP: BLOCK 1 ;ADDRESS OF BOOT CPU'S EXEC MAP
PERPRB: BLOCK 1 ;START OF PER-PROCESS AREA
CSHPTR: BLOCK 1 ;AOBJN POINTER BASED ON /CACHESIZE:
PAGSTA: BLOCK 1 ;WHERE TO START ALLOCATING PAGES
CACHE: BLOCK MX.CSZ ;SPACE TO CACHE MAXIMUM NUMBER OF PAGES
EZCORE==.-1 ;END OF ZEROED AREA
END MAKSYM ;THE END