.title vxldr dynamic load of a subr ; create and map a section that is a dynamically called subr ; called from vxloadr ; t dow 5/13/82 .enable debug .psect wes_data pic,usr,con,rel,noshr,noexe,rd,wrt $secdef $jpidef secfab: $fab fop=ufo,fac=put ;prototype FAB maprange: .blkl 2 getvad: .word 4 .word jpi$_frep0va ;getjpi, next free page .long 0 .long 0,0 retrange: .blkl 2 memsiz: .long maprange-secfab hirange:.long ^X3FFFFFFF .psect wes_code pic,usr,con,lcl,rel,shr,exe,rd,nowrt vxldr:: .word ^M subl2 #4,sp ;get memory for FAB pushl sp ;addr list for lib$get_vm pushal memsiz calls #2,lib$get_vm gvm: movl (sp),r6 ;addr of fab movc3 memsiz,secfab,(r6) ;copy proto fab movl 4(ap),r1 ;addr desriptor of filespec movl 4(r1),r1 ;addr length+string movb 0(r1),fab$b_fns(r6) ;length of filespec (char varying) moval 2(r1),fab$l_fna(r6) ;addr of string $open fab=(r6) ;open section file opn: moval maprange,getvad+4 ; i.e., getvad+4 = .address maprange movl hirange,maprange+4 $getjpi_s itmlst=getvad ;get addr of next free page in p0 ; $crmpsc_s inadr=maprange,- ; retadr=retrange,- ; pagcnt=#68,- ; flags=#sec$m_wrt,- ; chan=secfab+fab$l_stv,- ; vbn=#2 jpi: pushl #0 ;pfc pushl #0 ;prot pushl @12(ap) ;vbn pushl @8(ap) ;pagcnt pushl fab$l_stv(r6) ;chan pushl #0 ;relpag pushl #0 ;ident pushl #0 ;gsdnam pushl #sec$m_wrt ;flags pushl #0 ;acmode pushal retrange ;retadr pushal maprange ;inadr calls #12,@#sys$crmpsc crm: movl retrange,r0 ;return addr ret .end