VXLOADR: PROC(FILESPEC,CALLADDR); /*LOAD A SUBROUTINE (LINKED) DYNAMICALLY, AND RETURN THE ADDRESS OF CODE FOR VXLINKR TO EXECUTE IN ORDER TO INVOKE THE SUBR T DOW 5/13/82 ***********************************************/ DCL FILESPEC CHAR(*) VAR; /*ACTULLY LIMITED TO CHAR(63) VAR*/ DCL CALLADDR PTR; DCL (JDIR,JEX,CALLOFF,NPAGES,SVBN) FIXED BIN(31); DCL VXLDR ENTRY(CHAR(*) VAR, FIXED BIN(31), FIXED BIN(31)) RETURNS(PTR); DCL DUMPL ENTRY (PTR,FIXED BIN(31)); DCL (LOADADDR) PTR; DCL IMAGE FILE RECORD INPUT; DCL SECFILE FILE RECORD OUTPUT ENVIRONMENT (FIXED_LENGTH_RECORDS); DCL (DIRSPEC,SECSPEC) CHAR(63) VAR; DCL IMREC CHAR(512) BASED(IMPTR); DCL 1 IMAGE_HEAD BASED(IMPTR), 2 IH_FILL1 CHAR(2), 2 IH_TAOFF FIXED BIN(15), 2 IH_STOFF FIXED BIN(15), 2 IH_FILL2 CHAR(10), 2 IH_NHBLK CHAR(1); DCL IMPTR PTR, IMPTRB FIXED BIN(31) DEF(IMPTR); DCL PTRA PTR, PTRB FIXED BIN(31) DEF (PTRA); DCL PAGES FIXED BIN(15) BASED(PTRA); DCL OFFS FIXED BIN(31) BASED(PTRA); DCL I FIXED BIN(31); DCL LIB$GET_VM ENTRY (FIXED BIN(31),PTR) RETURNS(FIXED BIN(31)); DCL 1 CALL_STRUC BASED(CALLADDR), 2 CS_OPCO CHAR(1), 2 CS_NARG CHAR(1), 2 CS_OS CHAR(1), 2 CS_ASUB PTR, 2 CS_RET CHAR(1); DCL EOF BIT(1) INIT('0'B); ON ENDFILE(IMAGE) EOF = '1'B; /**** SET UP FILESPEC FOR SECTION FILE *****/ JDIR = INDEX (FILESPEC,']'); IF JDIR = 0 THEN DO; DIRSPEC = ''; SECSPEC = FILESPEC; END; ELSE DO; SECSPEC = SUBSTR(FILESPEC,JDIR+1); DIRSPEC = SUBSTR(FILESPEC,1,JDIR); END; JEX = INDEX(SECSPEC,'.'); IF JEX = 0 THEN SECSPEC = SECSPEC || '.PVS'; ELSE SECSPEC = SUBSTR(SECSPEC,1,JEX) || 'PVS'; SECSPEC = DIRSPEC || SECSPEC; OPEN FILE(IMAGE) TITLE(FILESPEC); OPEN FILE(SECFILE) TITLE(SECSPEC); /*put SKIP EDIT(SECSPEC)(A);*/ /********** GET INFIO FROM IMAGE HEADER *******/ READ FILE(IMAGE) SET(IMPTR); SVBN = RANK(IH_NHBLK) + 1; PTRB = IMPTRB + IH_TAOFF + 4; /* transf addr is second in array*/ CALLOFF = OFFS - 512 * (SVBN - 1); PTRB = IMPTRB + IH_STOFF; NPAGES = PAGES - SVBN; /*put SKIP EDIT(NPAGES,SVBN,calloff)(3 F(16));*/ /*call DUMPL(IMPTR,96);*/ /********* COPY SECTION FILE FROM IMAGE FILE (SECFILE CAN BE UPDATED*/ DO WHILE(^EOF); WRITE FILE(SECFILE) FROM (IMREC); READ FILE(IMAGE) SET(IMPTR); END; CLOSE FILE(SECFILE); CLOSE FILE(IMAGE); PTRA = VXLDR(SECSPEC,NPAGES,SVBN); /*call dumpl (ptra,32);*/ PTRB = PTRB + CALLOFF; /*call DUMPL(PTRA,32);*/ I = LIB$GET_VM(8,CALLADDR); CS_OPCO = BYTE(251); /*FB = calls*/ CS_NARG = BYTE(0); /*FILLED IN BY VXLNKCL*/ CS_OS = BYTE(159); /*9F = absolute addr*/ CS_ASUB = PTRA; /*FROM VXLDR*/ CS_RET = BYTE(4); /*ret */; /*call DUMPL(/*callADDR,8);*/ END VXLOADR;