From:	MERC::"uunet!WKUVX1.BITNET!MacroMan" 20-APR-1993 16:05:51.55
To:	MACRO32 <MACRO32@WKUVX1.BITNET>
CC:	
Subj:	Re: $FAO - safe to use above IPL 2?

Jamie writes:

>In article <01GX6X5WLLHE8WW38R@MONMOUTH-etdl1.Army.MIL>,
>"Brian J. Schenkenberger, VAXman"<SCHENKENBERG@Monmouth-ETDL1.Army.MIL> writes:
>> Jamie.  I did look it up, in SDA.
>>
>> Looks like all the code is in pageable memory.  EXE$FAO is in
>> MESSAGE_ROUTINES, the MESSAGE_ROUTINES' LDRIMG$L_PAGE_R_BASE has
>> an address defined, LDRIMG$L_PAGE_W_BASE is zero.  :-(
>[...]
>Hmmm.  I suppose I could always send a special kernel AST to a process
>(*any* process) to do the $FAO at IPL 2, then report back!
>
>Nyyahh...

Hey Jamie, here an Idea...   (now where did I see this code before?) :-)

BJS- /Brian Schenkenberger/Schenkenberg@Eisner.DECUS.Org/Space for Rent/
    /VMS Software Support/Vitronics, Inc./Eatontown, NJ/(908) 542-0600/
   /Independent Consult./Tmesis Consulting/Jackson, NJ/(908) 363-7551/
  /<VAXman or Schenkenberger>@Monmouth-ETDL1.Army.Mil/CIS: 70253,114/


        .TITLE  LOCK_LDRIMG_REGIONS     Rtn. to lock Loadable image regions
        .IDENT  'VMS 5.4-2%3.110'
;------------------------------------------------------------------------------
        .LINK    "SYS$SYSTEM:SYS.STB"   ; Link w/ SYS.STB (LDR$GQ_IMAGE_LIST)
        .LIBRARY /SYS$LIBRARY:LIB/      ; Search this library during assembly.
        $LDRIMGDEF                      ; Loadable executive image block defs.
;------------------------------------------------------------------------------
        .PSECT  DATA,RD,WRT,NOEXE,LONG
LDRIMGNAM:      .ASCII  /MESSAGE_ROUTINES.EXE/
LDRIMGLEN=      .-LDRIMGNAM
;------------------------------------------------------------------------------
        .PSECT  CODE,RD,NOWRT,EXE,LONG
        .ENTRY  LCKLDRIMG,0

        $CMKRNL_S       ROUTIN=LOCK_LDRIMG
        RET

;------------------------------------------------------------------------------
        .ENTRY  LOCK_LDRIMG,^M<R2,R3,R4,R5>
        MOVAB   @#LDR$GQ_IMAGE_LIST,R4  ; get loadable image listhead address
        MOVL    R4,R5                   ; put in r5 so we can walk-the-list
10$:    MOVL    (R5),R5                 ; get an entry from the list
        CMPL    R4,R5                   ; check if its the 'end-of-the-line'
        BEQL    20$                     ; list exhausted? ('end-of-the-line')
        CMPB    LDRIMG$B_IMGNAMLEN(R5),-; could this be the one? check if the
                #LDRIMGLEN              ; ==- image name is the right size
        BNEQU   10$                     ; better luck next time around
        CMPC3   #LDRIMGLEN,LDRIMGNAM,-  ; length checked out ok! now check if
                LDRIMG$T_IMGNAM(R5)     ; ==- the image name is correct
        BNEQU   10$                     ; better luck next time around

        PUSHL   LDRIMG$L_PAG_R_LEN(R5)  ; get the length of paged code
        PUSHL   LDRIMG$L_PAG_R_BASE(R5) ; get the base of paged code
        JSB     G^MMG$LOCK_SYSTEM_PAGES ; set system wsle wsl$v_wslock bit &
                                        ; ==- pfn$ax_shrcnt[pfn] = 1

        PUSHL   LDRIMG$L_PAG_W_LEN(R5)  ; get the length of paged data
        PUSHL   LDRIMG$L_PAG_W_BASE(R5) ; get the base of paged data
        JSB     G^MMG$LOCK_SYSTEM_PAGES ; set system wsle wsl$v_wslock bit &
                                        ; ==- pfn$ax_shrcnt[pfn] = 1

        MOVL    #1,R0                   ; return with success.
        RET
20$:    MOVL    #<SS$_NONXPAG&-2>,R0    ; return warning! non-existant page
        RET                             ; ==- image not loaded ??!!!

        .END    LCKLDRIMG

