.title map_sections Map to sections code .ident /V02-001/ ; KOB 15th Aug 1993 ; © 2000 P. Beaudoin ; This software is supplied as is and the usual warranty ; is implied - none. You may use, abuse, modify or ; or ignore this software as you see fit but are ; encouraged to give credit, as is good practice ; when stealing with permission ; ; v02-001 23-09-96 PB Rewrite for EMU5 ; V01-004 01-02-94 PB Undid 003 - now 64 buffs. ; V01-003 16-11-93 PB Changed Ebuffs section to map 56 (former 64) buffs. ; V01-002 27-09-93 kob Added map sections to disk file ; V01-001 created KOB 15th Aug 1993 ;++ ;1 MAP_SECTIONS ; Module containing routines used to map and unmap EMU global sections. ; see individual routines for detail ;-- .enable suppression .library /sys$library:lib.mlb/ .library /emu5_LIB:emu5.mlb/ $secdef ; Global Section $ssdef $LCKDEF EMUCTRLDEF EMUIPCDEF EMUSYSDEF EMUPSRDEF EMUCNTDEF EMURLTDEF EMUMSGDEF .psect rw_data, noexe, rd, wrt, quad, pic, noshr ;Read/Write data ; Global section areas returned addresses inaddr: .quad 0 CONTROL_A: .QUAD 0 ; gblsiz: .long 0 ; File Structures PSRFAB: $FAB FAC = ,- ; Access SHR = ,- ORG = IDX,- ; Indexed XAB = PSRXAB,- FNM = ,- ; Filename DNM = ; Filename PSRRAB: $RAB FAB = PSRFAB,- ; Record RAC = SEQ PSRXAB: $XABKEY REF=0,- PROLOG=0,- POS=0,- SIZ=8,- DTP=BN8,- FLG = DUP ; PTYKEY .ALIGN LONG CTLFAB: $FAB FAC = ,- ; Access SHR = ,- RFM = FIX,- ORG = SEQ,- ; Indexed FNM = ,- ; Filename DNM = ; Filename CTLRAB: $RAB FAB = CTLFAB,- ; Record RAC = SEQ,- RSZ = CTL_C_RECSIZE,- USZ = CTL_C_RECSIZE .ALIGN LONG ; Following is structure used to map a translation table. The file ; specified by the caller is opened and mapped directly. ; XLTTBLFAB: $FAB FAC = ,- SHR = ,- ORG = SEQ XLTTBLRAB: $RAB FAB=XLTTBLFAB,- RAC=SEQ ; Locking ; Lock value block DBLVB: LVBSTA: .WORD 0 ; Status LVBRES: .WORD 0 ; Reserved LVBID: .LONG 0 ; Lock id LVBSIZ: .LONG 0 ; Begining of LVB (Size of DB in pages) LVBSPR: .BLKL 3 ; Unused 12 bytes ; $ENQ call frame DBLOCK: .LONG 12 ; Arguments .LONG 0 ; EFN LKMODE: .LONG LCK$K_CWMODE ; Lock mode .ADDRESS DBLVB ; Lock value block LKFLGS: .LONG ; Use value block LKNAM: .LONG 0 ; Resourse name .LONG 0 ; Parent id .LONG 0 ; AST BLSPRM: .LONG 0 ; (BL)AST Param BLSRTN: .LONG 0 ; BLAST .LONG 0 ; ACC Mode .LONG 0 ; RSDM_ID .LONG 0 ; Null .ALIGN LONG XTBFILTBL: .ADDRESS SAPLIST .ADDRESS MOPDEV .ADDRESS PTYLIST .ADDRESS ETHMAN XTBFILTBL_LEN = .-XTBFILTBL XTBSECTBL: .ADDRESS SAPLIST_SEC .ADDRESS MOPDEV_SEC .ADDRESS PTYLIST_SEC .ADDRESS ETHMAN_SEC XTBSECTBL_LEN = .-XTBSECTBL .ALIGN LONG ERRORMSG: .LONG ;Arg, opts MSGCDE: .LONG ; Error code PARCNT: .WORD ; Paramater count .WORD ; Opts .LONG ; Time RTNNAM: .LONG ; Routine name MSGPARAMS: .BLKL 7 ; Up to 7 params ; Routine names ; List of routines in this module. This name is inserted at ; RTNNAM above when the error logger is called RTN_MAP_XLTTBL: .ASCID /MAP_XLTTBL/ RTN_MAP_EBUFFS: .ASCID /MAP_EBUFFS/ RTN_MAP_COMIPC: .ASCID /MAP_COMIPC/ RTN_UNMAPLVB_DB: .ASCID /UNMAPLVB_DB/ RTN_MAPLVB_DB: .ASCID /MAPLVB_DB/ RTN_MAP_COUNTERS: .ASCID /MAP_COUNTERS/ RTN_MAP_CONTROL: .ASCID /MAP_CONTROL/ RTN_MAP_PSRTBL: .ASCID /MAP_PSRTBL/ RTN_MAP_ALL_DB: .ASCID /MAP_ALL_DB/ ; Table file names SAPLIST: .ASCID /EMU5_DAT:SAPLIST.XTBL/ MOPDEV: .ASCID /EMU5_DAT:MOPDEV.XTBL/ PTYLIST: .ASCID /EMU5_DAT:PTYLIST.XTBL/ ETHMAN: .ASCID /EMU5_DAT:ETHMAN.XTBL/ ; Table SECTION names SAPLIST_SEC: .ASCID /EMU5_SAPXTBL/ MOPDEV_SEC: .ASCID /EMU5_MOPXTBL/ PTYLIST_SEC: .ASCID /EMU5_PTYXTBL/ ETHMAN_SEC: .ASCID /EMU5_ETHXTBL/ EMUCTRL: .ASCID \EMU_CONTROL\ COUNTERS: .ASCID \EMU_COUNTERS\ COMIPC: .ASCID \EMU_COMIPC\ EBUFFS: .ASCID \EMU_EBUFFS\ PSRTBL: .ASCID \EMU_PSRTBL\ .psect prog_code, rd, nowrt, exe, pic, shr, long .sbttl map_ebuffs (srd) .CALL_ENTRY MAX_ARGS=2, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_XLTTBL ;++ ;2 MAP_XLTTBL ; Maps caller to the specified translation table. Cuurently there are 4: ; Netware SAP ; Ethernet Protocol types ; Ethernet UOD (maufacturer's ID) ; MOP device types ;3 Inputs ; .long table to map. Symbols are in _EMUUIDEF ; .address of .quad returned addresses of section ; The necessary file and section names are ;3 Outputs ; The quad 1st and last address of the section is written in P2 ;3 Returns ; Any from $RMS, $CRMPSC ;-- ; Get file name. After, R7 = address of .ascid filename MOVAL XTBFILTBL,R6 ; File names SUBL3 #1,4(AP),R1 ; Make index MOVL (R6)[R1],R7 ; Set address ; Get Section name. After, R8 = address of .ascid section name MOVAL XTBSECTBL,R6 ; Section names SUBL3 #1,4(AP),R1 ; Make index MOVL (R6)[R1],R8 ; Set address ;Open file, get size ; Set name MOVB (R7),XLTTBLFAB+FAB$B_FNS MOVL 4(R7),XLTTBLFAB+FAB$L_FNA $OPEN FAB = XLTTBLFAB ;Open input file BLBS R0,10$ ;OK ? RET ; Die 10$: ; Get mem CLRL -(SP) ; P0 Space CLRL -(SP) ; Access mode PUSHAL INADDR ; Returned address PUSHL XLTTBLFAB+FAB$L_ALQ ; No. of pages CALLS #4,G^SYS$EXPREG BLBS R0,20$ ; Br no error RET ; Die ; Map 20$: CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL XLTTBLFAB+FAB$L_ALQ ; no. of pages CLRL -(SP) ; Channel CLRL -(SP) ; rel page no. CLRL -(SP) ; version id PUSHL R8 ; Section name PUSHL # CLRL -(SP) ; access mode PUSHL 8(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section BLBS R0,30$ RET 30$: CMPL #SS$_CREATED,R0 BNEQU 100$ ; If not created, skip load 40$: ; Load file $CONNECT RAB=XLTTBLRAB BLBS R0,45$ RET 45$: MOVL @8(AP),R6 ; Start of section MOVL XLTTBLFAB+FAB$L_ALQ,R7 ; no. of page(let)s MULL #512,R7 ; Num bytes 50$: CMPL R7,#80 ; Enough left for longest rec? BLSSU 100$ ; Br if not MOVL R6,XLTTBLRAB+RAB$L_RBF ; Write rec here MOVL R6,XLTTBLRAB+RAB$L_UBF ; Write rec here MOVW #80,XLTTBLRAB+RAB$W_USZ ; Set max size MOVW #80,XLTTBLRAB+RAB$W_RSZ $GET RAB=XLTTBLRAB ; Get next BLBC R0,100$ ; Assume any error = eof MOVZWL XLTTBLRAB+RAB$W_RSZ,R1 ; Inpt rec size ADDL R1,R6 ; Move pointer SUBL R1,R7 ; Deduct used BRW 50$ ; Next 100$: $CLOSE FAB=XLTTBLFAB ; MOVL #SS$_NORMAL,R0 ; Always OK RET .CALL_ENTRY MAX_ARGS=1, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_EBUFFS ;++ ;2 MAP_EBUFFS ; Maps caller to the Ethernet buffer section. This section is where ; the Listener writes raw Ethernet frames to as they are read off the ; network. ;3 Inputs ; .address of .quad returned addresses of section ;-- ; Calc memory/file size, Get memory & Map section MULL3 #IPC_ETH_C_BUFSIZE,#IPC_ETH_C_BUFNO,GBLSIZ ; Size in bytes ADDL #IPC_EBUF_C_BUFSTART,GBLSIZ ; Que heads DIVL #512,GBLSIZ ; Pages INCL GBLSIZ ; Round up ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL GBLSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BSBW ERROR_CHK ; check ok ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL GBLSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHAL EBUFFS ; section name PUSHL # CLRL -(SP) ; access mode PUSHL 4(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section BSBW ERROR_CHK RET .CALL_ENTRY MAX_ARGS=1, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_COMIPC ;++ ;2 MAP_COMIPC ; Map common IPC (Inter Process Communication) buffers. If section created, ; init free buff by placing all buffs in free que. ;3 Inputs ; .address of .quad returned addresses of section ;-- ; ; Use default size for now MOVL #IPC_COM_C_SIZE,GBLSIZ ; Size in pages ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL GBLSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BSBW ERROR_CHK ; check ok ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL GBLSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHAL COMIPC ; section name PUSHL # CLRL -(SP) ; access mode PUSHL 4(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section BSBW ERROR_CHK CMPL #SS$_CREATED,R0 BEQL 200$ RET 200$: ; On create, calc number of buffs and set all buffs avalable MOVQ @4(AP),R6 ; Returned addresses MOVL #IPC_COM_C_SIZE,R2 ; Number of buffers CLRL R3 ; Index/buff count 210$: CLRQ (R6) ADDL #IPC_COM_C_BUFSIZ,R6 ; Next location CMPL R6,R7 ; Still in section? BGEQU 220$ ; Br if not AOBLEQ R2,R3,210$ ; Next buff 220$: ; R3 = Real number of buffers (can differ from requested number) ; Future addition: ; Number of buffs is written to control section and recalced on ; shutdown. Use this number or default if 0 to create and place ; R3 here at init. ; MOVL #SS$_NORMAL,R0 RET .CALL_ENTRY MAX_ARGS=2, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=UNMAPLVB_DB ;++ ;2 UNMAPLVB_DB ; Unmap a database section and convert the associated lock to NULL. ; This is essentialy the reverse of MAPLVB_DB. This is the default ; BLAST routine setup when MAPLVB_DB is called. ;3 Input ; .address of MAP_STRUCTURE ;3 Returns ; The Memory section given by the input is deleted ; The associated DB lock is converted to NL ;4 MAP_STRUCTURE ; SYS_MAP_Q_ADDR ; 1ST and last addresses of the section mapped. This routine ; clears this field. ; SYS_MAP_L_PID ; EMU defined process identifier of the DB creator ; SYS_MAP_L_KEY ; Offset in each record in this DB where the unique key is found ; SYS_MAP_L_LCKID ; The VMS assigned lock id ; SYS_MAP_L_SPR ; Spare field - Future use & keeps structure .quad aligned ; SYS_MAP_L_LOCK ; .address of the lock name associated with this DB ; SYS_MAP_L_SEC ; .address of the section name associated with this DB ;-- ; Delete mem. MOVL 4(AP),R6 ; MAP structure CLRQ -(SP) ADDL3 #SYS_MAP_Q_ADDR,R6,-(SP) ; Section address CALLS #3,G^SYS$DELTVA BLBS R0,20$ ; Log err MOVAL RTN_UNMAPLVB_DB, RTNNAM MOVL #MSG_MAPSEC_DELTVA,MSGCDE ; error MSG MOVL #6,PARCNT ; 5 params MOVAL MSGPARAMS,R1 ; Plist MOVL R0,(R1)+ ; VMS error MOVQ (R6)+,(R1)+ ; 1st 5 .longs of structure MOVQ (R6)+,(R1)+ MOVL (R6),(R1) PUSHAL ERRORMSG ; Log it CALLS #1,G^EMU_LOGGER ; Convert lock 20$: CLRQ SYS_MAP_Q_ADDR(R6) ; Invalidate this section MOVL SYS_MAP_L_LCKID(R6),LVBID ; This lock BISL #LCK$M_CONVERT,LKFLGS ; Set lock to convert MOVL #LCK$K_NLMODE,LKMODE ; Convert to NULL $ENQW_G DBLOCK ; RET .CALL_ENTRY MAX_ARGS=3, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAPLVB_DB ;++ ;2 MAPLVB_DB ; Maps a database section using Lock Manager with Lock Value block. ; This routine requests the lock specified by the input symbol in CW mode. ; The LVB has been previously written by the DB creator with the size (in ; pages) of the section. The calling process waits for the lock to be granted. ; If the LVB = 0 or this process creates the section, an error is returned. ; ; A blocking AST is always set up. The caller may specify it's own routine ; or accept the default one supplied. ; ; Note the lock request is $ENQW - The routine waits until the lock is ; granted ;3 Default_Blast ; If the caller does not specify it's own AST routine the default one: ; Deletes VM ; Clears the .quad pointer to the db ; converts lock to NL ; The caller MUST check the .quad for valid addresses before each access. ; It is advisable to disable ast during any access. ;3 User_Supplied_Blast ; In this case the caller supplies both: ; .address of the Blocking AST routine ; .long Blast param that will be returned upon AST delivery. ; Thus when the (exclusive)lock is requested by the creator the caller ; must unmap and release the lock. Normaly the param is set to indicate ; which DB to unmap. ; ;3 Inputs ; .address of MAP_STRUCTURE ; .address of user supplied Blast routine. (Optional) ; .address of .long Blast Param. (must be present if P2 specified) ;4 MAP_STRUCTURE ; SYS_MAP_Q_ADDR ; 1ST and last addresses of the section mapped ; SYS_MAP_L_PID ; EMU defined process identifier of the DB creator ; SYS_MAP_L_KEY ; Offset in each record in this DB where the unique key is found ; SYS_MAP_L_LCKID ; The VMS assigned lock id ; SYS_MAP_L_SPR ; Spare field - Future use & keeps structure .quad aligned ; SYS_MAP_L_LOCK ; .address of the lock name associated with this DB ; SYS_MAP_L_SEC ; .address of the section name associated with this DB ;3 Returns ; SS$_NORMAL Lock granted, section mapped to ; SS$_BADPARAM Called with 2 params (must be either 1 or 3) ; SS$_INVEVENT The size returned in the lock value block ; was <= 0. The caller has run before the ; database was created. ; Any return from $ENQW, $EXPREG or $CRMPSC ;-- MOVL 4(AP),R6 10$: ; Build default lock request MOVL SYS_MAP_L_LOCK(R6),LKNAM ; Get this lock BISL #LCK$M_VALBLK,LKFLGS ; With LVB MOVL #LCK$K_CWMODE,LKMODE ; Concurrent write MOVAL UNMAPLVB_DB,BLSRTN ; Default Blast routine MOVL 4(AP),BLSPRM ; Addr of this structure is BLAST Param CMPL #1,(AP) ; Def params? BEQL 30$ ; Br if yes CMPL #3,(AP) ; right number of params? BEQL 20$ MOVL #SS$_BADPARAM,R0 RET 20$: ; Set up User supplied BLAST MOVL 8(AP),BLSRTN ; Blast address MOVL 12(AP),BLSPRM ; Blast param 30$: $ENQW_G DBLOCK ; BLBS R0,40$ RET 40$: MOVL LVBID,SYS_MAP_L_LCKID(R6) ; Return lock id TSTL LVBSIZ ; Valid section size? BGTR 50$ ; OK CLRQ SYS_MAP_Q_ADDR(R6) ; Invalidate this section MOVL SYS_MAP_L_LCKID(R6),LVBID ; This lock BISL #LCK$M_CONVERT,LKFLGS ; Set lock to convert MOVL #LCK$K_NLMODE,LKMODE ; Convert to NULL $ENQW_G DBLOCK ; MOVL #SS$_INVEVENT,R0 RET 50$: ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL LVBSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BSBW ERROR_CHK ; check ok ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL LVBSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHL SYS_MAP_L_SEC(R6) ; section name PUSHL # CLRL -(SP) ; access mode ADDL3 #SYS_MAP_Q_ADDR,R6,-(SP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section CMPL R0,#SS$_NORMAL BEQLU 200$ MOVL #SS$_INVEVENT,R0 ; ONLY normal is OK here 200$: RET .CALL_ENTRY MAX_ARGS=1, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_COUNTERS ;++ ;2 MAP_COUNTERS ; Maps the counter section. This section is written to by many processes ; counting significant events. EMU_DISP_xxxx displays the current counters ; in real time. ;3 Inputs ; .address of .quad returned addresses of section ;3 Outputs ; If mapped successfuly, the input quad is written with the 1st and ; last addresses of the section. ;3 Returns ; Any from $EXPREG, $CRMPSC ;-- ; Calc memory/file size, Get memory & Map section MOVL #CNT_GBL_C_SIZE,GBLSIZ ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL GBLSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BLBS R0,110$ RET 110$: ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL GBLSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHAL COUNTERS ; section name PUSHL # CLRL -(SP) ; access mode PUSHL 4(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section RET .CALL_ENTRY MAX_ARGS=1, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_CONTROL ;++ ;2 MAP_CONTROL ; Maps the caller to the control section. This section contains various ; dynamic paramaters used to control the system. ;3 Inputs ; .address of .quad returned addresses of section ;-- ; Calc memory/file size, Get memory & Map section MOVL #CTL_C_SIZE,GBLSIZ ; Number of pages ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL GBLSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BSBW ERROR_CHK ; check ok ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL GBLSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHAL EMUCTRL ; section name PUSHL # CLRL -(SP) ; access mode PUSHL 4(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section CMPL #SS$_CREATED,R0 ; Did we create? BEQL 200$ ; Br if so 110$: RET ; Load section with entries. ; Open table file ; 200$: $OPEN FAB = CTLFAB ;Open input file BLBC R0,270$ ; Br on error $CONNECT RAB = CTLRAB ;Connect input stream BLBC R0,270$ ; Br on error ; Load Table 230$: MOVL @4(AP),R11 ; Pointer 250$: MOVL R11,CTLRAB+RAB$L_UBF ; Write rec here $GET RAB = CTLRAB ; Get THE record (only 1 rec) BLBS R0,260$ ; If no error goto load routine RET ; No - Die 260$: $CLOSE FAB=CTLFAB 270$: $ERASE FAB=CTLFAB ; Erase all versions BLBS R0,270$ MOVL #SS$_NORMAL,R0 RET .CALL_ENTRY MAX_ARGS=2, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_PSRTBL ;++ ;2 MAP_PSRTBL ; Maps the PSRTBL section to the caller. If the section is created, the file ; is opened and the contents are loaded into memory. The number of entries is ; always returned. ; Entries are counted only when section is created. The count is ; stored in the control section @CTL_PSTTBL_L_CNT. Subsequent calls map the ; section, skip the load and return the count and addr. ;2 Inputs: ; .address of .quad returned addresses of section ; .address of .long where count of entries found is returned ;-- ; Need access to control section here. Ensure it is mapped. TSTL CONTROL_A ; Mapped? BNEQ 50$ ; Br if it is PUSHAL CONTROL_A ; Control section return addresses CALLS #1, G^MAP_CONTROL ; Create and map control section BSBW ERROR_CHK ; check errors 50$: ; Calc memory/file size, Get memory & Map section MOVL #PSR_TBL_C_SECSIZE,GBLSIZ ; Number of pages ; Get Memory 100$: CLRQ -(SP) ; p0 space, access mode PUSHAL INADDR ; returned address PUSHL GBLSIZ ; no. of pages CALLS #4, G^SYS$EXPREG ; Expand process space BSBW ERROR_CHK ; check ok ; map section CLRQ -(SP) ; pfc, protection CLRL -(SP) ; virtual block number PUSHL GBLSIZ ; no. of pages CLRQ -(SP) ; channel, rel page no. CLRL -(SP) ; version id PUSHAL PSRTBL ; section name PUSHL # CLRL -(SP) ; access mode PUSHL 4(AP) ; returned address PUSHAL INADDR ; in address CALLS #12, G^SYS$CRMPSC ; create section BSBW ERROR_CHK CMPL #SS$_CREATED,R0 BEQL 200$ 110$: ; return previously set count of entries ADDL3 CONTROL_A,#CTL_PSTTBL_L_CNT,R6 ; Addr of count MOVL (R6),@8(AP) ; Return count of entries MOVL #SS$_NORMAL,R0 RET ; Load section with entries. ; Open table file ; 200$: $OPEN FAB = PSRFAB ;Open input file BLBS R0,210$ ;OK ? RET ; Die 210$: $CONNECT RAB = PSRRAB ;Connect input stream BLBS R0,220$ ;Branch if OK RET ; Die 220$: ; Load Table 230$: MOVL @4(AP),R11 ; Pointer ADDL3 CONTROL_A,#CTL_PSTTBL_L_CNT,R6 ; Addr of count CLRL (R6) ; None yet MOVW #PSR_TBL_C_SIZE,PSRRAB+RAB$W_RSZ ; rec size MOVW #PSR_TBL_C_SIZE,PSRRAB+RAB$W_USZ ; rec size 250$: MOVL R11,PSRRAB+RAB$L_UBF ; Write rec here $GET RAB = PSRRAB ; Get a record BLBS R0,260$ ; Br if no error CMPL R0,#RMS$_EOF ; Was error end of file BEQLU 270$ ; Yes - OK RET ; No - Die 260$: INCL (R6) ; Count ADDL #PSR_TBL_C_SIZE,R11 ; Next slot BRB 250$ ; Next Rec 270$: $CLOSE FAB=PSRFAB BRW 110$ .CALL_ENTRY MAX_ARGS=1, HOME_ARGS=TRUE, - INPUT=, - PRESERVE=, - LABEL=MAP_ALL_DB ;++ ;2 MAP_ALL_DB ; Maps all known DBs in the input table. If the section is already ; mapped the entry is skipped. It is then safe to call this routine ; without knowing which DBs are currently mapped. ;3 Inputs ; .address of desc pointing to table of MAP_STRUCTUREs. There ; is one structure per DB to map and no restrictions on the ; number of structures passed in a single call ;4 MAP_STRUCTURE ; .quad 1st and last address of the DB. Write only ; .long EMU PID of DB to map. This is the SYS_PID_C_xxxxx ; symbol found in _EMUSYSDEF. Read only ; .long Offset to the key in this database. Not used by ; most routines. ; .long LOCK Id. Where the lock this process takes out on ; the database is written. Write only ; .long Spare/align ; .long Address of .ascid lock name ; .long address of .ascid section name ; Offsets and symbols are in _EMUSYSDEF ; ;3 Outputs ; Any section newly mapped has it's 1st and last addr written ; to the associated map structure. ;3 Returns ; SS$_NORMAL is always returned in R0 ; Number of newly mapped databases is returned in R1 ;3 Locking ; Each database requests a CW lock and if granted, writes ; the DB addresses in the structure. It also sets a Blocking ; AST that when fired (by the DB owner requesting exclusive access) ; clears the DB addresses. The caller must then: ; 1. Check before access that the DB is still mapped. ; 2. Disable ASTs for the duration of the operation. ; 3. Re-enable ASTs ;-- MOVQ @4(AP),R8 ADDL3 R8,R9,R10 ; Last addr to map CLRL R1 60$: TSTL SYS_MAP_Q_ADDR(R9) ; ALready mapped? BNEQ 70$ ; Skip if so TSTL SYS_MAP_L_PID(R9) ; Valid DB? BEQL 70$ ; Br if no PID PUSHL R9 ; Map structure CALLS #1,G^MAPLVB_DB BLBC R0,70$ ; Br if error INCL R1 ; Count newly mapped 70$: ADDL #SYS_MAP_C_MAPSIZ,R9 CMPL R9,R10 ; Done mapping? BLSSU 60$ ; Br if more RET ;------------------------------------------------------------------------------ .sbttl Error checking subroutine ERROR_CHK: .JSB_ENTRY INPUT=, - OUTPUT= BLBC R0,100$ ; Branch if error RSB 100$: RET ; Return .end