Trailing-Edge
-
PDP-10 Archives
-
BB-H138C-BM
-
galaxy-sources/glxipc.mac
There are 26 other files named glxipc.mac in the archive. Click here to see a list.
TITLE GLXIPC -- IPCF INTERFACE FOR GALAXY PROGRAMS
SUBTTL Cliff Romash & Irwin L. Goverman/CER/PJT/DC/MLB 11-JUN-79
;
;
; COPYRIGHT (c) 1975,1976,1977,1978,1979
; 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.
SEARCH GLXMAC ;SEARCH SUBSYSTEMS SYMBOLS
PROLOG(GLXIPC,IPC) ;PRODUCE PROLOG CODE
;THE PURPOSE OF THIS MODULE IS TO PROVIDE AN OPERATING SYSTEM INDEPENDENT
; IPCF INTERFACE TO GALAXY PROGRAMS (OR ANY OTHER PROGRAM WHICH
; WANTS TO USE IT).
;ALL SUBROUTINES IN THIS MODULE USE ACS S1 AND S2 (1 AND 2) AND GUARANTEE
; THAT ALL OTHER ACS WILL BE PRESERVED.
IPCEDT==43 ;VERSION NUMBER
SUBTTL Table of contents
; TABLE OF CONTENTS FOR GLXIPC
;
;
; SECTION PAGE
; 1. Table of contents......................................... 2
; 2. Revision History.......................................... 3
; 3. Entry Points found in GLXIPC.............................. 4
; 4. Global Storage............................................ 5
; 5. C%INIT - Initialize the IPCF interface.................... 6
; 6. C%CPID - Create a PID..................................... 6
; 7. CHKNAM - See if PIB has a name attached................... 10
; 8. CHKAND - Check PIB to see if account and node pointers specified 10
; 9. C%KPID, C%SPID............................................ 11
; 10. C%SEND Routine to send an IPCF Message.................... 12
; 11. SNDMSG - Work routine to do actual IPCF send.............. 14
; 12. C%INTR - Interrupt level routine to flag message available 16
; 13. C%RECV - Non-blocking IPCF receive........................ 16
; 14. C%BRCV - Blocking IPCF Receive............................ 16
; 15. RCVMSG - Work routine to do an actual IPCF receive........ 17
; 16. C%REL - Release the last message received................ 20
; 17. C%RPRM Routine to read IPCF Parameters................... 20
; 18. GETPID - Acquire a PID for this job....................... 21
; 19. KILPID Routine to delete a pid........................... 22
; 20. SPID - Set a system PID................................. 23
; 21. RSPIDS Routine to read System Pid tables................. 24
; 22. RSPID Routine to return a system pid...................... 25
; 23. C%MAXP - Read maximum short packet size.................. 27
; 24. CPIDI - Connect PID to specified interrupt channel....... 28
; 25. IPRM Read/Write IPCF parameters........................... 29
; 26. MNPRED/MNPWRT - Read/Write maximum number of PIDS......... 30
; 27. QTARED/QTAWRT - Read/Write the Send and Receive Quotas.... 31
; 28. SETNAM - Routine to declare our name to INFO.............. 32
; 29. SNDSYS - Routine to converse with [SYSTEM]INFO & IPCC..... 33
; 30. STAC - Routine to build INFO messages................... 35
; 31. C%PIDJ Returb PID owners job number...................... 36
SUBTTL Revision History
COMMENT \
Edit GCO Reason
---- ------- -------------------------------------------------------
0001 Initial version of GLXIPC
0002 Make sending to PID 0 illegal
0003 Convert to new OTS format
0004 Add better send failure recovery code
Also, receive packets .GT. short packet size if they come
0005 G012 Change the definition of the 'capabilties' word in the MDB
to contain a canonical set of capabilities rather than the
operating-system specific capabilities. It also contains
the senders job number.
0006 G016 On the -10, don't try to determine the length of the System
PID table before doing the GETTABs. Just do SZ.PID GETTABs.
0007 Change the debugging system so that 'alternates' are used
only if DEBUGW is set.
0010 G025 Change the DEBUGW so that a non-zero value enables
the DEBUGGING System while a negative value will
declare a private component to SYSTEM[INFO].
Also fix C%RECV so that MD%PWH is only turned on with
JACCT on the -10.
0011 G026 FIX RSEFLG ACTION TO RETURN ON ERRORS AND LOOP THE
PROPER NUMBER OF TIMES IF NOT SET
0012 G027 MAKE C%RECV USE THE ASSOCIATED VARIABLE NAD DO PAGE
CHECK FIRST
0013 G052 Fix C%RECV to Destroy non-existent page if failed on
page mode due to wrong mode
0014 Remove DEBUGW test to set quotas and job wide pid
Also -- convert some$STOP messages to $FATAL and
some $TEXT to $WARN
0015 Made extensive changes to Debugging code and initializtion
code. Added error code ERICA$ to use in range checks.
Modified RSPIDS to do alternate search based on DEBUGW
and a special name table.
Modified C%SEND to clear the internal pid table entry
if a send to a system pid fails.
0016 Fixed TOPS20 code in KILPID and SNDSYS to work properly
0017 Fixed SNDSYS to save SNDFLG
0020 Cosmetic cleanup. Changed ERICA$ to ERARG$ for
errors which are caused by bad calling args.
Corrected spelling.
Added "PULSAR" name for SP.TLP
0021 Use SPIDS macro to make up SPDNAM
0022 Change C%INIT to setup debugging names based on SPIDS,
Not on contents of the IB
The degugging flag DEBUGW (135) now has 2, not 3 meanings
0== off, -1 == on. If it is ON, and the IB says to become
a system PID, then C%INIT uses the name in the SPIDS table
to declare [p,pn]NAME to system info
0023 Install PIB and multiple PID support
0024 Print Becomming PID message only if Debugging. Make getting
of maximum packet size a Library entry Point (C%MAXP)
0025 Make getting maximum packet size a part of C%INIT
even if no PIB is specified in IB
0026 Preserve RCVMDB+MDB.MS durring SNDSYS so C%REL will
always work after sending to a system component in
in DEBUG mode
0027 Make C%PIDJ entry to return Pid's job number
0030 Make C%KPID work for -10. Kill named PIDs via INFO only,
and unnamed PIDs via IPCC, then INFO if that fails.
0031 Fix setting of Maximum number of Pids to first
Read the number then increment and write it out
0032 Change SAVE to $SAVE
0033 Fix Maximum PID setting Bug
0034 Make MAXPAK a global variable
0035 Return ARG if sending a 0 length message
0036 Return ARG if attempting to SNDMSG with a 0 PID
0037 TOPS10 - Set job # as PID when conversing with
INFO or IPCC to get a PID.
0040 Write system PID table after setting MYPID
0041 Fix a bug in wait logic if debugging and the component
does not yet exist.
0042 -10, Set Job number as PID
0043 CHANGE THE SEND QUOTA SETTINGS TO READ THE CURRENT
SETTING AND THEN ADD TO IT
while asking INFO for PIDs of debugging
system components
\ ;END OF REVISION HISTORY
SUBTTL Entry Points found in GLXIPC
ENTRY C%INIT ;INITIALIZE THE MODULE
ENTRY C%CPID ;CREATE A PID
ENTRY C%SPID ;SET DEFAULT SENDER PID
ENTRY C%KPID ;KILL A PID
ENTRY C%RPRM ;READ IPCF PARAMETERS
ENTRY C%INTR ;POST AND IPCF INTERRUPT
ENTRY C%SEND ;SEND AN IPCF MESSAGE
ENTRY C%RECV ;NON-BLOCKING IPCF RECEIVE
ENTRY C%BRCV ;BLOCKING IPCF RECEIVE
ENTRY C%REL ;RELEASE LAST IPCF MESSAGE
ENTRY C%MAXP ;MAX PACKET SIZE ENTRY POINT
ENTRY C%PIDJ ;RETURN PID OWNERS JOB NUMBER
SUBTTL Global Storage
EXT IIB ;USE GLOBAL IB
EXT MYJOB ;JOB NUMBER FROM GLXINT
$GDATA MYPID ;PROCESS IDENTIFIER
$DATA DEFPID ;Default (ie first) PID
$DATA FSTPFG ;Set after we define first PID
$GDATA IMOPR ;Set if we are ORION
$DATA PSIFLG ;FLAG SET IF IPCF IS CONNECT TO PSI SYSTEM
$DATA SNDFLG ;FLAGS TO USE FOR SEND
$DATA RCVFLG ;FLAGS TO USE FOR RECIEVE
$DATA RCVPAG ;PAGSIZ,,PAGADR RESERVED FOR RECV
$DATA MSGFLG ;SET AT INTERRUPT LEVEL (IF PSI USED)
$GDATA RSEFLG ;RETURN SEND ERROR FLAG
$GDATA MAXPAK ;LARGEST SIZE OF A SHORT MESSAGE
$DATA IPCINT ;INTERRUPT ADDRESS FOR IPCF STATUS
$DATA IPCSTS ;IPCF STATUS..ASSOCIATED VARIABLE
$DATA PIDTAB,SZ.PID ;TABLE OF SYSTEM PIDS
$DATA ALTNAM,SZ.PID ;Table of alternate names for system
;components. Debuggers can poke
;a slot to -1 to force a debugging library
;to talk to that system component.
;Or, the address of an ASCIZ string can
;be poked in to force a debugging
;library to talk to that named component
;instead of the standard library
;debugging conventions.
$DATA STACP ;BYTE POINTER FOR NAME CREATION
$DATA MTLBLK,3 ;MUTIL BLOCK
SYSPRM (IPCSLN,4,.IPCFP+1) ;Length of a send block
SYSPRM (IPCRLN,.IPCFC+1,.IPCLL+1) ;Length of a receive block
$DATA SNDBLK,IPCSLN ;IPCF SEND PACKET DESCRIPTOR BLOCK
$DATA RCVBLK,IPCRLN ;IPCF RECEIVE PDB
$DATA SNDSAB,SAB.SZ ;PLACE TO BUILD A SAB INTO
$DATA RCVMDB,MDB.SZ ;PLACE TO BUILD MDB INTO
$DATA ACTPTR ;POINTER TO USER AREA FOR ACCT STRING
$DATA NODPTR ;POINTER TO USER AREA FOR NODE STRING
$DATA PACKET,SZ.PAK ;PLACE TO RECEIVE SHORT MESSAGE INTO
TOPS10 <
$DATA OPRPPN ;PPN OF THE OPERATOR
> ;END TOPS10 CONDITIONAL
;SPDNAM TABLE TO SETUP SEARCH FOR SPECIAL SYSTEM PIDS BY NAME
DEFINE .SPID(CANNAM,T10IDX,T20IDX,SYMNAM),<
IFNB <SYMNAM>,<
$SET (CANNAM,,<SIXBIT/SYMNAM/>)
>;;END IFNB SYMNAM
>;End DEFINE .SPID
SPDNAM: $BUILD (SZ.PID)
SPIDS ;Generate the Special names
$EOB
; INDIRECT TEXT STRING TO USE FOR BUILDING INFO NAME
TOPS10 <
NAMTXT: ITEXT(<^U/[-1]/^W/S1/>) ;OUR NAME+CUSP+NULL
>
TOPS20 <
NAMTXT: ITEXT(<[^U/[-1]/]^W/S1/>)
> ;END TOPS20 CONDITIONAL
DEFINE $SLEEP(TIME),<
XLIST
TOPS10 <MOVEI S1,TIME ;;GET THE TIME TO SLEEP IN SECONDS
SLEEP S1, ;;GO TO SLEEP
>
TOPS20 <MOVEI S1,TIME*^D1000 ;;GET THE TIME TO SLEEP IN MILLISECONDS
DISMS ;;GO TO SLEEP
>
LIST>
SUBTTL C%INIT - Initialize the IPCF interface
; Initializes IPCF interface, acquires PID and does alternate search.
;CALL IS: IIB setup by I%INI1 in GLXINT
;TRUE RETURN: Always, PID stored in the IIB
C%INIT: SETZM FSTPFG ;Clear first PID flag
SETZM IMOPR ;Say that I'm not ORION
SETZM MYPID ;We don't have a PID
SETZM ACTPTR ;Clear out the acct string ptr
SETZM NODPTR ;And clear out nod pointer, too
SETOM ALTNAM+SP.INF ;Always use real system info
PUSHJ P,C%MAXP ;READ MAXIMUM PACKET SIZE
CAXLE S1,SZ.PAK ;IS IT TOO LARGE?
$WARN <Packet size (^D/[SZ.PAK]/) too small. MAXPAK (^D/S1/).>
CAXLE S1,SZ.PAK ;PACKET SIZE OK?
MOVX S1,SZ.PAK ;NO -- GET OUR MAXIMUM
MOVEM S1,MAXPAK ;STORE FOR C%SEND
TOPS10<
SETOM ALTNAM+SP.IPC ;Always use real IPCC, too
>;End TOPS10 conditional
SKIPN S2,IIB+IB.PIB ;Does the caller want to use IPCF?
$RETT ;No, nothing to do here!
LOAD S1,PB.HDR(S2),PB.LEN ;Yes, get length of block in S1
PUSHJ P,C%CPID ;Get the PID
JUMPT .RETT ;OK
$STOP (CGP,Can't Get a PID)
SUBTTL C%CPID - Create a PID
;This routine will create a PID, give it a name, connect it to
; the interrupt system, set its quotas, etc, etc, based on the PIB passed.
;Arguments:
; S1-Length of block
; S2-Addr of PIB
;Returns:
; True, all set
; False, ERARG$
C%CPID: CAIL S1,PB.MNS ;Small PIB?
CAILE S1,PB.MXS ;.. or big PIB
$RETE (ARG) ;No good
$SAVE <P1,P2> ;Save some work regs
DMOVE P1,S1 ;Copy the input args
SKIPE FSTPFG ;Has our data base been intialized?
JRST CPID.1 ;Yes, charge on!
SETOM MSGFLG ;SET MESSAGE AVAILABLE FLAG
SETZM SNDFLG ;INIT SEND FLAGS
MOVX S1,IP.TTL ;GET TRUNCATE LONG MESSAGE FLAG
MOVEM S1,RCVFLG ;INIT RECIEVE FLAGS
PUSHJ P,RSPIDS ;READ THE SYSTEM PIDS
TOPS10 <
MOVX S1,%LDFFA ;WE NEED OPR PPN FOR PRIV CHECK
GETTAB S1, ;SO GET IT
MOVX S1,<1,,2> ;USE A SUITABLE DEFAULT
MOVEM S1,OPRPPN ;SAVE IT
> ;END TOPS10 CONDITIONAL
;C%INIT CONTINUED ON NEXT PAGE
;C%INIT CONTINUED FROM PREVIOUS PAGE
CPID.1: LOAD S2,PB.INT(P2),IP.SPI ;GET REQUESTED INDEX
JUMPE S2,CPID.3 ;JUMP IF WE ARE NOT SYSTEM TO JUST GET A PID
CAXN S2,SP.OPR ;Becoming ORION?
SETOM IMOPR ;Set flag for .STOP
SKIPN S1,PIDTAB(S2) ;IS THERE A PID THERE?
JRST CPID.2 ;NAME NOT THERE -- MUST GET A PID
MOVEM S1,PB.PID(P2) ;Save as ours
PUSHJ P,C%PIDJ ;GET PID'S JOB NUMBER
JUMPF CPID.2 ;NO OWNER -- MUST GET A PID
CAME S1,MYJOB ;IS IT MINE?
$FATAL (Requested Pid belongs to JOB ^D/S1/) ;NOPE
JRST CPID.7 ;NO NEED TO GET A PID
;We already own that PID
CPID.2: SKIPN DEBUGW ;Are we debugging?
JRST CPID.4 ;No, never bother INFO in production
PUSHJ P,CHKNAM ;Set up the name pointer
JUMPT CPID.5 ;All set, caller has special debug name
;Otherwise, set up library convention
LOAD S2,PB.INT(P2),IP.SPI ;Get back special index
SKIPN S1,SPDNAM(S2) ;Get debugging name from table
$FATAL (No debugging name for special index ^O/S2/) ;None there
MOVEI S2,NAMTXT ;Aim at ITEXT to convert debug name
JRST CPID.5 ;Go setup the name, get the PID
;Here if we're not becoming a system PID
CPID.3: PUSHJ P,CHKNAM ;Set up name pointers
JUMPT CPID.5 ;All set, use callers name
;otherwise, use noname
CPID.4: SETZ S2, ;Indicate no name desired
CPID.5: PUSHJ P,SETNAM ;Set name in message to IPCC or IPCF
LOAD S1,PB.FLG(P2),IP.JWP ;Get desired job-wide flag
PUSHJ P,GETPID ;GET A PID FOR MY JOB
MOVEM S1,PB.PID(P2) ;SAVE ACQUIRED PID
;C%INIT CONTINUED ON NEXT PAGE
;C%INIT CONTINUED FROM PREVIOUS PAGE
;Here when the PID and requisite name have been set up.
CPID.7: LOAD S2,PB.PID(P2) ;Get back pid
SKIPE FSTPFG ;First time 'round?
JRST CPID.8 ;No, the defaults were set last time
MOVEM S2,DEFPID ;Save as default for -1 to C%SPID
MOVEM S2,MYPID ;That's mine!
SETOM FSTPFG ;Note that we've been here
CPID.8: LOAD S1,PB.INT(P2),IP.SPI ;GET SPECIAL INDEX FIELD
SKIPE S1 ;WANT TO BE SYSTEM PID?
PUSHJ P,SPID ;YES -- GO SET IT
SETO S1, ;SET TO WRITE IPCF PARAMETERS
SKIPE S2,PB.SYS(P2) ;GET IPCF PARAMETER WORD
PUSHJ P,IPRM ;MAKE CHANGES
LOAD S1,PB.FLG(P2),IP.RSE ;WANT SEND FAILURES RETURNED?
MOVNM S1,RSEFLG ;SET OR CLEAR THE FLAG
LOAD S1,PB.FLG(P2),IP.SPB ;GET SENDER'S PRIV FLAG
SKIPN DEBUGW ;DEBUGGING?
STORE S1,RCVFLG,IP.CFP ;NO -- STORE IN RECIEVE FLAGS
LOAD S1,PB.INT(P2),IP.CHN ;GET CHANNEL OR OFFSET FOR PSI
LOAD S2,PB.FLG(P2),IP.PSI ;SEE WHETHER PSI IS TO BE USED
MOVNM S2,PSIFLG ;SET OR CLEAR THE FLAG
LOAD S2,PB.PID(P2) ;Get desired PID
SKIPE PSIFLG ;IS IPCF CONNECTION WANTED?
PUSHJ P,CPIDI ;YES, CONNECT PID TO INTERRUPT SYSTEM
PUSHJ P,CHKAND ;Check out account and node pointers
$RETT ;All done
SUBTTL CHKNAM - See if PIB has a name attached
;Call - P1/ length of PIB
; P2/ addr of PIB
;Returns - FALSE if PIB is too short or no name pointer in PIB
; TRUE - S1 has pointer, S2 has ITEXT to it (suitable for SETNAM)
CHKNAM: CAILE P1,PB.NAM ;Was a name supplied?
SKIPN S1,PB.NAM(P2) ;Was one?
$RETF ;No, Tell caller there's none
TLCE S1,-1 ;0 left half
TLCN S1,-1 ; or -1 left half?
HRLI S1,(POINT 7,) ;Yes, make a pointer
MOVEI S2,[ITEXT (<^Q/S1/>)] ;Aim at the pointer just built
$RETT ;Return S1,S2 setup
SUBTTL CHKAND - Check PIB to see if account and node pointers specified
;Call - P1/ length of PIB
; P2/ addr of PIB
;Returns - TRUE (always)
CHKAND: CAIG P1,PB.ACT ;Is there an act ptr on the block?
$RETT ;No, quit
SKIPE S1,PB.ACT(P2) ;Get ptr, if any
MOVEM S1,ACTPTR ;Save it if there is one
CAIG P1,PB.LOC ;Is there a logical location pointer
$RETT ;No
SKIPE S1,PB.LOC(P2) ;Maybe, get it
MOVEM S1,NODPTR ;Yes there is, save it
$RETT ;All done
SUBTTL C%KPID, C%SPID
;C%KPID - Kill a PID
; Call - S1/addr of PIB describing PID to be killed
; Return, TRUE - PID has been killed, and removed from system tables
; (if appilicable)
; FALSE - PID wasn't killed,perhaps because
; insufficient privs, or no such PID
C%KPID: $SAVE <P1> ;Save work reg
MOVE P1,S1 ;Copy input arg
SKIPN S1,PB.PID(P1) ;Get PID, if any
$RETT ;None there, all done!
TOPS10<
LOAD S2,PB.INT(P1),IP.SPI ;Get special PID index
SKIPE S2 ;If special index
SKIPN DEBUGW ; ... and we're debugging,
SKIPA ;(Not special, or not debug) skipa
JRST KPID.N ; ... must be named, kill via INFO
$SAVE <P2> ;Preserve another AC
PUSH P,S1 ;Save PID to be killed
MOVE P2,P1 ;Setup addr of PIB
LOAD P1,PB.HDR(P2),PB.LEN ;Get length of the PIB
PUSHJ P,CHKNAM ;See if this PIB is named
JUMPF [POP P,S1 ;No name, Get back PID
JRST KPID.U] ;And kill it either way
POP P,S1 ;There is a name, must kill via INFO
KPID.N: PUSHJ P,KILPDN ;Kill via INFO
SKIPA ;Reenter common flow
KPID.U:>;End TOPS10
PUSHJ P,KILPID ;Give it the gong
JUMPF .RETF ;Couldn't do it
MOVE S2,PB.PID(P1) ;Get back PID just killed
MOVSI S1,-SZ.PID ;Get AOBJN ptr for PIDTAB
KPID.1: CAMN S2,PIDTAB(S1) ;Does this one match?
SETZM PIDTAB(S1) ;Yes, kill it
AOBJN S1,KPID.1 ;Check all the pids in our table
$RETT ;Back to caller
;C%SPID - A routine to set the default send PID
;Call S1/addr of PIB describing new default or -1 to set original default
;Return - TRUE always
C%SPID: SKIPGE S1 ;Skip if a PIB is there, otherwise...
SKIPA S2,DEFPID ;Get original default PID
SKIPE S2,PB.PID(S1) ;Get PID to be set
MOVEM S2,MYPID ;Set as our sender default
$RETT
SUBTTL C%SEND Routine to send an IPCF Message
;CALL S1/ Length of SAB
; S2/ Address of SAB
;TRUE Return if message is sent Successfully
;FALSE Return if message cannot be sent for any reason
;POSSIBLE ERRORS
; ERARG$ Invalid Calling Argument
; ERNSP$ No Such Pid
; ERRQF$ Recievers Quota Full
; ERSQF$ Senders Quota Full
; ERSLE$ System Limits Exceeded
; ERUSE$ Unexpected System Error
C%SEND: CAXGE S1,SAB.SZ ;PROPER SAB?
$RETE(ARG) ;NO -- RETURN ERROR
PUSHJ P,.SAVE2 ;PRESERVE P1-P2
LOAD P1,SAB.LN(S2) ;P1 IS MESSAGE LENGTH
MOVE P2,S2 ;P2 IS SAB ADDRESS
CAIL P1,1 ;MESSAGE LENGTH OK?
CAILE P1,PAGSIZ
$RETE(ARG) ;NO -- RETURN ERROR
LOAD S2,SAB.MS(P2) ;GET MESSAGE ADDRESS
CAMG P1,MAXPAK ;LARGR THAN A PACKET?
JRST SEND.4 ;NO -- SEND A PACKET
CAIN P1,PAGSIZ ;EXACTLY ONE PAGE?
JRST SEND.2 ;YES -- GO SEND IT
SEND.1: $CALL M%GPAG ;NO -- CREATE A PAGE AND COPY MESSAGE
HRL S1,SAB.MS(P2) ;FORM BLT POINTER
HRRZ S2,S1 ;GET NEW PAGE ADDRESS
ADDI S2,0(P1) ;ADDRESS + MESSAGE SIZE
BLT S1,-1(S2) ;MOVE ENTIRE MESSAGE TO NEW PAGE
SUBI S2,0(P1) ;RECLAIM NEW MESSAGE ADDRESS
;HERE TO SEND A PAGE
SEND.2: TRNE S2,PAGSIZ-1 ;IS PAGE ON PAGE BOUNDRY?
$RETE(ARG) ;NO -- RETURN ERROR
ADR2PG S2 ;YES -- CONVERT TO PAGE NUMBER
HRLI S2,PAGSIZ ;SEND A FULL PAGE
MOVX S1,IP.CFV ;GET THE PAGE MODE FLAG
IORM S1,SNDFLG ;AND SET IT
MOVE S1,P2 ;POINT TO SAB
MOVEI P2,(S2) ;REMEMBER THE PAGE NUMBER
PUSHJ P,SNDMSG ;GO SEND THE MESSAGE
$SAVE <TF,S1> ;SAVE FOR FINAL RETURN
MOVE S1,P2 ;RECLAIM PAGE NUMBER
JUMPF SEND.3 ;ANY ERRORS?
$CALL M%IPSN ;NO -- MARK SENT BY IPC
SKIPA S1,P2 ;RECLAIM NUMBER AND RELEASE
SEND.3: CAIE P1,PAGSIZ ;IS THIS MY CREATED PAGE?
$CALL M%RELP ;YES -- RELEASE IT
$RET ;RETURN TF AND S1 FROM SNDMSG
;HERE TO SEND A PACKET
SEND.4: HRL S2,P1 ;FORM LENGTH,,ADDRESS
MOVX S1,IP.CFV ;GET PAGE MODE FLAG
ANDCAM S1,SNDFLG ;AND CLEAR IT
MOVE S1,P2 ;POINT TO SAB
PJRST SNDMSG ;FALL INTO COMMON CODE AND RETURN
SUBTTL SNDMSG - Work routine to do actual IPCF send
;CALL S1/ SAB Address
; S2/ Message Length,,Message Address
SNDMSG: $SAVE <P1,P2,P3,P4>
DMOVE P1,S1 ;PRESERVE CALLING ARGS
SKIPN P3,RSEFLG ;RETURN SEND ERRORS?
MOVX P3,RT.SFL ;NO -- LOAD RETRY LIMIT
SETO P4, ;SYSTEM INDEX OR -1 IF SEND BY PID
MOVE S1,MYPID ;GET MY PID
SKIPE S2,SAB.PB(P1) ;Want to send for a different PID?
MOVE S1,PB.PID(S2) ;Yes, get PID from PIB attached to SAB
SKIPN S1 ;Is there really a PID?
$RETE (ARG) ;No, complain
MOVEM S1,SNDBLK+.IPCFS ;I AM SENDER
LOAD S1,SAB.PD(P1) ;GET RECIEVERS PID
LOAD S2,SAB.SI(P1),SI.FLG ;GET SPECIAL INDEX FLAG
JUMPE S2,SNDM.2 ;SEND BY PID?
LOAD S1,SAB.SI(P1),SI.IDX ;NO -- SEND BY INDEX
MOVE P4,S1 ;REMEMBER WHO IT IS
SKIPN P3,RSEFLG ;RETURN SEND ERRORS?
MOVX P3,RT.SCL ;NO -- GET SYSTEM RETRY LIMIT
SNDM.1: PUSHJ P,RSPID ;GET THE RECIEVERS PID
JUMPF [CAIE S1,ERNSP$ ;UNKNOWN PID FOR SYSTEM COMPONENT?
$RET ;NO -- RETURN THE ERROR
CAXN P3,RT.SCL ;YES -- FIRST RETRY?
SKIPN SPDNAM(P4) ;YES -- DOES PID HAVE A NAME?
CAIA ;NO -- DON'T PRINT THE MSG
SKIPN DEBUGW ;YES -- DEBUGGING?
CAIA ;NO -- DON'T PRINT THE MESSAGE
$WARN (Waiting for ^W/SPDNAM(P4)/ to start)
SOJL P3,.POPJ ;RETURN ERROR IF RETRY LIMIT EXAUSTED
$SLEEP RT.SLP ;SLEEP FOR A WHILE
MOVE S1,P4 ;RETORE DESIRED INDEX
JRST SNDM.1] ;AND TRY AGAIN
SNDM.2: MOVEM S1,SNDBLK+.IPCFR ;SAVE RECIEVERS PID
MOVEM P2,SNDBLK+.IPCFP ;SAVE PAGE/PACKET POINTER
MOVE S2,SNDFLG ;GET SEND FLAGS
TOPS10 <
CAMN S1,PIDTAB+SP.IPC ;SENDING TO IPCC?
IORX S2,IP.CFP ;YES -- ENABLE PRIVS
> ;END TOPS10 CONDITIONAL
MOVEM S2,SNDBLK+.IPCFL ;STORE SEND FLAGS
TOPS10 <
SNDM.3: MOVE S1,[IPCSLN,,SNDBLK] ;ARG FOR UUO
IPCFS. S1, ;SEND THE MESSAGE
JRST SNDM.4 ;SEE WHY WE LOST
$RETT ;GIVE A GOOD RETURN
> ;END TOPS10 CONDITIONAL
TOPS20 <
SNDM.3: MOVEI S1,IPCSLN ;NUMBER OF WORDS IN BLOCK
MOVEI S2,SNDBLK ;AND ITS ADDRESS
MSEND ;SEND IT
JRST SNDM.4 ;SEE WHY WE LOST
$RETT ;GIVE A GOOD RETURN
> ;END TOPS20 CONDITIONAL
;SNDMSG CONTINUED ON NEXT PAGE
;SNDMSG CONTINUED FROM PREVIOUS PAGE
;HERE TO HANDLE SEND FAILURES
SNDM.4: CAXE S1,IPE.SQ ;SENDER'S QUOTA FULL?
CAXN S1,IPE.RQ ;OR RECIEVER'S QUOTA FULL?
JRST SNDM.5 ;YES -- THEN TRY AGAIN
CAXE S1,IPE.SF ;FREE SPACE EXAUSTED?
JRST SNDM.7 ;NO -- THEN FAIL
;HERE TO HANDLE TRANSIENT SEND FAILURES
SNDM.5: SOJL P3,SNDM.6 ;TIME TO GIVE UP?
$SLEEP RT.SLP ;WAIT FOR CONDITION TO CLEAR
JRST SNDM.3 ;THEN TRY THE SEND AGAIN
SNDM.6: CAXN S1,IPE.SF ;NO SYSTEM FREE SPACE?
$RETE(SLE) ;YES -- SYSTEM LIMIT EXCEEDED
CAXN S1,IPE.RQ ;IS RECEIVER'S QUOTA FULL?
$RETE(RQF) ;YES -- RETURN ERROR
CAXN S1,IPE.SQ ;IS SENDER'S QUOTA FULL?
$RETE(SQF) ;YES -- RETURN ERROR
SNDM.7: CAXE S1,IPE.DU ;UNKNOWN DESTINATION?
$RETE(USE) ;NO -- UNEXPECTED SYSTEM ERROR
SKIPL P4 ;YES --WAS THERE A SYSTEM INDEX?
SETZM PIDTAB(P4) ;YES -- REMEMBER IT'S GONE AWAY
$RETE(NSP) ;RETURN NO SUCH PID
SUBTTL C%INTR - Interrupt level routine to flag message available
;Called to note the fact that an IPCF interrupt has occured
;CALL IS: No arguments
;
;TRUE RETURN: Always
C%INTR: SKIPN PSIFLG ;ARE IPCF INTERRUPTS EXPECTED?
$STOP(UIR,Unexpected IPCF interrupt received)
SETOM MSGFLG ;FLAG THAT INTERRUPT HAS OCCURED
TOPS10 <
MOVE S1,@IPCINT ;GET ASSOCIATED VARIABLE
SKIPN IPCSTS ;ALREADY SETUP
MOVEM S1,IPCSTS ;NO..SET IT UP
>;END TOPS10 CONDITIONAL
$RETT ;TAKE A GOOD RETURN
SUBTTL C%RECV - Non-blocking IPCF receive
;C%RECV returns the next message from the IPCF queue or error ERNMA$
; indicating that no messages are outstanding.
;
;CALL IS: No arguments
;
;TRUE RETURN: S1/ CONTAINS POINTER TO MDB (SEE GLXMAC)
; OR
;FALSE RETURN: S1/ CONTAINS ERROR CODE FOR FAILURE
C%RECV: AOSE MSGFLG ;IF FLAG SAYS THERE IS MESSAGE
SKIPN PSIFLG ; OR NO PSI CONNECTION
SKIPA S1,[IP.CFB] ;OK -- GET NON-BLOCKING FLAG
$RETE(NMA) ;OTHERWISE, NO MESSAGE AVAILABLE
IORM S1,RCVFLG ;SET THE FLAG
PJRST RCVMSG ;AND GO DO THE WORK
SUBTTL C%BRCV - Blocking IPCF Receive
;C%BRCV differs from C%RECV in that it never returns with the error
; condition ERNMA$. If no message is available, C%BRCV will block,
; waiting for the next IPCF message.
;
;CALL IS: No arguments
;
;TRUE RETURN: S1/ CONTAINS POINTER TO MDB (SEE GLXMAC)
; OR
;FALSE RETURN: S1/ CONTAINS ERROR CODE (SEE GLXMAC)
C%BRCV: MOVX S1,IP.CFB ;GET NON BLOCKING FLAG
ANDCAM S1,RCVFLG ;CLEAR IT AND GO DO RECIEVE
SUBTTL RCVMSG - Work routine to do an actual IPCF receive
RCVMSG: PUSHJ P,.SAVE3 ;GET SOME AC'S
SETZ S1, ;SETUP TO TEST/CLEAR IPCSTS
EXCH S1,IPCSTS ;GET STATUS WORD AND RESET
SKIPN S1 ;ANYTHING SET?
TXOA S1,1 ;NO -- SET A BIT FOR PAGE MODE
LOAD S1,S1,IP.CFV ;YES -- GET ACTUAL MODE
STORE S1,RCVFLG,IP.CFV ;STORE MODE FLAG
JUMPE S1,RCVM.1 ;PACKET?
RCVM.0: SKIPE S1,RCVPAG ;NO -- DO WE HAVE A RECIVE PAGE?
JRST RCVM.1 ;YES -- NO NEED TO GET ONE
PUSHJ P,M%NXPG ;NO --GET A NON-EXISTENT PAGE
JUMPF [SETOM MSGFLG ;OOPS -- CAN'T GET ONE
$RETE (SLE)] ;RETURN ERROR
HRLI S1,PAGSIZ ;PLACE PAGE SIZE IN LEFT HALF
MOVEM S1,RCVPAG ;AND SAVE IT
RCVM.1: MOVE S1,RCVFLG ;GET FLAGS TO USE
MOVEM S1,RCVBLK+.IPCFL ;INIT RECIEVE BLOCK
TXNN S1,IP.CFV ;PAGE MODE?
SKIPA S2,[SZ.PAK,,PACKET] ;NO -- POINT TO PACKET
MOVE S2,RCVPAG ;YES -- GET PAGE TO USE
MOVEM S2,RCVBLK+.IPCFP ;SAVE PROPER POINTER
MOVE S1,MYPID ;RECIEVE ON MY BEHALF
MOVEM S1,RCVBLK+.IPCFR
SETZM RCVBLK+.IPCFS ;UNKNOWN SENDER -- UNTIL RECIEVE
TOPS10 <
RCVM.2: MOVE S1,[IPCRLN,,RCVBLK] ;UUO ARGUMENT
IPCFR. S1, ;DO THE RECEIVE
JRST RCVM.3 ;WE HAVE AN ERROR, GO ANALYZE IT
SKIPE S1 ;ANY ASSOCIATED VARIABLE
MOVEM S1,IPCSTS ;YES..UPDATE THE STATUS
LOAD S2,RCVBLK+.IPCFU ;GET LOGGED IN PPN OF USER
STORE S2,RCVMDB+MDB.SD ;STORE IT
STORE S2,RCVMDB+MDB.CD ;ALSO USE IT AS CONNECTED DIRECTORY
MOVE S2,RCVBLK+.IPCFC ;GET CAPABILTIES WORD
LOAD P1,S2,IP.SJN ;GET SENDERS JOB NUMBER
STORE P1,P1,MD.PJB ;STORE IT
TXNE S2,IP.JAC ;JACCT ON?
TXO P1,MD.PWH ;YES, TURN ON WHEEL
MOVE S2,RCVBLK+.IPCFU ;GET PPN WORD
CAMN S2,OPRPPN ;IS HE THE OPERATOR?
TXO P1,MD.POP ;YES, SET OPERATOR
STORE P1,RCVMDB+MDB.PV ;SAVE USER PRIVILEGES
JRST RCVM.5 ;GO FINISH UP
> ;END TOPS10 CONDITIONAL
TOPS20 <
RCVM.2: MOVE S1,ACTPTR ;Get ptr to users acct area
MOVEM S1,RCVBLK+.IPCAS ;SAVE IT IN THE BLOCK.
MOVE S1,NODPTR ;Get ptr to users node area
MOVEM S1,RCVBLK+.IPCLL ;SAVE IT IN THE BLOCK
DMOVE S1,[EXP IPCRLN,RCVBLK] ;SET SIZE AND LOCATION OF BLOCK
MRECV ;DO THE RECEIVE
JRST RCVM.3 ;WE HAVE AN ERROR, ANALYZE IT
SKIPE S1 ;ANY ASSOCIATED VARIABLE
MOVEM S1,IPCSTS ;YES..UPDATE THE STATUS
MOVE S2,RCVBLK+.IPCFD ;GET LOGGED IN NUMBER
STORE S2,RCVMDB+MDB.SD ;STORE AS USER NUMBER
MOVE S2,RCVBLK+.IPCSD ;GET THE CONNECTED DIRECTORY
STORE S2,RCVMDB+MDB.CD ;AND STORE IT TOO
LOAD S1,RCVBLK+.IPCFS ;GET SENDERS PID
$CALL C%PIDJ ;GET SENDERS JOB NUMBER
SKIPT ;FAIL?
SETZ S1, ;YES..STORE A ZERO
STORE S1,P3,MD.PJB ;AND PUT IT IN THE CORRECT PLACE
MOVE S2,RCVBLK+.IPCFC ;GET OS CAPABILITIES
TXNE S2,SC%WHL ;SENDER A WHEEL?
TXO P3,MD.PWH ;YES
TXNE S2,SC%OPR ;SENDER AN OPERATOR?
TXO P3,MD.POP ;YES
TXNE S2,SC%MNT ;GOT MAINTAINACE PRIVS
TXO P3,MD.PMT ;YES!
MOVEM P3,RCVMDB+MDB.PV ;STORE THE PRIVS
JRST RCVM.5 ;GO FINISH UP THE RECEIVE
> ;END TOPS20 CONDITIONAL
; HERE TO WHEN IPCF RECIEVE FAILS
RCVM.3: CAXN S1,IPE.NM ;IS THIS "NO MESSAGE"?
$RETE (NMA) ;YES -- RETURN
CAXE S1,IPE.WM ;CHECK FOR "WRONG MODE" ERROR
JRST RCVM.4 ;NOPE -- MUST BE REAL ERROR
MOVX S1,IP.CFV ;YES --GET PAGE MODE BIT
XORB S1,RCVFLG ;SWITCH MODES
TXNE S1,IP.CFV ;PAGE MODE
JRST RCVM.0 ;YES -- GO GET IT RIGHT
JRST RCVM.1 ;NO -- GO GET A PACKET
RCVM.4: CAXE S1,IPE.NR ;CHECK FOR "NO ROOM" (TOPS-10)
$STOP(IRF,IPCF Reception failure)
PUSHJ P,M%IPRM ;TRY TO MAKE SOME ROOM
JRST RCVM.1 ;TRY AGAIN
;HERE ON A SUCCESSFUL RECEIVE
RCVM.5: SKIPE IPCSTS ;MORE MESSAGES IN QUEUE?
SETOM MSGFLG ;YES -- SET MSG AVAILABLE FLAG
LOAD S1,RCVBLK+.IPCFL ;GET FLAGS
STORE S1,RCVMDB+MDB.FG ;STORE INTO MDB
TXNE S1,IP.CFV ;DID WE RECIVE A PAGE?
SETZM RCVPAG ;YES -- CLEAR OUR PAGE
LOAD S1,RCVBLK+.IPCFP ;GET LENGTH AND ADDRESS OF DATA
STORE S1,RCVMDB+MDB.MS ;STORE INTO MDB
LOAD S1,RCVBLK+.IPCFS ;GET PID OF SENDER
STORE S1,RCVMDB+MDB.SP ;STORE AS SENDER'S PID
LOAD S1,RCVBLK+.IPCFR ;GET RECEIVER'S PID
STORE S1,RCVMDB+MDB.RP ;STORE IT TOO
ZERO RCVMDB+MDB.SI ;ASSUME NOT A SPECIAL SENDER
MOVSI S1,-SZ.PID ;GET LENGTH OF TABLE
MOVE S2,RCVMDB+MDB.SP ;GET SENDER'S PID
CAME S2,PIDTAB(S1) ;MATCH SENDER'S PID?
AOBJN S1,.-1 ;KEEP LOOKING
TXZN S1,LHMASK ;WAS IT A MATCH?
JRST RCVM.6 ;NO -- GIVE UP
TXO S1,SI.FLG ;YES -- SET SPECIAL INDEX FLAG
MOVEM S1,RCVMDB+MDB.SI ;STORE INTO INDEX WORD
RCVM.6: LOAD S1,RCVMDB+MDB.MS,MD.CNT ;GET SIZE OF MESSAGE
CAXE S1,PAGSIZ ;IF NOT A PAGE
JRST RCVM.7 ;RETURN NOW
LOAD S1,RCVMDB+MDB.MS,MD.ADR ;GET PAGE NUMBER
PUSHJ P,M%IPRC ;NOTIFY THAT IT IS IN NOW
LOAD S1,RCVMDB+MDB.MS,MD.ADR ;GET PAGE NUMBER FROM MDB
PG2ADR S1 ;CONVERT IT TO AN ADDRESS
STORE S1,RCVMDB+MDB.MS,MD.ADR ;STORE IT BACK INTO MDB
RCVM.7: MOVEI S1,RCVMDB ;GET POINTER TO MDB AND TAKE
$RETT ;GENERATE A GOOD RETURN
SUBTTL C%REL - Release the last message received
; C%REL is used to release the last message received via C%RECV or C%BRCV.
;If this message is a packet, then this is a null operation, and if its
;a page, the page is released.
;CALL IS: No arguments
;
;TRUE RETURN: Always
C%REL: SKIPN S2,RCVMDB+MDB.MS ;GET SIZE AND ADDRESS OF MESSAGE
$STOP(RAR,Releasing already released IPCF message) ;ALREADY RELEASED
ZERO RCVMDB+MDB.MS ;MARK MESSAGE AS RELEASED
LOAD S1,S2,MD.CNT ;GET SIZE OF MESSAGE
CAXE S1,PAGSIZ ;IS THIS MESSAGE A PAGE?
$RETT ;NO, SO RETURN NOW
LOAD S1,S2,MD.ADR ;GET ADDRESS OF MESSAGE
ADR2PG S1 ;GET THE PAGE NUMBER
PJRST M%RELP ;RETURN AFTER RELEASING THE PAGE
SUBTTL C%RPRM Routine to read IPCF Parameters
;C%RPRM IS USED TO EXAMINE THE MOST COMMONLY NEEDED
;IPCF PARAMETERS. THESE INCLUDE THE TOTAL NUMBER OF PIDS AND THE
;IPCF RECEPTION / SEND QUOTAS.
;CALL IS: S1/ -1 TO READ PARAMETERS OF PID QUOTA, SND,RCV QUOTAS
; OR ELSE AN SP.??? SYMBOL TO RETURN THAT ENTRY FROM
; THE PID TABLE
;
;TRUE RETURN: IF THE INFORMATION IS AVAILABLE
; S1/<MAX PIDS>B17+<SND QUOTA>B26+<RCV QUOTA>B35 ;IF S1=-1
; S1/ PID TABLE ENTRY ; IF S1=0 OR +
C%RPRM: JUMPGE S1,RSPID ;IF NON-ZERO, WANT SYSTEM PID
SETZ S1, ;SET TO READ IPCF PARAMETERS
PJRST IPRM ;GO READ PARAMS AND RETURN
SUBTTL GETPID - Acquire a PID for this job
;CALL IS: First, Call SETNAM to setup name (if any)
; S1 - 1 means set JWP
;
;TRUE RETURN: S1/ PID acquired for this job
GETPID:
TOPS10 <
$SAVE <P1,P2,MYPID> ;Save some regs
PJOB S2, ;Get our job number
MOVEM S2,MYPID ;Save as our (temporary) PID
SKIPN P2,S1 ;Want JWP?
TXO S2,1B0 ;NO -- MAKE PID TEMPORARY
MOVEM S2,PACKET+.IPCI1 ;ARGUMENT
SETO P1, ;Set 'named PID flag'
SKIPE PACKET+.IPCI2 ;Is a name desired?
JRST GETP.3 ;Yes, must go thru INFO
SETZ P1, ;Clear 'named PID flag'
MOVE S1,[XWD C%INIT,.IPCSC] ;FUNCTION IS MAKE PID
MOVX S2,SP.IPC ;ASK IPCC TO DO IT
PUSHJ P,SNDSYS ;SEND IT OFF, GET REPLY
JUMPF GETP.2 ;Failed, maybe no privs, try INFO
MOVE S1,PACKET+.IPCS2 ;GET PID RETURNED BY IPCC
$RETT ;RETURN
;Here to ask INFO for a PID (perhaps named)
GETP.2: SETZ S2, ;Indicate no name desired
PUSHJ P,SETNAM ;Set up the PACKET
GETP.3: MOVE S1,[XWD C%INIT,.IPCII] ;Function to make a named PID, till RESET
SKIPE P2 ;Want to be job-wide?
MOVE S1,[XWD C%INIT,.IPCIJ] ;Function to make a named PID, job wide
MOVX S2,SP.INF ;Ask INFO to do it
PUSHJ P,SNDSYS ;SEND IT OFF, GET REPLY
SKIPT ;Ok?, Yes, return it
$FATAL <Can't get a PID>
MOVE S1,PACKET+.IPCI1 ;Get the PID returned by INFO
SKIPN P1 ;Did we get a name?
$RETT ;Give that back
SKIPE DEBUGW ;ARE WE DEBUGGING?
$WARN <^I/NAMMSG/> ;Type the name we're getting
$RETT ;AND RETURN
> ;END TOPS10 CONDITIONAL
TOPS20 <
$SAVE <T1,T2,T3,T4> ;SAVE TEMPS
MOVX T1,.MUCRE ;CREATE A PID FUNCTION
MOVX T2,IP%CPD+.FHSLF ;CREATE A PID FOR ME
STORE S1,T2,IP%JWP ;SET OR CLEAR REQUEST FLAG
DMOVE S1,[EXP 3,T1] ;3 WORDS, START AT T1
MUTIL ;EXECUTE IT
$FATAL <Can't get a PID>
MOVEM T3,PACKET+.IPCI1 ;Save PID obtained
MOVE S1,T3 ;Set up for quick return
SKIPN PACKET+.IPCI2 ;Do we need a name?
$RETT ;No, all done!
PUSH P,MYPID ;Save whatever is there now
MOVEM S1,MYPID ;Save temp PID while we name ourselves
SKIPE DEBUGW ;ARE WE DEBUGGING?
$WARN <^I/NAMMSG/> ;TYPE OUT MESSAGE
MOVE S1,[XWD C%INIT,.IPCII] ;Setup code to assign name
MOVX S2,SP.INF ;Send to INFO
PUSHJ P,SNDSYS ;Get name assigned to our PID
SKIPT ;Did that work?
$FATAL <Can't name the PID. Error bits = ^O/RCVMDB+MDB.FG,IP.CFE/>
MOVE S1,MYPID ;Get back PID
POP P,MYPID ;Put back previous PID
$RETT ;OK
> ;END TOPS20 CONDITIONAL
;An ITEXT to print out the debugging name
NAMMSG: ITEXT <Becoming ^T20/PACKET+.IPCI2/ (PID = ^O/S1/)>
SUBTTL KILPID Routine to delete a pid
;KILL PID IS CALLED DURING INITIALIZATION TO RETURN ANY PID ACQUIRED
;THAT WE NO LONGER NEED.
;Tops10 Alternate entry at KILPDN, to kill a PID via INFO, since
; the PID to be killed is known to be named
;CALL S1/ Pid to be killed
;TRUE RETURN: Pid has been killed
;FALSE RETURN: Pid wasn't killed
TOPS10 <
KILPID: MOVEM S1,PACKET+.IPCI1 ;SAVE PID TO BE KILLED
MOVE S1,[KILPID,,.IPCSZ] ;CODE,,DELETE PID FUNCTION
MOVX S2,SP.IPC ;Try sending to IPCC
PUSHJ P,SNDSYS ;SEND IT OFF
JUMPT .RETT ;RETURN IF ALL SET
MOVE S1,PACKET+.IPCI1 ;Get back PID which should have gone
KILPDN: MOVEM S1,PACKET+.IPCI2 ;Save PID in message to INFO
MOVE S1,[KILPID,,.IPCID] ;IPCC won't listen, probably no privs
MOVX S2,SP.INF ;Try INFO
PJRST SNDSYS ;If that bombs, return F
> ;END TOPS10 CONDTIONAL
TOPS20 <
KILPID: MOVEM S1,MTLBLK+1 ;SAVE PID TO BE KILLED
DMOVE S1,[EXP 1,MTLBLK] ;POINT TO IT
MOVX S1,.MUDES ;DESTROY THE PID
MOVEM S1,MTLBLK ;SET THE FUNCTION
MUTIL
$RETF
$RETT
> ;END TOPS20 CONDITIONAL
SUBTTL SPID - Set a system PID
;SPID sets a system wide pid in the internal pid table and in the
;monitor pid table if not debugging.
;CALL IS: S1/ Index into the system pid table
; S2/ Pid to store in system Pid Table
;
;TRUE RETURN: Pid stored in internal and system pid table
; (if Debugging -- pid is stored in internal table only)
SPID: CAIL S1,1 ;MUST BE 1 THRU SZ.PID
CAXL S1,SZ.PID ;INDEX IN RANGE?
$STOP (PIR,PID Index out of range)
CAMN S2,PIDTAB(S1) ;IS REQUESTED INDEX ALREADY SET?
$RETT ;YES, NO NEED TO SET IT AGAIN
MOVEM S2,PIDTAB(S1) ;STORE MYPID IN INTERNAL TABLE
SKIPE DEBUGW ;DEBUGGING?
$RETT ;YES -- DON'T TELL THE MONITOR
;NO -- SET PID IN SYSTEM TABLE
TOPS20 <
MOVEM S1,MTLBLK+1 ;STORE THE TABLE OFFSET
MOVEM S2,MTLBLK+2 ;STORE PID TOO
MOVX S1,.MUSSP ;FUNCTION IS SET SYSTEM PID TABLE
MOVEM S1,MTLBLK+0 ;STORE IT
DMOVE S1,[EXP 3,MTLBLK] ;3 WORD MUTIL BLOCK
MUTIL ;ASK SYSTEM TO SET THE PID UP
$FATAL <Can't write System PID table>
$RETT ;AND RETURN
> ;END TOPS20 CONDITIONAL
TOPS10 <
MOVEM S1,PACKET+.IPCS1 ;STORE FIRST WORD , THE INDEX
MOVEM S2,PACKET+.IPCS2 ;STORE PID TO SET
MOVE S1,[XWD SPID,.IPCWP] ;FUNCTION IS SET SYSTEM PID
MOVX S2,SP.IPC ;WANT TO SEND TO IPCC
PUSHJ P,SNDSYS ;SEND TO [SYSTEM]IPCC
JUMPT .POPJ ;RETURN ALL OK IF WE ARE IN GOOD SHAPE
$FATAL <Can't write System PID table>
> ;END TOPS10 CONDITIONAL
SUBTTL RSPIDS Routine to read System Pid tables
;RSPIDS is called from initialization to set up our internal System
;pid table. It requests all system pids from the monitor or from
;INFO if the pid has a name. If a Pid exists, it's entry in PIDTAB
;will be non-zero.
;RSPIDS is usually called only during intialization. It gets a PID for us,
;reads all the PIDS, then destroys the PID
;For hacking around, the ALTNAM table can be twiddled, and
;a debugger can do PUSHJ P,RSPIDS to set up some different PIDs
;CALL No Arguments
;TRUE RETURN PIDTAB Contains all valid system pids
RSPIDS: $SAVE <P1> ;PRESERVE P1
MOVE S1,[XWD PIDTAB,PIDTAB+1] ;Make BLT pointer
SETZM PIDTAB ;To clear all the PIDs
BLT S1,PIDTAB+MX.PID ;Clear it
TOPS20< ;Get a temporary PID on the -20
SETZ S2, ;Indicate no name desired
PUSHJ P,SETNAM ;Set up our name
SETZ S1, ;Indicate No JWP desired
PUSHJ P,GETPID ;Get us a temporary PID
>;End TOPS20
TOPS10<
PUSHJ P,GETMIN ;Setup the bare essential PIDs
>;End TOPS10
PUSH P,MYPID ;Save whatever is there now
MOVEM S1,MYPID ;Save as ours, for now
MOVSI P1,-SZ.PID ;DO ALL ENTRIES
RSPD.1: HRRZ S1,P1 ;LOAD THE INDEX
PUSHJ P,RSPID ;GET THE PID
JUMPF [CAIE S1,ERARG$ ;INVALID INDEX?
TDZA S1,S1 ;NO -- MUST BE NO SUCH PID
SETO S1, ;YES -- MARK INVALID ENTRY
JRST .+1] ;RETURN IN LINE
MOVEM S1,PIDTAB(P1) ;STORE THE ENTRY
RSPD.2: AOBJN P1,RSPD.1 ;LOOP THRU ALL ENTRIES
TOPS20<
MOVE S1,MYPID ;Get our temporary PID
PUSHJ P,KILPID ;Flush it out
>;End TOPS20
POP P,MYPID ;Put back the old one
$RETT ;AND RETURN
SUBTTL RSPID Routine to return a system pid
;RSPID is called to return system PID when sending by special index.
;If the Pid is not found in our internal table, we request the Pid
;from the monitor (or from INFO if we are debugging and the System
;index has a name.)
;The PID is obtained from the system table unless
; 1) - the DEBUGW is set
; and ALTNAM(index) contains an address of a string
;or
; 2) - the DEBUGW is set
; and ALTNAM(index) = 0 (no fooling around), and SPDNAM has a SIXBIT
; library convention debug name.
;Under normal debug, ALTNAM is 0.
;To fool around, put a -1 in an entry to talk to system component, or
; put the address of a string which is the name of the PID you want to talk to.
;CALL IS: S1/ Index into System PID table
;
;TRUE RETURN: S1/ PID for that index
;FALSE RETURN: ERARG$ Invalid index
; ERNSP$ No Such Pid
RSPID: CAIL S1,0 ;INDEX VALID?
CAIL S1,SZ.PID
$RETE(ARG) ;NO -- FAIL
MOVE S2,S1 ;GET THE INDEX
SKIPE S1,PIDTAB(S2) ;IS ENTRY IN OUR INTERNAL TABLE?
$RETT ;YES -- RETURN
SKIPN DEBUGW ;Are we debugging?
JRST RSPI.1 ;No, never use names
SKIPGE S1,ALTNAM(S2) ;Force use of system for this component?
JRST RSPI.1 ;Yes, go thru system table
JUMPN S1,RSPI.2 ;If an addr was in there, use that name
SKIPE S1,SPDNAM(S2) ;0 in ALTNAM, is there a library entry?
JRST RSPI.2 ;Yes, use library convention
;Here to get PID from system table
RSPI.1:
TOPS10 <
MOVEI S1,.GTSID ;NO -- ASK THE MONITOR
HRL S1,S2 ;LOAD THE INDEX
GETTAB S1, ;GET THE ENTRY
$RETE(ARG) ;INVALID INDEX
SKIPN S1 ;ANY VALUE?
$RETE(NSP) ;NO -- RETURN NO SUCH PID
JRST RSPI.3 ;STORE THE PID
;GETMIN is called before reading the system PID table to setup
; the minimum PIDs we may need to find out the rest of the PIDs
; GETMIN returns a temporary PID
GETMIN: MOVX S2,SP.INF ;And index for INFO
PUSHJ P,RSPI.1 ;Find that one
PJOB S1, ;-10, just use job # as PID
;And return that as pid for caller
$RETT ;Ignore error (don't depend on INFO)
> ;END TOPS10 CONDITIONAL
TOPS20 <
MOVX S1,.MURSP ;READ SYSTEM PID FUNCTION
MOVEM S1,MTLBLK+0 ;SET FUNCTION
MOVEM S2,MTLBLK+1 ;SET INDEX
DMOVE S1,[EXP 3,MTLBLK] ;POINT TO ARGUMENTS
MUTIL ;AND ASK THE MONITOR
JRST [CAXE S1,IPCF27 ;NO SUCH PID?
$RETE(ARG) ;NO -- ASSUME INVALID INDEX
$RETE(NSP)] ;YES -- RETURN THE ERROR
MOVE S1,MTLBLK+2 ;GET THE PID
MOVE S2,MTLBLK+1 ;GET THE INDEX
JRST RSPI.3 ;STORE THE PID
> ;END TOPS20 CONDITIONAL
;RSPIDS is continued on the next page
;RSPIDS continued from previous page
;Here to find a system component thru INFO
;Enter with S1/addr of ASCIZ name (LH of S1 = 0)
; or S1/SIXBIT debug name (LH of S1 .NE. 0)
; S2/ special system index
RSPI.2: $SAVE <P1> ;PRESERVE P1
MOVE P1,S2 ;SAVE THE INDEX
MOVEI S2,NAMTXT ;Assume library convention
TLNN S1,-1 ;Is S1 SIXBIT?
MOVEI S2,[ITEXT (<^T/(S1)/>)] ;No, use different arg
PUSHJ P,FNDNAM ;ASK INFO FOR THE PID
MOVE S2,P1 ;RESTORE THE INDEX
JUMPF .POPJ ;RETURN ERROR FROM FNDNAM
RSPI.3: MOVEM S1,PIDTAB(S2) ;STORE THE PID
$RETT
SUBTTL C%MAXP - Read maximum short packet size
;CALL IS: No arguments
;
;TRUE RETURN: S1/ Largest size of short IPCF message
TOPS10 <
C%MAXP: MOVX S1,%IPCML ;ASK MONITOR FOR IT
GETTAB S1, ;
MOVEI S1,-1 ;WILL TAKE "TOO LARGE" FAILURE
$RETT ;RETURN
> ;END TOPS10 CONDITIONAL
TOPS20 <
C%MAXP: MOVX S1,.MUMPS ;ASK MONITOR FOR
MOVEM S1,MTLBLK ;LARGEST PACKET SIZE
DMOVE S1,[EXP 2,MTLBLK] ;ARG COUNT AND ADDRESS
MUTIL ;
TROA S1,-1 ;LOAD LARGE NUMBER
MOVE S1,MTLBLK+1 ;GET SIZE OF PACKET
$RETT ;AND RETURN IT
> ;END TOPS20 CONDITIONAL
SUBTTL CPIDI - Connect PID to specified interrupt channel
;This routine connects the PID acquired
;to the specified interrupt channel.
;CALL IS: S1/ Channel to connect PID to
; S2 / PID to connect
; TOPS10, IIB is used to setup internal intrpt connection
;TRUE RETURN: Always
CPIDI:
TOPS20 <
MOVEM S1,MTLBLK+2 ;STORE CHANNEL
MOVX S1,.MUPIC ;FUNCTION IS CONNECT TO PSI
MOVEM S1,MTLBLK+0 ;SO STORE FUNCTION
MOVEM S2,MTLBLK+1 ;Save PID to connect
DMOVE S1,[EXP 3,MTLBLK] ;SIZE AND LOC OF MUTIL BLOCK
MUTIL ;DO THE ACTUAL EXEC FUNCTION
$STOP(IIF,IPCF to interrupt system connect failed)
MOVX S2,1B0 ;GET A BIT IN PLACE 0
MOVN S1,MTLBLK+2 ;GET CHANNEL NUMBER BACK
LSH S2,0(S1) ;PUT INTO PROPER PLACE
MOVX S1,.FHSLF ;FOR MYSELF
AIC ;ACTIVATE THE CHANNEL
ERJMP [$STOP(AII,Cannot activate IPCF interrupts)]
$RETT
> ;END TOPS20 CONDITIONAL
TOPS10 <
HRLZM S1,MTLBLK+1 ;STORE OFFSET,,0
PUSH P,S1 ;Save offset
MOVX S1,.PCIPC ;REASON IS IPCF RECEPTION
MOVEM S1,MTLBLK+0 ;STORE IT
SETZM MTLBLK+2 ;CLEAR PRIORITY LEVEL
MOVE S1,[PS.FAC+MTLBLK] ;ADD THE CONDITION
PISYS. S1, ;ADD IT
$STOP(IIF,IPCF to interrupt system connect failed)
LOAD S1,IIB+IB.INT ;ADDRESS OF INTERRUPT VECTOR
POP P,S2 ;GET VECTOR OFFSET FOR IPCF
ADDI S1,.PSVIS(S2) ;GET ADDRESS OF ASSOCIATED VARIABLE
MOVEM S1,IPCINT ;SAVE ADDRESS FOR C%INTR
$RETT ;RETURN
> ;END TOPS10 CONDITIONAL
SUBTTL IPRM Read/Write IPCF parameters
;CALL IS: S1 / -1 TO WRITE, 0 TO READ PARAMETERS
; S2 / PARAMETERS TO WRITE (IF S1=-1)
;
;TRUE RETURN: S1 / <MAX PIDS>B17+<SND QUOTA>B26+<RCV QUOTA>B35 ;IF S1=0
IPRM: PUSHJ P,.SAVE1 ;GET ONE AC
MOVE P1,S2 ;REMEMBER 2ND ARG
JUMPE S1,IPRM.2 ;IF READING, SKIP THIS
HLRZ S1,S2 ;GET THE PID MAX WANTED
JUMPE S1,IPRM.1 ;IF DEFAULTED, SKIP THIS
PUSHJ P,MNPRED ;GET THE CURRENT MAXIMUM
HLRZ S2,P1 ;GET THE REQUESTED NUMBER
ADD S1,S2 ;ADD TO CURRENT AMOUNT
CAIL S1,1000 ;MAXIMUM IN RANGE
MOVEI S1,777 ;NO..SET TO MAXIMUM
PUSHJ P,MNPWRT ;WRITE MAXIMUM NUMBER OF PIDS
SKIPT ;OK?
$FATAL <IPCF privileges required to set maximum number of pids>
IPRM.1: HRRZ S1,P1 ;GET THE QUOTAS
JUMPE S1,.RETT ;IF DEFAULTING, LEAVE IT ALONE
PUSHJ P,QTARED ;READ THE CURRENT SETTINGS
LOAD S2,S1,IP.SQT ;GET THE SEND QUOTAS
LOAD S1,P1,IP.SQT ;GET CURRENT SETTING REQUEST
ADD S1,S2 ;GET NEW SEND QUOTAS
CAIL S1,1000 ;MAXIMUM IN RANGE
MOVEI S1,777 ;NO..SET TO MAXIMUM
STORE S1,P1,IP.SQT ;SAVE THE VALUES
HRRZ S1,P1 ;GET THE QUOTAS AGAIN
PUSHJ P,QTAWRT ;WRITE QUOTAS OUT
JUMPT .RETT ;IF ALL OK, RETURN NOW
$FATAL <IPCF privileges required to set IPCF quotas>
IPRM.2: PUSHJ P,MNPRED ;READ MAXIMUM NUMBER OF PIDS
MOVE P1,S1 ;REMEMBER THE ANSWER
PUSHJ P,QTARED ;AND THE QUOTA'S
SKIPT ;DID WE GET IT?
$FATAL <Can't read IPCF quotas>
HRLM P1,S1 ;MAKE UP THE TWO HALVES
$RETT ;AND RETURN
SUBTTL MNPRED/MNPWRT - Read/Write maximum number of PIDS
;THESE ROUTINES DO THE SYSTEM DEPENDENT WORK FOR SETTING THE MAXIMUM
;NUMBER OF PIDS FOR A JOB.
;
; CALL IS: READ/NO ARGUMENTS WRITE/S1 MAXIMUM NUMBER OF PIDS
;TRUE RETURN: READ/S1 MAX NR. OF PIDS WRITE/NO RETURNED VALUE
;FALSE RETURN: FAILURE OF SOME SORT
TOPS20 <
MNPWRT: SKIPA S2,[.MUSPQ] ;SET MAX. NUMBER OF PIDS
MNPRED: MOVX S2,.MUFPQ ;READ MAX. NUMBER OF PIDS
MOVEM S2,MTLBLK ;SET IT UP
MOVEM S1,MTLBLK+2 ;STORE THE DESIRED NUMBER (FOR WRITE)
MOVE S1,MYPID ;GET OUR PID
MOVEM S1,MTLBLK+1 ;SET IT UP
DMOVE S1,[EXP 3,MTLBLK] ;3 WORD BLOCK @ MTLBLK
MUTIL ;ASK THE MONITOR
$RETF ;FAILURE
MOVE S1,MTLBLK+2 ;PICK UP MAX NUMBER OF PIDS
$RETT ;SUCCESS
> ;END TOPS20 CONDITIONAL
TOPS10 <
MNPRED: MOVX S1,777 ;LARGE NUMBER OF PIDS AVAILABLE
MNPWRT: $RETT ;RETURN WITH IT
> ;END TOPS10 CONDITIONAL
SUBTTL QTARED/QTAWRT - Read/Write the Send and Receive Quotas
;CALL IS: S1/ 0,,<SND QUOTA>B26+<RCV QUOTA>B35 IF WRITING
;TRUE RETURN: S1/ 0,,<SND QUOTA>B26+<RCV QUOTA>B35 IF READING
;FALSE RETURN: ON ANY FAILURE OF TASK
TOPS20 <
QTARED: SKIPA S2,[EXP .MUFSQ] ;READ THE QUOTA FOR SEND/RECEIVE
QTAWRT: MOVX S2,.MUSSQ ;SET QUOTA
MOVEM S2,MTLBLK ;SET IT UP
MOVEM S1,MTLBLK+2 ;STORE THE DESIRED QUOTA (FOR WRITE)
MOVE S1,MYPID ;GET OUR PID
MOVEM S1,MTLBLK+1 ;SET IT UP
DMOVE S1,[EXP 3,MTLBLK] ;SET UP 3 WORD MUTIL BLOCK
MUTIL ;ASK THE MONITOR
$RETF ;FAILURE
MOVE S1,MTLBLK+2 ;PICK UP SEND/RECEIVE QUOTA
$RETT ;SUCCESS
> ;END TOPS20 CONDITIONAL
TOPS10 <
QTARED: SKIPA S2,[EXP .IPCSR] ;READ QUOTAS
QTAWRT: MOVX S2,.IPCSQ ;WRITE QUOTAS
HRLI S2,QTAWRT ;A GOOD CODE TO USE
MOVEM S1,PACKET+.IPCS2 ;STORE QUOTA FOR WRITE
MOVE S1,MYPID ;GET OUR PID
MOVEM S1,PACKET+.IPCS1 ;STORE IT AWAY
MOVX S1,SP.IPC ;SEND TO IPCC
EXCH S1,S2 ;WHOOPS, BUILT IT BACKWARDS
PUSHJ P,SNDSYS ;SEND IT OFF
MOVE S1,PACKET+.IPCS2 ;GET RESPONSE
POPJ P, ;PASS ON SNDSYS'S TF VALUE
> ;END TOPS10 CONDITIONAL
SUBTTL SETNAM - Routine to declare our name to INFO
;SETNAM is used to setup the name in the packet about to go to INFO or IPCC
;This allows programs to communicate
; by other means than the system PID table. This is useful for debugging
; purposes when multiple components are going to be used.
;SETNAM should always be called just before calling GETPID
;CALL: S2/ Addr of ITEXT of name to write
; or 0, to set up no name
;
;TRUE RETURN: Always, name has been established
; 2 nd word of PACKET has 0 or name,
; STACP has incremented pointer
SETNAM: SETZM PACKET+.IPCI2 ;Clear name from message
PUSH P,[POINT 7,PACKET+.IPCI2] ;GET POINTER TO MESSAGE AREA
POP P,STACP ;STORE THAT POINTER
JUMPE S2,.RETT ;If no name desired, we're done
$TEXT(STAC,<^I/(S2)/^0>) ;CREATE THE NAME
$RETT ;RETURN SUCCESS
;FNDNAM is used to ask INFO for the pid of a specified name
; It is called by GETPID to look for our name and by RSPIDX
; to check for Private Quasar and Private Orion
;CALL: S2/ addr of ITEXT to build name
;TRUE RETURN: S1/ Pid of Specified Name
FNDNAM: PUSHJ P,SETNAM ;Set up name in message
MOVE S1,[XWD FNDNAM,.IPCIW] ;FUNCTION IS FIND PID FOR NAME
MOVX S2,SP.INF ;COMMUNICATE WITH [SYSTEM]INFO
PUSHJ P,SNDSYS ;SEND TO SYSTEM, WAIT FOR REPLY
JUMPF [$RETE(NSP)] ;RETURN NO SUCH PID
SKIPE S1,PACKET+.IPCI1 ;GET THE PID
$WARN <Alternate ^T20/PACKET+.IPCI2/ (PID = ^O/S1/)> ;SHOW THE NAME
$RETT ;RETURN SUCCESS
SUBTTL SNDSYS - Routine to converse with [SYSTEM]INFO & IPCC
;SNDSYS is used to carry on a SEND-RECEIVE dialog with the system
; IPCF facilities
;CALL IS: S1/ CODE WORD TO USE, I.E. ID,,FUNCTION CODE
; S2/ CANONICAL SYSTEM INDEX TO SEND TO, EITHER SP.IPC OR SP.INF
;
;TRUE RETURN: If acknowledgement comes back successfully
;
;FALSE RETURN: If for any reason we cannot sent, or the
; response contains an error.
SNDSYS: $SAVE <P1,P2,SNDFLG,RCVMDB+MDB.MS> ;PRESERVE WHAT WE TOUCH
DMOVE P1,S1 ;SAVE INPUT ARGUMENTS
MOVEM S1,PACKET+.IPCI0 ;STORE THE CODE WORD AWAY
CAXN P2,SP.INF ;IF SENDING TO INFO,
ZERO PACKET+.IPCI1 ;NO ONE IS TO BE COPIED
MOVEI S1,PACKET ;GET LOCATION OF PACKET
MOVEM S1,SNDSAB+SAB.MS ;STORE MESSAGE LOCATION
TOPS10 <
CAXN P2,SP.IPC ;SENDING TO IPCC?
SKIPA S1,[EXP PACKET+2] ;YES -- FORCE PACKET LENGTH TO 3
;NO -- COMPUTE PACKET LENGTH
> ;END TOPS10 CONDITIONAL
TOPS20 <
SKIPN MYPID ;DO WE HAVE A PID?
$STOP (SWP,Called SNDSYS without a PID);Something has gone wrong
> ;END TOPS20 CONDITIONAL
SNDS.1: HRRZ S1,STACP ;HERE TO SEND TO INFO
SUBI S1,PACKET-1 ;COMPUTE SIZE
MOVEM S1,SNDSAB+SAB.LN ;STORE AS MESSAGE LENGTH
SKIPN S1,PIDTAB(P2) ;GET PROPER SYSTEM PID
$FATAL <Attempt to send to non-existant system component>
MOVEM S1,SNDSAB+SAB.PD ;SEND IS BY PID
ZERO SNDSAB+SAB.SI ;NOT BY INDEX
;SNDSYS CONTINUED ON NEXT PAGE
;SNDSYS CONTINUED FROM PREVIOUS PAGE
MOVEI S1,SAB.SZ ;SIZE OF SAB
MOVEI S2,SNDSAB ;AND ITS LOCATION
PUSHJ P,C%SEND ;SEND IT OFF
JUMPF .POPJ ;RETURN ERROR IF SEND FAILS
SNDS.2: PUSHJ P,C%BRCV ;DO A WAITING RECEIVE NOW
JUMPF .RETF ;IF ANY SORT OF ERROR, GIVE UP
LOAD S1,RCVMDB+MDB.SI,SI.IDX ;GET THE SPECIAL PID INDEX
CAME S1,P2 ;REPLY FROM DESTINATION?
JRST SNDS.3 ;NO, TRY AGAIN
MOVE S1,PACKET+.IPCI0 ;GET CODE WORD
CAME S1,P1 ;DOES IT MATCH WHAT WE SENT?
JRST SNDS.3 ;NO
LOAD S1,RCVMDB+MDB.FG,IP.CFE ;DID WE GET ANY ERRORS?
JUMPN S1,.RETF ;IF WE DID, GIVE UP NOW
$RETT ;OTHERWISE, RETURN A GOOD RETURN
SNDS.3: PUSHJ P,C%REL ;RELEASE THE UNWANTED MESSAGE
JRST SNDS.2 ;AND REPEAT THE RECEPTION
SUBTTL STAC - Routine to build INFO messages
; STAC IS USED IN THE $TEXT INSTRUCTION TO DEPOSIT CHARACTERS INTO
; THE MESSAGE THAT IS SENT TO SYSTEM-INFO
STAC: IDPB S1,STACP ;STORE A BYTE
HRRZ S1,STACP ;GET THE BYTE POINTER ADDRESS PART
SUBI S1,PACKET ;SUBTRACT OFF START OF PACKET
CAILE S1,SZ.PAK ;STILL INSIDE PACKET?
$RETF ;NO, FORCE A STOP
$RETT ;OTHERWISE, RETURN GOODLY
SUBTTL C%PIDJ Returb PID owners job number
;CALL IS: S1/ PID
;
;TRUE RETURN S1/ Job number of PID's owner
TOPS20 <
C%PIDJ: MOVEM S1,MTLBLK+1 ;USE MUTIL TO FIND JOB ASSOCIATED
MOVX S1,.MUFOJ ;WITH THIS PID
MOVEM S1,MTLBLK ;
DMOVE S1,[EXP 3,MTLBLK] ;ARG COUNT AND ADDRESS
MUTIL
$RETF ;CAN'T GET JOB NUMBER OF PID
MOVE S1,MTLBLK+2 ;GET THE JOB NUMBER
$RETT ;AND RETURN
> ;END TOPS20 CONDITIONAL
TOPS10 <
C%PIDJ: MOVX S2,%IPCPM ;GET SYSTEM PID MASK
GETTAB S2, ;FROM MONITOR
$RETF ;CAN'T GET PID MASK
AND S1,S2 ;AND TO GET PID TABLE OFFSET
MOVSS S1 ;REVERSE TO GET GETTAB INDEX
HRRI S1,.GTPID ;AND NOW LOOK INTO PID TABLE
GETTAB S1, ;TO GET THE JOB NUMBER
$RETF ;CAN'T GET JOB NUMBER OF PID
AND S1,S2 ;STRIP ALL BUT JOB NUMBER
JUMPE S1,.RETF ;NO OWNER
$RETT ;RETURN THE JOB
> ;END TOPS10 CONDITIONAL
IPC%L: ;LABEL THE LITERAL POOL
END