.TITLE USER_DXPAST Declare AST another process service .IDENT /V02.01/ ;++USRDXPAST.MAR ; ; Facility: ; Fermilab Accelerator Control System - ACNET ; FERMIUSS user-written system services privileged image. ; ; Abstract: ; This module provides the user-written system service routines to ; allow one process to declare an AST external to it (in another ; process). Prior handshaking is required to pass the AST routine's ; virtual address from the one process (AST destination) to the ; AST source process. ; ; Environment: ; Kernel mode user-written system services. Must be linked with ; the dispatchers in FERMIDISP. ; ;-- ; ; Modification History: ; ; Author: F. Nagy Creation date: 14-May-83 ; ; V01.00 14-May-83 FJN Created from NETASTS.MAR ; .PAGE .SUBTITLE Declarations ; ; Include Files: ; .LIBRARY "SYS$LIBRARY:LIB.MLB" ;Executive macro library .LIBRARY "SYS$LIBRARY:FERMILIB.MLB" ;Fermilab local macro library ; ; Library Macros: ; .NOCROSS $ACBDEF ;AST Control block definitions $DYNDEF ;Dynamic memory block type defs. $PRDEF ;Processor register definitions $PSLDEF ;PSL and access mode definitions $PRIDEF ;Priority Increment Class definitions $PCBDEF ;Process control block definitions $PLVDEF ;Privileged vector offsets $PRVDEF ;Privilege bit definitions $IPLDEF ;Processor interrupt levels $SSDEF ;System service completion codes .CROSS ; ; Local Macros: ; ; NONE ; ; Equated Symbols: ; PRI.XAST = PRI$_IOCOM ;Priority increment class same as for ; I/O completion ; ; Argument offsets from AP ; pidadr = 4 ;Process id longword address prcnam = 8 ;Process name string descriptor ; address astadr = 12 ;Address of AST routine astprm = 16 ;AST parameter longword acmode = 20 ;AST access mode longword ; ; Program section for USS code ; .PSECT USER_SERVICES,BYTE,EXE,NOWRT,CON,LCL,SHR,RD,PIC .SHOW BINARY .PAGE .SUBTITLE Declare Internal Network AST in User Process ;+0USER_DCLINA ; ; Functional Description: ; This routine is used by the source process to declare/trigger the ; AST in the destination AST. Prior handshaking is needed to pass ; the AST address from the destination process back to the source ; process. ; ; Calling Sequence: ; status = USER_DXPAST( [pidadr], [prcnam], astadr, [astprm], [acmode] ) ; ; Input Parameters: ; 04(AP) - pidadr is the address of the longword containing the process ; identification of the user process in which the network AST is ; to be triggered. If the longword contains 0, the process ; identification will be returned in it. If pidadr is 0, the ; pid will not be returned. ; 08(AP) - prcnam is the address of the string descriptor which specifies ; the name of the process in which to trigger the network AST. ; If prcnam is 0, the pid is used. If the pid is also 0 (or ; pidadr is 0), then the current process is used. ; 12(AP) - astadr is the address of the AST routine in the destination ; process. ; 16(AP) - astprm is the parameter to be passed to the network AST. ; Remember, since the AST runs in a Separate process, astprm ; must be a numberic value or an index into a global section, ; it cannot be a private virtual address unless the destination ; processes provides some such to the source process by some ; other method. ; 20(AP) - acmode is the access mode at which the AST is to be run. The ; access mode is maximized with respect to the caller's access ; mode. ; ; Implicit Inputs: ; (R4) - address of the current process's PCB ; ; Output Parameters: ; R0 - completion status code ; @04(AP) - (if pidadr non-zero) returns the process id of the target ; process ; ; Implicit Outputs: ; NONE ; ; Condition Codes: ; SS$_NORMAL AST has been queued for the destination process ; SS$_ACCVIO access violation ; SS$_EXQUOTA AST quota limit of destination process exceeded ; SS$_INSFMEM insufficient dynamic memory ; SS$_NONEXPR target process does not exist ; SS$_NOPRIV insufficient privilege (GROUP/WORLD) to trigger AST ; in the destination target process ; ; Side Effects: ; NONE ; ;- .ENTRY USER_DXPAST,^M ; ; Convert destination process id/name into address of destination process PCB ; PUSHL R4 ;Save current process PCB address LBEG1: SETIPL LOCK1 ;Set to ASTDEL IPL and "lock" code JSB G^EXE$NAMPID ;Process the first two arguments BLBC R0,XIT1 ;Check for error in target proc. select CMPW R1,G^SCH$GL_SWPPID ;Don't allow NULL or SWAPPER processes BGTRU SKP1 ;Target process id? MOVZWL #SS$_NONEXPR,R0 ;Report non-existant process XIT1: SETIPL #0 ;Restore to normal IPL RET ;Return to caller ; ; Setup pointers to source and destination process' PCB's ; SKP1: MOVL R4,R5 ;Save pointer to dest. process PCB MOVL R1,R6 ;Save destination process PID POPREG R4 ;Restore current process PCB address ; ; Check AST quota if neither process has EXQUOTA privilege ; MOVZBL #1,R7 ;Flag set to skip AST quota decrement IFPRIV EXQUOTA,10$ ;Check source process IFPRIV EXQUOTA,10$,R5 ;Check destination process CLRL R7 ;AST quota being enforced TSTW PCB$W_ASTCNT(R5) ;Check destination process AST quota BGTR 10$ ;Continue if some left MOVZWL #SS$_EXQUOTA,R0 ;Exhausted AST quota error SETIPL #0 ;Normal IPL (down from ASTDEL) RET ; ; Get AST Control Block (ACB) from VMS pool ; 10$: JSB G^EXE$ALLOCIRP ;Allocate memory block for ACB BLBC R0,XIT1 ;Check that there was sufficient memory MOVB #DYN$C_ACB,ACB$B_TYPE(R2) ;Set block type to ACB ; ; Setup fields in the ACB ; EXTZV #0,#2,acmode(AP),R0 ;Get user-specified AST access mode JSB G^EXE$MAXACMODE ;Maximize access mode with caller's BLBS R7,20$ ;Check for AST quota counting DECW PCB$W_ASTCNT(R5) ;Decrement dest. process's AST quota BISB #<1@ACB$V_QUOTA>,R0 ;Flag in ACB that AST counted in quota 20$: MOVB R0,ACB$B_RMOD(R2) ;Store AST access mode in ACB MOVL R6,ACB$L_PID(R2) ;Store destination pid in ACB MOVL astadr(AP),- ;Store AST dest. process virtual addr. ACB$L_AST(R2) MOVL astprm(AP),- ;Store AST parameter from source proc. ACB$L_ASTPRM(R2) ; ; Queue the AST and perform rescheduling if needed ; MOVL R2,R5 ;Move address of ACB MOVZBL #PRI.XAST,R2 ;Set priority increment class code JSB G^SCH$QAST ;Queue the AST SETIPL #0 ;Normal IPL (down from ASTDEL) RET ;Return status from QAST call LOCK1: .LONG IPL$_ASTDEL ;Make sure no page faults at SYNCH LEND1: ASSUME LE 512 .END