Trailing-Edge
-
PDP-10 Archives
-
BB-P363B-SM_1985
-
mcb/nml/nmut10.mac
There are 2 other files named nmut10.mac in the archive. Click here to see a list.
;NET:<GROSSMAN.NML-SOURCES>NMUT10.MAC.2 8-Mar-82 14:30:55, Edit by GROSSMAN
;
; Add some code to DETACH so to set virtual timer traps so that NML goes
; virtual.
;
;NET:<GROSSMAN.NML-SOURCES>NMUT10.MAC.2 9-Feb-82 16:32:45, Edit by GROSSMAN
;
; Turn off interrupts during message processing in order to prevent typeout
; races.
;
; NMUT10 - TOPS10 specific utility functions
; LSG DECnet Network Management
;
; COPYRIGHT (c) 1980, 1981, 1982
; DIGITAL EQUIPMENT CORPORATION
; Maynard, Massachusetts
;
; 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 NMUT10 - TOPS10 specific utility functions
SUBTTL Introduction
Comment &
This set of routines implements the TOPS10 versions
of utility functions required. There are two cases
for these functions:
(A) TOPS10 only functions. These are functions
that are required for TOPS10 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 UUOSYM ; Monitor symbol definitions
SEARCH MACTEN ; Useful macros
SEARCH JOBDAT ; Job data area
; Register definitions
T0==0 ; Temporaries (scratchable)
T1==1
T2==2
T3==3
T4==4
P==17 ; Stack pointer
TWOSEG 400000 ; Put this into the high seg
define OFF%INTERRUPT
< MOVX T1,PS.FOF
PISYS. T1,
HALT .
AOS INTNST##>
define ON%INTERRUPT(%LAB)
< SOSLE INTNST##
JRST %LAB
MOVX T1,PS.FON
PISYS. T1,
HALT .
%LAB: >
SUBTTL DETACH
; Routine - DETACH
;
; Function - This routine will detach the job if it is started on the Force
; line.
;
; Arguments - none.
;
; Value - none.
;
ENTRY DETACH
DETACH: PUSH P,T1 ; Save an AC
PUSH P,T2 ; Save another AC
MOVE T1,[%CNFLN] ; Get the number of the FRCLIN
GETTAB T1, ; Get it
JRST GOVIRT ; Return, restoring T1
SETO T2, ; Prepare to
TRMNO. T2, ; get the number of this tty
JRST GOVIRT ; Probably detached already
SUBI T2,.UXTRM ; Turn the udx into a tty number
CAME T1,T2 ; Are we on the FRCLIN???
JRST GOVIRT ; No, don't detach us
HRLZI T1,-1 ; Get a -1 as the tty number
ATTACH T1, ; Detach us
JFCL ; Sigh...
; Here when we want to go virtual
GOVIRT: MOVE T2,[.STTVM,,^D500] ; Set virtual timer trap interval
SETUUO T2, ; Set it
JFCL ; ???
T2POPJ: POP P,T2 ; Restore T2
TPOPJ: POP P,T1 ; " T1
.POPJ: POPJ P,
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
RELOC ; Put this in low seg
CURTSK: BLOCK 1 ; Current task block address
PRVTSK: BLOCK 1 ; Previous task block address
RELOC ; Back in the high seg
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
; Here to simulate an outstr
OTSTR: MOVEI T1,440700 ; Get magic num
HRLM T1,-1(P) ; Install it in the pointer
SS%CLMESSAGE:
PUSHJ P,NOINT ; Turn off interrupts for entire string
SS%CL2: ILDB T1,-1(P) ; Get byte
JUMPE T1,YESINT ; Return if no more
PUSHJ P,OUTC ; Output the character
JRST SS%CL2 ; And keep going
SS%CMESSAGE:
PUSHJ P,NOINT ; Turn off interrupts for a sec
PUSH P,[[BYTE (7)15,12]] ; Start message on a new line
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
SETZ T4, ; Output all the alignment spaces
PJRST SS%MS2 ; Go print message
SS%MESSAGE:
PUSHJ P,NOINT ; Turn off interrupts
PUSH P,[[BYTE (7)15,12]] ; Start message on a new line
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
SKIPN T2,CURTSK ; Get address of current task block
JRST [PUSH P,[[ASCIZ | [(none)]:|]]
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
MOVEI T4,^d10
JRST SS%MS2]
PUSH P,[[ASCIZ | [|]] ; Start task name output
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
MOVEI T4,^d16 ; Get the maximum number of chars
MOVEI T2,TB.NAM##(T2) ; Point to name of task
HRLI T2,440700
SS%MS1: ILDB T1,T2 ; Get next character in name
SKIPN T1 ; Check for null character
JRST SS%MS3 ; Null, quit now
PUSHJ P,OUTC ; Output the character
SOJG T4,SS%MS1 ; .. increment count and loop
SS%MS3:
MOVEI T3,^D16 ; Get the starting number of chars
SUBM T3,T4 ; T4 now equals the length of the name
PUSH P,[[ASCIZ |]:|]] ; Terminate the task name
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
ADDI T4,4 ; Add " [", "]:" to count
SS%MS2: MOVE T1,[POINT 7,[ASCIZ \ \]]
EXCH T1,T4
ADJBP T1,T4
PUSH P,T1 ; Save byte pointer
PUSHJ P,SS%CLMESSAGE ; Output alignment spaces
ADJSP P,-1 ; .. restore stack
PUSH P,-1(P) ; Do a silly thing
PUSHJ P,SS%CLMESSAGE ; Go output supplied message
ADJSP P,-1 ; Fix the stack
PUSHJ P,OUTFIN ; and flush out the buffer
PJRST YESINT ; and re-enable interrupts
NMU$FATAL==:SS%TFATAL
SS%TFATAL::
PUSH P,[[ASCIZ |? Fatal error - |]]
PUSHJ P,OTSTR ; Simulate an outstr
ADJSP P,-1 ; Fix the stack
PUSH P,-1(P)
PUSHJ P,SS%MESSAGE
PUSHJ P,OUTFIN ; And flush the buffer
EXIT 1, ; Stop execution
JRST .-1
SUBTTL OUTC Output character buffering and lowest level tty I/O
; OUTC - Output the character in T1
; OUTFIN - Flush out the remaining buffer
OUTS: PUSHJ P,OUTFIN ; Call the string putter outter
OUTC: SOSGE OUTCNT ; Any room left?
JRST OUTS ; Nope, dump out the buffer
IDPB T1,OUTPTR ; Yes, install the character
POPJ P, ; And return happily
OUTFIN: PUSH P,T1 ; Save T1
SETZ T1, ; Get a null
IDPB T1,OUTPTR ; Tie off the end of the buffer
SETO T1, ; We want to know about this jobs'
TRMNO. T1, ; controlling terminal
JRST TELOPR ; Detached -- TRMOP. to OPR
OUTOUT: OUTSTR OUTBFR ; Output the buffer to the tty
FINOUT: MOVEI T1,^D80 ; Line buffer is 80 characters
MOVEM T1,OUTCNT ; Buffer is now officially empty
MOVE T1,[POINT 7,OUTBFR] ; Get the buffer pointer
MOVEM T1,OUTPTR ; Install it
POP P,T1 ; Restore the work AC
POPJ P, ; And return
TELOPR: MOVSI T1,'OPR' ; Get the device name
IONDX. T1, ; Get it's UDX
JRST OUTOUT ; Well, what can I do!
MOVEM T1,TRMBLK+1 ; Install the udx
MOVE T1,[XWD 3,TRMBLK] ; Set up for the TRMOP.
TRMOP. T1, ; Output to OPR
JRST OUTOUT ; Might as well hang in TO
JRST FINOUT ; SUCCESS! Go clean up the buffer
SUBTTL NOINT Turn off interrupts in a recursive manner
NOINT: AOSE INTOFF ; Been here already???
POPJ P, ; Yes, don't bother
PUSH P,T1 ; Preserve this AC
MOVX T1,PS.FOF ; Function is PIOFF
PISYS. T1, ; Disable interrupts
JFCL ; Maybe no PSIs yet???
POP P,T1 ; Restore work ac
POPJ P,
YESINT: SOSL INTOFF ; Should we enable interrupts
POPJ P, ; No, not now
MOVX T1,PS.FON ; Function is PION
PISYS. T1, ; Enable interrupts
JFCL ; Who cares
POPJ P, ; Return
RELOC ; Low seg stuff
OUTCNT: ^D80 ; Lotsa room to begin with
OUTPTR: POINT 7,OUTBFR ; Output buffer pointer
OUTBFR: BLOCK ^D80/5+1 ; The buffer itself
TRMBLK: .TOOUS ; Output asciz string
0 ; No udx yet
OUTBFR ; Point to the buffer
INTOFF: -1 ; NOINT interlock
END