Trailing-Edge
-
PDP-10 Archives
-
bb-kl11l-bm_tops20_v7_0_tsu03_2_of_3
-
t20src/mxnt20.mac
There are 11 other files named mxnt20.mac in the archive. Click here to see a list.
; COPYRIGHT (c) DIGITAL EQUIPMENT CORPORATION 1986, 1989.
; ALL RIGHTS RESERVED.
;
; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED
; ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE
; INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER
; COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
; OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY
; TRANSFERRED.
;
; THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE
; AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
; CORPORATION.
;
; DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS
; SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
TITLE NMUT20 - TOPS20 specific utility functions
SUBTTL Introduction
Comment &
This set of routines implements the TOPS20 versions
of utility functions required. There are two cases
for these functions:
(A) TOPS20 only functions. These are functions
that are required for TOPS20 only, and no
other operating system uses them.
(B) Generic system specific functions. These
functions are required of all operating
system interfaces, have a standard calling
convention, but have different code sets to
implement them.
&
SUBTTL Definitions
SALL ; Suppress macro expansions
; for a clean listing
SEARCH MONSYM ; Monitor symbol definitions
SEARCH MACSYM ; Useful macros
SEARCH JOBDAT ; Job data area
;External references
EXTERN TSTACK ; Global address of a stack
EXTERN MXLOGF ; File-id of the log file
EXTERN MXLOGM ; A dummy address
EXTERN UF%CLO ; MX$FILE_CLOSE routine
EXTERN DEBUG ; Debug word
EXTERN DB.GLX ; Debugging flag designating private
; GALAXY (DEP 135 -1)
; Register definitions
T0==0 ; Temporaries (scratchable)
T1==1
T2==2
T3==3
T4==4
P1==5
P2==6
P==17 ; Stack pointer
define OFF%INTERRUPT
< MOVEI T1,.FHSLF
DIR
AOS INTNST##>
define ON%INTERRUPT
< MOVEI T1,.FHSLF
SOSG INTNST##
EIR>
SUBTTL SS%SWITCH
; Routine - SS%SWITCH
;
; Function - This routine is called with the address of two task
; blocks. One is the "current" task, the other is for
; the "future" task. When this routine completes a
; context switch between the two tasks will have been
; done.
;
; Parameters -
;
; -1(P) Future task block address
; CURTSK/ Address of current task's task block
ENTRY SS%SWITCH
INTERN CURTSK, PRVTSK
CURTSK: BLOCK 1 ; Current task block address
PRVTSK: BLOCK 1 ; Previous task block address
SS%SWITCH:
EXCH T1,CURTSK ; Save register and get task blk addr
MOVEM T1,PRVTSK ; Save as the previous task
JUMPE T1,SSS.1 ; If no task ... just run new one
MOVEM T0,TB.CTX##+T0(T1) ; Save register 0 in context block
MOVE T0,CURTSK ; Get contents of register 1
MOVEM T0,TB.CTX##+T1(T1) ; Save register 1 in context block
MOVEI T0,TB.CTX##+P(T1) ; Calculate end of context block
ADD T1,[T2,,TB.CTX##+T2] ; Start of registers to BLT
BLT T1,@T0 ; Copy into context block
SSS.1: HRLZ T0,-1(P) ; Get new task block address
HLRZM T0,CURTSK ; Save current task block address
ADD T0,[TB.CTX##+T1,,T1] ; Offset to saved registers
BLT T0,P ; Copy back registers
MOVE T0,CURTSK ; Get current task block address
ADDI T0,TB.CTX##+T0 ; Offset to register 0
MOVE T0,@T0 ; Get register 0
POPJ P, ; Return to new task
SUBTTL SS%TINIT
; Routine - SS%TINIT
;
; Function - This routine sets up a task block for running it
; the first time. It does not start the task, only
; initializes the task block stack.
;
; Parameters -
;
; -1(P) Size of task's stack
; -2(P) Task block to initialize
ENTRY SS%TINIT
SS%TINIT:
MOVE T1,-2(P) ; Get address of task block
MOVEI T2,TB.STK##(T1) ; Copy it for a stack pointer
MOVN T3,-1(P) ; Get length of stack
HRL T2,T3 ; Make initial stack pointer
PUSH T2,[US%FINI##] ; Put task exit routine onto stack
HRRZ T3,TB.STR##(T1) ; Get starting address
PUSH T2,T3 ; Put starting address onto stack
MOVEM T2,TB.CTX##+P(T1) ; Set initial stack pointer for task
POPJ P, ; Return
SUBTTL SS%MESSAGE
; Routine - SS%MESSAGE
;
; Function - This routine outputs a message to the operator
; or console.
;
; Parameters -
;
; -1(P) Byte pointer to error message string
ENTRY SS%MESSAGE
ENTRY SS%CMESSAGE
ENTRY SS%CLMESSAGE
SS%CLMESSAGE:
MOVE T1,-1(P) ; Get byte pointer
PSOUT ; Output supplied message
POPJ P, ; Return
SS%CMESSAGE:
HRROI T1,[BYTE (7)15,12] ; Point to a CRLF
PSOUT ; Start message on new line
SETZ T4, ; Output all the alignment spaces
JRST SS%MS2 ; Go print message
SS%MESSAGE:
HRROI T1,[BYTE (7)15,12] ; Point to a CRLF
PSOUT ; Start message on new line
SKIPN T2,CURTSK ; Get address of current task block
JRST [HRROI T1,[ASCIZ \ [(none)]:\]
PSOUT
MOVEI T4,^d10
JRST SS%MS2]
HRROI T1,[ASCIZ \ [\] ; Start task name output
PSOUT
SETZ T4, ; Clear count of characters
MOVEI T2,TB.NAM##(T2) ; Point to name of task
HRLI T2,440700
SS%MS1: ILDB T3,T2 ; Get next character in name
SKIPE T3 ; Check for null character
AOJA T4,SS%MS1 ; No .. increment count and loop
CAILE T4,^d16 ; Check bigger than 16 character name
MOVEI T4,^d16 ; Yes .. limit to 16 character output
MOVEI T1,.PRIOU ; Primary output (TTY)
MOVE T2,CURTSK ; Point to task name
HRROI T2,TB.NAM##(T2)
MOVN T3,T4 ; Get number of characters in name
SOUT ; Output name string
HRROI T1,[ASCIZ \]:\] ; Terminate the task name
PSOUT
ADDI T4,4 ; Add " [", "]:" to count
SS%MS2: MOVE T1,[POINT 7,[ASCIZ \ \]]
EXCH T1,T4
ADJBP T1,T4
PSOUT ; Output alignment spaces
MOVE T1,-1(P) ; Get byte pointer
PSOUT ; Output supplied message
POPJ P, ; Return
SUBTTL LOGEVT - log a network management event
;LOGEVT - log a network management event
;
; Call: LOGEVT (ptr) : NOVALUE
; i.e.: -1(P) has addr of text string
LOGEVT::
MOVE T1,-1(P) ;Get address of string
MOVEM T1,EVLARG+5 ;Watch out numeric offset
MOVX T1,QU%DBG ;Debug flag
MOVE T2,DEBUG ;Get debug word
TXNE T2,DB.GLX ;Using private GALAXY?
IORM T1,EVLARG+.QUFNC ; -yes, set debugging flag
MOVEI T1,^D10 ;10 words in argument block
MOVEI T2,EVLARG ; and get address
;*** Don't do this for MX
; QUEUE% ;Shoot!
; ERJMP .+1 ; Ignore errors
RET ;Return
EVLARG: QU%NRS!.QUWTO ;No response, WTOPR function
EXP 0 ;No response block
FLD(^D20,QA%LEN)!FLD(.QBTYP,QA%TYP) ;Length, prived type
[ASCIZ /Message from DECnet event logger/]
FLD(^D300,QA%LEN)!FLD(.QBMSG,QA%TYP) ;Length, type
BLOCK 1 ;Address of message
QA%IMM!FLD(1,QA%LEN)!FLD(.QBDTY,QA%TYP) ;Display type
.QBEVT ;DECnet event message
QA%IMM!FLD(1,QA%LEN)!FLD(.QBDFG,QA%TYP) ;Formatting flags
QU%SJI!QU%NFO
SUBTTL NMLDIE - dump and stop NML
;NMLDIE will dump and halt NMLT20.
;
; Call: NMLDIE (error_pc, ptr_to_error_str);
; i.e.: -2(P) has error_pc
; -1(P) has ptr_to_error_str
;Set up REENTER address so that @REENTER crashes and dumps NMLT20
LOC .JBREN
NMLREE
RELOC
;NMLREE - come here on REENTER - rely on a stack to exist
NMLREE: EXCH 0,CRSACS ;Save the ACs
BLT 0,CRSACS+17 ;...into CRSACS
MOVE 0,[.JBREN] ;Use this as our PC
MOVEM 0,CRSPC ;Store it here
MOVE 0,[-1,,[ASCIZ /Dump forced with @REENTER/]]
MOVEM 0,CRSPTR ;
NMLDIE::
AOSE DIECNT ;Been here before?
HALTF% ; -recursion, die
EXCH 0,CRSACS ;Check to see if the acs have been saved
CAME 0,[1,,CRSACS+1] ;Have they been saved already?
IFSKP.
BLT 0,CRSACS+17 ;No, save them now
ELSE.
EXCH 0,CRSACS ;Yes, restore the saved AC0.
ENDIF.
MOVX T1,.FHSLF ;Me
GETER% ;Get the last error
ERJMP .+1 ;I don't care
HRRZM T2,CRSERR ;Save the last error (in case its useful)
OFF%INTERRUPT ;Turn off PI system
MOVE P,[IOWD 600,TSTACK];We'll use this stack
SKIPN CRSPTR ;Is there something left to say?
IFSKP.
PUSH P,CRSPTR ;Yes, Point to the message
PUSHJ P,SS%MESSAGE ;This will display what task and which error
ADJSP P,-1 ;Adjust the stack
ENDIF.
PUSH P,MXLOGF ;File-id of the log file
PUSH P,[0] ;Keep the file
MOVEI T1,MXLOGM ;Address for an error code
PUSH P,T1
PUSHJ P,UF%CLO ;Close the logfile...
ADJSP P,-3 ;Make the stack correct, just in case.
SETZ T1
MOVX T1,.FHINF ;Kill all the inferiors
KFORK% ;using this JSYS
HRROI T1,[ASCIZ /DMP:/] ;DMP:
STDEV% ; exists?
SKIPA T2,[POINT 7,[ASCIZ /MX:MX.DMP/]]
MOVE T2,[POINT 7,[ASCIZ /DMP:MX.DMP/]]
MOVX T1,GJ%FOU!GJ%NEW!GJ%SHT ;GTJFN flags
GTJFN% ;Get JFN
ERJMP JSYERR ; Go type out error
MOVE P1,T1 ;P1 will have JFN
HRLI T1,.FHSLF ;Set up for SSAVE (handle,,JFN)
HRR T1,P1 ; so get JFN too
MOVE T2,[-1000,,SS%RD!SS%CPY!0] ;Do 1000 pages from page 0
SETZ T3, ;Unused
SSAVE% ;Save DMP:
ERJMP JSYERR ; Go type out error
HRROI T1,[ASCIZ /RUNMX:/] ;Logical name for program to run
STDEV% ;Is there any?
HALTF% ; -no, all done
MOVX T1,.DWNTI ;Get the scheduled downtime
GETAB% ;of the system
ERJMP JSYERR ;Oops (this should never bomb)
CAMN T1,[-1] ;Are we shut down already?
HALTF% ;Yes, DO NOT try to re-run MX!!!
MOVX T1,.FHSLF ;Close all files at or below us
CLZFF% ;Close..
ERJMP JSYERR
MOVX T1,CR%CAP ;Give subfork our caps
CFORK% ;Create subfork
ERJMP JSYERR
MOVE P2,T1 ;Save handle
MOVX T1,.FHSLF ;Get our
RPCAP% ; capabilities
ERJMP JSYERR
MOVE T1,P2 ;and set those for our subfork
EPCAP%
ERJMP JSYERR
MOVX T1,GJ%SHT!GJ%OLD ;Existing file
HRROI T2,[ASCIZ /RUNMX:/] ;File name
GTJFN% ;Get JFN
ERJMP JSYERR
HRL T1,P2 ;Handle,,JFN
SETZ T2, ;No page limits
GET% ;Get the new program into the subfork
ERJMP JSYERR
MOVE T1,P2 ;Subfork handle
SETZ T2, ;Use offset 0
SFRKV% ;Start subfork
ERJMP JSYERR
MOVEM P2,SPLARG+.SFUIN ;Subfork handle
MOVX T1,SF%EXT!SPLARG ;Extended splice fork
SPLFK% ;Replace us with our subfork
ERJMP JSYERR ; Error
HALTF% ;Cannot get here.....
;Splice fork argument block
SPLARG: EXP 4 ;Length
.SFCOD ;Function code
0 ;Unused
BLOCK 1 ;Subfork handle
;Space for QUEUE% jsys
DIEMSG: BLOCK ^D50
QUEARG: QU%NRS!.QUWTO ;No response, WTOPR function
EXP 0 ;No response block
FLD(^D20,QA%LEN)!FLD(.QBTYP,QA%TYP) ;Length, prived type
[ASCIZ /Message from DECnet network management/]
FLD(^D50,QA%LEN)!FLD(.QBMSG,QA%TYP) ;Length, type
DIEMSG ;Address of message string
QA%IMM!FLD(1,QA%LEN)!FLD(.QBDFG,QA%TYP) ;Formatting flags
QU%SJI!QU%NFO
;JSYERR - type out jsys error
JSYERR: HRROI T1,[ASCIZ /?MX - jsys error in DIE routine
/]
PSOUT%
MOVX T1,.PRIOU
MOVE T2,[.FHSLF,,-1]
SETZ T3,
ERSTR%
JFCL
JFCL
HALTF%
;Recursion count
DIECNT: EXP -1
;Crash block
CRSBLK==.
CRSERR::BLOCK 1
CRSACS::XWD 1,.+1 ; AC for BLT to save context
BLOCK 17 ; Place to save AC's on a reenter
CRSPC:: BLOCK 1
CRSPTR::BLOCK 1
END