<<< NOTED::DISK$NOTES7:[NOTES$LIBRARY_7OF4]HACKERS.NOTE;1 >>> -< ** Hackers ** >- ================================================================================ Note 1486.12 Who is using that global section? 12 of 14 JRDMI2::OZAKI 1116 lines 28-FEB-1995 08:25 -------------------------------------------------------------------------------- re:3 Ian, I made little modifification in your program for more convenient operation. I attach it in below (code embed building procedure). $! build.com - build gsd_scope absolute module $ savvfy ='f$ve() $ savdef =f$en("default") $ prd ="SHWGSDMAP" ! name of program product $ tpf ="temp"+f$getj(0,"pid") $ jcl =f$el(0,";",f$en("procedure")) $ say ="wr sys$output" $ hdr ="%" + f$pa(jcl,,,"name") + "-" $!!! alpha32 =f$gets("arch_name") .eqs. "Alpha" $ alpha32 =(f$gets("archflag").and.%x08ff) .ne. %x8f0 $ set mes /f/s/i/t $ set noon $ clo/nol dro $ clo/nol dri $ if "" .nes. f$sea(tpf+".*") then delete 'tpf'.*;* /exc=(*.mlb) $ pur/k=1 'jcl $ rename 'jcl' *.*;1 $! get calling parameters $ bldflg =0 $ p1 =","+P1+","+P2+","+P3+","+P4+","+P5+","+P6+","+P7+","+P8+"," $ p1 =f$ed(p1,"upcase,collapse,trim") $ p8 ='f$ve(0) $ p8 =0 $ sts =1 $12: p8 =1+p8 $ p6 =f$el(p8,",",p1) $ if "," .nes. p6 $ then $ if p6 .eqs. "" then goto 12 $ p5 =bldflg $ if p6 .eqs. f$ex(0,f$le(p6),"ASM") then bldflg=bldflg .or. 7 $ if p6 .eqs. f$ex(0,f$le(p6),"IMAGE") then bldflg=bldflg .or. 7 $ if p6 .eqs. f$ex(0,f$le(p6),"MAPPING") then bldflg=bldflg .or. 7 $ if p6 .eqs. f$ex(0,f$le(p6),"ASSEMBLE") then bldflg=bldflg .or. 7 $ if p6 .eqs. f$ex(0,f$le(p6),"INSTALL") then bldflg=bldflg .or. 128 $ if p6 .eqs. f$ex(0,f$le(p6),"DEBUG") then bldflg=bldflg .or. 256 $ if p6 .eqs. f$ex(0,f$le(p6),"LIST") then bldflg=bldflg .or. 512 $ if p5 .ne. bldflg then goto 12 $ say hdr,"F-BADPARAM, unrecognized function, ",p6 $ sts =%x14 $ goto 12 $ endif $ if.not. sts then goto fine $ if 0 .eq. (bldflg.and.255) then bldflg=bldflg.or.7 $ p8 =f$ve(savvfy) $! start processing $ p7 =f$el(alpha32,"|","|/migration") $ p8 =f$el(0.eq.(bldflg.and.256+512),"|","|no") $ asm ="macro''p7'/obj/''p8'list" $ map ="link/exe/''p8'map/''p8'cross/''p8'symbol_table" $ msg ="message/obj/''p8'list" $ p7 =f$el(alpha32,"|","|/machine_code") $ p8 =f$el(0.eq.(bldflg.and.256),"|","|no") $ asm =asm+"/''p8'debug=(symbol,traceback)/''p8'show=binary''p7'" $ map =map+"/''p8'debug/''p8'traceback" $ if 0 .ne. (bldflg.and.3) then call build_mlb 'tpf'.mlb $! image $ if bldflg/1 $ then $ say hdr,"I-BLDIMAGE, creating image, ''prd'.EXE" $ if "" .nes. f$sea(prd+".*") then delete 'prd'.*;* $ call create_src 'tpf'.tmp $ call build_absolute 'prd'.exe 'tpf'.tmp $ sts =$status $ if .not.sts then goto fine $ endif $! move file to target $ if bldflg/128 $ then $ say hdr,"I-INSTALL, move files to target directories" $ call install_images sys$common:[sysexe]magic.exe $ sts =$status $ if .not.sts then goto fine $ say hdr,"I-INSTALLED, ",sts/2," files moved" $ else $ if 0 .ne. (bldflg.and.127) then - $ say hdr,"W-NO_INSTALLED, issue ""@",f$pa(jcl,,,"name")," INSTALL"" to install images to run" $ endif $ sts =$status $! termination $fine: p8 ='f$ve(0) $ if "" .nes. f$sea(tpf+"*.*") then delete 'tpf'*.*;* $ exit sts .or. (f$ve(savvfy,savvfy/2)*0) $ exit $!============================================================================== $! entry p1=image file spec. $! p2=source module file spec. $build_absolute: $ subr $ set noon $ on control_y then exit %x10000610 $ on error then exit $status $ on severe_error then exit $status $ p8 =f$pa(p1,,,"name") $ p7 =f$pa(p2,,,"name") $ if "" .nes. f$sea(p8+".exe") then delete 'p8'.exe;* $ if "" .nes. f$sea(p8+".lis") then delete 'p8'.lis;* $ if "" .nes. f$sea(p8+".map") then delete 'p8'.map;* $! build reloactable module $ define sys$error nl: $ define sys$output 'tpf'.zzz $ asm 'p2' - +'tpf'.mlb/library - +sys$share:lib.mlb/library - +sys$share:starlet.mlb/library $ sts =$status $ deas sys$output $ deas sys$error $ if "" .nes. f$sea(p2) then delete 'f$el(0,";",p2)';* $ if .not. sts then goto 70$ $ if "" .eqs. f$sea(tpf+".zzz") then goto fine $! evaluate result $ set mes/nof/nos/noi/not $ sea/out=nl:/match=or 'tpf'.zzz "-F-","-E-","-W-" $ sts =$status $ set mes /f/s/i/t $ if .not.sts then goto fine $70$: if 3 .ne. (sts.and.7) $ then $ type 'tpf'.zzz $ if sts then sts=%x2c $ goto fine $ endif $ if "" .nes. f$sea(tpf+".zzz") then delete 'tpf'.zzz;* $! build absolute module $ if alpha32 $ then $ call build_map_option 'p7'.tmp $ map/section_bind/sysshr/syslib/sysexe=selective 'p7' - -! ,sys$system:sys$base_image.stb/selective_search - -! ,sys$share:imagelib.olb/library - ,'savdef''p7'.tmp/option $ else $ map/sysshr/syslib 'p7' - -! ,sys$share:imagelib.olb/library - ,sys$system:sys.stb/selective_search $ endif $ sts =$status $ if "" .nes. f$sea(p7+".tmp") then delete 'p7'.tmp;* $ if "" .nes. f$sea(p7+".obj") then delete 'p7'.obj;* $ if.not. sts then goto fine $! $! patch/absolute/journal=nl: 'p7'.exe $!deposit 0b0=0 $!update $! termination $fine: p6 ='f$ve(0) $ if "" .nes. f$sea(p7+".lis") then rename 'p7'.lis 'p8'.* $ if "" .nes. f$sea(p7+".exe") then rename 'p7'.exe 'p8'.* $ if "" .nes. f$sea(p7+".map") then rename 'p7'.map 'p8'.* $ if "" .nes. f$sea(tpf+"*.*") then delete 'tpf'*.*;* /exclude=(*.mlb) $ if "" .nes. f$sea(p8+".*") $ then $ purge/keep=1 'p8'.* $ rename 'p8'.* *.*;1 $ endif $ exit sts .or. (f$ve(savvfy,savvfy/2)*0) $ exit $ ends $build_map_option: $ subr $ p8 ='f$ve(0) $ copy nl: 'tpf'.tmp $ ope/a dro 'tpf'.tmp $ wr dro "PSECT_ATTR=''prd'$BANKI,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT,NOVEC" $ wr dro "PSECT_ATTR=''prd'$BANKR,PIC,USR,CON,REL,LCL,SHR,NOEXE,RD,NOWRT,NOVEC" $ wr dro "collect=bank_linkage,$linkage" $ wr dro "collect=bank_readonly,''prd'$bankr,''prd'$banki" $ close dro $ p7 =f$ve(p8) $ ends $!============================================================================== $install_images: $ subr $ savvfy ='f$ve() $ savprv =f$setprv("all") $ instl ="$install/command_mode" $ pur/k=1 $ set noon $! p7 ="detach," $! SHWGSDMAP.EXE $ if "" .eqs. p1 then p1=f$pa(prd,"SYS$SYSTEM:.EXE") $ if "" .nes. f$sea(prd+".exe") $ then $ if "" .nes. f$sea(p1) $ then $ if f$fil(p1,"known") then instl remove 'p1' $ if f$fil(p1,"known") then instl remove 'p1' $ delete/log 'p1';* $ endif $ copy/log 'prd'.exe 'f$el(0,";",p1)';1 $ sts =$status $ if .not.sts then goto 90$ $ set file/prot=w:e 'p1' $ p8 =f$ve(1) $ INSTL 'f$el(f$file(p1,"known"),"|","ADD|REPLACE")' 'p1' /OPEN/SHARE/HEADER/PRIV=CMKRNL $ p8 ='f$ve(0) $ p8 =f$verify(savvfy) $!!! delete 'prd'.exe;* $ p5 =1+p5 $ endif $! termination $90$: p8 =f$setprv(savprv) $ p8 =f$verify(savvfy) $ exit sts .or. (2*p5) $ ends $!============================================================================== $build_mlb: $ subr $ if "" .nes f$sea(p1) then delete 'p1';* $ if "" .nes. f$sea(tpf+".tmp") then delete 'tpf'.tmp;* $ p8 =f$gets("version") $ if 0 .lt. f$ex(5,1,p8) $ then p8=f$ex(1,1,p8)+f$ex(3,1,p8)+f$ex(5,1,p8) $ else p8=f$ex(1,1,p8)+f$ex(3,1,p8)+"0" $ endif $ copy nl: 'tpf'.tmp $ ope/a dro 'tpf'.tmp $ wr dro " .macro exec_version" $ wr dro " exec_version=",p8 $!!! wr dro " alpha32=",f$str("Alpha".eqs.f$gets("arch_name")) $ wr dro " alpha32=",f$str((f$gets("archflag").and.%x08ff) .ne. %x8f0) $ wr dro " .endm" $ close dro $ savvfy ='f$ve(0) $ create 'tpf'.tmp $ deck/dollar=%% .macro parmdef parm_k=4*0 parm_1=4*1 parm_2=4*2 parm_3=4*3 parm_4=4*4 parm_5=4*5 parm_6=4*6 parm_7=4*7 parm_8=4*8 parm_9=4*9 parm_10=4*10 parm_11=4*11 parm_12=4*12 char$c_ht=9 char$c_sp=32 .endm ; program section definition procedures .macro $align offset .if le alpha32 .rept <<.+offset-1>/offset*offset>-. nop .endr .endc .endm .macro $banki bankname ; instruction bank .iif gt alpha32, .psect $banki,shr,long,pic,exe,nord,nowrt .iif le alpha32, .psect $bankr,shr,byte,pic,exe,rd,nowrt .endm .macro $bankdr bankname ; data bank (write inhibit gaurd mode) .iif gt alpha32, .psect $bankr,shr,long,pic,noexe,rd,nowrt .iif le alpha32, .psect $bankr,shr,byte,pic,exe,rd,nowrt .=<.+3>/4*4 .endm .macro $bankdw bankname ; data bank ;;; .error *** unexpected writable section .psect $bankw,noshr,long,pic,noexe,rd,wrt .endm ; AMACRO32 macro procedures for VAX/VMS v5.52 and earlier .macro call_jsb_entry .if le alpha32 .if lt exec_version-600 .macro .call_entry max_args=?,home_args=?,input=<>,output=<>,scratch=<>,preserve=<> .word ^m .endm .macro .jsb_entry max_args=?,input=<>,output=<>,scratch=<>,preserve=<> .endm .endc ;lt exec_version-600 .endc ;le alpha32 .endm call_jsb_entry %% $ p8 =f$ve(savvfy) $ append 'tpf'.tmp 'tpf'.tmp;1 $ delete 'tpf'.tmp;2 $ libr/create/macro 'p1' 'tpf'.tmp $ delete 'tpf'.tmp;* $ ends $!============================================================================== $! create automail.exe that contains subroutines $create_src: $ subr $ p8 ='f$ve(0) $ create 'p1' $ deck /dollar=%% .title show_globalsection_Users .ident "V1.0" ; ; This program will attempt to list all processes which are referencing ; a given global section. ; This program is provided AS IS and as such offers no warranty, ; implied or otherwise by DIGITAL EQUipMENT CORPORATION or any ; of it's employees. Any loss of services or damages incurred by ; the use of this program are the sole responsibility of those ; authorizing it's execution. ; Author: ; ian Megarity (191107) ; digital MCS Customer Support Centre ; basingstoke UK ; comics::Megarity (megarity@uvo.mts.dec.com) ; Date: ; 12-noV-1993 ; .default displacement,word bugon =0 pagsiz =512 exec_version ; load executive level call_jsb_entry ; for v5.52 and earlier parmdef ; call arguments $acbdef $chfdef $ddbdef $dscdef $dyndef $fcbdef $gsddef $lib$routinesdef $jpidef $pcbdef $phddef $pridef $ptedef $secdef $sbdef .iif gt alpha32, sf$a_handler=0 .iif le alpha32, $sfdef $ssdef $statedef $ucbdef $wcbdef ; ; address redirection for alpha32 machine ; .if gt alpha32 exe$ipid_to_pcb =exe$cvt_ipid_to_pcb exe$epid_to_ipid=exe$cvt_epid_to_ipid exe$ipid_to_epid=exe$cvt_ipid_to_epid .endc .page .sbttl ACB extention ; ; What follows is the acb plus other data that's going to be used ; to get the relevant data back from the target process. ; $defini acb,,acb$k_length $def acb_l_ownpid .blkl 1 $def acb_l_gsd .blkl 1 ; not used $def acb_l_vpx .blkl 1 $def acb_l_gstx .blkl 1 ; not used $def acb_l_pteknt .blkl 1 $def acb_l_sts .blkl 1 $def acb_l_va .blkl 1 $def acb_l_pteadr .blkl 1 $def acb_a_code .blkl 0 $defend ; ; local control table ; .save .psect $abs$,abs .=0 z_q_iosb: .blkq 1 z_l_acpsta: .blkl 1 z_l_prcsts: .blkl 1 z_l_prcsta: .blkl 1 z_l_curpid: .blkl 1 z_l_curpte: .blkl 1 z_l_cur_va: .blkl 1 z_l_acbadr: .blkl 1 ; address of clone ACB (in expool) z_l_swppid: .blkl 1 ; epid of swapper z_l_usrpid: .blkl 1 z_l_prcknt: .blkl 1 ; mapped process count (for a section) z_l_gsdknt: .blkl 1 ; processed section count z_l_gsdptr: .blkl 1 ; chain pointer word of gsd z_l_gsdtop: .blkl 1 ; listhead of gsd chain z_q_secfid: .blkq 1 ; file-identifier-code (six bytes) z_l_refknt: .blkl 1 z_l_secwcb: .blkl 1 z_l_allcls: .blkl 1 z_t_secdev: .blkb 4 ; device mnemonic (counted ascii) z_l_secunt: .blkl 1 z_t_secnnm: .blkb 8 ; node name (counted ascii) z_t_gsdnam: .blkb 16 ; global section name (last found - counted ascii) z_q_gblsnm: .blkq 1 ; descriptor of given section name (from operator) .blkb 32 z_q_prcnam: .blkq 1 ; descriptor of process name .blkb 16 z_q_devnam: .blkq 1 ; descriptor of device name .blkb 32 z_q_filnam: .blkq 1 ; descriptor of file name .blkb 64 z_b_tmpacb: .blkb acb_a_code ; ACB template z_k_length: .restore_psect .page .sbttl common_data_bank (guarded) $bankdr ; .ascic "!/ section process PID PTEVA P0_VA state" mgfao7a:.ascic <13><10>" Section Process PID PTEVA P0_VA State" mgfao7: .ascic /!3UL !17AC!16AS!XL !XL !XL !AC/ mgfao6: .ascic /!3UL process(es) found referencing to section, !AC/ mgfao5: .ascic " searching GSDs in GSDSYS for !AS ... " mgfao4: .ascic "$!ZL$!AC!ZW:" mgfao3: .ascic "!AC$!AC!ZW:" mgfao2: .ascic " !AS (state=%x!XL)" mgfao1: .ascic /!3UL section(s) processed/ mgsusp: .ascic " process !AS (pid=%x!XL) is suspended. ignoring it" .if ge bugon-1 mgfao9: .ascic " address of ACB clone is %x!XL and SWAPPER's pid is %x!XL" mgfao8: .ascic / interrogating pid %x!XL (!AS)/ mgproc: .ascic / calling $getjpi for next process.../ mgfree: .ascic / acb in expool deallocated.../ .endc ;ge bugon-1 mg_gbl: .ascic "name of global section : " matst1: .ascic "GPTE" matst2: .ascic "valid" .page .sbttl kernel ast routine (template) ; ; Here's the AST code that will be executed by each of the target ; processes as a Special Kernel mode AST. ; all it does is get the target process to search it's own PTEs for ; references to the given GSD. ; first of all,save some registers. Bear in mind that we don't ; need to save R0 thru R5 since they've already been saved on ; the stack by the ASTDEL code. ; also,bear in mind that on entry to a Special Kmode AST,R5 will ; contain the address of the acb. ; entry R4=pcb ; R5=pcb ; return none ; destroy R0-R3 ; calling jsb ; $banki kast: .jsb_entry input=,preserve=<>,scratch= pushr #^m movl g^ctl$gl_pcb,R6 ; R6=pcb movl pcb$l_phd(R6),R6 ; R6=phd ashl #9,g^swp$gl_bslotsz,R0 ; balance slot size in bytes. subl3 phd$l_frep1va(R6),#^x7ffffE00,R2 movl phd$l_frep0va(R6),R1 ashl #2-9,R2,R2 ; convert it to bytes ashl #2-9,R1,R1 ; R1=number of p0 PTEs. bicl #3,R2 bicl #3,R1 ; R1=length of p0 PTE region in bytes subl3 R2,R0,R2 ; R2 <- distance of start addl phd$l_p0br(R6),R1 ; R1=final va of p0 PTE region addl R6,R2 ; add on phd address to get ; start va of p1 PTEs in R2. ; compute number of PTEs addl3 R6,R0,R7 ; R7=address of start of next balance slot subl phd$l_p0br(R6),R7 ; R7=size of pte region in bytes ashl #-2,R7,R7 ; R7=number of ptes ; Here we go loop the loop ... movl g^pfn$al_pte,R9 ; R9=PTE array start address. movl acb_l_vpx(R5),R10 ;+++ movl acb_l_gstx(R5),R47 movl phd$l_p0br(R6),R6 ; R6=start of p0 PTEs. clrl R0 brb 12$ 11$: incl R0 ; Increment PTE count. cmpl R6,R2 ; If it's a p1 PTE,then go get next one. bgtru 12$ cmpl R6,R1 ; If a p0 PTE,then go get next one. blequ 12$ movl R2,R6 ; update the current PTE subl R1,R2 ; compute size of "No-Mans land" ; region in bytes and store it in R2. ashl #-2,R2,R2 ; convert it to PTEs. subl R2,R7 ; subtract this number from the number ; of PTEs that are yet to be processed. addl R2,R0 ; add it to R0. 12$: movl (R6)+,R3 ; move next PTE into R3. beql 16$ ; skip if Zero. bbs #pte$v_valid,R3,20$ ; valid bit set ? bbs #pte$v_typ1,R3,16$ ; If typ1 bit clear ? bbs #pte$v_typ0,R3,30$ ; Is typ0 bit set ? 16$: sobgtr R7,11$ movl s^#ss$_normal,acb_l_sts(R5) clrl acb_l_pteadr(R5) brb 40$ ; PTE valid 20$: extzv #0,#21,R3,R8 ; extract the PFN cmpl g^mmg$gl_maxpfn,R8;;;;;;; blssu 16$;;;;;;;;;;;;;;;;;;;;;; ; cmpl g^mmg$gl_minpfn,R8;;;;;;; ; bgtru 16$;;;;;;;;;;;;;;;;;;;;;; movl (R9)[R8],R8 ; move PTE array element subl g^mmg$gl_gptbase,R8 ashl #-2,R8,R8 cmpl R10,R8 ; Is it the same as the vpx ? bneq 16$ ; No. movl #2,acb_l_sts(R5) brb 31$ ; GPTE redirected 30$: cmpzv #pte$v_gptx,#pte$s_gptx,R3,R10 ; compare the GPTX. bneq 16$ clrl acb_l_sts(R5) 31$: moval -(R6),acb_l_pteadr(R5) ; Yes - We have a match. cmpl R1,R6 ; Is it a p0 PTE ? blequ 32$ ashl #9,R0,acb_l_va(R5) brb 40$ 32$: subl3 R0,acb_l_pteknt(R5),R1 ashl #9,R1,R1 ; convert it to a va. subl3 R1,#^X7ffffE00,acb_l_va(R5) 40$: lock lockname=sched,- savIpl=-(sp),- preserve=NO movl acb_l_ownpid(R5),R1 ; R1=my ipid jsb g^sch$wake unlock lockname=sched,- newIpl=(sp)+,- condition=RESTORE,- preserve=NO popr #^m rsb kastsize=.-kast tmpacbsz=acb_a_code+kastsize .page .sbttl main instruction stream $banki begin: .call_entry max_args=4,preserve= movab -z_k_length(sp),sp movc5 #0,(sp),#0,#z_q_gblsnm,(sp) ; clear local control table ; initialize string descriptors movab z_q_devnam+8(sp),R0 movab z_q_filnam+8(sp),R1 moval (R0),-(R0) ;;; movl s^#32,-(R0) moval (R1),-(R1) ;;; movl s^#63,-(R1) movab z_q_prcnam+8(sp),R0 movab z_q_gblsnm+8(sp),R1 moval (R0),-(R0) ;;; movl s^#15,-(R0) moval (R1),-(R1) ;;; movl s^#32,-(R1) movl sp,r11 ; initialize template acb movc5 #0,(sp),#0,#acb_a_code,z_b_tmpacb(sp) ; clear template acb area movb #,- ; Make it a special KAST whose acb$b_rmod+z_b_tmpacb(sp) ; acb doesn't get deleted. movw #tmpacbsz,acb$w_size+z_b_tmpacb(sp) .if gt alpha32 movzwl #ss$_bugcheck,R0 cmpw #pagsiz,g^mmg$gl_page_size bneq 15$ .endc ;======= ; get own process information ;======= clrq -(sp) ;;; psuhl #0 pushal z_l_curpid(R11) pushl #!4 ;;; pushl #0 ; param-7:astprm clrq -(sp) ; param-6:astadr pushaq z_q_iosb(R11) ; param-5:iosb pushal 4*3(sp) ; param-4:itmlst pushl #0 ; param-3:prcnam ;;; pushl #0 ; param-2:pidadr clrq -(sp) ; param-1:efn .if gt alpha32 calls #7,g^sys$getjpiw addl #4*4,sp .iff calls #7+4,g^sys$getjpiw .endc blbc R0,17$ movzwl z_q_iosb(R11),R0 blbc R0,17$ movl z_l_curpid(R11),acb_l_ownpid+z_b_tmpacb(R11) pushab z_b_tmpacb(R11) ; param-1:template acb pushl #1 ; param-k: pushal (sp) pushab setup_own_ipid calls #2+2,g^sys$cmexec ;======= ; get target global section name ;======= 14$: movab mg_gbl,R1 movl s^#32,dsc$w_length+z_q_gblsnm(R11) movzbl (R1)+,R0 pushr #^m ; descriptor of questionary pushaw z_q_gblsnm(R11) ; param-3: pushaq 4*1(sp) ; param-2: pushaq z_q_gblsnm(R11) ; param-1: calls #3,g^lib$get_foreign addl #4*2,sp ; flush stack blbs R0,18$ cmpw r0,#rms$_eof&^x0ffff bneq 17$ incl R0 15$: cmpw #ss$_nosuchsec,R0 ; end of section search? bneq 17$ ; no, abend brw 80$ ; yes, display ending message 17$: ret 18$: tstw dsc$w_length+z_q_gblsnm(R11) beql 14$ pushaq z_q_gblsnm(R11) pushl (sp) calls #2,g^str$upcase blbc R0,17$ ;======= ; search given global section name in GSD chain ;======= ; ; the global section listHead addresses are :- ; ; EXE$GL_GSDSYSGL - system list. ; EXE$GL_GSDGRPFL - Group list. ; EXE$GL_GSDDELFL - Delete-Pending list. ; ; so,if one wanted to process the Delete-Pending global section list ; instead of the system list,all one has to do is modify the following ; line so it uses EXE$GL_GSDDELFL instead of EXE$GL_GSDSYSGL. ; moval g^exe$gl_gsdsysfl,R2 pushaq z_q_gblsnm(R11) pushab mgfao5 calls #2,fanout movab (R2),z_l_gsdtop(R11) movab (R2),z_l_gsdptr(R11) ; ; initialize to process a global section ; 22$: clrl z_l_prcknt(R11) ; clear mapped process counter mcoml #0,z_l_usrpid(R11) ; init for $getjpi pid scan assume dsc$w_length eq 0 movl s^#32,z_q_devnam(R11) ; init string descriptor movl s^#63,z_q_filnam(R11) ; init string descriptor ; search next global section pushal acb_l_gstx+z_b_tmpacb(R11) ; param-3:address to return GSTE (NOT USED) pushal acb_l_vpx+z_b_tmpacb(R11) ; param-2:address to return vpx pushal (R11) ; param-1:control table pushl #3 ; param-k: pushal (sp) pushab get_gsd_info calls #2,g^sys$cmexec addl #4*4,sp 23$: blbc R0,15$ movl R1,acb_l_gsd+z_b_tmpacb(R11) ; address of name matched gsd (NOT USED) movl R1,z_l_gsdptr(R11) ; save for next search incl z_l_gsdknt(R11) ; increment processed section count ;======= ; display file specification as a service message ;======= tstl z_l_secwcb(R11) ; do we have a real wcb or not ? beql 30$ ; construct device name moval mgfao4,R1 movzbl z_l_allcls(R11),R0 bneq 24$ moval mgfao3,R1 movab z_t_secnnm(R11),R0 ; R0=buffer of nodename string 24$: pushab 1(R1) movzbl (R1),-(sp) pushl z_l_secunt(R11) ; p3 pushab z_t_secdev(R11) ; p2 pushl R0 ; p1 pushaw z_q_devnam(R11) ; outlen pushl (sp) ; outbuf pushaq 4*5(sp) ; ctrstr .if gt alpha32 calls #6,g^sys$fao addl #4*2,sp .iff calls #6+2,g^sys$fao .endc .if ge bugon-1 pushaq z_q_devnam(R11) calls #1,g^lib$put_output .endc ; xlate fid to filename which global section mapped pushal z_l_acpsta(R11) ; param-6:buffer to return file status pushl #0 ; param-5: pushaw z_q_filnam(R11) ; param-4:descriptor of result buffer pushl (sp) ; param-3:buffer to return result length pushab z_q_secfid(R11) ; param-2:buffer of fid stored pushaq z_q_devnam(R11) ; param-1:descriptor of device name calls #6,g^lib$fid_to_name blbc R0,23$ ;======= ; allocate a acb in expool ;======= 30$: pushal z_l_swppid(R11) ; param-3:buffer to return swapper's epid pushal z_l_acbadr(R11) ; param-2:buffer of return real acb pushab z_b_tmpacb(R11) ; param-1:address of template acb (size is "acb_a_code") pushl #3 ; param-k: pushal (sp) pushab acb_clone_create .if gt alpha32 calls #2,g^sys$cmkrnl addl s^#4*4,sp .iff calls #2+4,g^sys$cmkrnl .endc blbc R0,43$ .if ge bugon-1 pushl z_l_swppid(R11) pushl z_l_acbadr(R11) pushab mgfao9 calls #3,fanout .endc ;======= ; search all processes PTE for a section ;======= pushab mgfao7a ;;; calls #1,fanout calls #1,putout ; ; it's at this point that we start to go through all processes on the ; system and fire a KAST at each one in order to find which one's have ; got an interest in a particular global section. ; 41$: .if ge bugon-1 pushab mgproc calls #1,putout .endc movl sp,R2 ; save stack-pointer clrq -(sp) ;;; pushl #0 pushal z_l_curpid(R11) pushl #!4 ; pushl #0 ; pushal z_l_prcsts(R11) ; pushl #!4 ; pushl #0 ; pushal z_l_prcsta(R11) ; pushl #!4 pushaw z_q_prcnam+dsc$w_length(R11) pushl z_q_prcnam+dsc$a_pointer(R11) pushl #!15 ;;; pushl #0 ; param-7:astprm clrq -(sp) ; param-6:astadr pushaq z_q_iosb(R11) ; param-5:iosb pushal 4*3(sp) ; param-4:itmlst pushl #0 ; param-3:prcnam pushal z_l_usrpid(R11) ; param-2:pidadr pushl #0 ; param-1:efn calls #7,g^sys$getjpiw movl R2,sp ; flush stack blbs r0,44$ cmpw r0,#ss$_suspended ; May not be able to ignore !! bneq 43$ pushl z_l_curpid(R11) pushaq z_q_prcnam(R11) pushab mgsusp calls #3,putout 42$: brb 41$ 43$: cmpw r0,#ss$_nomoreproc bneq 47$ 44$: movzwl z_q_iosb(R11),R0 blbc R0,47$ cmpl z_l_curpid(R11),z_l_swppid(R11) beql 41$ .if ge bugon-1 pushaq z_q_prcnam(R11) pushl z_l_curpid(R11) pushab mgfao8 calls #3,fanout .endc pushl z_l_acbadr(R11) pushl z_l_curpid(R11) pushl #2 pushal (sp) ; arglst pushab search_proc_ptes ; routin calls #2+3,g^sys$cmkrnl blbc R0,47$ $hiber_s pushal z_l_cur_va(R11) ; param-5:buffer to return va pushal acb_l_pteknt+z_b_tmpacb(R11) ; param-4:buffer to return pte count pushal acb_l_sts+z_b_tmpacb(R11) ; param-3:buffer to return status pushal z_l_curpte(R11) ; param-2:buffer to return pte pushl z_l_acbadr(R11) ; param-1:acb address pushl #5 pushal (sp) ; arglst pushab retrieve_data ; routin .if gt alpha32 calls #2,g^sys$cmkrnl addl #4*6,sp .iff calls #2+6,g^sys$cmkrnl .endc 47$: blbc R0,49$ movl acb_l_sts+z_b_tmpacb(R11),R0 blbs R0,42$ incl z_l_prcknt(R11) ; increment mapped process count pushab matst1 bbc #1,R0,48$ addl s^#matst2-matst1,(sp) ; param-7: 48$: pushl z_l_cur_va(R11) ; param-6:p0_va pushl z_l_curpte(R11) ; param-5:pteva pushl z_l_curpid(R11) ; param-4:pid pushaq z_q_prcnam(R11) ; param-3:prcnam pushab z_t_gsdnam(R11) ; param-2:section name pushl z_l_prcknt(R11) ; param-1:seq no pushab mgfao7 ; param-k: calls #8,fanout brw 41$ ; result message for a section 49$: pushr #^m pushab z_t_gsdnam(R11) pushl z_l_prcknt(R11) pushab mgfao6 calls #3,fanout pushl z_l_acpsta(R11) ; param03:ACP state pushaq z_q_filnam(R11) ; param-2:associated file spec. pushab mgfao2 calls #3,fanout popr #^m ;======= ; release clone acb (in expool) ;======= movl z_l_acbadr(R11),R2 bgeq 77$ pushr #^m pushab (R2) ; param-1: pushl #1 ; param-k: pushal (sp) pushab acb_clone_free calls #2+2,g^sys$cmkrnl blbc R0,89$ clrl z_l_acbadr(R11) .if ge bugon-1 pushab mgfree calls #1,putout .endc popr #^m ; process next section in GSD chain 77$: cmpw r0,#ss$_nomoreproc bneq 89$ brw 22$ ;======= ; termination ;======= 80$: pushl z_l_gsdknt(R11) beql 89$ pushab mgfao1 calls #2,fanout ;;; movzwl #ss$_nomoresec!1,R0 89$: ret .page .sbttl search_proc_ptes ;+============================================================================== ; search_proc_ptes ; entry parm_1=EPID ; parm_2=acb address ; return R0=completion code ; destroy R0-R1 ; calling call ;- search_proc_ptes: .call_entry max_args=2,preserve= movab g^exe$sigtoret,sf$a_handler(fp) movl parm_2(ap),R5 movl parm_1(ap),R0 jsb g^exe$epid_to_ipid movl r0,acb$l_pid(R5) beql 9$ movb #,acb$b_rmod(R5) movl s^#pri$_ticom,R2 jsb g^sch$qast ret 9$: movzwl #ss$_noSuchdev,R0 ret ;;; .page .sbttl retrieve_data ;+============================================================================== ; retrieve_data ; entry parm_1=local control table ; parm_2=buffer to return, PTEVA ; parm_3=buffer to return, result status ; parm_4=buffer to return, PTE count ; parm_5=buffer to return, process VA ; return R0=completion code ; destroy R0-R1 ; calling call ;- retrieve_data: .call_entry max_args=5,preserve=<> movl parm_1(ap),R1 movl s^#ss$_normal,R0 movab g^exe$sigtoret,sf$a_handler(fp) ; Set up a condition handler. movl acb_l_pteadr(R1),@parm_2(ap) movl acb_l_sts(R1),@parm_3(ap) movl acb_l_pteknt(R1),@parm_4(ap) movl acb_l_va(R1),@parm_5(ap) ret ;;; .page .sbttl get_gsd_info ;+============================================================================== ; get_gsd_info ; entry parm_1=local control table ; parm_2=address to return vpx ; parm_3=address to return GSTE ; return R0=completion code ; R1=address of name matched gsd ; destroy R0,R1 ; calling call (cmexec) ;- get_gsd_info: .call_entry max_args=3,preserve= movl parm_1(ap),R11 movab g^exe$sigtoret,sf$a_handler(fp) ; Set up a condition handler movq z_q_gblsnm(R11),R8 ; R9=buffer of global section name assume z_l_gsdtop eq z_l_gsdptr+4 movq z_l_gsdptr(R11),R6 ;;; movl z_l_gsdtop(R11),R7 movzbl R8,R8 ; R8=length of global section name brb 12$ 11$: movzwl #ss$_nosuchsec,R0 ret 12$: movl (R6),R6 cmpl R7,R6 ; have we reached the end yet ? beql 11$ cmpb gsd$t_gsdnam(R6),R8 ; Is the name the correct length ? blssu 12$ ; no, skip this one cmpc3 R8,gsd$t_gsdnam+1(R6),(R9) ; is it the correct name ? bneq 12$ cvtwl gsd$w_gstx(R6),R7 ; extract the GSTE from the GSD movl g^mmg$gl_sysphd,R2 movl R7,@parm_3(ap) mnegl R7,R7 ; change it's sign from -ve to +ve. addl phd$l_pstbasoff(R2),R2 ; R2 now points at the end of the global section Table ashl #2,R7,R7 ; convert it from longword ; index to byte index. subl R7,R2 ; R2 now points to the global section Table Entry that we're interested in ;+++ movl sec$l_gsd(R2),R8 extzv #0,#22,sec$l_vpxpfc(R2),@parm_2(ap) movl sec$l_refcnt(R2),z_l_refknt(R11) divl sec$l_pagcnt(R2),z_l_refknt(R11) movl sec$l_window(R2),R2 ; R2=WCB movl R2,z_l_secwcb(R11) beql 80$ movl wcb$l_orgucb(R2),R1 ; R1=UCB movl wcb$l_fcb(R2),R2 ; R2=FCB movw ucb$w_unit(R1),z_l_secunt(R11) movl ucb$l_ddb(R1),R1 ; R1=DDB movl fcb$w_fid(R2),z_q_secfid+0(R11) movw fcb$w_fid_rvn(R2),z_q_secfid+4(R11) movl ddb$t_name(R1),z_t_secdev(R11) movl ddb$l_allocls(R1),z_l_allcls(R11) movl ddb$l_sb(R1),R1 beql 80$ assume exec_version le 690 movq sb$t_nodename(R1),z_t_secnnm(R11) 80$: movq gsd$t_gsdnam+0(R6),z_t_gsdnam+0(R11) movq gsd$t_gsdnam+8(R6),z_t_gsdnam+8(R11) movl s^#ss$_normal,R0 movl R6,R1 ret .page .sbttl setup_own_ipid ;+============================================================================== ; setup_own_ipid ; entry parm_1=buffer of template acb ; return R0=completion code ; destroy R0,R1 ; calling call ;- setup_own_ipid: .call_entry max_args=1,preserve= movl parm_1(ap),R2 movl acb_l_ownpid(R2),R0 jsb g^exe$epid_to_ipid tstl R0 beql 1$ movl R0,acb_l_ownpid(R2) movl s^#ss$_normal,R0 ret 1$: movzwl #ss$_nonexpr,R0 ret ;;; .page .sbttl acb_clone_create ;+============================================================================== ; acb_clone_create ; entry parm_1=address of template acb body ; parm_2=buffer to return acb in expool ; parm_3=buffer to return swapper epid ; return R0=completion code ; destroy R0,R1 ; calling call ;- acb_clone_create: .call_entry max_args=4,preserve= movab g^exe$sigtoret,sf$a_handler(fp) movl parm_1(ap),R3 movl acb_l_ownpid(R3),R0 jsb g^exe$ipid_to_pcb tstl R0 bgeq 9$ movl pcb$l_phd(R0),R0 ; R0=PHD assume pagsiz eq 512 ashl #9,g^swp$gl_bslotsz,R5 ; R5=balance slot size in bytes movl phd$l_p0br(R0),R2 addl R0,R5 ; R5=address of start of next balance slot subl R2,R5 ; R5=size of pte region in bytes ashl #-2,R5,R5 ; R5=number of ptes movl R5,acb_l_pteknt(R3) movzwl #tmpacbsz,R1 ; R1=expool request size jsb g^exe$alononpaged blbc R0,7$ pushr #^m movc3 #acb_a_code,(R3),(R2) ; copy all the data to pool movc3 #kastsize,kast,(R3) ; add kast routine popr #^m movab acb_a_code(R2),acb$l_kast(R2) movl r2,@parm_2(ap) movzwl r1,acb$w_size(R2) movb #dyn$c_acb,acb$b_type(R2) ; Update the TYPE field. ; finally,let's get the swapper's EPID and pass it back. movl g^sch$gl_swppid,R0 jsb g^exe$ipid_to_epid movl r0,@parm_3(ap) movl s^#ss$_normal,R0 7$: ret 9$: movzwl #ss$_nonexpr,R0 ret ;;; .page .sbttl acb_clone_free ;+============================================================================== ; acb_clone_free ; entry parm_1=address of acb to release ; return R0=completion code ; destroy R0,R1 ; calling call ;- acb_clone_free: .call_entry max_args=1,preserve= movl parm_1(ap),R0 movab g^exe$sigtoret,sf$a_handler(fp) .if ge bugon-1 cmpw #/64*64,ucb$w_size(R0) beql 0$ movl acb$w_size(R0),R1 movzwl #ss$_ivbuflen,R0 brb 1$ 0$: .endc jsb g^exe$deanonpaged movl s^#ss$_normal,R0 1$: ret .page .sbttl faoout - edit and display on sys$output ;+============================================================================== ; faoout - edit and display on sys$output ; entry parm_1=$fao control string (counted ascii) ; parm_2=$fao parameter-1 ; parm_3=$fao parameter-2 ; fanout: .call_entry max_args=6,preserve=<> movl parm_1(ap),R1 movab -128(sp),sp pushab (sp) ; dsc$a_pointer ashl #7,#1,-(sp) ; dsc$w_length movzbl (R1)+,R0 pushr #^m pushal parm_2(ap) ; param-4:arglst pushaw 4*3(sp) ; param-3:outcnt pushl (sp) ; param-2:outbuf pushal 4*3(sp) ; param-1:ctrstr calls #4+2,g^sys$faol pushaq (sp) calls #1,g^lib$put_output ;;; movab 128+<4*2>(sp),sp ret ;;; .page .sbttl putout - display on sys$output ;+============================================================================== ; putout - display on sys$output ; entry parm_1=string-1 (counted ascii) ; | ; parm_6=string-6 (counted ascii) ;- putout: .call_entry max_args=6,preserve= clrl R2 2$: movl parm_1(ap)[R2],R1 pushab 1(R1) movzbl (R1)+,-(sp) pushaq (sp) calls #1+2,g^lib$put_output aoblss parm_k(ap),R2,2$ ret .end begin %% $ p8 =f$ve(savvfy) $ ends $!==============================================================================