Google
 

Trailing-Edge - PDP-10 Archives - bb-h138f-bm - 7-sources/rmsdsp.mac
There are 6 other files named rmsdsp.mac in the archive. Click here to see a list.
TITLE	RMSDSP -- ENTRY VECTOR AND DISPATCH TABLE FOR RMS
SEARCH	RMSINT,RMSMAC,MONSYM						;m501
$PROLOG

REPEAT 0,<

;
;	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1977, 1986.
;	ALL RIGHTS RESERVED.
;
;	THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY  BE  USED  AND
;	COPIED ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH
;	THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE.   THIS  SOFTWARE  OR
;	ANY  OTHER  COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE
;	AVAILABLE TO ANY OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE
;	SOFTWARE IS HEREBY TRANSFERRED.
;
;	THE INFORMATION IN THIS SOFTWARE IS  SUBJECT  TO  CHANGE  WITHOUT
;	NOTICE  AND  SHOULD  NOT  BE CONSTRUED AS A COMMITMENT BY DIGITAL
;	EQUIPMENT CORPORATION.
;
;	DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR  RELIABILITY  OF
;	ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL.
;




NAME:		RMSDSP
AUTHOR:		S. BLOUNT
EDIT DATE:	22-Apr-83
FUNCTION:	RMS-20 JSYS DISPATCHER



REVISION HISTORY:

EDIT	DATE		WHO	PURPOSE
====	====		===	=======

1	5-MAY-77	SB	CHANGE ENTRY DISPATCH VECTOR TO SYMBOLIC FORM
2	12-DEC-79	AU	1. CHANGE REGISTER USAGE SO THAT AC 1 COULD BE
				   USED THE ARGUMENT POINTER.
				2. ADD CODE TO USE RMS'S OWN STACK.
				3. MODIFY CODE TO SUIT NEW USER INTERFACE

*************************************************
*						*
*		NEW REVISION HISTORY		*
*						*
*************************************************

PRODUCT	MODULE	 SPR
 EDIT	 EDIT	 QAR		DESCRIPTION
======	======	=====		===========
60	3	(MBROWN,SWE)	Preserve registers 3 and 4; return
				status in register 2 for every verb.

66	4	NONE		(RL, 19-Apr-83) Fix entry vector
				definition.  Use MACRO to define EV in
				RMSEVC.REL with RMS$EV, rather than
				using LINK /START:RMS.EV, which was
				changed with LINK v5.1.

71				Add copyright notice to executable

	***** END OF REVISION HISTORY *****

	***** Start Version 2 development *****

PRODUCT	MODULE	 SPR
 EDIT	 EDIT	 QAR		DESCRIPTION
======	======	=====		===========
301	300	XXXXX		Support for extended addressing

302	301	(SWE, FTS-20)	Allow ERJMP or ERCAL to use indexing
				and/or indirection

450	450	(SWE,DIL)	(RL, 13-Jan-84) Turn off trapping for
				nonexistent page interrupts on entry
				to RMS; turn it on again on exit.
				If the $NOMESSAGE JSYS has been issued
				(which turns on bit 35 in RMSSTS),
				then don't do any checking for traps.
*** VERSION 3 ***

501		Development	(AN, 17-May-84) Add new functions

507		Development	(AN, Jul-84) Put in hooks for $Rename

521		Development	(AN, 8-Nov-84) Don't clobber AC2
>;;END OF REPEAT 0

LOC 137						;FOR VERSION # ON 10
$VERS

$PURE
SUBTTL	ENTRY POINTS TO RMS

	RELOC	400000

	ENTRY	RMS.EV

; ***	 PUSHJ ENTRY LOGIC
;
RMS$10::	REPEAT XX$MAX,<JSR CALDSP>
				; Make JSR to not lose AC2		;m521
				;[507] CREATE OFFSET TO IDENTIFY CALLED ROUTINE

;[71] Copyright notice, RL, 1-Jun-83
SMNCPY::ASCIZ\

	COPYRIGHT (C) DIGITAL EQUIPMENT CORPORATION 1977, 1986.
	ALL RIGHTS RESERVED.

\ ;[71]

CALDSP: Z
	MOVEM	T2,USERAC##+T2  ;[507] Preserve AC2
	MOVE	T2,CALDSP	;[507] Get calling addr
	SUBI	T2,RMS$10+1	;[3] GET OFFSET INTO TABLE OF ADDRESSES
	HRRZM	T2,UJSYS	;[3] STORE IT AWAY ;M506
	TLNN	T2,37		; SECTION 0? ;A506
	 JRST	[POP P,RETPC	; YES.	     ;A506
		 JRST SETUP]	; 	     ;A506
	POP	P,RETPC+1	;STORE RETURN ADDRESS AWAY ;M506
	JRST	SETUP		;AND CONTINUE AS IF THIS WERE A JSYS

				; WITH THE /R OPTION, WHATEVER THAT MEANS

; ***	JSYS ENTRY LOGIC

RMS.EV==:VECLNG,,RMS$EV		;FOR SETTING RMS20 ENTRY VECTOR WITH LINK... /ST:RMS.EV

RMS$EV::JRST	RMS$20		;ADDRESS OF NORMAL DISPATCHER
	JRST	RMS20I		;ADDRESS OF RMS INITIALIZATION ROUTINE
	$VERS			;RMS VERSION #
	UJSYS##			;PLACE TO STORE JSYS CODE FROM MONITOR
	RETPC##			;PLACE TO STORE RETURN PC
VECLNG==.-RMS$EV		;LENGTH OF ENTRY VECTOR




RMS$20::
	SKIPA			;BYPASS TURN-OFF OF INITED FLAG
RMS20I:	SETZM	INTFLG##	;SIGNAL THAT THIS IS 1ST CALL
	MOVEM	T2,USERAC##+T2	;Don't clobber AC2 ;a521
	MOVE	T2,UJSYS##	;[3] GET JSYS CODE
	HRLI	T2,(JSYS)	;[300] Make "JSYS nnn"
	CAMLE	T2,[RM$MAX]	;[3] JSYS TOO HIGH?
	JRST	E.JSYS		;YES
	SUB	T2,[RM$MIN]	;[3] COMPUTE JSYS OFFSET
	MOVEM	T2,UJSYS##	;[3] STORE OFFSET INTO TABLE
;	JRST	SETUP		;MERGE WITH PUSHJ ENTRY
SUBTTL	RMS COMMON ENTRY/EXIT CODE

;THIS ROUTINE IS THE FIRST ONE TO GET CONTROL AFTER A RMS MACRO
; HAS BEEN EXECUTED.  IT PERFORMS THE FOLLOWING FUNCTIONS:
;
;	1.  SAVE USER AC'S
;	2.  DISPATCH TO PROPER RMS ROUTINE
;
;COME HERE ON EITHER A DIRECT CALL (PUSHJ) OR AN RMS-20 JSYS.
;
SETUP:
	SKIPN	INTFLG##	;1ST CALL?
	JSP	T2,RMSINI##	;[300] YES, INIT RMS
	MOVE	T2,USERAC##+T2	;Don't clobber AC2 (it was already saved) ;a521
	MOVEM	17,USERAC##+17	;SAVE LAST AC
	MOVEI	17,USERAC##	;SET UP TO SAVE USER AC'S
	BLT	17,USERAC##+16	;SAVE THEM
	JRST	RMSENT		;HOP OVER 1-TIME CODE PUT OUT BY $MAIN

$SCOPE	(TOP-LEVEL)
$MAIN	(RMSENT,TRAPERR,<IOWD PDLNG##,RMSTACK##>)

	;
	; See if we are in a nonzero section
	; if so, stack should be global.
	;
	SKIPE	RMSSEC		;In nonzero section?			;a525
	 HLL	P,RMSSEC	;Yes. make stack global 		;a525

IFN TOP$20,<								;a572
	;[450]  Turn off trapping for page creation
	;[450]  Note: By way of a crock, the $NOMESSAGE JSYS
	;[450]        may be used to skip the following code,
	;[450]        if trap-checking is not wanted.  The
	;[450]        $NOMESSAGE and $MESSAGE JSYSes no longer
	;[450]        affect message output, and so are being
	;[450]        used to control this code.  Bit 35 of
	;[450]        RMSSTS is STSNOMESSAGE, which once turned 
	;[450]        off message output; it now turns off
	;[450]        trap checking.
	;[450] 
	MOVE	T5,RMSSTS##	;[450] Check if we should bother
	TRNE	T5,1		;[450]   to look at trapping
	  JRST	NOCHK1		;[450] Don't bother - go on
	PUSH	17,T1		;[450] Save T1
	MOVEI	T1,.FHSLF	;[450] Get our interrupt mask
	RCM%			;[450] ...
	  ERCAL	MONERR##	;[450] ...
	AND	T1,[EXP 1B22]	;[450] Save .ICNXP bit
	MOVEM	T1,INTMSK##	;[450] ...
	SKIPN	INTMSK##	;[450] Is trapping enabled?
	  JRST	NONXP1		;[450] No - don't worry
	MOVEI	T1,.FHSLF	;[450] Deactivate the channel
	MOVE	T2,[EXP 1B22]	;[450] ...
	DIC%			;[450] ...
	  ERCAL	MONERR##	;[450] ...
NONXP1:	POP	17,T1		;[450] Restore T1
> ; END IFN TOP$20						;A572

NOCHK1:	MOVEI	T2,SU$SUC	;[450] ASSUME A SUCCESSFUL CONCLUSION
	MOVEM	T2,USRSTS##	;STORE IT IN USER STATUS FIELD
	SETZM	USTOSF##	;START WITH NO STATUS SUGGESTION
	SETZM	OAFLAGS		;INDIC NO OPEN ACTIVITY EXTANT
	SETZM	USRSTV##	;CLEAR STATUS-VALUE
	SETZM	ERRADR##	;CLEAR ERROR ADDRESS
	SKIPN	RMSSEC##	;[300] Is this extended addressing?
	 JRST	RMSEN1		;[300] No, don't worry about this.
	MOVE	T2,RETPC+1	;[300] Get PC just incase it is
	HLLZM	T2,USRSEC##	;[300] Store user's section for this call.
	TLNN	T1,-1		;[300] Is user's control block in sec 0?
	 HLL	T1,T2		;[300] Yes, default to JSYS call section.
	HLLZM	T1,BLKSEC##	;[300] Remember section where his block is.
RMSEN1:	PUSH	17,T1		;PUSH CONTROL BLOCK addr
	PUSH	17,USERAC##+T2	;[507] PUSH SECOND CONTROL BLOCK addr
				;       ignored unless $RENAME
	MOVE	T3,UJSYS##	;GET OFFSET INTO TABLE
	MOVE	T2,DSPTAB(T3)	;[300] Get address of routine
	PUSHJ	17,(T2)		;[300] Dispatch to routine,
				;[300]  doesn't return.
SUBTTL	EXIT CODE

UA%BLK==1			;?AB ADDRESS ORIG PASSED IN AC1

TRAPERR:			;ABORTIVE ERROR OCCURRED
	MOVEI	T1,ER$BUG	;RET BUG VAL
	MOVEM	T1,USRSTV##	; IN 2NDARY STATUS FIELD
	MOVE	T2,USRSTS##	;IS THERE ANOTHER CODE ALREADY?
	CAIN	T2,SU$SUC	;JUMP IF YES
	MOVEM	T1,USRSTS##	;NO, SET AS PRIMARY CODE TOO
	JRST	USRFOK		;SKIP OABORT CHK

;Here if user calling error (Bad JSYS).
; Have to make sure RMS is setup.
;He gets an error on his TTY, despite $MESSAGE or $NOMESSAGE.

E.JSYS::
	SKIPN	INTFLG##	;1ST CALL?
	JSP	T2,RMSINI##	;[300] YES, INIT RMS
	MOVEM	17,USERAC##+17	;SAVE LAST AC
	MOVEI	17,USERAC##	;SET UP TO SAVE USER AC'S
	BLT	17,USERAC##+16	;SAVE THEM
	MOVE	17,[IOWD PDLNG##,RMSTACK##] ;Setup our own stack.
	HRRZ	T2,UJSYS##	;Get octal JSYS code
	PUSH	P,T2
	SKIPE	RMSSEC##	;In extended section?
	 JRST	[PUSH P,RETPC##+1 ;Yes, save PC
		JRST .+2]	;Instead of 1-word one.
	PUSH	P,RETPC##	;"at" (Octal PC)
	PUSH	P,[MF$IJC##]	;"?Invalid JSYS code "
	PUSHJ	P,TX$OUT##
	ADJSP	P,-3		;Fix stack after call.
	MOVEI	T2,ER$BUG	;HALT USER WITH BAD JSYS CODE
	MOVEM	T2,USRSTS##	;JUST GIVE A STATUS CODE
	SETZM	USRSTV##	;NO SUBSID CODE
	JRST	USRFOK		;On return

USRERR::			;COME HERE ON BAD RETURN FROM RMS
	JFCL			;NO-OP, HERE ONLY TO PROVIDE PLACE TO SET BRK-PT
USRRET::			;COME HERE ON GOOD RETURN FROM ALL RMS MACRO'S
	SKIPN	OAFLAGS##	;OPEN LEFT HANGING?
	 JRST	USRFOK		;No

	PUSH	P,[0]		;Tell OABORT USRSTS already set, so ret in line
	PUSHJ	P,OABORT##	;Clean-up after error.
	ADJSP	P,-1		;Fix stack after call.
USRFOK:				;FILE ENVIR GUARAN OK BY HERE
IFN TOP$20,<								;a572

	;[450] 
	;[450]  Restore user's page-creation trapping state
	;[450] 
	SKIPN	INTMSK##	;[450] Was user trapping?
	  JRST	NONXP2		;[450] No - don't reset anything
	MOVEI	T1,.FHSLF	;[450] Turn trapping on again
	MOVE	T2,[EXP 1B22]	;[450] ...
	AIC%			;[450] ...
	  ERJMP	MONERR##	;[450] ...
NONXP2:
> ;End of IFN TOP$20							;a572
	MOVE	UA%BLK,USERAC##+UA%BLK ;[450][301] User's AC
	TLNN	UA%BLK,-1	;[300] Local sec # (LH zero)?
	 IOR	UA%BLK,BLKSEC## ;[300] Yes, get whole address.
	MOVE	T2,USRSTV##	;[4] GET STATUS VALUE
	$STORE	T2,STV,(UA%BLK)	;[4] STORE IT IN CONTROL BLOCK
	HRRZ	T2,USRSTS##	;GET THE USER'S ERROR CODE
	$STORE	T2,STS,(UA%BLK)	;STORE IT IN CONTROL BLOCK
IFN TOP$10,<
	SETOM	USERAC		;[572] Indicate success
>
	CAIGE	T2,.ERBAS	;IS IT AN ERROR CODE(.GEQ. 300000?)
	 JRST	RETILN		;[301] No, just return in-line
IFN TOP$10,<
	SETZM	USERAC		;[572] Indicate failure
>
	SKIPE	RMSSEC##	;[300] In Non-zero section?
	 SKIPA	T4,RETPC+1	;[300] Yes, get PC
	MOVE	T4,RETPC	;[300] GET ADDRESS TO RETURN TO
	MOVE	T3,(T4)		;[300] GET INSTRUCTION THERE
	AND	T3,[777740,,0]	;[301] Check only opcode and AC field
	CAMN	T3,[JUMP 16,]	;[3] IS IT AN ERJMP?
	JRST	DOJMP		;YES, "GOTO" ERROR ADDRESS
	CAME	T3,[JUMP 17,]	;[3] IS IT ERCAL?
	 JRST	RETILN		;[3] No, illegal call (Didn't use RMS macro).
				;[3] So just return in-line.
	MOVE	T1,USERAC+17	;[301] Fetch user's pushdown ptr.
	SKIPN	RMSSEC##	;[300] Skip if extended addressing
	 JRST	DOCALN		;[300] Non-extended, easy.

;Have to simulate PUSHJ in extended addressing. Be careful of
; the user's local stack ptr.

	MOVE	T4,RETPC+1	;[300] Get return PC
	JUMPGE	T1,DOCLN1	;[300] Global stack, ok
	PUSH	P,USRSEC	;[300] Remember user's section #
	EXCH	T1,USRSEC	;[300] Get user's section #
	HRR	T1,USRSEC	;[300] Make global PDP
	ADDI	T4,1		;[300] This will be put on user's stack
	PUSH	T1,T4		;[300] Simulate PUSHJ
	MOVE	T1,USRSEC	;[300] Re-fetch user's PDP
	ADJSP	T1,1		;[300] Fix it.
	MOVEM	T1,USERAC+17	;[301] Save updated pushdown ptr.
	POP	P,USRSEC	;[300] Restore user's section #
	JRST	DOJMP		;[300] and return.

DOCALN:	MOVE	T4,RETPC	;[3] Get return PC
DOCLN1:	ADDI	T4,1		;SIMULATE PUSHJ AT LOCATION OF ERCAL
	PUSH	T1,T4		;...BY PUSHING @RETPC+1 ON STACK
	MOVEM	T1,USERAC+17	;[301] Save updated pushdown ptr.
;	JRST	DOJMP		;[301] and return.
;Do EACALC and return to where user told us.
; If not extended addressing, then we don't need to do an
;Effective address calcalation, because the section number will
;always be zero. Instead, just take the ERJMP instruction and
;make the opcode a JRST and the ac field be zero. Then XCT it after
;restoring the user's AC's.

DOJMP:	SKIPE	RMSSEC##	;[301] Extended addressing is hard.
	 JRST	DOJMPE		;[301] Hard EACALC.
	MOVE	T3,RETPC	;[301] Get place where ERJMP/CAL is.
	MOVE	T3,(T3)		;[301] Get instruction
	TLZ	T3,777740	;[301] Turn off opcode, AC field
	IOR	T3,[JRST]	;[301] Make unconditional jump
	MOVEM	T3,USRSEC	;[301] Store here a sec..
	MOVSI	17,USERAC##	;restore user AC's
	BLT	17,17
	HRRZ	2,USRSTS	;[301] Setup user status. Note - the original
				;[301] AC2 has been smashed.. it can't be used
				;[301] for indexing in the ERJMP/ERCAL.
	XCT	USRSEC		;[301] Jump to desired location.

;Extended addressing EACALC

DOJMPE:	MOVE	T3,RETPC+1	;[301] Get place where ERJMP is
	MOVE	T3,(T3)		;[301] Fetch instruction.
	MOVE	T2,USRSEC	;[301] Current EACALC section is user's section
	HRR	T2,T3		;[301] Get "E" if no indirect, indexing
	TLNN	T3,37		;[301] Skip if indirect bits on
	 JRST	DOJE		;[301] Got "E"

;Got some indexing or indirection here!
;Here with T3 = next instruction word
;	T2 (6:17) = E (6:17)

IWLOOP:	HRRZ	T4,T3		;T4 = "Y"
	TLNN	T3,17		;Indexing = 0?
	 JRST	IWLUP1		;No
	LDB	T1,[POINT 6,T2,17] ;Get register number
	MOVE	T1,USERAC(T1)	;Get T1=contents of index register
	TLNN	T2,7777		;Section # = 0?
	 JRST	IWLUP2		;Yes, sign doesn't matter
	JUMPLE	T1,IWLUP2	;neg or zero, just add RH to Y
	TLZ	T1,770000	;Clear junk, get bits 6-35 of index reg.
	TLNE	T1,-1		;"Local" indexing used?
	 HLL	T1,T2		;Yes, use local section number.
	ADD	T1,T4		; + Y
	MOVE	T2,T1		; = E.
	JRST	IWCHKI		;go check indirection

;Local (section 0) indexing calculation.
; or Contents of index register is negative.

IWLUP2:	HRRZ	T1,T1		;Get RH of index register
	ADD	T1,T4		; + Y
	HRR	T2,T1		; = E (RH)
	JRST	IWCHKI		;Go check indirection

IWLUP1:	HRR	T2,T4		;Y --> E(RH)

;Here when indexing done (if needed). Do indirection if needed.

IWCHKI:	TXNN	T3,1B13		;Indirection?
	 JRST	DOJE		;No, got "E"
INDWLP:	MOVE	T3,@T2		;Fetch indirect word from E
	 ERJMP	RETILN		;? EACALC error, return in-line
				; (Should really give RMS error as well)
	TLNN	T2,7777		;In section 0?
	 JRST	IWLOOP		;Yes, only instruction formats used.
	TXNN	T3,1B0		;Global indirect bit on?
	 JRST	INDWL1		;Yes
	TXNN	T3,1B1		;Yes, 10?
	 JRST	IWLOOP		;Yes, local indirect - instruction format
	JRST	RETILN		;11 = error ("Page fail trap").
INDWL1:	MOVE	T4,T3		;Get T4= "Y"
	TLZ	T4,770000
	LDB	T1,[POINT 4,T3,5]	;Index register number
	JUMPN	T1,INDWL2	;Jump if global indexing
	MOVE	T2,T4		;Y--> E
	JRST	INDWL3		;Check global indirection as well..

INDWL2:	MOVE	T1,USERAC(T1)	;Get contents of index register
	TLZ	T1,770000	;Delete junk bits
	ADD	T1,T4		;XR + Y
	MOVE	T2,T1		; = E

INDWL3:	TXNE	T3,1B1		;Global indirection?
	 JRST	INDWLP		;Yes, chain to next word.

;Here when got final "E" in T2.

DOJE:	MOVE	0,T2		;Put "E" in T0
	EXCH	0,USERAC##	;Restore user ac 0
	MOVE	17,[USERAC+1,,1]
	BLT	17,17		;Restore user ac's
	HRRZ	2,USRSTS	;Return RMS status in AC 2
	JRST	@USERAC		;[3] Transfer to user routine.

;Here to return in-line (through return PC)

RETILN:	MOVSI	17,USERAC##	;RESTORE USER AC'S
	BLT	17,17		;...
	HRRZ	2,USRSTS	;Return RMS status in AC 2
	SKIPE	RMSSEC		;[300] In extended addressing?
	 XJRSTF	RETPC		;[300] Yes, return via XJRSTF
	JRST	@RETPC		;[3] Return.

NOVALRET::	;USE THIS INSTEAD OF USRRET IF NO BLOCK ($DEBUG, $MESSAGE)

	SKIPN	INTMSK##	;[571] Was user trapping?
	  JRST	RETILN		;[571] No - don't reset anything
	MOVEI	T1,.FHSLF	;[571] Turn trapping on again
	MOVE	T2,[EXP 1B22]	;[571] ...
	AIC%			;[571] ...
	  ERJMP	MONERR##	;[571] ...
	JRST	RETILN		;[571]

$ENDMAIN
$ENDSCOPE(TOP-LEVEL)
SUBTTL	RMS DISPATCH TABLE

DEFINE	RMSVRB(NAME)<$'NAME##> ;;FOR PUSHJ INDIRECT TO ACTUAL PROCESSING IN RMS
					; New verbs added		;a501
DSPTAB::
	RMSVRB (OPEN)
	RMSVRB (CLOSE)
	RMSVRB (GET)
	RMSVRB (PUT)
	RMSVRB (UPDATE)
	RMSVRB (DELETE)
	RMSVRB (FIND)
	RMSVRB (TRUNCATE)
	RMSVRB (CONNECT)
	RMSVRB (DISCONNECT)
	RMSVRB (CREATE)
	RMSVRB (DEBUG)
	RMSVRB (RELEASE)
	RMSVRB (FLUSH)
	RMSVRB (MESSAGE)
	RMSVRB (NOMESSAGE)
	RMSVRB (DISPLAY)
	RMSVRB (ERASE)
	RMSVRB (FREE)
	RMSVRB	(UTLINT)
 	RMSVRB (NXTVOL)
 	RMSVRB (REWIND)
 	RMSVRB (WAIT)
 	RMSVRB (READ)
 	RMSVRB (SPACE)
 	RMSVRB (WRITE)
 	RMSVRB (PARSE)
 	RMSVRB (SEARCH)
 	RMSVRB (ENTER)
 	RMSVRB (EXTEND)
 	RMSVRB (REMOVE)
 	RMSVRB (RENAME)

END