Google
 

Trailing-Edge - PDP-10 Archives - BB-D480G-SB_FORTRAN10_V11.0_short - extend.pco
There is 1 other file named extend.pco in the archive. Click here to see a list.

Reproduced below are the two MCOs required for Extended Addressing to work
under Tops-10 version 7.03A.  The FILCOMs supplied use the Autopatch 15
monitor sources as their base.

				MCO 13121
[Symptom]

     Various security holes in PAGE.  UUO:

     1.  It's  possible  to  create  "indirect  section  loops".   The
         monitor  KAFs  the  next time it tries to resolve an indirect
         section pointer contained in the loop.

     2.  With the advent of IDC, the monitor gets confused if you  try
         to  delete  (for example) pages 2, 3, and 4, and create pages
         3, 4, and 5.  It will wind up putting physical pages 0 and  1
         in  the  user's  address  space  for virtual pages 4 and 5 (I
         think).



[Diagnosis]

     1.  No code to check for loops.

     2.  Monitor sees it wants to delete pages  2,  3,  and  4  (which
         exist),  then  sees  it  wants to create 3, 4, and 5 with IDC
         lit.  Since 3 and 4 already exist when the list  is  scanned,
         we  say they're already created and allocate only one page to
         add to  the  user's  PAGTAB  chain.   Previous  to  IDC  this
         couldn't  happen  because pages 3 and 4 would have caused the
         create part of the PAGE.  UUO  to  fail  since  they  already
         existed.   The  monitor  then processes the deletes for all 3
         pages so that when it gets around to making sure  that  pages
         exist  for  pages  3,  4,  and 5, it really needs 3 pages and
         falls off the end of the pages it allocated.  Similar  things
         can happen for PAGE IN/OUT.



[Cure]

     1.  Add (lots of) code to check  for  loops.   Force  the  target
         sections  (i.e.   right  half  of the argument word) to be in
         monotonically increasing order, analagous to other PAGE.  UUO
         functions  so  that  the  checking is a little (but not much)
         easier.

     2.  Although individual cases I might think of may be fixable  by
         just  not  assuming  the  correct  number of pages are always
         pre-allocated through  PLTSN  (actually  through  the  number
         returned  by  PLTSN), it seems safer to just restrict the arg
         list  to  be  strictly  monotonically  increasing.    Current
         behaviour  is  that  the  creates  must be increasing and the
         deletes must be increasing, but not that the entire list must
         be  increasing.   However,  this  anomaly  hasn't  ever  been
         documented  and  I  can't  think  of  anyone  who  uses   it.
         Restricting the list to be monotonically increasing means the
         user can't do two things to the same page in one arg list.

     Module: VMSER

[Filcom]

File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

1)177		SETZB	P1,P2			;# OF PAGES CREATED, DESTROYED
1)		SETZ	T4,			;# OF PAGES REQUIRED TO ADD
1)		XSFM	T2			;SECTION # OF PC SECTION
1)		ANDI	T2,MXSECN		;KEEPING ONLY SECTION #
1)	CHGSC1:	PUSHJ	P,NXTSPG		;GET NEXT ARG
1)		JUMPL	T1,CHGSC3		;DESTROY MAP
**** ;At CHGSEC+5L
2)177		MOVSI	T2,-<MXSECN+1>		;MAX # OF SECTIONS
2)		SETZ	P2,			;MAKE MASK OF SECTIONS NOW INDIRECT
2)		MOVSI	T4,(<PM.ACD^!PM.DCD>B2)	;SEE IF SECTION IS INDIRECT
2)	CHGSC0:	LSH	P2,1			;NEXT SECTION
2)		TDNE	T4,.UPMP+SECTAB(T2)	;IS THIS SECTION INDIRECT?
2)		AOS	P2			;THIS SECTION IS INDIRECT
2)		AOBJN	T2,CHGSC0
2)		LSH	P2,^D35-<MXSECN>
2)		SETZB	P1,T4			;# OF PAGES CREATED,,DESTROYED, PAGES TO ADD
2)		XSFM	T2			;SECTION # OF PC SECTION
2)		ANDI	T2,MXSECN		;KEEPING ONLY SECTION #
2)		MOVEM	T2,.USTMP		;SAVE IT
2)		SETO	T2,			;HIGHEST SECTION SEEN THUS FAR
2)	CHGSC1:	PUSHJ	P,NXTSPG		;GET NEXT ARG
2)		CAIL	T2,(T1)			;MONOTONICALLY INCREASING?
2)		JRST	IALERR			;NO
2)		MOVEI	T2,(T1)			;UPDATE
2)		JUMPL	T1,CHGSC3		;DESTROY MAP
**************
1)177		AOS	P2			;ONE MORE CREATE TO PROCESS
1)		SKIPN	.UPMP+SECTAB(T1)	;NO, DOES SECTION EXIST?
1)		JRST	CHGSC4
1)		TLNN	T1,(PG.IDC)		;IDC LIT?
**** ;At CHGSC2+3L
2)177		AOS	P1			;ONE MORE CREATE TO PROCESS
2)		PUSH	P,T1			;SAVE ARG
2)		MOVSI	T3,(1B0)		;TURN ON THAT THIS SECTION IS INDIRECT
2)		MOVNI	T1,(T1)
2)		LSH	T3,(T1)			;FIND RIGHT BIT
2)		POP	P,T1			;RESTORE ARG
2)		SKIPN	.UPMP+SECTAB(T1)	;NO, DOES SECTION EXIST?
2)		JRST	[TLNE	T1,(PG.SLO)	;INDIRECT SECTION?
2)			 JRST	CHGS2A		;CHECK TARGET SECTION
2)			 JRST	CHGSC4]		;SECTION WON'T BE INDIRECT LATER
2)		TLNN	T1,(PG.IDC)		;IDC LIT?
**************
1)177		SOJA	T4,CHGSC4		;YES, ONE LESS MAP TO GET A PAGE FOR
1)		JRST	CHGSC4			;IT EXISTS BUT HE DOESN'T CARE
1)	CHGSC3:	TRNE	T1,-1			;CAN'T DELETE SECTION 0
**** ;At CHGSC2+9L
2)177		TDZA	P2,T3			;SECTION WON'T BE INDIRECT LATER
2)	CHGS2A:	TDOA	P2,T3			;TURN IT ON FOR THIS SECTION
2)		SOJA	T4,CHGSC4		;ONE LESS PAGE TO GET MAP FOR
2)		HRRZM	T1,.USTMP+1		;SAVE THE TARGET SECTION
2)		HLRZS	T1			;GET THE SECTION MAPPING TO
2)	CHGS2B:	ANDI	T1,MXSECN		;SAVE ONLY SECTION #
2)		MOVNS	T1			;-SECTION #
2)		MOVSI	T3,(1B0)		;MAKE BIT MASK AGAIN
2)		LSH	T3,(T1)			;...
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

2)		MOVNS	T1			;SECTION # AGAIN
2)		CAILE	T1,(T2)			;HAVE WE ALREADY SCANNED THIS FAR?
2)		TRNE	P2,1			;OR DONE A FUTURE SCAN ALREADY?
2)		PUSHJ	P,CHGS20		;SCAN AHEAD IN THE LIST
2)		TDNN	P2,T3			;WILL SECTION BE INDIRECT AFTER PROCESSING?
2)		JRST	CHGSC4			;NO
2)		PUSHJ	P,CHGS30		;GET TARGET SECTION
2)		CAMN	T1,.USTMP+1		;LOOP?
2)		JRST	IALERR			;YES, HE LOSES
2)		JRST	CHGS2B
2)	CHGSC3:	TRNE	T1,-1			;CAN'T DELETE SECTION 0
**************
1)177		CAIN	T1,(T2)			;TRYING TO DESTROY SECTION WITH ARGS?
1)		JRST	IALERR			;CAN'T
1)		AOS	P1			;ONE MORE MAP TO DESTROY
1)	CHGSC4:	SOJG	P4,CHGSC1		;VALIDATE ALL ARGS
**** ;At CHGSC3+8L
2)177		CAMN	T1,.USTMP		;TRYING TO DESTROY SECTION WITH ARGS?
2)		JRST	IALERR			;CAN'T
2)		ADD	P1,[1,,0]		;# OF SECTIONS BEING DESTROYED
2)		MOVSI	T3,(1B0)		;THIS SECTION IF INDIRECT, NO
2)		MOVNI	T1,(T1)			;LONGER EXISTS
2)		LSH	T3,(T1)			;...
2)		ANDCAM	T3,P2			;...
2)	CHGSC4:	SOJG	P4,CHGSC1		;VALIDATE ALL ARGS
**************
1)177		JUMPE	P1,CHGSC8		;NO MAPS TO DESTROY
1)	CHGSC5:	PUSHJ	P,NXTSPG		;GET NEXT ARGUMENT
**** ;At CHGSC4+5L
2)177		TLZN	P1,-1			;ANY MAPS TO DESTROY?
2)		JRST	CHGSC8			;NO
2)	CHGSC5:	PUSHJ	P,NXTSPG		;GET NEXT ARGUMENT
**************
1)178	CHGSC8:	JUMPE	P2,TPOPJ1##		;CLEAR JUNK, NOTHING MORE TO DO
1)		MOVE	T4,(P)			;# OF PAGES WE NEED
**** ;At CHGSC8
2)178	CHGSC8:	JUMPE	P1,TPOPJ1##		;CLEAR JUNK, NOTHING MORE TO DO
2)		MOVE	T4,(P)			;# OF PAGES WE NEED
**************
1)179	;SUBROUTINE TO SCAN A LIST OF PAGES, VERIFY THAT EACH ENTRY IN THE
**** ;At CHGS12+8L
2)179	;HERE TO SCAN AHEAD IN THE ARG LIST TO SET ALL BITS FOR SECTIONS
2)	;WHICH WILL BE INDIRECT
2)	CHGS20:	PUSHJ	P,SAVT##		;SAVE THE T'S
2)		PUSH	P,.USNXP		;SAVE CURRENT POSITION
2)		MOVEI	T4,-1(P4)		;# OF ARGS LEFT
2)		SOJLE	T4,CHGS24
2)	CHGS21:	PUSHJ	P,NXTSPG		;GET NEXT PAGE
2)		MOVNI	T2,(T1)			;WHATEVER THE TARGET PAGE IS
2)		MOVSI	T3,(1B0)		;MASK FOR THAT PAGE
2)		LSH	T3,(T2)			;MAKE IT
2)		TLNN	T1,(PG.GAF)		;IS THIS A DELETE?
2)		TLNN	T1,(PG.SLO)		;NO, IS THIS A MAP TOGETHER?
2)		TDZA	P2,T3			;DELETE OR CREATE EMPTY
2)		TDO	P2,T3			;MAP TOGETHER
2)		SOJG	T4,CHGS21
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

2)	CHGS24:	POP	P,.USNXP		;RESTORE .USNXP
2)		POPJ	P,			;ALL BITS SET
2)	;HERE TO GET NEXT LEVEL DOWN IN SECTION FOR SECTION IN T1
2)	CHGS30:	PUSH	P,.USNXP		;SAVE CURRENT .USNXP
2)		PUSH	P,T1			;SAVE THE ARG
2)		PUSH	P,T2
2)		PUSH	P,T3
2)		PUSH	P,T4
2)		CAMG	T1,.USTMP+1		;NEED TO GO BACK IN LIST?
2)		SKIPA	T4,P3			;RESTORE # OF ARGS
2)		SKIPA	T4,P4			;NO
2)		PUSHJ	P,FSTPAG		;BACK TO THE BEGINNING
2)	CHGS31:	PUSHJ	P,NXTSPG		;GET NEXT ARG
2)		HRRZ	T2,T1			;TARGET SECTION
2)		CAMLE	T2,-3(P)		;PASSED DESIRED SECTION?
2)		JRST	CHGS35			;YES, USE CURRENT MAPPING
2)		CAME	T2,-3(P)		;IS THIS THE DESIRED SECTION?
2)		SOJG	T4,CHGS31		;NO, LOOK AHEAD
2)		TLNN	T1,(PG.GAF)		;IS DELETE SET (SHOULD NOT BE)
2)		TLNN	T1,(PG.SLO)		;IS SLO SET (SHOULD BE)
2)		STOPCD	.,JOB,MIC		;++MONITOR IS CONFUSED
2)		HLRZS	T1			;THE SECTION
2)		ANDI	T1,MXSECN
2)		JRST	CHGS37
2)	CHGS35:	MOVE	T1,-3(P)		;USE CURRENT MAPPING
2)		SKIPE	T1,.UPMP+SECTAB(T1)		;GET THAT SECTION POINTER
2)		TLNN	T1,(<PM.ACD^!PM.DCD>B2)	;BETTER BE INDIRECT
2)		XCT	MIC
2)		LDB	T1,[POINT 5,T1,17]	;SECTION IT'S CURRENTLY MAPPED TO
2)	CHGS37:	MOVEM	T1,-3(P)
2)		POP	P,T4
2)		POP	P,T3
2)		POP	P,T2
2)		POP	P,T1
2)		POP	P,.USNXP
2)		POPJ	P,
2)180	;SUBROUTINE TO SCAN A LIST OF PAGES, VERIFY THAT EACH ENTRY IN THE
**************
1)179		PUSHJ	P,SAVE4##	;SAVE P1-P4
1)		PUSHJ	P,SAVR##	;AND R
**** ;At PLTSN+2L
2)180		PUSHJ	P,SAVE3##	;SAVE P1-P3
2)		PUSHJ	P,SAVR##	;AND R
**************
1)179		SETO	P4,		;HIGHEST SEEN
1)		SETZB	R,P3		;NOTE CAN **NEVER** THINK OF DESTROYING P0
**** ;At PLTSN0+1L
2)180		SETZB	R,P3		;NOTE CAN **NEVER** THINK OF DESTROYING P0
**************
1)180	PLTSN5:	CAIL	P4,(T1)		;THIS PAGE HIGHER THAN THE LAST PAGE SEEN?
1)		JRST	[PUSHJ P,IALERR	;NO, ILLEGAL ARGUMENT LIST ERROR
1)			JRST PLTS16]	;LOSE
1)		MOVEI	P4,(T1)		;SAVE AS HIGHEST PAGE SEEN
1)		MOVSI	T3,1		;ADD 1 TO THE COUNT OF ARGUMENTS WITH THE
**** ;At PLTSN5
2)181	PLTSN5:	JUMPE	P3,PLTS5A	;FIRST TIME
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

2)		CAIL	P3,(T1)		;THIS PAGE HIGHER THAN THE LAST PAGE SEEN?
2)		JRST	[PUSHJ P,IALERR	;NO, ILLEGAL ARGUMENT LIST ERROR
2)			JRST PLTS16]	;LOSE
2)	PLTS5A:	MOVEI	P3,(T1)		;SAVE AS HIGHEST PAGE SEEN
2)		MOVSI	T3,1		;ADD 1 TO THE COUNT OF ARGUMENTS WITH THE
**************
1)182		JUMPGE	T3,PLTSN4	;W/O PA.GAF LIT?
1)	PLTSN3:	PUSHJ	P,IALERR
**** ;At PLTSN2+1L
2)183		JUMPGE	T3,PLTSN4	;W/O PG.GAF LIT?
2)	PLTSN3:	PUSHJ	P,IALERR
**************

[End of MCO 13121]
				MCO 13137:
[Symptom]

     Monitor too slow (KAFs sometimes).


[Diagnosis]

     1.  Missing calls to SCDCHK.

     2.  Monitor attempts to always add new pages to the  end  of  the
         job's  PAGTAB  chain.  With a few mods in the UUO level code,
         that isn't really necessary any more.

     3.  KILNZS bypasses call to an effective SCDCHK type routine  the
         first  time,  but may not end up calling it soon enough if we
         were called on the hairy edge of a KAFfing.



[Cure]

     1.  Liberally sprinkle calls to SCDCHK.

     2.  Make ADPAGS add pages immediately after the first page  of  a
         job;  make PAGIMT figure out how this works.

     3.  Change hardware clock level to AOS .CPTMF so that we can  see
         how  many  clock  ticks  have  happened  since we got to PI7.
         Block at UUO level (or DLYCOM at command level) in KILNZS  if
         more than three have passed.

     Modules: VMSER, CLOCK1, CORE1

[Filcom]

File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA1[10,422,MON,AP16,DEC29]	created: 1350 06-Jan-87

1)60		PUSHJ	P,SCPAGS##	;FIND THE LAST PAGE ALLOCATED TO THIS JOB
1)		MOVE	T2,P2		;NUMBER OF PAGES REQUESTED
1)		PUSHJ	P,ADPAGS##	;ALLOCATE THAT NUMBER
**** ;At CREMP1+9L
2)60		MOVE	T2,P2		;NUMBER OF PAGES REQUESTED
2)		LDB	T1,JBYLSA##	;FIRST PAGE OF JOB
2)		PUSHJ	P,ADPAGS##	;ALLOCATE THAT NUMBER
**************
1)105		PUSHJ	P,SCPAGS##	;YES, GET END OF PAGTAB CHAIN
1)		MOVEI	T2,1
**** ;At IPCIN5+3L
2)105		LDB	T1,JBYLSA##	;FIRST PAGE OF JOB
2)		MOVEI	T2,1
**************
1)145		PUSHJ	P,SCPAGS##	;YES, FIND THE LAST PAGE CURRENTLY ALLOCATED TO THE JOB
1)		MOVE	T2,P2		;SETUP ARGUMENTS TO ADPAGS
**** ;At PAGEB1+19L
2)145		LDB	T1,JBYLSA##	;FIRST PAGE OF JOB
2)		MOVE	T2,P2		;SETUP ARGUMENTS TO ADPAGS
**************
1)146		PUSHJ	P,PAGIMT	;SETUP MEMTAB FOR PAGING INPUT
**** ;At PAGEB2+1L
2)146		PUSH	P,P2		;SAVE # OF PAGES ALLOCATED
2)		MOVN	P3,P2		;GET -# OF PAGES INTO P3
2)		PUSHJ	P,PAGIMT	;SETUP MEMTAB FOR PAGING INPUT
**************
1)146		TLO	P3,(MT.LEF)	;INDICATE NOT LAST FRAGMENT
**** ;At PAGEB2+4L
2)146		SUBM	P4,(P)		;-# OF PAGES REMAINING ON STACK
2)		MOVMS	(P)		;+# OF PAGES REMAINING ON STACK
2)		TLO	P3,(MT.LEF)	;INDICATE NOT LAST FRAGMENT
**************
1)146		PUSHJ	P,PAGIMT	;SETUP MEMTAB FOR THIS FRAGMENT
**** ;At PAGEB4+5L
2)146		MOVN	P3,-1(P)	;-# OF PAGES USABLE
2)		PUSHJ	P,PAGIMT	;SETUP MEMTAB FOR THIS FRAGMENT
**************
1)146		MOVE	P1,P4		;SAVE THE NUMBER OF PAGES IN FRAGMENT
**** ;At PAGEB4+8L
2)146		SUBM	P4,-1(P)	;# OF PAGES REMAINING
2)		MOVMS	-1(P)
2)		MOVE	P1,P4		;SAVE THE NUMBER OF PAGES IN FRAGMENT
**************
1)146		JRST	PAGEB7		;MAKE THE ENTRY IN SWPLST AND DO THE I/O
1)	PAGEB6:	MOVE	T1,P4		;BUILD A SWPLST ENTRY
1)		DPB	P3,[POINT SL.SPN,T1,<^L<SL.PPN>+SL.SPN-1>]
**** ;At PAGEB5+4L
2)146		ADJSP	P,-1		;CLEAN JUNK OFF THE STACK
2)		JRST	PAGEB7		;MAKE THE ENTRY IN SWPLST AND DO THE I/O
2)	PAGEB6:	POP	P,(P)		;FIX STACK (# OF PAGES ALLOCATED)
2)		MOVE	T1,P4		;BUILD A SWPLST ENTRY
2)		DPB	P3,[POINT SL.SPN,T1,<^L<SL.PPN>+SL.SPN-1>]
**************
1)147	;	MOVEI	P4,0
**** ;At PAGE10+5L
2)147	;	MOVEI	P3,-# OF PAGES ALLOCATED (ONLY NEEDED IF P1=/=0)
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA1[10,422,MON,AP16,DEC29]	created: 1350 06-Jan-87

2)	;	MOVEI	P4,0
**************
1)147		MOVE	P1,T1		;SAVE THE FIRST PHYSICAL PAGE ALLOCATED
1)		PUSH	P,[0]		;PREVIOUS DISK ADDRESS+PREVIOUS PHYSICAL PAGE
1)	PAGIM1:	PUSHJ	P,NXTPAG	;GET THE NEXT USER ARGUMENT
1)		JUMPL	T1,PAGIM1	;JUMP IF ARGUMENT INDICATES PAGE TO BE PAGED-OUT
**** ;At PAGIMT+2L
2)147		HRLZS	P3		;MAKE AOBJN POINTER
2)		MOVE	P1,T1		;SAVE THE FIRST PHYSICAL PAGE ALLOCATED
2)		PUSH	P,[0]		;INIT FIRST VIRTUAL,,FIRST PHYSICAL
2)		PUSH	P,[0]		;INIT PREV DSK ADDR+PREV PHYS PAG
2)	PAGIM1:	PUSHJ	P,INTLVL##	;AT INTERRUPT LEVEL?
2)		  TRNE	P3,777		;NO, DONE ~1000 PGS
2)		CAIA			;DON'T WAIT
2)		PUSHJ	P,SCDCHK##
2)		PUSHJ	P,NXTPAG	;GET THE NEXT USER ARGUMENT
2)		JUMPL	T1,PAGIM1	;JUMP IF ARGUMENT INDICATES PAGE TO BE PAGED-OUT
**************
1)148		SKIPE	(P)		;FIRST TIME THROUGH FOR THIS FRAGMENT?
1)		JRST	PAGIM5		;NO
1)		HRRZ	P3,P1		;YES, REMEMBER FIRST PHYSICAL PAGE IN FRAGMENT
1)		TLO	P3,(T1)		;AND FIRST VIRTUAL PAGE IN FRAGMENT
1)		JRST	PAGIM6		;SKIP ON SINCE DON'T KNOW NEXT VIRTUAL PAGE NUMBER YET
**** ;At PAGIM4+6L
2)148		SKIPE	-1(P)		;FIRST TIME THROUGH FOR THIS FRAGMENT?
2)		JRST	PAGIM5		;NO
2)		HRRZM	P1,-1(P)	;YES, REMEMBER FIRST PHYSICAL PAGE IN FRAGMENT
2)		HRLM	T1,-1(P)	;AND FIRST VIRTUAL PAGE IN FRAGMENT
2)		JRST	PAGIM6		;SKIP ON SINCE DON'T KNOW NEXT VIRTUAL PAGE NUMBER YET
**************
1)149		JRST	PAGIM1		;NO, GO GET ANOTHER ARGUMENT
1)		JUMPE	P1,PAGI10	;DONE IF NO REAL PAGES (SHOULD BE TRUE)
1)		JRST	PAGIM1		;YES, SETUP TO PAGE THEM IN
1)150	PAGIM8:	HRRZS	P1		;CLEAR JUNK
1)		SSX	P1,MS.MEM	;PAGTAB SECTION
1)		SKIPGE	P1,PAGTAB(P1)	;GET THE NEXT PHYSICAL PAGE ALLOCATED
1)		STOPCD	CPOPJ##,DEBUG,APF,	;++ALLOCATED PAGE FREE
1)		TRNN	P1,-1		;IS THERE REALLY A PAGE?
1)		SKIPE	.USTMP		;STILL SOME QUEUED PAGES?
**** ;At PAGIM7+24L
2)149		AOJA	P3,PAGIM1	;NO, GO GET ANOTHER ARGUMENT
2)		JUMPE	P1,PAGI10	;DONE IF NO REAL PAGES (SHOULD BE TRUE)
2)		AOJA	P3,PAGIM1	;YES, SETUP TO PAGE THEM IN
2)150	PAGIM8:	SSX	P1,MS.MEM	;PAGTAB SECTION
2)		SKIPGE	P1,PAGTAB(P1)	;GET THE NEXT PHYSICAL PAGE ALLOCATED
2)		STOPCD	CPOPJ##,DEBUG,APF,	;++ALLOCATED PAGE FREE
2)		AOBJN	P3,PAGIM1	;IF NO QUEUED PAGES, ARE THERE MORE PHYSICAL?
2)		SKIPE	.USTMP		;STILL SOME QUEUED PAGES?
**************
1)150		AOSA	-1(P)		;FRAGMENTED RETURN
1)	PAGI10:	LDB	P1,[POINT 14,(P),35] ;GET LAST PHYSICAL PAGE
1)		POP	P,T2		;POP OFF REMINDER
1)		JUMPE	T2,CPOPJ##	;RETURN IF ALL PAGES ARE ALREADY IN CORE
**** ;At PAGIM9+2L
2)150		AOSA	-2(P)		;FRAGMENTED RETURN
2)	PAGI10:	LDB	P1,[POINT 14,(P),35] ;GET LAST PHYSICAL PAGE
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA1[10,422,MON,AP16,DEC29]	created: 1350 06-Jan-87

2)		POP	P,T2		;POP OFF REMINDER
2)		POP	P,P3		;FIRST VIRTUAL,,FIRST PHYSICAL
2)		JUMPE	T2,CPOPJ##	;RETURN IF ALL PAGES ARE ALREADY IN CORE
**************
1)151	;	MOVEI	P3,0
**** ;At PAGI10+14L
2)151	;	MOVEI	P1,-# OF PAGES TO GO OUT
2)	;	MOVEI	P3,0
**************
1)151	PAGOM1:	PUSHJ	P,NXTPAG	;GET THE NEXT ARGUMENT FROM THE USER'S ARGUMENT LIST
1)		JUMPGE	T1,PAGOM1	;JUMP IF THE ARGUMENT REQUESTS PAGING-IN
**** ;At PAGOM1
2)151	PAGOM1:	PUSHJ	P,INTLVL##	;AT INTERRUPT LEVEL?
2)		TRNE	P1,777		;IF NOT, STOP APPROX EVERY 1000 PGS
2)		CAIA
2)		PUSHJ	P,SCDCHK##
2)		PUSHJ	P,NXTPAG	;GET THE NEXT ARGUMENT FROM THE USER'S ARGUMENT LIST
2)		JUMPGE	T1,PAGOM1	;JUMP IF THE ARGUMENT REQUESTS PAGING-IN
**************
1)156	CHGPG3:	SOSLE	(P)		;DELETED ALL THAT WERE REQUESTED?
1)		JRST	CHGPG2		;NO, CONTINUE
1)		PUSHJ	P,FSTPAG	;RESTORE THE ARGUMENT LIST POINTER
**** ;At CHGPG3
2)156	CHGPG3:	SOSLE	T1,(P)		;DELETED ALL THAT WERE REQUESTED?
2)		JRST	[PUSHJ	P,INTLVL## ;AT INTERRUPT LEVEL?
2)			 TRNE	T1,777	;NO, STOP EVERY APPROX 1000 PAGES
2)			 JRST	CHGPG2	;AT CLOCK LEVEL OR LIMIT NOT EXPIRED
2)			 PUSHJ	P,SCDCHK## ;WAIT
2)			 JRST	CHGPG2]
2)		PUSHJ	P,FSTPAG	;RESTORE THE ARGUMENT LIST POINTER
**************
1)156		PUSHJ	P,SCPAGS##	;FIND THE LAST PAGE CURRENTLY ALLOCATED TO THE JOB
1)		POP	P,T2		;RESTORE # OF PAGES TO GET
1)		PUSHJ	P,ADPAGS##	;ALLOCATE THE PAGES
**** ;At CHGPG4+15L
2)156		POP	P,T2		;RESTORE # OF PAGES TO GET
2)		LDB	T1,JBYLSA##	;FIRST PAGE OF JOB
2)		PUSHJ	P,ADPAGS##	;ALLOCATE THE PAGES
**************
1)157		TLNN	M,ARGMD
**** ;At CHGPG9+3L
2)157		PUSHJ	P,INTLVL##	;AT CLOCK LEVEL?
2)		TRNE	P2,777		;NO, STOP EVERY APPROX 1000 PAGES
2)		CAIA
2)		PUSHJ	P,SCDCHK##	;TO CHECK FOR OTHER THINGS
2)		TLNN	M,ARGMD
**************
1)158	CHGP12:	PUSHJ	P,NXTPAG	;GET THE NEXT ARGUMENT
1)		JUMPL	T1,CHGP12	;JUMP IF NOT CREATE PAGE ARGUMENT
**** ;At CHGP12
2)158	CHGP12:	PUSHJ	P,INTLVL##	;INTERRUPT LEVEL?
2)		TRNE	P3,777		;NO, STOP APPROX EVERY 1000 PAGES
2)		  CAIA
2)		PUSHJ	P,SCDCHK##
2)		PUSHJ	P,NXTPAG	;GET THE NEXT ARGUMENT
2)		JUMPL	T1,CHGP12	;JUMP IF NOT CREATE PAGE ARGUMENT
File 1)	SOFT:VMSER.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:VMSER.MA1[10,422,MON,AP16,DEC29]	created: 1350 06-Jan-87

**************
1)161		PUSHJ	P,SCPAGS##	;FIND END
1)		MOVEI	T2,(T3)
1)		PUSHJ	P,ADPAGS##
**** ;At CRSM12+3L
2)161		MOVEI	T2,(T3)
2)		LDB	T1,JBYLSA##	;FIRST PAGE OF JOB
2)		PUSHJ	P,ADPAGS##
**************
1)162	GSMPG2:	PUSHJ	P,SCPAGS##	;LAST PAGE OF JOB
1)		MOVEI	T2,(T4)
1)		PUSHJ	P,ADPAGS##	;ADD IT IN
**** ;At GSMPG2
2)162	GSMPG2:	MOVEI	T2,(T4)
2)		LDB	T1,JBYLSA##
2)		PUSHJ	P,ADPAGS##	;ADD IT IN
**************
1)163	MOVPG1:	PUSHJ	P,NXTSPG	;GET THE NEXT ARGUMENT
1)		PUSH	P,T1		;SAVE IT AT 0(P)
**** ;At MOVPG1
2)163	MOVPG1:	TRNN	P1,777		;(THIS FUNCTION NOT EXECUTED @INTERRUPT LEVEL)
2)		PUSHJ	P,SCDCHK##	;STOP EVERY APPROX 1000 PGS
2)		PUSHJ	P,NXTSPG	;GET THE NEXT ARGUMENT
2)		PUSH	P,T1		;SAVE IT AT 0(P)
**************
1)165	MOVP10:	PUSHJ	P,PREPAG	;BACK UP TO PREVIOUS ARGUMENT
1)		MOVSS	T1		;MAKE IT AN ARG FOR UNDOING ITSELF
**** ;At MOVP10
2)165	MOVP10:	TRNN	P1,777		;WAIT APPROX EVERY 1000 PGS
2)		PUSHJ	P,SCDCHK##
2)		PUSHJ	P,PREPAG	;BACK UP TO PREVIOUS ARGUMENT
2)		MOVSS	T1		;MAKE IT AN ARG FOR UNDOING ITSELF
**************
1)208		JRST	KILNZ2
1)	KILNZ1:	PUSHJ	P,KILNZ6		;SEE IF NEED TO WAIT
**** ;At KILNZS+9L
2)208	KILNZ1:	PUSHJ	P,KILNZ6		;SEE IF NEED TO WAIT
**************
1)209	KILNZ6:	SKIPN	SCDRTF##		;FORCED RESCHED PENDING?
1)		SKIPE	.CPTMF##		;CLOCK TICK?
1)		CAIA				;ONE OF THE ABOVE
1)		PJRST	CPOPJ1##		;OK TO PROCEED
1)		PUSHJ	P,UUOLVL##		;UUO LEVEL?
1)		  POPJ	P,			;NO
**** ;At KILNZ6
2)209	KILNZ6:	SKIPE	SCDRTF##		;FORCED RESCHED PENDING?
2)		JRST	KILNZ7
2)		PUSH	P,T1			;SAVE T1
2)		SKIPE	T1,.CPTMF##		;CLOCK TICK AT ALL?
2)		CAIG	T1,3			;MORE THAN 3 TIMES?
2)		PJRST	TPOPJ1##		;OK TO PROCEED
2)		POP	P,T1
2)	KILNZ7:	PUSHJ	P,UUOLVL##		;UUO LEVEL?
2)		  POPJ	P,			;NO
**************
[Filcom]

File 1)	SOFT:CLOCK1.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:CLOCK1.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

1)2		SETOM	.CPTMF##	;SET FLAG THAT APR CLOCK HAS TICKED
1)		SETOM	.CPCKF##	;SET FLAG FOR CLK FORCED SCHEDULER INTERRUPT
**** ;At APRSU2+1L
2)2		AOSN	.CPTMF##	;SET FLAG THAT APR CLOCK HAS TICKED
2)		AOS	.CPTMF##	;I SAID SET IT (KAF BEFORE WRAPAROUND ANYWAY)
2)		SETOM	.CPCKF##	;SET FLAG FOR CLK FORCED SCHEDULER INTERRUPT
**************
[Filcom]

File 1)	SOFT:CORE1.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:CORE1.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

1)13		PUSHJ	P,SCPAGS	;FIND THE LAST PAGE WHICH IS CURRENTLY
1)					; ALLOCATED TO THE SEGMENT
1)		MOVE	T2,(P)		;T2 = NUMBER OF PAGES TO ADD TO THE SEGMENT
1)		ADDM	T2,JBTIMI##(J)	;INCREASE JBTIMI BY THAT NUMBER OF PAGES
1)		PUSHJ	P,ADPAGS	;ALLOCATE ENOUGH PAGES TO SATISFY THE REQUEST
**** ;At CORE1A+14L
2)13		LDB	T1,JBYLSA##	;FIRST PAGE OF SEGMENT
2)		CAILE	J,JOBMAX##	;UNLESS HIGH SEG
2)		LDB	T1,JBYHSA##
2)		MOVE	T2,(P)		;T2 = NUMBER OF PAGES TO ADD TO THE SEGMENT
2)		ADDM	T2,JBTIMI##(J)	;INCREASE JBTIMI BY THAT NUMBER OF PAGES
2)		CAILE	J,JOBMAX##	;IF A HISEG,
2)		PUSHJ	P,SCPAGS	;KEEP THEM IN ORDER
2)		MOVE	T2,(P)		;SCPAGS CLOBBERS THIS
2)		PUSHJ	P,ADPAGS	;ALLOCATE ENOUGH PAGES TO SATISFY THE REQUEST
**************
1)14		MOVEI	T2,0		;FIND THE FIRST PAGE OF THE SEGMENT
1)		PUSHJ	P,SNPAGS	;T1 = FIRST PAGE TO RETURN TO FREE CORE LIST
1)		JRST	CORE1D		;GO RETURN PAGES
**** ;At CORE1B+14L
2)14		PUSH	P,J		;IN CASE LEFT HALF CRUFT,
2)		HRRZS	J		;CLEAR CRUFT
2)		LDB	T1,JBYLSA##	;FIRST PAGE OF THE SEGMENT
2)		CAILE	J,JOBMAX##	;UNLESS HIGH SEG
2)		LDB	T1,JBYHSA##
2)		POP	P,J
2)		JRST	CORE1D		;GO RETURN PAGES
**************
1)26		HRRM	T4,PAGTAB(T1)	;LINK IT TO THE PAGES CONTAINED IN THIS SEGMENT
1)		SKIPA	T4,T1
1)	GTPAGS::
1)		SETZ	T4,
1)	IFN FTMP,<
**** ;At ADPAGS+3L
2)26		PUSH	P,PAGTAB(T1)	;SAVE PREVIOUS LINK
2)		HRRM	T4,PAGTAB(T1)	;LINK IT TO THE PAGES CONTAINED IN THIS SEGMENT
2)		MOVE	T4,T1		;PRE-LOAD PAGE
2)		JRST	GTPAG0
2)	GTPAGS::
2)		SETZ	T4,
2)		SE1ENT			;GET TO SECTION 1
2)		PUSH	P,T4		;VALUE TO PUT ON END OF PAGTAB CHAIN
2)	GTPAG0:
2)	IFN FTMP,<
**************
1)26		SE1ENT			;GET TO SECTION 1
1)		SKIPN	T1,PAGPTR##	;GET FIRST FREE PAGE
**** ;At GTPAGS+6L
2)26		SKIPN	T1,PAGPTR##	;GET FIRST FREE PAGE
**************
1)26		HLLZS	PAGTAB(T4)	;INDICATE THAT THIS IS THE LAST PAGE ALLOCATED
1)					; TO THIS SEGMENT
1)		POPJ	P,		;AND RETURN TO THE CALLER
**** ;At GTPAG1+13L
2)26		POP	P,T3		;THE BEGINNING OF THE REST OF THE CHAIN
2)		HRRZM	T3,PAGTAB(T4)	;POINT NEW PART TO OLD PART
File 1)	SOFT:CORE1.MAC[10,422,MON,AP16,DEC29]	created: 1352 06-Jan-87
File 2)	SOFT:CORE1.MA0[10,422,MON,AP16,DEC29]	created: 1353 06-Jan-87

2)		JUMPE	T3,CPOPJ##	;RETURN IF NO BACK LINK TO UPDATE
2)		SSX	T3,MS.MEM	;POINT TO PAGTAB SECTION
2)		HRRM	T4,PT2TAB(T3)	;UPDATE BACK LINK
2)		POPJ	P,		;AND RETURN TO THE CALLER
**************

[End of MCO 13137]
   --------