Google
 

Trailing-Edge - PDP-10 Archives - BB-H348C-RM_1982 - swskit-v21/listings/rsx11s/plsub.list
There are no other files named plsub.list in the archive.
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3


      1						.TITLE	PLSUB
      2						.IDENT	/00/
      3
      4					;
      5					; COPYRIGHT (C) 1976
      6					; DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS.
      7					;
      8					; THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED
      9					; OR COPIED IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE.
     10					;
     11					; VERSION 00
     12					;
     13					; T. J. MILLER 8-MAR-76
     14					;
     15					; PROGRAM LOGICAL ADDRESS SPACE (PLAS) COMMON SUBROUTINES
     16					;
     17					; MACRO LIBRARY CALLS
     18					;
     19
     20
     21						.IF DF	P$$LAS
     22
     23						.MCALL	HDRDF$,HWDDF$,PCBDF$,TCBDF$
     24						HDRDF$			;DEFINE TASK HEADER OFFSETS
     25						HWDDF$			;DEFINE HARDWARE REGISTERS
     26						PCBDF$			;DEFINE PARTITION CONTROL BLOCK OFFSETS
     27						TCBDF$			;DEFINE TASK CONTROL BLOCK OFFSETS
     28
     29					;+
     30					; **-$SRNAM-SEARCH FOR NAMED PARTITION
     31					;
     32					; THIS ROUTINE SEARCHES FOR A NAMED PARTITION AND RETURNS A SUCCESS/
     33					; FAILURE INDICATION AND A POINTER TO THE PCB IF FOUND.
     34					;
     35					; INPUTS:
     36					;
     37					;	R3=POINTER TO DOUBLE-WORD RAD50 NAME
     38					;
     39					; OUTPUTS:
     40					;
     41					;	C=1 IF NO MATCH ON NAME
     42					;
     43					;	C=0 IF NAMED PARTITION FOUND
     44					;		R2=PCB ADDRESS
     45					;-
     46
     47					$SRNAM::MOV	$PARHD,R2	;POINT TO FIRST PCB IN THE LIST
     48					10$:	CMP	P.NAM(R2),(R3)	;MATCH ON FIRST WORD OF NAME?
     49						BNE	20$		;IF NE NO
     50						CMP	P.NAM+2(R2),2(R3) ;MATCH ON SECOND WORD OF NAME?
     51						BEQ	50$		;IF EQ YES
     52					20$:				;REF LABEL
     53
     54
     55						.IF DF	D$$YNM&M$$MGE
     56
     57						BIT	#PS.SYS,P.STAT(R2) ;SYSTEM CONTROLLED PARTITION?
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3-1


     58						BEQ	40$		;IF EQ NO
     59						TST	P.SUB(R2)	;IS THERE ANOTHER SUBPARTITION?
     60						BEQ	30$		;IF EQ NO
     61						MOV	P.SUB(R2),R2	;POINT TO NEXT SYS SUBPARTITION
     62						BR	10$		;
     63					30$:	MOV	P.MAIN(R2),R2	;POINT BACK TO MAIN PCB
     64
     65						.ENDC
     66
     67
     68					40$:	MOV	(R2),R2		;POINT TO NEXT PCB (P.LNK)
     69						BNE	10$		;IF NE THERE IS ONE
     70						SEC			;RETURN C=1
     71					50$:	RETURN			;
     72
     73					;+
     74					; **-$CKACC-CHECK DESIRED ACCESS
     75					;
     76					; THIS ROUTINE CHECKS IF THE DESIRED ACCESS OF A TASK TO A REGION
     77					; IS ALLOWED.  THE BITS IN THE PROTECTION WORD ARE ARRANGED IN THE
     78					; FOLLOWING ORDER:
     79					;
     80					;	[WORLD,GROUP,OWNER,SYSTEM]
     81					;	 15			0
     82					;
     83					; THE BITS WITHIN EACH CATEGORY IN THE PROTECTION WORD ARE ARRANGED
     84					; IN THE FOLLOWING ORDER:
     85					;
     86					;	DELETE  EXTEND  WRITE  READ
     87					;	3       2       1      0
     88					;
     89					; A BIT SET MEANS THE CORRESPONDING ACCESS IS NOT ALLOWED.
     90					;
     91					; INPUTS:
     92					;
     93					;	R0=DESIRED ACCESS MASK IN LOW FOUR BITS
     94					;	R1=CURRENT UIC OF TASK
     95					;	R2=PCB ADDRESS OF REGION
     96					;
     97					; OUTPUTS:
     98					;
     99					;	R0,R1 ARE MODIFIED
    100					;
    101					;	DIRECTIVE STATUS OF D.RS16 RETURNED IF ACCESS DENIED.
    102					;-
    103
    104					$CKACC::MOV	#30$,-(SP)	;PUSH COROUTINE ADDRESS
    105						BIC	#^C17,R0	;CLEAR ALL BUT DESIRED ACCESS MASK
    106					10$:	SWAB	R1		;REVERSE GROUP AND OWNER IN UIC WORD
    107						CALL	@(SP)+		;CHECK IF QUALIFIED IN NEXT CATEGORY
    108						BNE	20$		;IF NE NO
    109						BIT	R0,P.PRO(R2)	;ALLOWED ACCESS IN THIS CATEGORY?
    110						BNE	20$		;IF NE NO
    111						TST	(SP)+		;POP COROUTINE ADDRESS
    112						RETURN			;RETURN TO CALLER
    113					20$:	ASL	R0		;SHIFT MASK TO NEXT CATEGORY
    114						ASL	R0		;
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3-2


    115						ASL	R0		;
    116						ASL	R0		;
    117						BR	10$		;CHECK ACCESS IN THIS CATEGORY
    118					30$:	CMPB	R1,#10		;SYSTEM UIC?
    119						BHI	40$		;IF HI NO
    120						SEZ			;SET FLAG FOR ACCESS CHECK
    121					40$:	CALL	@(SP)+		;CHECK ACCESS AND SHIFT MASK
    122						CMP	R1,P.OWN(R2)	;OWNER UIC?
    123						CALL	@(SP)+		;CHECK ACCESS AND SHIFT MASK
    124						CMPB	R1,P.OWN+1(R2)	;SAME GROUP?
    125						CALL	@(SP)+		;CHECK ACCESS AND SHIFT MASK
    126						SEZ			;INSURE CHECK FOR WORLD ACCESS
    127						CALL	@(SP)+		;CHECK ACCESS
    128						DRSTS	D.RS16		;ACCESS DENIED IF WE GET HERE
    129
    130					;+
    131					; **-$CRATT-CREATE ATTACHMENT DESCRIPTOR
    132					;
    133					; THIS ROUTINE CREATES AN ATTACHMENT DESCRIPTOR AND INSERTS IT IN THE
    134					; NECESSARY QUEUES.
    135					;
    136					; INPUTS:
    137					;
    138					;	R2=PCB ADDRESS OF REGION BEING ATTACHED TO
    139					;	R4=ACCESS CODE
    140					;	R5=TCB ADDRESS OF ATTACHING TASK
    141					;
    142					; OUTPUTS:
    143					;
    144					;	C=0 IF SUCCESSFUL
    145					;		R1=ADDRESS OF ATTACHMENT DESCRIPTOR
    146					;		R0 IS MODIFIED
    147					;	C=1 IF AN ATTACHMENT DESCRIPTOR COULD NOT BE ALLOCATED
    148					;		R0,R1 ARE MODIFIED
    149					;-
    150
    151					$CRATT::MOV	R3,-(SP)	;SAVE R3
    152						MOV	R2,-(SP)	;SAVE PCB ADDRESS
    153						MOV	#A.LGTH,R1	;PICK UP ATTACHMENT DESCRIPTOR SIZE
    154						CALL	$ALOCB		;ALLOCATE THE ATTACHMENT DESCRIPTOR
    155						BCS	10$		;IF CS ALLOCATION FAILURE
    156						ADD	R0,R1		;POINT PAST END OF ATTACHMENT DESCRIPTOR
    157						MOV	(SP),-(R1)	;SET PCB ADDRESS (A.PCB)
    158						MOV	R4,-(R1)	;INIT STATUS AND MAP COUNT (A.STS)
    159						BIC	#^C17,(R1)	;CLEAR ALL BUT ACCESS BITS (A.STS)
    160						TST	-(R1)		;POINT TO TCBL THREAD WORD (A.TCBL)
    161						MOV	R5,R0		;POINT TO TCB ATTACHMENT LISTHEAD
    162						ADD	#T.ATT,R0	;
    163						CALL	$QINSF		;INSERT DESCRIPTOR AT END OF QUEUE
    164						MOV	R5,-(R1)	;SET TCB ADDRESS (A.TCB)
    165						CLRB	-(R1)		;ZERO I/O COUNT (A.IOC)
    166						MOVB	T.PRI(R5),-(R1)	;INIT PRIORITY TO TASK PRIORITY (A.PRI)
    167						TST	-(R1)		;POINT TO PCBL THREAD (A.PCBL)
    168						MOV	(SP),R0		;POINT TO PCB ATTACHMENT LISTHEAD
    169						ADD	#P.ATT,R0	;
    170						CALL	$QINSP		;INSERT IN QUEUE BY PRIORITY
    171						CLC			;INDICATE SUCCESS
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3-3


    172					10$:	MOV	(SP)+,R2	;RESTORE PCB ADDRESS
    173						MOV	(SP)+,R3	;RESTORE R3
    174						RETURN			;
    175
    176					;+
    177					; **-$SRATT-SEARCH FOR ATTACHMENT DESCRIPTOR
    178					;
    179					; THIS ROUTINE VERFIES IF A VALID REGION ID WAS PASSED IN A PLAS DIRECTIVE
    180					; BY SEARCHING FOR THE CORRESPONDING ATTACHMENT DESCRIPTOR IN THE TCB'S
    181					; ATTACHMENT QUEUE.
    182					;
    183					; INPUTS:
    184					;
    185					;	(R3)=REGION ID TO VERIFY (OR 0 TO IMPLY TASK REGION)
    186					;	R5=TCB ADDRESS OF CURRENT TASK
    187					;
    188					; OUTPUTS:
    189					;
    190					;	R5=ADDRESS OF ATTACHMENT DESCRIPTOR
    191					;
    192					;	D.RS86 IS RETURNED IF THE ATTACHMENT DESCRIPTOR CANNOT BE FOUND.
    193					;-
    194
    195					$SRATT::MOV	T.ATT(R5),R5	;POINT TO FIRST ATTACHMENT DESCRIPTOR
    196						MOV	(R3),-(SP)	;DEFAULT TO TASK REGION?
    197						BEQ	20$		;IF EQ YES
    198						ADD	#A.TCBL,(SP)	;ADD BIAS TO LINK WORD
    199					10$:	CMP	R5,(SP)		;MATCH ON THIS DESCRIPTOR?
    200						BEQ	20$		;IF EQ YES
    201						MOV	(R5),R5		;ELSE POINT TO NEXT DESCRIPTOR (A.TCBL)
    202						BNE	10$		;IF NE THERE IS ONE
    203						DRSTS	D.RS86		;INVALID REGION ID
    204					20$:	SUB	#A.TCBL,R5	;POINT TO START OF ATTACHMENT DESCRIPTOR
    205						TST	(SP)+		;CLEAN STACK
    206						RETURN			;
    207
    208					;+
    209					; **-$SRWND-SEARCH FOR SPECIFIED ADDRESS WINDOW
    210					;
    211					; THIS ROUTINE VERIFIES THAT THE SPECIFIED ADDRESS WINDOW ID CORRESPONDS
    212					; TO A VALID ESTABLISHED ADDRESS WINDOW.
    213					;
    214					; INPUTS:
    215					;
    216					;	(R3)=ADDRESS WINDOW ID
    217					;	R4=ADDRESS OF CURRENT TASK HEADER
    218					;
    219					; OUTPUTS:
    220					;
    221					;	R4=POINTER TO SPECIFIED WINDOW BLOCK
    222					;	R0 IS MODIFIED.
    223					;
    224					;	D.RS87 IS RETURNED IF THE SPECIFIED ADDRESS WINDOW IS INVALID
    225					;-
    226
    227					$SRWND::MOV	H.WND(R4),R4	;POINT TO NUMBER OF WINDOWS
    228						MOVB	(R3),R0		;PICK UP ADDRESS WINDOW ID (W.NID)
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3-4


    229						BEQ	10$		;IF EQ ILLEGAL
    230						CMP	R0,(R4)+	;WINDOW ID TOO LARGE?
    231						BHIS	10$		;IF HIS YES
    232						ASL	R0		;CONVERT WINDOW ID TO 8 WORD OFFSET
    233						ASL	R0		;
    234						ASL	R0		;
    235						ASL	R0		;
    236						ADD	R0,R4		;POINT TO ADDRESS WINDOW
    237						TST	W.BSIZ(R4)	;IS IT AN ESTABLISHED ADDRESS WINDOW?
    238						BEQ	10$		;IF EQ NO
    239						RETURN			;
    240					10$:	DRSTS	D.RS87		;INVALID ADDRESS WINDOW
    241
    242					;+
    243					; **-$UNMAP-UNMAP ADDRESS WINDOW
    244					;
    245					; THIS ROUTINE SEARCHES FOR AND CONDITIONALLY UNMAPS THE SPECIFIED
    246					; ADDRESS WINDOW.
    247					;
    248					; INPUTS:
    249					;
    250					;	R4=ADDRESS OF WINDOW TO BE UNMAPPED
    251					;
    252					; OUTPUTS:
    253					;
    254					;	R0 IS MODIFIED
    255					;
    256					;	C=1 IF UNMAPPING WAS PERFORMED
    257					;-
    258
    259						.ENABL	LSB
    260					$UNMAP::TST	(R4)		;IS WINDOW MAPPED? (W.BPCB)
    261						BEQ	20$		;IF EQ IT IS NOT MAPPED
    262						MOV	R1,-(SP)	;SAVE R1
    263						CLR	(R4)		;UNMAP ADDRESS WINDOW (W.BPCB)
    264						MOV	W.BATT(R4),R0	;PICK UP ADDRESS OF ATTACHMENT DESCRIPTOR
    265						CLR	W.BATT(R4)	;CLEAR ATTACHMENT DESCRIPTOR POINTER
    266						DECB	A.MPCT(R0)	;DECREMENT MAPPING COUNT
    267						MOV	A.TCB(R0),R1	;POINT TO TASK TCB ADDRESS
    268						MOVB	W.BFPD(R4),R0	;POINT TO FIRST USER PDR
    269					10$:	BIT	#T3.PRV,T.ST3(R1) ;IS THE TASK PRIVILEGED?
    270						BEQ	14$		;IF EQ NO
    271						MOV	KISAR0-UISDR0(R0),UISAR0-UISDR0(R0) ;RESTORE PRV MAPPING
    272						MOV	#77406,(R0)+	;
    273						BR	15$		;
    274					14$:	CLR	(R0)+		;CLEAR NEXT USER PDR
    275					15$:	DECB	W.BNPD(R4)	;DONE YET?
    276						BGT	10$		;IF GT NO
    277						MOV	(SP)+,R1	;RESTORE R1
    278						SEC			;RETURN CS FOR WINDOW UNMAPPED
    279					20$:	RETURN			;
    280
    281						.ENDC
    282
    283
    284		000001 				.END
PLSUB	MACRO M1110  22-AUG-79 07:09  PAGE 3-5
SYMBOL TABLE

A$$CHK= 000000   	I$$RDN= 000000   	L$$ASG= 000000   	N$$LDV= 000001   	R$$11M= 000000
A$$CPS= 000000   	K$$CNT= 177546   	L$$DRV= 000000   	P$$RTY= 000000   	R$$11S= 000000
A$$TRP= 000000   	K$$CSR= 177546   	M$$CRB= 000124   	P$$TPT= 000000   	S$$YSZ= 001740
C$$ORE= 002000   	K$$IEN= 000115   	M$$MGE= 000000   	R$$DER= 000000   	V$$CTR= 001200
G$$TPP= 000000   	K$$LDC= 000001   	M$$NET= 000000   	R$$EXV= 000000   	V$$RSN= 000031
G$$TTK= 000000   	K$$TPS= 000074   	M$$NT2= 000000   	R$$SND= 000000   	X$$DBT= 000000
H$$RTZ= 000074

. ABS.	000000	   000
      	000000	   001
ERRORS DETECTED:  0

VIRTUAL MEMORY USED:  1140 WORDS  ( 5 PAGES)
DYNAMIC MEMORY:  2980 WORDS  ( 11 PAGES)
ELAPSED TIME:  00:00:13
[11,24]PLSUB,SY0:[11,34]PLSUB/-SP=[1,1]EXEMC/ML,[11,10]RSXMC/PA:1,PLSUB