Google
 

Trailing-Edge - PDP-10 Archives - BB-X117B-SB_1986 - 10,7/nml/nmut20.mac
There are 2 other files named nmut20.mac in the archive. Click here to see a list.
; UPD ID= 240, SNARK:<6.1.NML>NMUT20.MAC.3,  20-Jan-85 16:48:43 by GLINDELL
;  Add LOGEVT as a temporary measure until work to support display types
;  has been added to SEND_TO_OPERATOR.
;
; UPD ID= 231, SNARK:<6.1.NML>NMUT20.MAC.2,  17-Jan-85 10:52:52 by GLINDELL
; Remove NMU$FATAL since it is no longer used
; Add NMLDIE routine to dump and halt.
;
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.2 20-May-81 12:07:24, Edit by JENNESS
;
;    Add SS%CLMESSAGE routine.  It just outputs the string with
;    no vertical or horizontal adjustments.
;
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.2  5-May-81 10:55:06, Edit by JENNESS
;
;    Add SS%CMESSAGE routine.  It doesn't print the task name.
;    Fix SS%MESSAGE routine to suppress printing null characters at
;    end of the task name.
;
; NET:<DECNET20-V3P1.NMU>NMUT20.MAC.16 18-Mar-81 13:44:02, Edit by JENNESS
;    Rewrite context switch routine so that it doesn't require a stack
;    to be valid when called.
; NMUT20 - TOPS20 specific utility functions
;	   LSG DECnet Network Management

;
;			  COPYRIGHT (c) 1980
;                    DIGITAL EQUIPMENT CORPORATION
;
;     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  which  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 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
	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

NMLDIE::
	AOSE DIECNT		;Been here before?
	HALTF%			; -recursion, die

	MOVEM 0,CRSACS		;Save AC 0
	MOVE 0,[1,,CRSACS+1]	;Get BLT AC
	BLT 0,CRSACS+17		; and save all AC's

	OFF%INTERRUPT		;Turn of PI system

	MOVE T1,-2(P)		;Get error PC
	MOVEM T1,CRSPC		; and save it

	MOVE T1,-1(P)		;Get pointer to error string
	MOVEM T1,CRSPTR		; and save that too

	HRROI T1,[ASCIZ /DMP:/]	;DMP:
	STDEV%			;  exists?
	 SKIPA T2,[POINT 7,[ASCIZ /SYSTEM:NMLT20.DMP/]]
	  MOVE T2,[POINT 7,[ASCIZ /DMP:NMLT20.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

	HRROI T1,DIEMSG		;Address of operator message
	HRROI T2,[ASCIZ /
	NMLT20 is crashing, reason: /]
	SETZ T3,		;Stop on zero byte
	SOUT%			;Copy
	 ERJMP JSYERR
	MOVE T2,CRSPTR		;Get crash pointer
	SOUT%			;Append that
	 ERJMP JSYERR
	HRROI T2,[ASCIZ /
	Dumping to file /]
	SOUT%			;Copy
	 ERJMP JSYERR
	MOVE T2,P1		;Get JFN
	MOVX T3,FLD(.JSAOF,JS%DEV)!FLD(.JSAOF,JS%DIR)!FLD(.JSAOF,JS%NAM)!FLD(.JSAOF,JS%TYP)!FLD(.JSAOF,JS%GEN)!JS%PAF
	JFNS%			;Output filespec
	 ERJMP JSYERR
	HRROI T2,[ASCIZ /
/]
	SETZ T3,
	SOUT%
	 ERJMP JSYERR

	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

	MOVX T1,QU%DBG		;Debug flag
	MOVE T2,DEBUG		;Get debug word
	TXNE T2,DB.GLX		;Using private GALAXY?
	IORM T1,QUEARG+.QUFNC	; -yes, set debugging flag

	MOVEI T1,^D8		;8 words in argument block
	MOVEI T2,QUEARG		; and get address
	QUEUE%			;Shoot!
	 ERJMP .+1		; Ignore errors

	HRROI T1,[ASCIZ /RUNNML:/] ;Logical name for program to run
	STDEV%			;Is there any?
	 HALTF%			; -no, all done

	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 /RUNNML:/] ;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 /?NMLT20 - 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==.
CRSACS:	BLOCK 20
CRSPC:	BLOCK 1
CRSPTR:	BLOCK 1

	END