.TITLE USER_DCLRDH Declare image rundown handler .IDENT /V01.00/ ;++USRDCLRDH.MAR ; ; Facility: ; Fermilab Accelerator Control System - ACNET ; FERMIUSS user-written system services privileged image. ; ; Abstract: ; This module provides the user-written system service routine for ; declaring a user-written image rundown handler. This routine is ; not a replacement for an exit handler but an extension for use ; with specially written code (and thus not to be used by inexperienced ; users). ; ; 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 module, duplicating the ; ACNSS_DCLRDH routine ; .PAGE .SUBTITLE Declarations ; ; Include Files: ; .LIBRARY "SYS$LIBRARY:LIB.MLB" ;Executive macro library .LIBRARY "SYS$LIBRARY:FERMILIB.MLB" ;Fermilab general macros ; ; Library Macros: ; .NOCROSS $DYNDEF ;Dynamic memory block type defs. $PRDEF ;Processor register definitions $PSLDEF ;PSL and access mode definitions $PCBDEF ;Process control block definitions $PLVDEF ;Priviliege vector offsets $IPLDEF ;Processor interrupt levels $SSDEF ;System service completion codes $XSC_DEF ;eXtended System Common block defs. $RHB_DEF ;Rundown Handler Block offsets .CROSS ;The XSC and RHB blocks are locally ;defined at Fermilab. The XSC is ;setup at startup time by the XSCINIT ;program. ; ; Local Macros: ; ; NONE ; ; Equated Symbols: ; ; NONE ; ; Program section for USS code ; .PSECT USER_SERVICES,BYTE,EXE,NOWRT,CON,LCL,SHR,RD,PIC .SHOW BINARY .PAGE .SUBTITLE Declare image rundown handler ;+0USER_DCLRDH ; ; Functional Description: ; This routine is used to declare an image rundown handler. ; It will be called at initialization time in any user process that ; tries to connect to the network. The call to this routine from the ; user process will be done in the User Task Interface initialization ; routine. ; ; Calling Sequence: ; status = USER_DCLRDH(rdhblk) ; ; Input Parameters: ; 4(AP) - address of the rundown handler block to be linked into the list ; of image rundown handler blocks. ; R4 - address of PCB of current process ; ; Implicit Inputs: ; PCB of current process. ; XSC block with pointer to RUNDWNLST array. ; ; Output Parameters: ; R0 - completion condition code ; ; Implicit Outputs: ; The address of the rundown handler block is stored in the rundown ; handler array in the XSC. The link longword (first) of the rundown ; handler block is set to the previous value stored in the rundown ; handler array entry for this process. ; ; Condition Codes: ; SS$_NORMAL success ; SS$_ACCVIO cannot read argument list or 3 bytes at (non-zero) ; start of the rundown routine or cannot write first ; longword of the rundown block ; SS$_NOHANDLER Warning. No rundown handler block or no entry point ; for rundown routine (either is 0). Block is not ; linked into rundown handler list. ; SS$_SSFAIL EXE$GL_SITESPEC is zero (no XSC block) ; ; Side Effects: ; NONE ; ;- .ENTRY USER_DCLRDH,^M ; ; Make checks for XSC block (in VMS pool), rundown block address in the ; argument list, rundown handler address in the rundown block, access to ; at the start of the rundown handler routine and write access to the link ; longword of the rundown block. ; MOVL G^EXE$GL_SITESPEC,R2 ;Get address of XSC block BEQL NOT_THERE ;Error if XSC block not there MOVL 4(AP),R0 ;Get virtual address of rundown block BEQL NOHAND ;If zero return NOHANDLER MOVL RHB_L_ENTRY(R0),R1 ;Get rundown routine entry address BEQL NOHAND ;If none, return NOHANDLER IFNORD #3,(R1),ACCVIO ;Check that 3 bytes at routine address ;can be accessed - entry mask and RET! IFNOWRT #4,(R0),ACCVIO ;Check that link longword of rundown ; block is writable by caller ; ; Using current process index, get address of the rundown list header and ; link the new rundown block in as the first in the list. ; MOVZWL PCB$L_PID(R4),R1 ;Get current process index MOVAL @ACN_L_RUNDWNLST(R2)[R1],R2 ;Get rundown array entry address MOVL (R2),RHB_L_LINK(R0) ;Store current rundown list top entry ; address in new block MOVL R0,(R2) ;Add new block to top of list MOVZWL #SS$_NORMAL,R0 ;Return success RET ; ; Return warning, no image rundown handler declared (address is 0) ; NOHAND: MOVZWL #SS$_NOHANDLER,R0 RET ; ; Return error, no XSC block in VMS pool ; NOT_THERE: MOVZWL #SS$_SSFAIL,R0 RET ; ; Return error if argument cannot be accesses ; ACCVIO: MOVZWL #SS$_ACCVIO,R0 RET .END