$CONTROL MAP,CODE,USLINIT,LINES=120                                     00005000
$CONTROL MAP,CODE,USLINIT,DEFINE                               <<06613>>00010000
<<KERNELC : MODULE 92>>                                        <<01715>>00015000
<< HP32002C MPE SOURCE C.00.00 >>                                       00020000
<< COPYRIGHT     "(C) COPYRIGHT HEWLETT-PACKARD CO. 1980.           >>  00025000
<<     THIS PROGRAM MAY BE USED WITH ONE COMPUTER SYSTEM AT A       >>  00030000
<<     TIME AND SHALL NOT OTHERWISE BE RECORDED, TRANSMITTED OR     >>  00035000
<<     STORED IN A RETRIEVAL SYSTEM.  COPYING OR OTHER REPRODUCTION >>  00040000
<<     OF THIS PROGRAM EXCEPT FOR ARCHIVAL PURPOSES IS PROHIBITED   >>  00045000
<<     WITHOUT THE PRIOR WRITTEN CONSENT OF HEWLETT-PACKARD COMPANY.>>  00050000
<< **** Note - Dollar Copyright cannot be used with this module *** >>  00055000
$CONTROL PRIVILEGED, SEGMENT=KERNELC, MAIN=KERNELC                      00060000
$control define                                                <<06945>>00065000
                                                                        00070000
BEGIN                                                                   00075000
$include inclstdd                                              <<06212>>00080000
ARRAY STACK(*)=Q+0,QARRAY(*)=Q+0;                              <<06635>>00085000
                                                               <<03041>>00090000
DEFINE GLOBALTRACEFLAG = ABSOLUTE(%1267)#;                     <<03041>>00095000
DEFINE MEMPRESSURE'CELL = ABSOLUTE(%1350).(0:1)#;              <<*7766>>00100000
                                                               <<03041>>00105000
                                                                        00110000
<<                                                                      00115000
SYSGLOB CELLS                                                           00120000
>>                                                                      00125000
                                                                        00130000
                                                                        00135000
EQUATE SYSBASE=%1000,                                                   00140000
       SYSGLOBEXTIX=%377,                                      <<06945>>00145000
       SYSGLOBEXTBASE=SYSGLOBEXTIX+SYSBASE,                    <<06945>>00150000
       SLIX=1,                                                          00155000
       SYSSL=SYSBASE+SLIX,                                              00160000
       DSTIX=2,                                                         00165000
       SYSDST=SYSBASE+DSTIX,                                            00170000
       PCBIX=3,                                                         00175000
       SYSPCB=SYSBASE+PCBIX,                                            00180000
       ICSIX=7,                                                         00185000
       SYSICS=SYSBASE+ICSIX,                                            00190000
       LPDTIX=%10,                                                      00195000
       SYSLPDT=SYSBASE+LPDTIX,                                          00200000
       BPTIX = %25,                                            <<06948>>00205000
       SYSBPT=SYSBASE+BPTIX,                                            00210000
       TRLIX=%12,                                                       00215000
       SYSTRL=SYSBASE+TRLIX,                                            00220000
       JCUTIX=%13,                                             <<06942>>00225000
       STATICFENCEIX=%27,                                      <<06945>>00230000
       SYSSTATICFENCE=SYSBASE+STATICFENCEIX,                   <<06945>>00235000
       DFCIX=%32,                                                       00240000
       SYSDFC=SYSBASE+DFCIX,                                            00245000
       DFSIX=%33,                                                       00250000
       SYSDFS=SYSBASE+DFSIX,                                            00255000
       SPECREQTABIX=%42,                                                00260000
       SPECQHEADIX=%43,                                                 00265000
       HOLECOUNTIX=%44,                                        <<06945>>00270000
       SYSHOLECOUNT=SYSBASE+HOLECOUNTIX,                       <<06945>>00275000
       HOLELISTHEADIX=%250,                                    <<06945>>00280000
       SYSHOLELISTHEAD=SYSBASE+HOLELISTHEADIX,                 <<06945>>00285000
       HOLELISTTAILIX=%252,                                    <<06945>>00290000
       SYSHOLELISTTAIL=SYSBASE+HOLELISTTAILIX,                 <<06945>>00295000
       NBANKSIX=%47,                                                    00300000
       SYSNBANKS=SYSBASE+NBANKSIX,                                      00305000
       MAXAVAILREGIX=%45,                                               00310000
       SYSMAXAVAILREG=SYSBASE+MAXAVAILREGIX,                            00315000
       DISPAWAKEMSGIX=%50,                                              00320000
       SYSDISPAWAKEMSG=SYSBASE+DISPAWAKEMSGIX,                          00325000
       CSTXBLKIX=%51,                                                   00330000
       SYSCSTXBLK=SYSBASE+CSTXBLKIX,                                    00335000
       AWAKESCHEDMSGIX=%52,                                             00340000
       SYSAWAKESCHEDMSGIX=SYSBASE+AWAKESCHEDMSGIX,                      00345000
       WAITDISPMSGIX=%53,                                               00350000
       SYSWAITDISPMSG=SYSBASE+WAITDISPMSGIX,                            00355000
       CURRACTPRIIX=%54,                                                00360000
       SYSCURRACTPRI=SYSBASE+CURRACTPRIIX,                              00365000
       SYSMAPPINGFIRMWARE=SYSBASE+%220,                        <<06104>>00370000
       SYSMAPSEGBANK=SYSBASE+%221,                             <<06104>>00375000
       SYSMAPSEGADR=SYSBASE+%222,                              <<06104>>00380000
       SYSNRPGMSEGS=SYSBASE+%223,                              <<06104>>00385000
       DISPQHEADIX=%271,                                                00390000
       SYSDISPQHEAD=SYSBASE+DISPQHEADIX,                                00395000
       DISPQTAILIX=%272,                                                00400000
       SYSDISPQTAIL=SYSBASE+DISPQTAILIX,                                00405000
       BUGCATCHIX=%355,                                                 00410000
       SYSBUGCATCH=SYSBASE+BUGCATCHIX,                                  00415000
       LASTBANKIX=%361,                                                 00420000
       SYSLASTBANK=SYSBASE+LASTBANKIX,                                  00425000
       LASTBASEIX=%362,                                                 00430000
       SYSLASTBASE=SYSBASE+LASTBASEIX;                         <<06945>>00435000
                                                                        00440000
<<                                                                      00445000
SYSGLOB CELLS FOR DIRECT DB-REL ACCESS                                  00450000
>>                                                                      00455000
                                                                        00460000
INTEGER PCBSYSBASEINX=DB+PCBIX,                                         00465000
        DSTSYSBASEINX=DB+DSTIX,                                         00470000
        HOLECOUNT=DB+HOLECOUNTIX,                              <<06945>>00475000
        DFC=DB+DFCIX,                                                   00480000
        DFS=DB+DFSIX,                                                   00485000
        ICSSYSBASEINX=DB+ICSIX,                                         00490000
        SLSYSBASEINX=DB+SLIX,                                           00495000
        STATICMPLFENCE=DB+STATICFENCEIX,                       <<06945>>00500000
        SPECQHEAD=DB+SPECQHEADIX,                                       00505000
        MAXAVAILREG=DB+MAXAVAILREGIX,                                   00510000
        NBANKS=DB+NBANKSIX,                                             00515000
        CSTXBLKSYSBASEINX=DB+CSTXBLKIX,                                 00520000
        DISPQHEAD=DB+DISPQHEADIX,                                       00525000
        DISPQTAIL=DB+DISPQTAILIX;                                       00530000
                                                                        00535000
LOGICAL DISPTOAWAKEMSG=DB+DISPAWAKEMSGIX,                               00540000
        CURRACTPRI=DB+CURRACTPRIIX,                                     00545000
        AWAKETOSCHEDMSG=DB+AWAKESCHEDMSGIX,                             00550000
        BUGCATCH=DB+BUGCATCHIX,                                         00555000
        WAITTODISPMSG=DB+WAITDISPMSGIX;                                 00560000
                                                                        00565000
EQUATE FIRSTMEMIX=%20,                                                  00570000
       TIMELASTCYCIX=%22,                                               00575000
       SCANPOINTIX=%265,                                                00580000
       LASTCYCDURIX=%351,                                               00585000
       CYCLETHRESHIX=%353;                                              00590000
DOUBLE SCANPOINT=DB+SCANPOINTIX,                                        00595000
       FIRSTMEMADDR=DB+FIRSTMEMIX,                                      00600000
       LASTMEMORYADDRESS=DB+LASTBANKIX,                        <<06945>>00605000
       TIMEOFLASTCYCLE=DB+TIMELASTCYCIX,                                00610000
       CYCLETHRESHOLD=db+CYCLETHRESHIX,                                 00615000
       LASTCYCLEDURATION=DB+LASTCYCDURIX;                               00620000
                                                               <<06104>>00625000
DEFINE MAPPINGFIRMWARE = ABS(SYSMAPPINGFIRMWARE)#;             <<06104>>00630000
                                                                        00635000
   DEFINE FREE'PHY'CST'HEAD = ABSOLUTE (%1225)#,               <<06282>>00640000
          TOTAL'PHY'CST'NUM = ABSOLUTE (%1224)#;               <<06282>>00645000
   EQUATE CSTSIZE = 4;                                         <<06282>>00650000
                                                               <<06282>>00655000
                                                                        00660000
                                                                        00665000
<<                                                                      00670000
TABLE POINTERS (LST ACCESS)                                             00675000
>>                                                                      00680000
                                                                        00685000
INTEGER POINTER SL=SLIX,                                                00690000
                DST=DSTIX,                                              00695000
                PCB=PCBIX,                                              00700000
                LPDT=LPDTIX,                                            00705000
                SPECREQTAB=SPECREQTABIX,                                00710000
                CSTXBLK=CSTXBLKIX,                                      00715000
                ICS=ICSIX,                                              00720000
                JCUTARR=JCUTIX,                                <<06942>>00725000
                SYSGLOBEXT=SYSGLOBEXTIX;                                00730000
                                                                        00735000
                                                                        00740000
<<                                                                      00745000
SYSGLOB EXTENSION ASSIGNENTS                                            00750000
>>                                                                      00755000
                                                                        00760000
DOUBLE ARRAY                                                   <<06945>>00765000
   HOLELISTHEAD(*) = DB + HOLELISTHEADIX,                      <<06945>>00770000
   HOLELISTTAIL(*) = DB + HOLELISTTAILIX;                      <<06945>>00775000
                                                                        00780000
DEFINE GARBCOLLENABLED=SYSGLOBEXT(3)#,                                  00785000
       FIRSTMEMBANK=SYSGLOBEXT(1)#,                                     00790000
       FIRSTMEMBASE=SYSGLOBEXT(2)#,                                     00795000
       MEMORYPAGESIZE=SYSGLOBEXT(5)#,                                   00800000
       VDSPAGESIZE=SYSGLOBEXT(6)#,                                      00805000
       HOTIMELASTMAKEROOM=SYSGLOBEXT(7)#,                               00810000
       LOTIMELASTMAKEROOM=SYSGLOBEXT(8)#,                               00815000
       MEMPRESSDUREXT=SYSGLOBEXT(9)#,                                   00820000
       MOVETHRESHOLD=SYSGLOBEXT(4)#;                                    00825000
                                                                        00830000
                                                                        00835000
                                                                        00840000
<< LPDT defines >>                                             <<06675>>00845000
                                                               <<06675>>00850000
EQUATE LPDT'DITP = 2;    << Dit pointer from the LPDT >>       <<06675>>00855000
                                                               <<06675>>00860000
<<                                                                      00865000
STANDARD SYSTEM TABLES ENTRY ALLOCATION                                 00870000
>>                                                                      00875000
                                                                        00880000
LOGICAL ARRAY SYSTABENTRY(*) = DB + 0;                         <<06620>>00885000
DOUBLE ARRAY DSYSTABENTRY01(*) = DB + 1;                       <<06620>>00890000
LOGICAL ARRAY SYSTABENTRY00(*)=DB+0,                                    00895000
              SYSTABENTRY01(*)=DB+1,                                    00900000
              SYSTABENTRY02(*)=DB+2,                                    00905000
              SYSTABENTRY03(*)=DB+3,                                    00910000
              SYSTABENTRY04(*)=DB+4,                                    00915000
              SYSTABENTRY05(*)=DB+5,                                    00920000
              SYSTABENTRY16(*)=DB+16;                                   00925000
                                                                        00930000
DEFINE ENTRYWORD00=SYSTABENTRY00(X)#,                                   00935000
       ENTRYWORD01=SYSTABENTRY01(X)#,                                   00940000
       DENTRYWORD01=DSYSTABENTRY01(X)#,                        <<06620>>00945000
       ENTRYWORD02=SYSTABENTRY02(X)#,                                   00950000
       ENTRYWORD03=SYSTABENTRY03(X)#,                                   00955000
       ENTRYWORD04=SYSTABENTRY04(X)#,                                   00960000
       ENTRYWORD05=SYSTABENTRY05(X)#;                                   00965000
                                                                        00970000
$INCLUDE INCSYTAB                                              <<06616>>00975000
                                                               <<01987>>00980000
DEFINE TOTALDISCREQCNT=SYSTABENTRY00(X).(0:8)#,                <<01987>>00985000
       INUSEDISCREQCNT=SYSTABENTRY04(X).(8:8)#;                <<01987>>00990000
                                                               <<06616>>00995000
                                                               <<01987>>01000000
$INCLUDE INCLSIR                                               <<06264>>01005000
$INCLUDE INCLOBJ                                               <<06411>>01010000
$INCLUDE INCLST                                                         01015000
$INCLUDE INCLSLL                                                        01020000
$INCLUDE INCLPCB5                                              <<06650>>01025000
$INCLUDE INCLPCBX                                              <<06212>>01030000
$INCLUDE INCLICS                                                        01035000
$INCLUDE INCLSF                                                <<06411>>01040000
$INCLUDE INCLPXDL                                              <<*7765>>01045000
$INCLUDE INCLPXFT                                              <<*7765>>01050000
$INCLUDE INCLMMST                                              <<06212>>01055000
$INCLUDE INCLREG                                               <<06212>>01060000
$INCLUDE INCLMSG                                                        01065000
                                                                        01070000
$INCLUDE INCLDQH                                               <<06392>>01075000
$INCLUDE INCLIOQ                                               <<06392>>01080000
$INCLUDE INCLKNIO                                              <<06392>>01085000
$INCLUDE INCLDRQ                                               <<06392>>01090000
$INCLUDE INCLCDEF                                              <<06212>>01095000
$INCLUDE INCLLDR                                               <<06948>>01100000
                                                                        01105000
<<                                                                      01110000
BREAKPOINT TABLE                                                        01115000
>>                                                             <<MM.IV>>01120000
                                                               <<MM.IV>>01125000
EQUATE BKPT'FLAG      = SYSBPT,                                <<MM.IV>>01130000
       BPT'DST        = %36,                                   <<MM.IV>>01135000
       BPT'DST'IND    = BPT'DST*4,                             <<MM.IV>>01140000
       SYS'BKPT'EXT'X = 1;        <<INDEX OF HEAD OF SYS LIST>><<MM.IV>>01145000
                                                               <<MM.IV>>01150000
DEFINE SYS'BKPT       = ABSOLUTE(BKPT'FLAG).(15:1)#,           <<MM.IV>>01155000
       BPT'TAB'LOCKED = ABSOLUTE(BKPT'FLAG).(14:1)#,           <<MM.01>>01160000
       BKPT'VALID     = (3:1)#,                                <<06104>>01165000
      BKPT'UPDATING   = (10:1)#;                               <<MM.01>>01170000
                                                               <<MM.IV>>01175000
INTEGER ARRAY BPT(*)  = DB+0;                                  <<MM.IV>>01180000
DOUBLE  ARRAY DBPT(*)  = DB+0;                                 <<06660>>01185000
                                                               <<MM.IV>>01190000
EQUATE   USERLBLMODEOFFSET=1,                                  <<06104>>01195000
         CLABELOFFSET     =2,<<WORD 2 & 3 RESEVERED FOR SEGID>><<06660>>01200000
         PLOCOFFSET       =4,                                  <<06104>>01205000
         INSTROFFSET      =5,                                  <<06104>>01210000
         LINKOFFSET       =6,                                  <<06104>>01215000
         USERLBLOFFSET    =7;                                  <<06104>>01220000
                                                                        01225000
<<                                                                      01230000
MISC                                                                    01235000
>>                                                                      01240000
                                                                        01245000
EQUATE PAGEPOWER=7, <<8>> <<9>>                                         01250000
                                                               <<06212>>01255000
       MAXHOLESIZE=512, <<256>> <<128>>                                 01260000
       ARSBMLENGTH=MAXHOLESIZE/16+1,                                    01265000
       ARLDLENGTH=MAXHOLESIZE*2+2,                                      01270000
       CSTXBMWRDCNT=4;                                         <<06625>>01275000
                                                                        01280000
$INCLUDE inclparm                                              <<06212>>01285000
                                                               <<04663>>01290000
<< THE FOLLOWING DEFINES ARE USED TO SUPPORT PRIVILEGED    >>  <<04663>>01295000
<< MODE BOUNDS CHECKING. GET'XDSEG'LIMITS TRANSFERS THE    >>  <<04663>>01300000
<< BANK, BASE ADDRESS, AND LIMIT ADDRESS TO ICS QI MINUS   >>  <<04663>>01305000
<< AREA. THE INDEX REGISTER IS EXPECTED TO BE POINTING TO  >>  <<04663>>01310000
<< DST ENTRY, WORD 0.                                      >>  <<04663>>01315000
                                                               <<04663>>01320000
DEFINE  GET'XDSEG'LIMITS=                                      <<04663>>01325000
                                                               <<04663>>01330000
  BEGIN                                                        <<04663>>01335000
  TOS:= X;                    << SAVE INDEX REG >>             <<04663>>01340000
  TOS:= DST(X:= X+2);         << GET XDSEG BANK NUM >>         <<04663>>01345000
  TOS:= DST(X:= X+1);         << GET XDSEG BASE ADDR >>        <<04663>>01350000
  ASMB(DUP);                  << COPY XDSEG BASE ADDR >>       <<04663>>01355000
  TOS:= (DST(X:= X-3).(3:13) & LSL(2)) + TOS;                  <<04663>>01360000
  ICS(- ICS'XDSEGLIMCELL):= TOS;    << ICS GETS XDSEG LIMT >>  <<04663>>01365000
  ICS(- ICS'XDSEGBASECELL):= TOS;   << ICS GETS XDSEG BASE >>  <<04663>>01370000
  ICS(- ICS'XDSEGBNKCELL):= TOS;    << ICS GETS XDSEG BANK >>  <<04663>>01375000
  X:= TOS;                          << RESTORE INDEX REG. >>   <<04663>>01380000
  END#;                                                        <<04663>>01385000
                                                               <<04663>>01390000
DEFINE  XFER'XDSEG'LIMITS=                                     <<04663>>01395000
                                                               <<04663>>01400000
  TOS:= 2;                                                     <<04663>>01405000
  ASMB(SBL)#;                     << CPU REG GET XDSEG INFO >> <<04663>>01410000
                                                               <<04663>>01415000
DEFINE   CPUNUM= ASMB(PCN)#,         << GET CPU NUMBER >>      <<04663>>01420000
         SBF   = CON %20104, %11#,   << SET BOUNDS FLAG >>     <<04663>>01425000
         SBL   = CON %20104, %12#;   << SET BOUNDS LIMITS >>   <<04663>>01430000
                                                               <<04663>>01435000
EQUATE SERIES64    = 4;                                        <<04663>>01440000
                                                               <<04663>>01445000
<< PCBX'BNDSINFO GETS THE CURRENT PCBX BANK AND ADDRESS.   >>  <<04663>>01450000
<< GET'PCBXBNDS'FLAG TRANSFERS THE BOUNDS CHECKING STATUS  >>  <<04663>>01455000
<< WORD FOUND IN THE PCBX TO THE ICS QI MINUS AREA.        >>  <<04663>>01460000
<< UPDATE'PCBXBNDS'FLAG TRANSFERS THE BOUNDS STATUS WORD   >>  <<04663>>01465000
<< FOUND IN THE ICS QI MINUS AREA TO THE PCBX. TOS SHOULD  >>  <<04663>>01470000
<< CONTAIN THE PCBX BOUND STATUS WORD, BANK, AND BASE OF   >>  <<04663>>01475000
<< THE PCBX.                                               >>  <<04663>>01480000
                                                               <<04663>>01485000
DEFINE PCBX'BNDSINFO =                                         <<04663>>01490000
                                                               <<04663>>01495000
       TOS:= X;                     << SAVE INDEX REG >>       <<04663>>01500000
       TOS:= ICS'STKBANK;           << GET STACK BANK NUM >>   <<04663>>01505000
       TOS:= ICS'STKBASE+ SBTOPMBNDSTAT;                       <<04663>>01510000
       << GET STACK BASE ADDRESS AND ADD OFFSET >>             <<04663>>01515000
                                                               <<04663>>01520000
       ASMB(LSEA)#;                                            <<04663>>01525000
                                                               <<04663>>01530000
DEFINE GET'PCBXBNDS'FLAG =                                     <<04663>>01535000
                                                               <<04663>>01540000
       BEGIN                                                   <<04663>>01545000
       PCBX'BNDSINFO;                                          <<04663>>01550000
       TOS:= TOS.(0:2);                                        <<04663>>01555000
       ICS(-ICS'PMBNDSTATCELL).(14:2):= TOS;                   <<04663>>01560000
       ICS(-ICS'XDSEGBNKCELL):= -1;                            <<04663>>01565000
       ASMB(DDEL);                                             <<04663>>01570000
       X:= TOS;                                                <<04663>>01575000
       END#;                                                   <<04663>>01580000
                                                               <<04663>>01585000
DEFINE UPDATE'PCBXBNDS'FLAG =                                  <<04663>>01590000
                                                               <<04663>>01595000
       BEGIN                                                   <<04663>>01600000
       PCBX'BNDSINFO;                                          <<04663>>01605000
       TOS.(0:2):= ICS(-ICS'PMBNDSTATCELL).(14:2);             <<04663>>01610000
       ASMB(SSEA;DDEL);                                        <<04663>>01615000
       X:= TOS;                                                <<04663>>01620000
       END#;                                                   <<04663>>01625000
                                                               <<04663>>01630000
DEFINE UPDATE'ICS'XDSEGBNKCELL =                               <<04663>>01635000
                                                               <<04663>>01640000
       BEGIN                                                   <<04663>>01645000
       ABSOLUTE(ABSOLUTE (5)- ICS'XDSEGBNKCELL):= -1;          <<04663>>01650000
       XFER'XDSEG'LIMITS;                                      <<04663>>01655000
       END#;                                                   <<04663>>01660000
                                                               <<04663>>01665000
                                                                        01670000
EQUATE SOFTSWAP=FALSE,   <<SWAPIN'S EFFORT CONTROL PARAMETER>> <<01987>>01675000
       HARDSWAP=TRUE;                                          <<01987>>01680000
                                                               <<01987>>01685000
EQUATE MMOK=0,  <<MEM MANAGEMENT STATUS RETURNS>>              <<01987>>01690000
       MMPREEMPT=4,                                            <<01987>>01695000
       MMIOERR=5,                                              <<01987>>01700000
       MMSEGBUSY=6,                                            <<01987>>01705000
       MMTHRASHDANGER=7,                                       <<01987>>01710000
       MMNOLOCKSPACE=8,                                        <<01987>>01715000
       MMOUTOFDISCREQ=9;                                       <<01987>>01720000
                                                               <<01987>>01725000
                                                               <<06212>>01730000
<<some qualifiers for mmstat parameters>>                      <<06212>>01735000
                                                               <<06212>>01740000
EQUATE                                                         <<06212>>01745000
                                                               <<06212>>01750000
   <<mmstatfetch event parameter 3>>                           <<06212>>01755000
                                                               <<06212>>01760000
   mmstatpres   = 0,                                           <<06212>>01765000
   mmstatroc    = 1,                                           <<06212>>01770000
   mmstatimi    = 2,                                           <<06212>>01775000
   mmstatfullfetch = 3;                                        <<06212>>01780000
                                                               <<01987>>01785000
$INCLUDE INCLMEAS                                                       01790000
                                                               <<04109>>01795000
$INCLUDE INCLMIFT                                              <<04109>>01800000
$INCLUDE INCLJCUT                                              <<06942>>01805000
$PAGE "SOFT INTERRUPT GLOBAL DEFINES."                         <<03041>>01810000
$INCLUDE INCLTRL                                               <<06943>>01815000
                                                               <<03041>>01820000
                                                               <<03041>>01825000
EQUATE                                                         <<03041>>01830000
   UGLYPSEUDOINT  = 4,                                         <<03041>>01835000
   MAXMSGLEN      = 4,                                         <<03041>>01840000
   DELETEMSG      = 0,                                         <<03041>>01845000
   SAVEMSG        = %100000;                                   <<03041>>01850000
                                                               <<03041>>01855000
                                                               <<03041>>01860000
                                                               <<03041>>01865000
EQUATE  <<MMSTAT MMSTATE PSEUDO-INTERRUPT NUMBERS>>            <<03041>>01870000
   HARDKILLER      = 0,                                        <<03041>>01875000
   SOFTKILLER      = 1,                                        <<03041>>01880000
   CONTROLY        = 2,                                        <<03041>>01885000
   BREAKER         = 3,                                        <<03041>>01890000
   SYSOFTINT       = 4,                                        <<03041>>01895000
   USERSOFTINT     = 5;                                        <<03041>>01900000
                                                               <<03041>>01905000
EQUATE  <<PSEUDO-INTERRUPT VALUES>>                            <<03041>>01910000
   HARDKILLVALUE  = 1,                                         <<03041>>01915000
   SOFTKILLVALUE  = 2,                                         <<03041>>01920000
   STOPVALUE      = 3,                                         <<03041>>01925000
   HYBERNATEVALUE = 4,                                         <<03041>>01930000
   CONTROLYVALUE  = 5,                                         <<03041>>01935000
   BREAKVALUE     = 6,                                         <<03041>>01940000
   NORMALVALUE    = 7;                                         <<03041>>01945000
                                                               <<03041>>01950000
EQUATE  <<RETURN VALUES OF TIMEOUT PROCEDURE>>                 <<03041>>01955000
   TIMEOUTOCCURRED= 0,                                         <<03041>>01960000
   TRLXEXHAUSTED  = 1,                                         <<03041>>01965000
   SOFTINTOCCURRED= 2;                                         <<03041>>01970000
                                                               <<03041>>01975000
EQUATE                                                         <<03041>>01980000
   USERMSGPORT    = 1,                                         <<03041>>01985000
   SYSTEMSGPORT   = 2;                                         <<03041>>01990000
                                                               <<k7563>>01995000
PROCEDURE SOFT'DEATH(WHICH);                                   <<k7563>>02000000
   VALUE WHICH;                                                <<k7563>>02005000
   INTEGER WHICH;                                              <<k7563>>02010000
   OPTION EXTERNAL;                                            <<k7563>>02015000
                                                               <<06947>>02020000
PROCEDURE SENDMSG(DESTPIN,DESTPORTNUM,MSGLENGTH,FLAGS);        <<06947>>02025000
VALUE DESTPIN,DESTPORTNUM,MSGLENGTH,FLAGS;                     <<06947>>02030000
INTEGER DESTPIN,DESTPORTNUM,MSGLENGTH;                         <<06947>>02035000
LOGICAL FLAGS;                                                 <<06947>>02040000
OPTION EXTERNAL;                                               <<06947>>02045000
                                                               <<06947>>02050000
INTEGER PROCEDURE PORTSTATUS(PORTNUMBER);                      <<06947>>02055000
VALUE PORTNUMBER;                                              <<06947>>02060000
INTEGER PORTNUMBER;                                            <<06947>>02065000
OPTION EXTERNAL;                                               <<06947>>02070000
                                                               <<06947>>02075000
PROCEDURE RECEIVEMSG(PORTNUM,MSGLENGTH,FLAGS);                 <<06947>>02080000
VALUE PORTNUM,MSGLENGTH,FLAGS;                                 <<06947>>02085000
INTEGER PORTNUM,MSGLENGTH;                                     <<06947>>02090000
LOGICAL FLAGS;                                                 <<06947>>02095000
OPTION EXTERNAL;                                               <<06947>>02100000
                                                               <<06947>>02105000
PROCEDURE PORTSEG'COMPLETOR(REQ'ID);                           <<06947>>02110000
VALUE REQ'ID;                                                  <<06947>>02115000
INTEGER REQ'ID;                                                <<06947>>02120000
OPTION EXTERNAL;                                               <<06947>>02125000
$include inclcimp                                              <<06212>>02130000
$INCLUDE INCLIOIM                                              <<06212>>02135000
$INCLUDE INCLMIMP                                              <<06212>>02140000
$page "Exportable Forward Procedure Declarations"              <<06212>>02145000
                                                               <<06212>>02150000
INTEGER PROCEDURE CONVEXTLABELTODELTAP(EXTLABEL);              <<03041>>02155000
VALUE EXTLABEL;                                                <<03041>>02160000
INTEGER EXTLABEL;                                              <<03041>>02165000
OPTION FORWARD;                                                <<03041>>02170000
                                                                        02175000
DOUBLE  PROCEDURE BUILDSEGID(SEGTYPE,SEGNO,PIN);               <<06660>>02180000
   VALUE SEGTYPE,SEGNO,PIN;                                    <<06104>>02185000
   INTEGER SEGTYPE,SEGNO,PIN;                                  <<06104>>02190000
   OPTION FORWARD;                                             <<06104>>02195000
                                                               <<06104>>02200000
INTEGER PROCEDURE CONVSEGIDTOSTINX(SEGID);                     <<06104>>02205000
   VALUE SEGID;                                                <<06104>>02210000
   DOUBLE  SEGID;                                              <<06660>>02215000
   OPTION FORWARD;                                             <<06104>>02220000
                                                               <<06104>>02225000
INTEGER PROCEDURE CSTCONV(PLABEL,PCBPT);                       <<06104>>02230000
   VALUE PLABEL,PCBPT;                                         <<06104>>02235000
   INTEGER PLABEL,PCBPT;                                       <<06104>>02240000
   OPTION FORWARD;                                             <<06104>>02245000
                                                               <<06104>>02250000
DOUBLE  PROCEDURE MAPPEDCSTTOPHYCST(PLABEL,PCBPT);             <<06660>>02255000
   VALUE PLABEL,PCBPT;                                         <<06104>>02260000
   INTEGER PLABEL,PCBPT;                                       <<06104>>02265000
   OPTION FORWARD;                                             <<06104>>02270000
                                                               <<06104>>02275000
PROCEDURE AWAKE (PCBPT,WAKECODE,WAITFLAGS);                             02280000
VALUE PCBPT,WAKECODE,WAITFLAGS;                                         02285000
INTEGER PCBPT,WAITFLAGS;                                                02290000
LOGICAL WAKECODE;                                                       02295000
OPTION FORWARD;                                                         02300000
                                                                        02305000
PROCEDURE IMPEDE(PCBPT);                                                02310000
VALUE PCBPT;                                                            02315000
INTEGER PCBPT;                                                          02320000
OPTION FORWARD;                                                         02325000
                                                                        02330000
PROCEDURE UNIMPEDE(PCBPT);                                              02335000
VALUE PCBPT;                                                            02340000
INTEGER PCBPT;                                                          02345000
OPTION FORWARD;                                                         02350000
                                                                        02355000
PROCEDURE QUEUEPROC(PROCSYSDBINX,QUEUENAME,LOCATION);                   02360000
VALUE PROCSYSDBINX,QUEUENAME,LOCATION;                                  02365000
INTEGER PROCSYSDBINX,QUEUENAME,LOCATION;                                02370000
OPTION FORWARD;                                                         02375000
                                                                        02380000
PROCEDURE IOFREEZE'(OBJIDENT);                                 <<06212>>02385000
VALUE OBJIDENT;                                                <<06212>>02390000
DOUBLE  OBJIDENT;                                              <<06660>>02395000
OPTION FORWARD;                                                         02400000
                                                                        02405000
PROCEDURE IOUNFREEZE'(OBJIDENT);                               <<06212>>02410000
VALUE OBJIDENT;                                                <<06212>>02415000
DOUBLE  OBJIDENT;                                              <<06660>>02420000
OPTION FORWARD;                                                         02425000
LOGICAL PROCEDURE SETSYSDB;                                    <<06616>>02430000
OPTION FORWARD;                                                <<06616>>02435000
                                                               <<06616>>02440000
PROCEDURE RESETDB(WHERE);                                      <<06616>>02445000
VALUE WHERE;                                                   <<06616>>02450000
INTEGER WHERE;                                                 <<06616>>02455000
OPTION FORWARD;                                                <<06616>>02460000
                                                               <<06616>>02465000
LOGICAL PROCEDURE EXCHANGEDB(WHERE);                           <<06616>>02470000
VALUE WHERE;                                                   <<06616>>02475000
INTEGER WHERE;                                                 <<06616>>02480000
OPTION FORWARD;                                                <<06616>>02485000
                                                               <<06616>>02490000
                                                               <<06212>>02495000
PROCEDURE QueueOnObject(OBJIDENT);                             <<06212>>02500000
VALUE OBJIDENT;                                                <<06212>>02505000
DOUBLE  OBJIDENT;                                              <<06660>>02510000
OPTION FORWARD;                                                <<06212>>02515000
                                                               <<06212>>02520000
PROCEDURE WAIT(EVENTMASK,SPECIALINFO);                         <<06212>>02525000
VALUE EVENTMASK,SPECIALINFO;                                   <<06212>>02530000
INTEGER EVENTMASK;                                             <<06212>>02535000
LOGICAL SPECIALINFO;                                           <<06212>>02540000
OPTION FORWARD;                                                <<06212>>02545000
                                                               <<06212>>02550000
PROCEDURE ADDTOLOCALITY(SLLHEADINX,OBJIDENTIFIER,FLAGS);       <<06660>>02555000
VALUE SLLHEADINX,OBJIDENTIFIER,FLAGS;                          <<06660>>02560000
INTEGER SLLHEADINX,FLAGS;                                      <<06660>>02565000
DOUBLE OBJIDENTIFIER;                                          <<06660>>02570000
OPTION FORWARD;                                                <<06212>>02575000
                                                               <<06212>>02580000
PROCEDURE PreFetchObject(Pin, ObjID);                          <<06212>>02585000
VALUE Pin, ObjID;                                              <<06212>>02590000
INTEGER Pin;                                                   <<06212>>02595000
DOUBLE  ObjID;                                                 <<06660>>02600000
OPTION FORWARD;                                                <<06212>>02605000
                                                               <<06212>>02610000
PROCEDURE ADJUSTLOCALITY(PROCINX,OBJIDENT,REQSIZE,FLAGS);      <<06212>>02615000
VALUE PROCINX,OBJIDENT,REQSIZE,FLAGS;                          <<06212>>02620000
LOGICAL PROCINX,REQSIZE,FLAGS;                                 <<06660>>02625000
DOUBLE OBJIDENT;                                               <<06660>>02630000
OPTION FORWARD;                                                <<06212>>02635000
                                                               <<06212>>02640000
LOGICAL PROCEDURE SETCRITICAL;                                 <<06212>>02645000
OPTION FORWARD;                                                <<06212>>02650000
                                                               <<06212>>02655000
PROCEDURE RESETCRITICAL(OLDCRITICAL);                          <<06212>>02660000
VALUE OLDCRITICAL;                                             <<06212>>02665000
                                                               <<06212>>02670000
LOGICAL OLDCRITICAL;                                           <<06212>>02675000
OPTION FORWARD;                                                <<06212>>02680000
                                                               <<06212>>02685000
PROCEDURE RELEASEREGION(REGIONBASE,REQSIZE);                   <<06212>>02690000
VALUE REGIONBASE,REQSIZE;                                      <<06212>>02695000
DOUBLE REGIONBASE;                                             <<06212>>02700000
INTEGER REQSIZE;                                               <<06212>>02705000
OPTION FORWARD;                                                <<06212>>02710000
                                                               <<06212>>02715000
PROCEDURE STARTOBJWRITE(OBJID,URGCLASS,REGIONBASE,LOGXFERREQ,  <<06212>>02720000
                        DISCREQINX);                           <<06212>>02725000
VALUE OBJID,URGCLASS,REGIONBASE,LOGXFERREQ,DISCREQINX;         <<06212>>02730000
DOUBLE  OBJID;                                                 <<06660>>02735000
INTEGER URGCLASS,LOGXFERREQ,DISCREQINX;                        <<06212>>02740000
DOUBLE REGIONBASE;                                             <<06212>>02745000
OPTION FORWARD;                                                <<06212>>02750000
                                                               <<06212>>02755000
PROCEDURE RECOVEROC (OBJID,SEGDESCSTINX, OCREGIONBASE);        <<06212>>02760000
VALUE OBJID, SEGDESCSTINX, OCREGIONBASE;                       <<06212>>02765000
DOUBLE OCREGIONBASE,OBJID;                                     <<06660>>02770000
INTEGER SEGDESCSTINX;                                          <<06660>>02775000
OPTION FORWARD;                                                <<06212>>02780000
                                                               <<06212>>02785000
$page "Non-Exportable Forward Declarations"                    <<06212>>02790000
                                                               <<06212>>02795000
PROCEDURE COLLECTGARBAGE(SINGLEHOLEBASE);                      <<06212>>02800000
VALUE SINGLEHOLEBASE;                                          <<06212>>02805000
DOUBLE SINGLEHOLEBASE;                                         <<06212>>02810000
OPTION FORWARD;                                                <<06212>>02815000
                                                               <<06212>>02820000
PROCEDURE PROCESSINITMSG(REGIONBASE);                          <<06212>>02825000
VALUE REGIONBASE;                                              <<06212>>02830000
DOUBLE REGIONBASE;                                             <<06212>>02835000
OPTION FORWARD;                                                <<06212>>02840000
                                                               <<06212>>02845000
                                                               <<06212>>02850000
                                                               <<06212>>02855000
PROCEDURE PROCESSCOMPMSG(REGIONBASE,OBJIDENT,DESCSTINX,IOSTAT);<<06212>>02860000
VALUE REGIONBASE,OBJIDENT,DESCSTINX,IOSTAT;                    <<06212>>02865000
DOUBLE REGIONBASE;                                             <<06212>>02870000
DOUBLE  OBJIDENT;                                              <<06660>>02875000
INTEGER DESCSTINX,IOSTAT;                                      <<06212>>02880000
OPTION FORWARD;                                                <<06212>>02885000
                                                               <<06212>>02890000
                                                               <<06212>>02895000
INTEGER PROCEDURE SwapIn(swapinprocinx,swapinstructions);      <<06411>>02900000
VALUE swapinprocinx,swapinstructions;                          <<06411>>02905000
INTEGER swapinprocinx;                                         <<06411>>02910000
LOGICAL swapinstructions;                                      <<06411>>02915000
OPTION FORWARD;                                                <<06411>>02920000
                                                               <<06212>>02925000
$PAGE "MMSTAT : EVENT TRACE GENERATOR"                         <<06212>>02930000
                                                               <<06212>>02935000
<<*************************************************************<<06212>>02940000
                                                               <<06212>>02945000
COMMENT  THIS FUNCTION IS CALLED TO MONITOR AND/OR COLLECT     <<06212>>02950000
         PERFORMANCE MEASUREMENT DATA;                         <<06212>>02955000
PROCEDURE MMSTAT'(EVENT,P1,P2,P3,P4,P5,P6);                    <<06948>>02960000
VALUE EVENT,P1,P2,P3,P4,P5,P6;                                 <<06948>>02965000
INTEGER EVENT,P1,P2,P3,P4,P5,P6;                               <<06948>>02970000
OPTION         PRIVILEGED,UNCALLABLE;                          <<01658>>02975000
                                                               <<01658>>02980000
                                                               <<01658>>02985000
BEGIN <<MMSTAT>>                                               <<01658>>02990000
                                                               <<01658>>02995000
INTEGER                                                        <<06948>>03000000
   PCBPT,                                                      <<06948>>03005000
   OFFSET;                                                     <<06948>>03010000
DOUBLE                                                         <<06948>>03015000
   BASE,                                                       <<06948>>03020000
   SAVE'DB;                                                    <<06948>>03025000
                                                               <<01658>>03030000
INTRINSIC        TIMER;                 <<TIME FUNCTION>>      <<01658>>03035000
$PAGE "SYSTEM TABLE MANAGEMENT : GET SYSTAB ENTRY"                      03040000
                                                               <<01658>>03045000
                                                               <<01658>>03050000
                                                               <<01658>>03055000
DOUBLE SUBROUTINE CONVERT'POINTER'TO'DOUBLE'ADDRESS(PTR);      <<06948>>03060000
VALUE PTR;                                                     <<06948>>03065000
LOGICAL PTR;                                                   <<06948>>03070000
BEGIN                                                          <<06948>>03075000
                                                               <<06948>>03080000
TOS := ABS(SYSBASE + PTR).(11:5); << extract bank >>           <<06948>>03085000
TOS := ABS(X) LAND %177740; << extract address >>              <<06948>>03090000
BASE := TOS;                                                   <<06948>>03095000
CONVERT'POINTER'TO'DOUBLE'ADDRESS := BASE;                     <<06948>>03100000
                                                               <<06948>>03105000
END; << subrouine CONVERT'POINTER'TO'DOUBLE'ADDRESS >>         <<06948>>03110000
                                                               <<06948>>03115000
<< IF A PROCESS IS EXECUTING, GET ITS PIN >>                   <<01658>>03120000
                                                               <<01658>>03125000
PCBPT := CURPRC;                                               <<06948>>03130000
                                                               <<01658>>03135000
                                                               <<01658>>03140000
<< IF THE EVENT NUMBER IS POSITIVE THEN >>                     <<01658>>03145000
<<                                      >>                     <<01658>>03150000
<<      CHECK EVENT VALIDITY            >>                     <<01658>>03155000
<<      DISABLE INTERRUPTS              >>                     <<01658>>03160000
<<      XCHD TO SYSDB                   >>                     <<01658>>03165000
<<      LOG THE EVENT TO MONBUF         >>                     <<01658>>03170000
<<                                      >>                     <<01658>>03175000
<< IF THE EVENT NUMBER IS NEGATIVE THEN >>                     <<01658>>03180000
<<                                      >>                     <<01658>>03185000
<<      MAKE IT POSITIVE                >>                     <<01658>>03190000
<<      CHECK ITS VALIDITY              >>                     <<01658>>03195000
<<      DISABLE INTERRUPTS              >>                     <<01658>>03200000
<<      XCHD TO SYSDB                   >>                     <<01658>>03205000
                                                               <<01658>>03210000
                                                               <<01658>>03215000
                                                               <<01658>>03220000
                                                               <<01658>>03225000
<<  Turn off traps >>                                          <<04442>>03230000
PUSH(STATUS);                                                  <<04442>>03235000
TOS.(2:1) := 0;                                                <<04442>>03240000
SET(STATUS);                                                   <<04442>>03245000
                                                               <<01658>>03250000
TOS := EVENT;                                                  <<01658>>03255000
                                                               <<01658>>03260000
IF >= THEN                                                     <<01658>>03265000
                                                               <<01658>>03270000
  BEGIN <<POSITIVE EVENT>>                                     <<01658>>03275000
                                                               <<01658>>03280000
  IF EVENT > MAXEVENTNUMBER THEN                               <<06948>>03285000
     RETURN;                                                   <<06948>>03290000
                                                               <<*8487>>03295000
  DISABLE;                                                     <<*8487>>03300000
  push(z); push(s); assemble(sub);                             <<01934>>03305000
                                                               <<01658>>03310000
  if TOS<34 then return; <<MMstat cant stand a stack overflow>><<*8487>>03315000
                                                               <<01658>>03320000
  TOS := SYSBASE D;                                            <<06948>>03325000
                                                               <<01658>>03330000
  ASSEMBLE(XCHD);                                              <<01658>>03335000
  SAVE'DB := TOS;                                              <<06948>>03340000
                                                               <<01658>>03345000
                                                               <<01658>>03350000
                                                               <<01658>>03355000
<< Save procinx, event, and parms into MONBUF >>               <<06948>>03360000
                                                               <<01658>>03365000
  SMONBUF(SMONDIX) := PCBPT;                                   <<06948>>03370000
  SMONBUF(X := X + 1) := EVENT;                                <<06948>>03375000
  SMONBUF(X:=X+1)  := P1;                                      <<01658>>03380000
  SMONBUF(X:=X+1)  := P2;                                      <<01658>>03385000
  SMONBUF(X:=X+1)  := P3;                                      <<01658>>03390000
  SMONBUF(X := X + 1) := P4;                                   <<06948>>03395000
  SMONBUF(X := X + 1) := P5;                                   <<06948>>03400000
  SMONBUF(X := X + 1) := P6;                                   <<06948>>03405000
                                                               <<06948>>03410000
                                                               <<06948>>03415000
                                                               <<01658>>03420000
                                                               <<01658>>03425000
<< IF THE END OF THE BUFFER HAS BEEN REACHED, >>               <<01658>>03430000
<< SET THE BUFFER INDEX TO THE START OF THE   >>               <<01658>>03435000
<< BUFFER AND RESET THE TIME STAMPS IN THE    >>               <<01658>>03440000
<< FIRST ENTRY.  THIS ENTRY CONTAINS TWO TIME >>               <<01658>>03445000
<< TIME STAMPS INDICATING THE LAST TWO TIMES  >>               <<01658>>03450000
<< WRAP AROUND HAS OCCURED.  TIME STAMPS ARE  >>               <<01658>>03455000
<< TWO WORDS IN LENGTH.                       >>               <<01658>>03460000
                                                               <<01658>>03465000
                                                               <<01658>>03470000
   IF (SMONDIX := SMONDIX + SMON'ENTRY'SIZE) >=                <<06948>>03475000
       SMONBUFSIZE THEN                                        <<06948>>03480000
                                                               <<01658>>03485000
     BEGIN <<MONBUF WRAP AROUND>>                              <<01658>>03490000
                                                               <<01658>>03495000
     SMONDIX := SMON'ENTRY'SIZE;                               <<*8487>>03500000
     TOS := TIMER;            <<GET NEW TIME STAMP>>           <<01658>>03505000
     TOS := SMONBUF(0);       <<GET OLD TIME STAMP>>           <<01658>>03510000
     TOS := SMONBUF(X:=X+1);                                   <<01658>>03515000
     SMONBUF(X:=X+2) := TOS;  <<SAVE OLD TIME STAMP>>          <<01658>>03520000
     SMONBUF(X:=X-1) := TOS;                                   <<01658>>03525000
     SMONBUF(X:=X-1) := TOS;  <<SAVE NEW TIME STAMP>>          <<01658>>03530000
     SMONBUF(X:=X-1) := TOS;                                   <<01658>>03535000
                                                               <<01658>>03540000
     END; <<MONBUF WRAP AROUND>>                               <<01658>>03545000
                                                               <<01658>>03550000
  END <<POSITIVE EVENT>>                                       <<01658>>03555000
                                                               <<01658>>03560000
ELSE                                                           <<01658>>03565000
                                                               <<01658>>03570000
  BEGIN <<NEGATIVE EVENT>>                                     <<01658>>03575000
                                                               <<01658>>03580000
  TOS := -EVENT;                                               <<01658>>03585000
                                                               <<01658>>03590000
  IF (EVENT := TOS) > MAXEVENTNUMBER THEN                      <<06948>>03595000
     RETURN;                                                   <<06948>>03600000
                                                               <<01658>>03605000
  DISABLE;                                                     <<01658>>03610000
  TOS := SYSBASE D;                                            <<06948>>03615000
  ASSEMBLE(XCHD);                                              <<01658>>03620000
  SAVE'DB := TOS;                                              <<06948>>03625000
                                                               <<01658>>03630000
  END; <<NEGATIVE EVENT>>                                      <<01658>>03635000
                                                               <<01658>>03640000
                                                               <<01658>>03645000
<< IF A MONITOR RUN IS REQUESTED THEN LOG THE EVENT >>         <<01658>>03650000
<< TO THE MEASBUF DOUBLE BUFFER SET AND CALL MEASIO >>         <<01658>>03655000
<< WHEN A BUFFER IS FILLED.                         >>         <<01658>>03660000
                                                               <<01658>>03665000
                                                               <<01658>>03670000
IF (TOS:=MEASFLAG) THEN                                        <<01658>>03675000
                                                               <<01658>>03680000
  BEGIN <<MEASUREMENT ENABLED>>                                <<01658>>03685000
                                                               <<01658>>03690000
                                                               <<01658>>03695000
<< COMPUTE THE GROUP ID (MODULO 10) AND TEST ITS >>            <<01658>>03700000
<< CORRESPONDING MEASUREMENT ENABLE FLAG.        >>            <<01658>>03705000
                                                               <<01658>>03710000
                                                               <<01658>>03715000
  TOS := EVENT/10;                                             <<01658>>03720000
  ASSEMBLE(TRBC 11);                                           <<01658>>03725000
                                                               <<01658>>03730000
  TOS := IF = THEN MEAS'MSK0 ELSE MEAS'MSK1;                   <<04109>>03735000
                                                               <<01658>>03740000
  ASSEMBLE(STBX; TBC 0,X; DDEL);                               <<01658>>03745000
                                                               <<01658>>03750000
                                                               <<01658>>03755000
                                                               <<01658>>03760000
<< IF THE EVENT IS ENABLED FOR MONTIORING, DUMP IT   >>        <<01658>>03765000
<< TO THE CURRENT MEASUREMENT BUFFER.  IF THE BUFFER >>        <<01658>>03770000
<< IS FILLED, CALL "MEASIO" TO WRITE THE BUFFER TO   >>        <<01658>>03775000
<< TAPE AND SWITCH TO THE OTHER BUFFER.              >>        <<01658>>03780000
                                                               <<01658>>03785000
                                                               <<01658>>03790000
                                                               <<01658>>03795000
  IF <> THEN                            <<TEST ENABLE FLAG>>   <<01658>>03800000
                                                               <<01658>>03805000
     BEGIN <<EVENT ENABLED>>                                   <<01658>>03810000
                                                               <<01658>>03815000
     ASSEMBLE(TBC 14);                  <<TEST GROUP FLAG>>    <<01658>>03820000
     OFFSET := IF = THEN 0 ELSE MEASBUFSIZE;                   <<06948>>03825000
                                                               <<02725>>03830000
     TOS := TIMER;                                             <<01658>>03835000
     ASSEMBLE(XCH);                                            <<01658>>03840000
     MEASBUF(INTEGER(MEAS'IDX) + OFFSET) := TOS;               <<06948>>03845000
     MEASBUF(X:=X+1)  := TOS;                                  <<01658>>03850000
     MEASBUF(X := X + 1) := PCBPT;                             <<06948>>03855000
     MEASBUF(X:=X+1)  := EVENT;                                <<01658>>03860000
     MEASBUF(X:=X+1)  := P1;                                   <<01658>>03865000
     MEASBUF(X:=X+1)  := P2;                                   <<01658>>03870000
     MEASBUF(X:=X+1)  := P3;                                   <<01658>>03875000
     MEASBUF(X := X + 1) := P4;                                <<06948>>03880000
     MEASBUF(X := X + 1) := P5;                                <<06948>>03885000
     MEASBUF(X := X + 1) := P6;                                <<06948>>03890000
                                                               <<01658>>03895000
     IF (MEAS'IDX := MEAS'IDX + MEAS'ENTRY'SIZE) >=            <<06948>>03900000
         MEASBUFSIZE THEN                                      <<06948>>03905000
                                                               <<01658>>03910000
        BEGIN <<WRITE BUFFER>>                                 <<01658>>03915000
                                                               <<01658>>03920000
        MEAS'IDX := 0;                                         <<04109>>03925000
        ASSEMBLE(TCBC 14; DUP);   <<SWITCH BUFFER FLAG>>       <<01658>>03930000
        MEASFLAG := TOS;          <<SAVE IN CASE INTERRUPTED>> <<01658>>03935000
        TOS := 0;                 <<RESULT>>                   <<01658>>03940000
        TOS := MEAS'LDEV;         <<TAPE LDEV>>                <<04109>>03945000
        TOS := 1;                 <<MEASIO WRITE REQUEST>>     <<01658>>03950000
        TOS := CONVERT'POINTER'TO'DOUBLE'ADDRESS(MEASBUFPTR);  <<06948>>03955000
        TOS := TOS + OFFSET;                                   <<06948>>03960000
        TOS := MEASBUFSIZE;       <<MEASBUF SIZE>>             <<01658>>03965000
        TOS := MEAS'PLAB;         <<MEASIO PLABEL>>            <<04109>>03970000
                                                               <<02725>>03975000
        TOS := SYSBASE D;                                      <<06948>>03980000
        ASSEMBLE(XCHD;DDEL);                                   <<02725>>03985000
                                                               <<02725>>03990000
        ASSEMBLE(PCAL 0);         <<CALL MEASIO>>              <<01658>>03995000
                                                               <<01658>>04000000
                                                               <<01658>>04005000
                                                               <<01658>>04010000
<< ON RETURN FROM "MEASIO", CHECK THE TAPE STATUS  >>          <<01658>>04015000
<< AND MARK THE APPROPRIATE MEASFLAG BIT:          >>          <<01658>>04020000
<<          MEASFLAG(12:1) - TAPE ERROR            >>          <<01658>>04025000
<<          MEASFLAG(13:1) - END OF TAPE           >>          <<01658>>04030000
<<          MEASFLAG(14:1) - BUFFER SELECT         >>          <<01658>>04035000
<<          MEASFLAG(15:1) - MEASIO ENABLE         >>          <<01658>>04040000
                                                               <<01658>>04045000
        DEL;                 <<DELETE TAPE STATUS WORD>>       <<01658>>04050000
                                                               <<01658>>04055000
        IF <> THEN           <<TEST TAPE STATUS>>              <<01658>>04060000
                                                               <<01658>>04065000
           BEGIN <<TAPE STATUS>>                               <<01658>>04070000
                                                               <<01658>>04075000
           IF > THEN TOS.(13:1) := 1    <<END OF TAPE>>        <<01658>>04080000
                ELSE TOS.(12:1) := 1;   <<TAPE ERROR>>         <<01658>>04085000
                                                               <<01658>>04090000
           TOS.(15:1) := 0;             <<CLEAR MEASIO ENABLE>><<01658>>04095000
                                                               <<01658>>04100000
           END; <<TAPE STATUS>>                                <<01658>>04105000
                                                               <<01658>>04110000
        END; <<WRITE BUFFER>>                                  <<01658>>04115000
                                                               <<01658>>04120000
     END; <<EVENT ENABLED>>                                    <<01658>>04125000
                                                               <<01658>>04130000
  MEASFLAG := TOS;                 <<RESTORE MEASFLAG>>        <<01658>>04135000
                                                               <<01658>>04140000
  END <<MEASUREMENT ENABLED>>                                  <<01658>>04145000
                                                               <<01658>>04150000
                                                               <<01658>>04155000
ELSE                                                           <<01658>>04160000
                                                               <<01658>>04165000
  DEL;                             <<DELETE MEASFLAG>>         <<01658>>04170000
                                                               <<01658>>04175000
TOS := SAVE'DB;                                                <<06948>>04180000
ASSEMBLE(XCHD);                                                <<01658>>04185000
DDEL;                                                          <<06948>>04190000
                                                               <<01658>>04195000
END; <<MMSTAT>>                                                <<01658>>04200000
                                                               <<06212>>04205000
$PAGE "STANDARD SYSTEM TABLE ENTRY MANAGEMENT"                 <<06212>>04210000
                                                               <<06212>>04215000
LOGICAL PROCEDURE GETSYSTABENTRY(TABLEDST,PRIMARY,WAIT);       <<06616>>04220000
VALUE TABLEDST,PRIMARY,WAIT;                                   <<06616>>04225000
LOGICAL TABLEDST,PRIMARY,WAIT;                                 <<06616>>04230000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06616>>04235000
BEGIN                                                          <<06616>>04240000
                                                               <<06616>>04245000
LOGICAL                                                        <<06616>>04250000
   RETURNVALUE = GETSYSTABENTRY,                               <<06616>>04255000
   PREV,                                                       <<06616>>04260000
   NEXT,                                                       <<06616>>04265000
   ENTRIESUSED,                                                <<06616>>04270000
   ABSOLUTE'DB,                                                <<06616>>04275000
   UCODE'KNOWN'TABLE,                                          <<06616>>04280000
   PCBPT,                                                      <<06616>>04285000
   NUM'FREE'ENTRIES,                                           <<06616>>04290000
   SECONDARY'IS'FULL,                                          <<06616>>04295000
   SEGMENT'WAS'ABSENT,                                         <<06616>>04300000
   ORIGINAL'DST,                                               <<06616>>04305000
   ENTRYSIZE;                                                  <<06616>>04310000
DOUBLE                                                         <<06616>>04315000
   SAVEDB;                                                     <<06616>>04320000
                                                               <<06616>>04325000
                                                               <<06616>>04330000
<< SEE IF SEGMENT IS PRESENT >>                                <<06616>>04335000
                                                               <<06616>>04340000
                                                               <<06620>>04345000
IF NOT LOGICAL(DST(TABLEDST&LSL(2)+1)).SEGRESIDENTFLAG         <<06620>>04350000
    THEN SUDDENDEATH(605);                                     <<06620>>04355000
DISABLE;                                                       <<06616>>04360000
PCBPT := CURPRC;                                               <<06650>>04365000
SEGMENT'WAS'ABSENT := LOGICAL(DST(TABLEDST&LSL(2))).ABSENTFLAG;<<06616>>04370000
ABSOLUTE'DB := DBXDSINFO.ABSDBFLAG;                            <<06650>>04375000
<< PUT DB AT THAT SEGMENT >>                                   <<06616>>04380000
IF SEGMENT'WAS'ABSENT THEN                                     <<06616>>04385000
   BEGIN                                                       <<06616>>04390000
   IF CURPRC = 0 THEN                                          <<06650>>04395000
      SUDDENDEATH(900);                                        <<06616>>04400000
   IF ABSOLUTE'DB THEN                                         <<06616>>04405000
      BEGIN                                                    <<06616>>04410000
      PUSH(DB);                                                <<06616>>04415000
      SAVEDB := TOS;                                           <<06616>>04420000
      RESETDB(-1);                                             <<06616>>04425000
      END;                                                     <<06616>>04430000
   ORIGINAL'DST := EXCHANGEDB(TABLEDST);                       <<06616>>04435000
   END                                                         <<06616>>04440000
ELSE                                                           <<06616>>04445000
   BEGIN                                                       <<06616>>04450000
   TOS := DST(TABLEDST&LSL(2) + 2); << BANK >>                 <<06616>>04455000
   TOS := DST(X + 1); << ADDRESS >>                            <<06616>>04460000
   ASMB(XCHD);                                                 <<06616>>04465000
   SAVEDB := TOS;                                              <<06616>>04470000
   END;                                                        <<06616>>04475000
AGAIN :                                                        <<07320>>04480000
                                                               <<06616>>04485000
   X := 0; << FOR ADDRESSING DB DIRECT INDEXED >>              <<06616>>04490000
   ENTRYSIZE := SYSTABENTRYSIZE;                               <<06616>>04495000
   UCODE'KNOWN'TABLE:=TABLEDST=DSTDST LOR TABLEDST=CSTDST;     <<06616>>04500000
   SECONDARY'IS'FULL := IF NOT UCODE'KNOWN'TABLE AND           <<06616>>04505000
                          SYSTABFREECNT <= SYSTABPRIMARYNUM    <<06753>>04510000
                        THEN TRUE ELSE FALSE;                  <<06753>>04515000
   NUM'FREE'ENTRIES := SYSTABFREECNT - 1;                      <<06616>>04520000
   IF < AND (PRIMARY LOR UCODE'KNOWN'TABLE) OR                 <<07320>>04525000
      SECONDARY'IS'FULL AND NOT PRIMARY AND NOT WAIT THEN      <<06616>>04530000
      BEGIN                                                    <<06616>>04535000
      GETSYSTABENTRY := 0                                      <<06616>>04540000
      END                                                      <<06616>>04545000
   ELSE                                                        <<06616>>04550000
      BEGIN                                                    <<06616>>04555000
      IF NOT UCODE'KNOWN'TABLE THEN                            <<06616>>04560000
         BEGIN                                                 <<06616>>04565000
         IF NOT PRIMARY THEN                                   <<06616>>04570000
            IF SECONDARY'IS'FULL THEN                          <<06616>>04575000
               BEGIN                                           <<06616>>04580000
               IF SYSTABIMPHEADINX = 0 THEN << FIRST TIME >>   <<06616>>04585000
                  BEGIN                                        <<06616>>04590000
                  PIMPPIN := 0;                                <<06650>>04595000
                  NIMPPIN := 0;                                <<06650>>04600000
                  X := 0;                                      <<06616>>04605000
                  SYSTABIMPHEADINX := PCBPT;                   <<06616>>04610000
                  END                                          <<06616>>04615000
               ELSE                                            <<06616>>04620000
                  BEGIN                                        <<06616>>04625000
                  NIMPPIN := 0;                                <<07320>>04630000
                  PIMPPIN := SYSTABIMPTAIL;                    <<*7564>>04635000
                  TOS := PCBPT;                                <<*7564>>04640000
                  PCBPT := SYSTABIMPTAIL;                      <<07320>>04645000
                  NIMPPIN := S0;                               <<*7564>>04650000
                  PCBPT := TOS;                                <<*7564>>04655000
                  END;                                         <<06616>>04660000
               X := 0;                                         <<06616>>04665000
               SYSTABIMPTAILINX := PCBPT;                      <<06616>>04670000
               SYSTABIMPCURRENTNUM := SYSTABIMPCURRENTNUM+1;   <<06616>>04675000
               SYSTABIMPCUM := SYSTABIMPCUM + 1;               <<06616>>04680000
               IF SYSTABIMPCURRENTNUM > SYSTABIMPMAX THEN      <<06616>>04685000
                  SYSTABIMPMAX := SYSTABIMPCURRENTNUM;         <<06616>>04690000
               IMPEDE(0);                                      <<06616>>04695000
               IF NOT SEGMENT'WAS'ABSENT THEN                  <<06616>>04700000
                  BEGIN << PUT DB BACK, DSP PUT US AT STACK >> <<06616>>04705000
                  TOS := DST(TABLEDST&LSL(2) + 2);             <<06616>>04710000
                  TOS := DST(X + 1);                           <<06616>>04715000
                  ASMB(XCHD);                                  <<06616>>04720000
                  DDEL;                                        <<06616>>04725000
                  X := 0;                                      <<06616>>04730000
                  END;                                         <<06616>>04735000
               GO AGAIN;                                       <<07320>>04740000
               END;<<CASE OF NOT HAVING SECONDARY ENTRIES>>    <<06616>>04745000
         END; << CASE OF NON SPECIAL PRIMARY/SECONDARY REQS >> <<06616>>04750000
      SYSTABFREECNT := SYSTABFREECNT - 1;                      <<06616>>04755000
      GETSYSTABENTRY := X := SYSTABFIRSTFREEINX;               <<06616>>04760000
      IF X = 0 THEN SUDDENDEATH(605);                          <<s8699>>04765000
      NEXT := SYSTABENTRYNEXTFREEINX;                          <<06616>>04770000
      IF NEXT = 0 AND NUM'FREE'ENTRIES > 0 THEN                <<s8699>>04775000
         SUDDENDEATH(605);                                     <<s8699>>04780000
      SYSTABENTRY00(X) := 0;                                   <<06616>>04785000
      X := 0;                                                  <<06616>>04790000
      SYSTABFIRSTFREEINX := NEXT;                              <<06616>>04795000
      IF NOT UCODE'KNOWN'TABLE THEN                            <<06616>>04800000
         BEGIN                                                 <<06616>>04805000
         IF NEXT = 0 THEN                                      <<06616>>04810000
            SYSTABLASTFREEINX := 0;                            <<06616>>04815000
         ENTRIESUSED := SYSTABENTRYCOUNT - SYSTABFREECNT;      <<06616>>04820000
         IF ENTRIESUSED > SYSTABMOSTUSED THEN                  <<06616>>04825000
            SYSTABMOSTUSED := ENTRIESUSED;                     <<06616>>04830000
         END;                                                  <<06616>>04835000
      << ZERO OUT THE ENTRY >>                                 <<06616>>04840000
      TOS := RETURNVALUE + 1;                                  <<06616>>04845000
      TOS := RETURNVALUE;                                      <<06616>>04850000
      TOS := ENTRYSIZE - 1;                                    <<06616>>04855000
      ASMB(MOVE);                                              <<06616>>04860000
                                                               <<06616>>04865000
      END; << CASE OF NOT HAVING ENTRIES >>                    <<06616>>04870000
                                                               <<06616>>04875000
IF SEGMENT'WAS'ABSENT THEN                                     <<06616>>04880000
   BEGIN                                                       <<06616>>04885000
   RESETDB(ORIGINAL'DST);                                      <<06616>>04890000
   IF ABSOLUTE'DB THEN                                         <<06616>>04895000
      BEGIN                                                    <<06616>>04900000
      SETSYSDB;                                                <<06616>>04905000
      TOS := SAVEDB;                                           <<06616>>04910000
      ASMB(XCHD);                                              <<06616>>04915000
      DDEL;                                                    <<06616>>04920000
      END;                                                     <<06616>>04925000
   END                                                         <<06616>>04930000
ELSE                                                           <<06616>>04935000
   BEGIN                                                       <<06616>>04940000
   TOS := SAVEDB;                                              <<06616>>04945000
   ASMB(XCHD);                                                 <<06616>>04950000
   END;                                                        <<06616>>04955000
                                                               <<06616>>04960000
END; << PROCEDURE GETSYSTABENTRY >>                            <<06616>>04965000
$PAGE                                                          <<06616>>04970000
INTEGER PROCEDURE GET'PHY'CST;                                 <<06282>>04975000
   OPTION UNCALLABLE;                                          <<06282>>04980000
                                                               <<06282>>04985000
BEGIN                                                          <<06282>>04990000
                                                               <<06282>>04995000
   INTEGER ENTRYINDEX;                                         <<06282>>05000000
                                                               <<06282>>05005000
   DISABLE;                                                    <<06282>>05010000
                                                               <<06282>>05015000
   IF FREE'PHY'CST'HEAD = 0 THEN                               <<06282>>05020000
      BEGIN                                                    <<06282>>05025000
         GET'PHY'CST := 0;  << NO CST AVAILABLE >>             <<06282>>05030000
         RETURN;                                               <<06282>>05035000
      END;                                                     <<06282>>05040000
                                                               <<06282>>05045000
   ENTRYINDEX := FREE'PHY'CST'HEAD;                            <<06282>>05050000
   FREE'PHY'CST'HEAD := SL(ENTRYINDEX+1);                      <<06282>>05055000
   SL(ENTRYINDEX) := 0;    << ZERO OUT ENTRY >>                <<06282>>05060000
   SL(X:=X+1) := 0;                                            <<06282>>05065000
   SL(X:=X+1) := 0;                                            <<06282>>05070000
   SL(X:=X+1) := 0;                                            <<06282>>05075000
   GET'PHY'CST := ENTRYINDEX/CSTSIZE;                          <<06282>>05080000
END;                                                           <<06282>>05085000
PROCEDURE REL'PHY'CST (PHYCST);                                <<06282>>05090000
   VALUE PHYCST;                                               <<06282>>05095000
   INTEGER PHYCST;                                             <<06282>>05100000
   OPTION UNCALLABLE;                                          <<06282>>05105000
                                                               <<06282>>05110000
BEGIN                                                          <<06282>>05115000
                                                               <<06282>>05120000
   INTEGER ENTRYINDEX;                                         <<06282>>05125000
                                                               <<06282>>05130000
   DISABLE;                                                    <<06282>>05135000
                                                               <<06282>>05140000
   ENTRYINDEX := PHYCST*CSTSIZE;                               <<06282>>05145000
   IF PHYCST > TOTAL'PHY'CST'NUM OR                            <<06282>>05150000
      SL(ENTRYINDEX) = %100000 THEN                            <<06282>>05155000
         SUDDENDEATH (603);                                    <<06282>>05160000
   SL(ENTRYINDEX) := %100000;                                  <<06282>>05165000
   SL(ENTRYINDEX+1) := FREE'PHY'CST'HEAD;                      <<06282>>05170000
   SL(ENTRYINDEX+2) := 0;                                      <<06282>>05175000
   SL(ENTRYINDEX+3) := 0;                                      <<06282>>05180000
   FREE'PHY'CST'HEAD := ENTRYINDEX;                            <<06282>>05185000
END;                                                           <<06282>>05190000
$PAGE                                                          <<06616>>05195000
PROCEDURE RELSYSTABENTRY(TABLEDST,ENTRYINDEX);                 <<06616>>05200000
VALUE TABLEDST,ENTRYINDEX;                                     <<06616>>05205000
LOGICAL TABLEDST,ENTRYINDEX;                                   <<06616>>05210000
OPTION PRIVILEGED,UNCALLABLE;                                  <<*7862>>05215000
                                                               <<06616>>05220000
BEGIN                                                          <<06616>>05225000
                                                               <<06616>>05230000
LOGICAL                                                        <<06616>>05235000
   PCBPT,                                                      <<06616>>05240000
   OLDTAIL,                                                    <<06616>>05245000
   OLDIMPHEAD,                                                 <<06616>>05250000
   ABSOLUTE'DB,                                                <<06616>>05255000
   SEGMENT'WAS'ABSENT := FALSE,                                <<06616>>05260000
   OLDHEAD,                                                    <<06616>>05265000
   ORIGINAL'DST,                                               <<06616>>05270000
   ENTRYSIZE;                                                  <<06616>>05275000
DOUBLE                                                         <<06616>>05280000
   SAVEDB;                                                     <<06616>>05285000
<< SEE IF SEGMENT IS PRESENT >>                                <<06616>>05290000
                                                               <<06616>>05295000
IF ENTRYINDEX = 0 THEN HELP;                                   <<06616>>05300000
IF NOT LOGICAL(DST(TABLEDST&LSL(2)+1)).SEGRESIDENTFLAG         <<06620>>05305000
    THEN SUDDENDEATH(605);                                     <<06620>>05310000
DISABLE;                                                       <<06616>>05315000
PCBPT := CURPRC;                                               <<06650>>05320000
SEGMENT'WAS'ABSENT := LOGICAL(DST(TABLEDST&LSL(2))).ABSENTFLAG;<<06616>>05325000
ABSOLUTE'DB := DBXDSINFO.ABSDBFLAG;                            <<06650>>05330000
<< PUT DB AT THAT SEGMENT >>                                   <<06616>>05335000
IF SEGMENT'WAS'ABSENT THEN                                     <<06616>>05340000
   BEGIN                                                       <<06616>>05345000
   IF CURPRC = 0 THEN                                          <<06650>>05350000
      SUDDENDEATH(900);                                        <<06616>>05355000
   IF ABSOLUTE'DB THEN                                         <<06616>>05360000
      BEGIN                                                    <<06616>>05365000
      PUSH(DB);                                                <<06616>>05370000
      SAVEDB := TOS;                                           <<06616>>05375000
      RESETDB(-1);                                             <<06616>>05380000
      END;                                                     <<06616>>05385000
   ORIGINAL'DST := EXCHANGEDB(TABLEDST);                       <<06616>>05390000
   END                                                         <<06616>>05395000
ELSE                                                           <<06616>>05400000
   BEGIN                                                       <<06616>>05405000
   TOS := DST(TABLEDST&LSL(2) + 2); << BANK >>                 <<06616>>05410000
   TOS := DST(X + 1); << ADDRESS >>                            <<06616>>05415000
   ASMB(XCHD);                                                 <<06616>>05420000
   SAVEDB := TOS;                                              <<06616>>05425000
   END;                                                        <<06616>>05430000
                                                               <<06616>>05435000
X := 0;                                                        <<06616>>05440000
ENTRYSIZE := SYSTABENTRYSIZE;                                  <<06616>>05445000
IF ENTRYINDEX <= 0 OR                                          <<06616>>05450000
   (ENTRYINDEX > (ENTRYSIZE*SYSTABCONFCOUNT(X))) THEN          <<06616>>05455000
   SUDDENDEATH(603);                                           <<06616>>05460000
SYSTABFREECNT := SYSTABFREECNT + 1;                            <<06616>>05465000
IF TABLEDST = DSTDST OR TABLEDST = CSTDST THEN                 <<06616>>05470000
   BEGIN                                                       <<06616>>05475000
   OLDHEAD := SYSTABFIRSTFREEINX;                              <<06616>>05480000
   IF OLDHEAD = 0 AND SYSTABFREECOUNT > 1 THEN                 <<s8699>>05485000
      SUDDENDEATH(605);                                        <<s8699>>05490000
   SYSTABFIRSTFREEINX := ENTRYINDEX;                           <<06616>>05495000
   X := ENTRYINDEX;                                            <<06616>>05500000
   SYSTABENTRYNEXTFREEINX := OLDHEAD;                          <<06616>>05505000
   SYSTABFREEINDICATOR := %100000;                             <<06616>>05510000
   END                                                         <<06616>>05515000
ELSE                                                           <<06616>>05520000
   BEGIN                                                       <<06616>>05525000
   X := 0;                                                     <<*7564>>05530000
   OLDTAIL := SYSTABLASTFREEINX;                               <<06616>>05535000
   SYSTABLASTFREEINX := ENTRYINDEX;                            <<06616>>05540000
   IF OLDTAIL = 0 THEN                                         <<06616>>05545000
      BEGIN << TABLE WAS EMPTY >>                              <<06616>>05550000
      SYSTABFIRSTFREEINX := ENTRYINDEX;                        <<06616>>05555000
      X := ENTRYINDEX;                                         <<06616>>05560000
      SYSTABENTRYNEXTFREEINX := 0;                             <<06616>>05565000
      END                                                      <<06616>>05570000
   ELSE                                                        <<06616>>05575000
      BEGIN                                                    <<06616>>05580000
      X := OLDTAIL;                                            <<06616>>05585000
      SYSTABENTRYNEXTFREEINX := ENTRYINDEX;                    <<06616>>05590000
      X := ENTRYINDEX;                                         <<06616>>05595000
      SYSTABENTRYNEXTFREEINX := 0;                             <<06616>>05600000
      END;                                                     <<06616>>05605000
   X := 0;                                                     <<06616>>05610000
   IF SYSTABFREECNT > SYSTABPRIMARYNUM THEN                    <<06616>>05615000
      BEGIN << SEE IF ANY IMPEDED >>                           <<06616>>05620000
      IF SYSTABIMPHEAD  <> 0 THEN                              <<06616>>05625000
         BEGIN << UNIMPEDE SUCKER >>                           <<06616>>05630000
         IF SYSTABIMPHEAD = SYSTABIMPTAIL THEN                 <<06616>>05635000
            BEGIN << THE ONLY GUY >>                           <<06616>>05640000
            OLDIMPHEAD := SYSTABIMPHEAD;                       <<06616>>05645000
            SYSTABIMPHEAD := 0;                                <<06616>>05650000
            SYSTABIMPTAIL := 0;                                <<06616>>05655000
            END                                                <<06616>>05660000
         ELSE                                                  <<06616>>05665000
            BEGIN << GOT A LONG Q >>                           <<06616>>05670000
            OLDIMPHEAD := SYSTABIMPHEAD;                       <<06616>>05675000
            PCBPT := PCB(OLDIMPHEAD + NIMPPINWORDNUM);         <<06650>>05680000
            PCB(OLDIMPHEAD + NIMPPINWORDNUM) := 0;             <<06650>>05685000
            PIMPPIN := 0;                                      <<06650>>05690000
            X := 0;                                            <<06616>>05695000
            SYSTABIMPHEAD := PCBPT;                            <<06616>>05700000
            END;                                               <<06616>>05705000
         SYSTABIMPCURRENTNUM := SYSTABIMPCURRENTNUM - 1;       <<07320>>05710000
         UNIMPEDE(OLDIMPHEAD);                                 <<06616>>05715000
         END;                                                  <<06616>>05720000
      END;                                                     <<06616>>05725000
   END;                                                        <<06616>>05730000
IF SEGMENT'WAS'ABSENT THEN                                     <<06616>>05735000
   BEGIN                                                       <<06616>>05740000
   RESETDB(ORIGINAL'DST);                                      <<06616>>05745000
   IF ABSOLUTE'DB THEN                                         <<06616>>05750000
      BEGIN                                                    <<06616>>05755000
      SETSYSDB;                                                <<06616>>05760000
      TOS := SAVEDB;                                           <<06616>>05765000
      ASMB(XCHD);                                              <<06616>>05770000
      DDEL;                                                    <<06616>>05775000
      END;                                                     <<06616>>05780000
   END                                                         <<06616>>05785000
ELSE                                                           <<06616>>05790000
   BEGIN                                                       <<06616>>05795000
   TOS := SAVEDB;                                              <<06616>>05800000
   ASMB(XCHD);                                                 <<06616>>05805000
   END;                                                        <<06616>>05810000
END; << PROCEDURE RELSYSTABENTRY >>                            <<06616>>05815000
$PAGE "MESSAGE FACILITY INTRINSICS : SEND MESSAGE"             <<06212>>05820000
$PAGE "MEASUREMENT INTERFACE : UPDATESTATISTICS"                        05825000
INTEGER PROCEDURE UPDATESTATISTICS(CLASS,SUBCLASS,SUBCLASSENTRY,        05830000
                                   STARTINGITEM,NEWVALUEFLAG,           05835000
                                   VALUECHANGE,DOUBLEITEMFLAG);         05840000
  VALUE   CLASS,SUBCLASS,SUBCLASSENTRY,STARTINGITEM,NEWVALUEFLAG,       05845000
          VALUECHANGE,DOUBLEITEMFLAG;                                   05850000
  INTEGER CLASS,SUBCLASS,SUBCLASSENTRY,STARTINGITEM;                    05855000
  DOUBLE  VALUECHANGE;                                                  05860000
  LOGICAL NEWVALUEFLAG,DOUBLEITEMFLAG;                                  05865000
  OPTION  PRIVILEGED,UNCALLABLE;                                        05870000
                                                                        05875000
COMMENT                                                                 05880000
*************************************************************           05885000
THIS PROCEDURE IS USED TO UPDATE AN ITEM IN A GIVEN CLASS,              05890000
SUBCLASS, ENTRY DEFINED BY THE MPE IV MEASUREMENT INTERFACE.            05895000
                                                                        05900000
INPUT PARAMETERS:                                                       05905000
                                                                        05910000
      CLASS,          THE CLASSNUMBER OF STATS TO BE UPDATED            05915000
      SUBCLASS,       SUBCLASS NUMBER OF CLASS                          05920000
      SUBCLASSENTY,   ENTRY NUMBER OF SUBCLASS                          05925000
      STARTINGITEM,           STARTINGITEM # OF ENTRY                   05930000
      NEWVALUEFLAG,   IF TRUE=> VALUECHANGE PARM REPLACES STARTINGITEM  05935000
                      ELSE ADD VALUECHANGE TO OLD STARTINGITEM          05940000
      VALUECHANGE     EITHER ADDED TO OR REPLACES OLD STARTINGITEM      05945000
      DOUBLEITEMFLAG  IF TRUE=> VALUECHANGE IS A DOUBLE WORD UPDATE     05950000
                                                                        05955000
RETURN VALUES:                                                          05960000
                                                                        05965000
      CC = CCL ==> BAD PARAMETER                                        05970000
      CC = CCE ==> OK                                                   05975000
      CC = CCG ==> NOT USED                                             05980000
                                                                        05985000
      UPDATESTATISTICS = 0 ==> OK                                       05990000
                       = 1 ==> STATS NOT ENABLED                        05995000
                       = 2 ==> BAD STARTINGITEM PARM                    06000000
                       = 3 ==> BAD SUBCLASSENTRY PARM                   06005000
                       = 4 ==> BAD SUBCLASS PARM                        06010000
                       = 5 ==> BAD CLASS PARM                           06015000
                                                                        06020000
ENTRY POINTS:                                                           06025000
                                                                        06030000
      FUPDATESTATISTICS: WILL BYPASS ALL PARAMETER CHECKING,            06035000
                         BUT WILL NOT ALLOW UPDATING IF CLASS           06040000
                         NOT ENABLED.                                   06045000
                                                                        06050000
OPERATION:                                                              06055000
                                                                        06060000
      UPDATESTATISTICS WILL FIRST CHECK TO SEE THAT THE CLASS           06065000
      OF STATISTICS REQUESTED TO BE UPDATED HAS BEEN ENABLED.           06070000
      IF IT WAS ENABLED IT WILL USE ABS ADDRESSING TO RETRIEVE          06075000
      SOME OFFSETS AND VALUES FROM THE LOCKED AND FROZEN STAT-          06080000
      ISTICS GATHERING DATASEGMENT. IF THE ALTERNATE ENTRY POINT        06085000
      FUPDATESTATISTICS WAS NOT USED, THEN PARAMETER CHECKING IS        06090000
      PREFORMED ON THE CLASS, SUBCLASS, SUBCLASSENTRY AND START-        06095000
      INGITEM PARAMETERS. IF AN ERROR WAS ENCOUNTERED THEN CC           06100000
      IS SET TO CCL AND WE RETURN, OTHERWISE EITHER A SINGLE            06105000
      OR DOUBLE ITEM IS UPDATED (BASED ON DOUBLEITEMFLAG) AND           06110000
      THE OLDVALUE IS EITHER INCREMENTED OR REPLACED (BASED ON          06115000
      NEWVALUEFLAG).                                                    06120000
                                                                        06125000
*************************************************************           06130000
;                                                                       06135000
BEGIN                                                                   06140000
                                                                        06145000
EQUATE  NOTENBLD       = 1,  <<STATISTICS GATH NOT ENBLD>>              06150000
        ITEM'ERROR     = 2,  <<ITEM OUT OF RANGE     >>                 06155000
        SUBENTRY'ERROR = 3,  <<SUBCLASS OUT OF RANGE >>                 06160000
        SUBCLASS'ERROR = 4,  <<SUBCLASS OUT OF RANGE    >>              06165000
        CLASS'ERROR    = 5;  <<CLASS OUT OF RANGE   >>                  06170000
                                                                        06175000
INTEGER ERROR:=NOTENBLD,                                                06180000
        CLASSBASE,       <<OFFSET TO REQUESTED CLASS>>                  06185000
        SUBBASE,         <<SEG REL OFFSET TO REQ SUBCLASS>>             06190000
        ACTUAL'ENTRIES,  <<NUM ENTRIES LESS ENTRY 0>>                   06195000
        VALUECHANGE0=VALUECHANGE,  <<MSW OF VALUECHANGE>>               06200000
        VALUECHANGE1=VALUECHANGE+1,<<LSW OF VALUECHANGE>>               06205000
        SAVECC,          <<TEMP COND CODE>>                             06210000
        X=X,             <<X REG>>                                      06215000
        STATUS=Q-1;      <<STATUS REGISTER>>                            06220000
                                                                        06225000
INTEGER ARRAY C0'SUBSIZES(*) = PB:= CLASS0'SUB0SIZE,                    06230000
                                    CLASS0'SUB1SIZE,                    06235000
                                    CLASS0'SUB2SIZE,                    06240000
                                    CLASS0'SUB3SIZE;                    06245000
                                                                        06250000
INTEGER ARRAY C1'SUBSIZES(*) = PB:= CLASS1'SUB0SIZE,                    06255000
                                    CLASS1'SUB1SIZE,                    06260000
                                    CLASS1'SUB2SIZE,                    06265000
                                    CLASS1'SUB3SIZE,                    06270000
                                    CLASS1'SUB4SIZE,                    06275000
                                    CLASS1'SUB5SIZE;                    06280000
                                                                        06285000
LOGICAL POINTER MEASINFO'TABPTR = %261;                                 06290000
                                                                        06295000
LOGICAL FUPDATE:=FALSE;                                                 06300000
                                                                        06305000
ENTRY FUPDATESTATISTICS;        <<WILL BYPASS PARM CHECKING>>           06310000
                                                                        06315000
DEFINE CLASSBASE'IDX   = (CLASS+1)#,  <<OFFSET TO CLASS>>               06320000
       SUBBASE'IDX     = (SUBCLASS+1)#, <<OFFSET TO SUBCLASS>>          06325000
       ACT'STARTINGITEM= (STARTINGITEM+3)#; <<GET PAST ENTRY 0>>        06330000
                                                                        06335000
<<***************SUBROUTINES*********************>>                     06340000
                                                                        06345000
LOGICAL SUBROUTINE GOODSUBCLASS;                                        06350000
BEGIN  <<CHECK FOR VALID SUBCLASS>>                                     06355000
GOODSUBCLASS:=TRUE;                                                     06360000
CASE CLASS OF                                                           06365000
   BEGIN                                                                06370000
   <<CLASS0>>                                                           06375000
   IF SUBCLASS < 0 OR SUBCLASS >= CLASS0'SUBCLASSCNT THEN               06380000
      GOODSUBCLASS:=FALSE;                                              06385000
   <<CLASS1>>                                                           06390000
   IF SUBCLASS < 0 OR SUBCLASS >= CLASS1'SUBCLASSCNT THEN               06395000
      GOODSUBCLASS:=FALSE;                                              06400000
   END; <<CASE>>                                                        06405000
END; <<GOODSUBCLASS>>                                                   06410000
                                                                        06415000
                                                                        06420000
LOGICAL SUBROUTINE GOODENTRY;                                           06425000
BEGIN <<CHECK FOR VALID SUBCLASSENTRY>>                                 06430000
GOODENTRY:=TRUE;                                                        06435000
IF SUBCLASSENTRY < 1 OR    <<DO NOT ALLOW UPDATING>>                    06440000
SUBCLASSENTRY > ACTUAL'ENTRIES THEN  <<OF ENTRY 0>>                     06445000
   GOODENTRY:=FALSE;                                                    06450000
END; <<GOODENTRY>>                                                      06455000
                                                                        06460000
                                                                        06465000
LOGICAL SUBROUTINE GOODSTARTITEM;                                       06470000
BEGIN <<CHECK FOR GOOD STARTINGITEM>>                                   06475000
GOODSTARTITEM:=TRUE;                                                    06480000
CASE CLASS OF                                                           06485000
   BEGIN                                                                06490000
   <<CLASS0>>                                                           06495000
   IF STARTINGITEM < 0 OR                                               06500000
   STARTINGITEM >= C0'SUBSIZES(SUBCLASS) OR                             06505000
   DOUBLEITEMFLAG AND STARTINGITEM+1 >= C0'SUBSIZES(SUBCLASS) THEN      06510000
      GOODSTARTITEM:=FALSE;                                             06515000
   <<CLASS1>>                                                           06520000
   IF STARTINGITEM < 0 OR                                               06525000
   STARTINGITEM >= C1'SUBSIZES(SUBCLASS) OR                             06530000
   DOUBLEITEMFLAG AND STARTINGITEM+1 >= C1'SUBSIZES(SUBCLASS) THEN      06535000
      GOODSTARTITEM:=FALSE;                                             06540000
   END; <<CASE>>                                                        06545000
END; <<GOODSTARTITEM>>                                                  06550000
                                                                        06555000
                                                                        06560000
LOGICAL SUBROUTINE GOODCLASS;                                           06565000
BEGIN << CHECK FOR VALID CLASS>>                                        06570000
GOODCLASS:=TRUE;                                                        06575000
IF CLASS < 0 OR CLASS >= CLASSCOUNT THEN                                06580000
   GOODCLASS:=FALSE;                                                    06585000
END; <<GOODCLASS>>                                                      06590000
                                                                        06595000
<<******************END OF SUBROUTINES******************>>              06600000
                                                                        06605000
GOTO START;                                                             06610000
                                                                        06615000
FUPDATESTATISTICS:                                                      06620000
                                                                        06625000
FUPDATE:=TRUE;                                                          06630000
                                                                        06635000
START:                                                                  06640000
                                                                        06645000
PDISABLE;   <<MAKE SURE NO ONE CHANGES GATHERING STATUS>>               06650000
                                                                        06655000
TOS:=GCLASSENABLEDMASK;   <<CHECK TO SEE IF REQUESTED CLASS>>           06660000
X:=CLASS;                 <<IS CURRENTLY ENABLED>>                      06665000
ASMB(TBC 0,X);                                                          06670000
IF <> THEN                                                              06675000
   BEGIN                   <<CLASS WAS ENABLED>>                        06680000
                                                                        06685000
   ERROR:=0;                                                            06690000
                                                                        06695000
   TOS:=MEASSTATXDSBANK;                                                06700000
   TOS:=MEASSTATXDSBASE+LDEVTABSIZE;  <<GET BEYOND LDEVTAB>>            06705000
   TOS:=TOS+CLASSBASE'IDX;            <<ABS ADDR OF CLASSBASE PTR>>     06710000
   ASMB(LSEA);                        <<PULL OUT OFFSET TO CLASS >>     06715000
   CLASSBASE:=TOS;                                                      06720000
                                                                        06725000
   <<NOW GET SEGRELOFF FOR SUBCLASS>>                                   06730000
                                                                        06735000
   TOS:=CLASSBASE-CLASSBASE'IDX+SUBBASE'IDX; <<ADD SEGREL OFFSETS>>     06740000
   ASMB(LADD;LSEA);       <<ADD TO ABS ADDR OF CLASSBASE PTR>>          06745000
   SUBBASE:=TOS+CLASSBASE;<<SEGREL OFFSET TO BASE OF SUBCLASS>>         06750000
                                                                        06755000
   <<FINALLY PULL OUT NUMBER OF ENTRIES IN SUBCLASS>>                   06760000
                                                                        06765000
   TOS:=SUBBASE-CLASSBASE-SUBBASE'IDX;                                  06770000
   ASMB(LADD);                                                          06775000
   ASMB(LSEA);                                                          06780000
   ACTUAL'ENTRIES:=TOS-1;   <<SUB 1 FOR ENTRY 0>>                       06785000
   DDEL;                                                                06790000
                                                                        06795000
   IF NOT FUPDATE THEN                                                  06800000
      BEGIN               <<PARAMETER CHECKING>>                        06805000
                                                                        06810000
      IF NOT GOODCLASS THEN                                             06815000
         ERROR := CLASS'ERROR                                           06820000
      ELSE                                                              06825000
         IF NOT GOODSUBCLASS THEN                                       06830000
            ERROR:=SUBCLASS'ERROR                                       06835000
         ELSE                                                           06840000
            IF NOT GOODENTRY THEN                                       06845000
               ERROR:=SUBENTRY'ERROR                                    06850000
            ELSE                                                        06855000
               IF NOT GOODSTARTITEM THEN                                06860000
                  ERROR := ITEM'ERROR                                   06865000
      END;                                                              06870000
                                                                        06875000
   END; <<CLASS ENABLED>>                                               06880000
                                                                        06885000
IF ERROR = 0 THEN                                                       06890000
                                                                        06895000
   BEGIN <<UPDATE ITEM>>                                                06900000
   TOS := MEASSTATXDSBANK;                                              06905000
   TOS := MEASSTATXDSBASE+LDEVTABSIZE+SUBBASE+ACT'STARTINGITEM;         06910000
   IF NOT DOUBLEITEMFLAG THEN                                           06915000
                                                                        06920000
      BEGIN <<PROCESS SINGLE ITEM UPDATE>>                              06925000
      IF NOT NEWVALUEFLAG THEN                                          06930000
         BEGIN <<RETRIVE OLD VALUE, ADD W/VLAUECHANGE,STORE>>           06935000
         ASMB(LSEA);                                                    06940000
         TOS:=TOS+VALUECHANGE1;                                         06945000
         ASMB(SSEA);                                                    06950000
         END                                                            06955000
      ELSE                                                              06960000
         BEGIN <<REPLACE OLDVALUE W/VALUECHANGE>>                       06965000
         TOS:=VALUECHANGE1;                                             06970000
         ASMB(SSEA);                                                    06975000
         END;                                                           06980000
      END   <<SINGLE ITEM UPDATE>>                                      06985000
                                                                        06990000
   ELSE                                                                 06995000
                                                                        07000000
      BEGIN <<PROCESS DOUBLE ITEM UPDATE>>                              07005000
      IF NOT NEWVALUEFLAG THEN                                          07010000
         BEGIN <<RETRIEVE OLD VALUE, ADD W/VALUECHANGE,STORE>>          07015000
         ASMB(LDEA);                                                    07020000
         TOS:=TOS+VALUECHANGE;                                          07025000
         ASMB(SDEA);                                                    07030000
         END                                                            07035000
      ELSE                                                              07040000
         BEGIN <<REPLACE OLD VALUE W/VALUECHANGE>>                      07045000
         TOS:=VALUECHANGE;                                              07050000
         ASMB(SDEA);                                                    07055000
         END;                                                           07060000
      END;                                                              07065000
                                                                        07070000
   DDEL; <<BANK,ADDRESS>>                                               07075000
   SAVECC:=CCE;                                                         07080000
   END                                                                  07085000
                                                                        07090000
ELSE                                                                    07095000
                                                                        07100000
   SAVECC:=CCL;                                                         07105000
                                                                        07110000
PENABLE;                                                                07115000
UPDATESTATISTICS:=ERROR;                                                07120000
CC:=SAVECC;                                                             07125000
END;  <<UPDATESTATISTICS>>                                              07130000
PROCEDURE MEAS'OBJFAULT(OBJ);                                   <<MEAS>>07135000
VALUE OBJ;                                                      <<MEAS>>07140000
DOUBLE OBJ;                                                     <<MEAS>>07145000
OPTION PRIVILEGED , UNCALLABLE;                                 <<MEAS>>07150000
BEGIN                                                           <<MEAS>>07155000
LOGICAL ARRAY OBJID(*) = OBJ;                                   <<MEAS>>07160000
INTEGER STOP'INDEX;                                             <<MEAS>>07165000
IF GCLASSENABLEDMASK.CLASS0 THEN BEGIN                          <<MEAS>>07170000
  CASE OBJID(OBJIDTYPEFIELD) OF BEGIN                           <<MEAS>>07175000
    <<0>>  STOP'INDEX := C'STOPDATAFAULT;                       <<MEAS>>07180000
    <<1>>  STOP'INDEX := C'STOPSLFAULT;                         <<MEAS>>07185000
    <<2>>  STOP'INDEX := C'STOPPBXFAULT;                        <<MEAS>>07190000
    <<3>>  STOP'INDEX := C'STOPCACHEFAULT;                      <<MEAS>>07195000
  END; <<CASE>>                                                 <<MEAS>>07200000
  TOS := MEASSTATXDSBANK;                                       <<MEAS>>07205000
  TOS := MEASSTATXDSBASE;                                       <<MEAS>>07210000
  TOS := TOS + C0SUB0'SEGRELOFF + STOP'INDEX;                   <<MEAS>>07215000
  ASMB(LSEA);                                                   <<MEAS>>07220000
  TOS := TOS + 1;                                               <<MEAS>>07225000
  ASMB(SSEA;DDEL);                                              <<MEAS>>07230000
END; <<CLASS 0 ENABLED>>                                        <<MEAS>>07235000
IF GCLASSENABLEDMASK.CLASS15 THEN BEGIN <<CLASS 15 ENABLED>>    <<MEAS>>07240000
  CASE OBJID(OBJIDTYPEFIELD) OF BEGIN                           <<MEAS>>07245000
    <<0>>  STOP'INDEX := CP'STOPDSTFAULT;                       <<MEAS>>07250000
    <<1>>  STOP'INDEX := CP'STOPSLFAULT;                        <<MEAS>>07255000
    <<2>>  STOP'INDEX := CP'STOPPBXFAULT;                       <<MEAS>>07260000
    <<3>>  STOP'INDEX := CP'STOPDSTFAULT; <<CP'STOPCACHEFAULT>> <<MEAS>>07265000
  END;  <<CASE>>                                                <<MEAS>>07270000
  TOS := MEASPROCXDSBANK;                                       <<MEAS>>07275000
  TOS := MEASPROCXDSBASE;                                       <<MEAS>>07280000
  TOS := TOS + CURPRC/PCBSIZE * CLASS15'SUB0SIZE + STOP'INDEX;  <<MEAS>>07285000
  ASMB(LSEA);                                                   <<MEAS>>07290000
  TOS := TOS + 1;                                               <<MEAS>>07295000
  ASMB(SSEA;DDEL);                                              <<MEAS>>07300000
END;                                                            <<MEAS>>07305000
END; <<PROCEDURE MEAS'OBJFAULT>>                                <<MEAS>>07310000
$PAGE "UNCALLABLE UTILITIES : SYSPROC"                                  07315000
PROCEDURE READYPROCESS(PCBPT);                                 <<03041>>07320000
VALUE PCBPT;                                                   <<03041>>07325000
INTEGER PCBPT;                                                 <<03041>>07330000
OPTION PRIVILEGED,UNCALLABLE;                                  <<03041>>07335000
BEGIN                                                          <<03041>>07340000
LOGICAL                                                        <<03041>>07345000
   PAWSEDFLAG;                                                 <<03041>>07350000
                                                               <<03041>>07355000
IF NOT LOG(SPCBDISPQ) AND SPCBWAITFIELD = 0 THEN               <<03041>>07360000
   BEGIN <<MUST GET PROCESS INTO CONTENTION FOR THE CPU>>      <<03041>>07365000
   PDISABLE;  <<PSEUDO DISABLE FOR FAST DB SWITCH>>            <<03041>>07370000
   TOS:=%1000D;                                                <<03041>>07375000
   EXCHDB;                                                     <<03041>>07380000
   QUEUEPROC(PCBPT,DISPATCHINGQ,FRONTOFCLASS);                 <<06650>>07385000
   PAWSEDFLAG:=DISPTOAWAKEMSG.PAUSEDFLAG;                      <<03041>>07390000
   EXCHDB;                                                     <<03041>>07395000
   PENABLE;                                                    <<03041>>07400000
   IF PAWSEDFLAG THEN ASMB(DISP);                              <<03041>>07405000
   END;                                                        <<03041>>07410000
END;  <<READYPROCESS>>                                         <<03041>>07415000
LOGICAL PROCEDURE SYSPROC(LOGICALPROCNUMBER);                           07420000
VALUE LOGICALPROCNUMBER;                                                07425000
INTEGER LOGICALPROCNUMBER;                                              07430000
OPTION PRIVILEGED,UNCALLABLE;                                           07435000
                                                                        07440000
COMMENT                                                                 07445000
                                                                        07450000
SYSPROC CONVERTS THE CALLER SUPPLIED LOGICAL PROCESS                    07455000
NUMBER INTO THE PCB RELATIVE POINTER TO THAT PROCESS'                   07460000
PCB ENTRY.                                                              07465000
                                                                        07470000
;                                                                       07475000
                                                                        07480000
BEGIN                                                                   07485000
                                                               <<06212>>07490000
EQUATE LOGPROCTABBASE=%1141,                                            07495000
       LOGPROCTABSIZE=12;                                               07500000
                                                                        07505000
SYSPROC:=IF LOGICALPROCNUMBER > LOGPROCTABSIZE THEN 0                   07510000
ELSE ABSOLUTE(LOGPROCTABBASE+LOGICALPROCNUMBER);                        07515000
END  <<PROCEDURE SYSPROC>>;                                             07520000
$PAGE "UNCALLABLE UTILITIES : BUILD/CONVERT SEG ID"                     07525000
DOUBLE  PROCEDURE BUILDOBJID(OBJTYPE,OBJNUMBER,PIN);           <<06660>>07530000
VALUE OBJTYPE,OBJNUMBER,PIN;                                   <<06212>>07535000
INTEGER OBJTYPE,OBJNUMBER,PIN;                                 <<06212>>07540000
OPTION PRIVILEGED,UNCALLABLE;                                           07545000
                                                                        07550000
COMMENT                                                                 07555000
                                                                        07560000
BUILDOBJID CONVERTS THE OBJECT NUMBER PARAMETER INTO THE STAND <<06212>>07565000
INVARIANT FORM OF OBJIDENTIFIER USED THROUGHOUT THE SYSTEM.    <<06212>>07570000
THIS ROUTINE MAY BE CALLED IN SPLIT STACK MODE.                <<06212>>07575000
                                                                        07580000
OBJTYPE =dataobject ==> OBJECT IS A DATA OBJECT,               <<06212>>07585000
               OBJNUMBER=DST ENTRY NUMBER OF OBJECT'S DESCRIPTO<<06212>>07590000
        =slobject ==> OBJECT IS A SYSTEM SL OBJECT,            <<06212>>07595000
               OBJNUMBER=SL ENTRY NUMBER OF OBJECT'S DESCRIPTOR<<06212>>07600000
        =pbxobject ==> OBJECT IS A PART OF A PROGRAM,          <<06212>>07605000
               OBJNUMBER=PROGRAM OBJECT NUMBER (>%300),        <<06212>>07610000
               PIN=PIN OF PROCESS EXECUTING THE PROGRAM                 07615000
        =mappeddomainobject ==> OBJECT IS A CACHED DISC DOMAIN,<<06212>>07620000
               OBJNUMBER = CDT ENTRY OF MAPPED DISC DOMAIN     <<06212>>07625000
                                                                        07630000
;                                                              <<06212>>07635000
                                                               <<06212>>07640000
BEGIN                                                                   07645000
                                                               <<06212>>07650000
DOUBLE  OBJID;                                                 <<06660>>07655000
DOUBLE  segid=objid;                                           <<06660>>07660000
INTEGER SEGNUMBER=OBJNUMBER;                                   <<06212>>07665000
DOUBLE  BUILT := 0D;                                           <<06660>>07670000
LOGICAL ARRAY BUILDSPACE(*)=BUILT;                             <<06660>>07675000
DEFINE SEGIDPBXFIELD=OBJIDPBXFIELD#;                           <<06212>>07680000
                                                               <<06212>>07685000
ENTRY BUILDSEGID; <<for backwards compatibility>>              <<06212>>07690000
                                                               <<06212>>07695000
BUILDSEGID :                                                   <<06212>>07700000
                                                               <<06212>>07705000
IF OBJTYPE=DataObject THEN BEGIN << Data Object >>             <<06660>>07710000
   BUILDSPACE(ObjIDTypeField):=DataObject;                     <<06660>>07715000
   BUILDSPACE(ObjIDnumField):=OBJNUMBER;                       <<06660>>07720000
END ELSE IF OBJTYPE = MappedDomainObject THEN                  <<06660>>07725000
   BEGIN  <<mapped disc domain>>                               <<06212>>07730000
   BUILDSPACE(ObjIDTypeField):= MappedDomainObject;            <<06660>>07735000
   BUILDSPACE(ObjIDnumField):=OBJNUMBER;                       <<06660>>07740000
   END                                                         <<06212>>07745000
ELSE                                                           <<06212>>07750000
   BEGIN  <<CODE OBJ >>                                        <<06212>>07755000
   IF OBJTYPE=SlObject THEN                                    <<06660>>07760000
      BEGIN <<SL OBJ>>                                         <<06212>>07765000
      BUILDSPACE(ObjIDTypeField):=SlObject;                    <<06660>>07770000
      BUILDSPACE(ObjIDnumField):=OBJNUMBER;                    <<06660>>07775000
      END                                                               07780000
   ELSE                                                                 07785000
      BEGIN <<PROGRAM OBJECT>>                                 <<06212>>07790000
      IF OBJTYPE <> pbxobject THEN SuddenDeath(619);           <<06212>>07795000
      IF MAPPINGFIRMWARE THEN                                  <<06104>>07800000
         TOS:=SEGNUMBER                                        <<06104>>07805000
      ELSE                                                     <<06104>>07810000
      TOS:=OBJNUMBER-%300;                                     <<06212>>07815000
      BUILDSPACE(ObjIDnumField):=TOS;                          <<06660>>07820000
      BUILDSPACE(ObjIDTypeField):=PbxObject;                   <<06660>>07825000
      BUILDSPACE(ObjIDpbxField):=                              <<06660>>07830000
            PCB(PIN * PCBSIZE + PBXWORDNUM);                   <<06650>>07835000
      END;                                                              07840000
   END;                                                                 07845000
   BUILDOBJID:=BUILT;                                          <<06660>>07850000
END <<BUILDOBJID>>;                                            <<06212>>07855000
LOGICAL PROCEDURE LABEL'IS'SL'SEG (PLABEL,PCBPT);              <<06104>>07860000
VALUE PLABEL,PCBPT;                                            <<06104>>07865000
INTEGER PLABEL,PCBPT;                                          <<06104>>07870000
OPTION UNCALLABLE;                                             <<06282>>07875000
                                                               <<06104>>07880000
<<RETURN TRUE IF PLABEL IS A SL SEGMENT   >>                   <<06104>>07885000
<<       FALSE IF IT IS A PROGRAM SEGMENT >>                   <<06104>>07890000
                                                               <<06104>>07895000
BEGIN                                                          <<06104>>07900000
                                                               <<06104>>07905000
   DEFINE PHYMAPPING    = LOGICAL(PLABEL.(0:1))#,              <<06104>>07910000
          SEGNUMBER     = PLABEL.(8:8)#,                       <<06104>>07915000
          PROGSEGNUM    = DST(CSTXBLK(SPCBPBX))#;              <<06104>>07920000
   PDISABLE;                                                   <<06104>>07925000
   IF PCBPT = 0 THEN PCBPT := (CURPRC);                        <<06650>>07930000
   IF MAPPINGFIRMWARE THEN                                     <<06104>>07935000
      IF PHYMAPPING THEN                                       <<06104>>07940000
         LABEL'IS'SL'SEG := TRUE                               <<06104>>07945000
      ELSE                                                     <<06104>>07950000
         IF SEGNUMBER > PROGSEGNUM THEN                        <<06104>>07955000
            LABEL'IS'SL'SEG :=TRUE                             <<06104>>07960000
         ELSE                                                  <<06104>>07965000
            LABEL'IS'SL'SEG :=FALSE                            <<06104>>07970000
   ELSE                                                        <<06104>>07975000
      IF SEGNUMBER < %300 THEN                                 <<06104>>07980000
         LABEL'IS'SL'SEG := TRUE                               <<06104>>07985000
      ELSE                                                     <<06104>>07990000
         LABEL'IS'SL'SEG := FALSE;                             <<06104>>07995000
   PENABLE;                                                    <<06104>>08000000
END;                                                           <<06104>>08005000
                                                               <<06104>>08010000
LOGICAL PROCEDURE MARKER'IS'SL'SEG(STATUS',DELTAP,PCBPT);      <<07365>>08015000
VALUE STATUS',DELTAP,PCBPT;                                    <<07365>>08020000
INTEGER STATUS',DELTAP,PCBPT;                                  <<07365>>08025000
OPTION UNCALLABLE;                                             <<06282>>08030000
<<RETURN TRUE IF MARKER IS A SL SEGMENT   >>                   <<06104>>08035000
<<       FALSE IF IT IS A PROGRAM SEGMENT >>                   <<06104>>08040000
                                                               <<06104>>08045000
BEGIN                                                          <<06104>>08050000
                                                               <<06104>>08055000
DEFINE PHYMAPPING    = LOGICAL(DELTAP.(1:1))#,                 <<07365>>08060000
       SEGNUMBER     = STATUS'.(8:8)#,                         <<07365>>08065000
          PROGSEGNUM    = DST(CSTXBLK(SPCBPBX))#;              <<06104>>08070000
   PDISABLE;                                                   <<06104>>08075000
   IF PCBPT = 0 THEN PCBPT := (CURPRC);                        <<06650>>08080000
   IF MAPPINGFIRMWARE THEN                                     <<06104>>08085000
      IF PHYMAPPING THEN                                       <<06104>>08090000
         MARKER'IS'SL'SEG := TRUE                              <<06104>>08095000
      ELSE                                                     <<06104>>08100000
         IF SEGNUMBER > PROGSEGNUM THEN                        <<06104>>08105000
            MARKER'IS'SL'SEG :=TRUE                            <<06104>>08110000
         ELSE                                                  <<06104>>08115000
            MARKER'IS'SL'SEG :=FALSE                           <<06104>>08120000
   ELSE                                                        <<06104>>08125000
      IF SEGNUMBER < %300 THEN                                 <<06104>>08130000
         MARKER'IS'SL'SEG := TRUE                              <<06104>>08135000
      ELSE                                                     <<06104>>08140000
         MARKER'IS'SL'SEG := FALSE;                            <<06104>>08145000
   PENABLE;                                                    <<06104>>08150000
END;                                                           <<06104>>08155000
                                                                        08160000
INTEGER PROCEDURE CONVSEGIDTOSTINX(OBJTEMPORARY);              <<06660>>08165000
VALUE OBJTEMPORARY ;                                           <<06660>>08170000
DOUBLE  OBJTEMPORARY ;                                         <<06660>>08175000
OPTION PRIVILEGED,UNCALLABLE;                                           08180000
                                                                        08185000
COMMENT                                                                 08190000
                                                                        08195000
CONVERTS A OBJIDENTIFIER TO THE CURRENT SEGMENT TABLE INDEX OF <<06212>>08200000
THE CORRESPONDING SEGMENT'S DESCRIPTOR. THIS ROUTINE MAY       <<01609>>08205000
BE CALLED IN SPLIT STACK MODE.                                 <<01609>>08210000
                                                               <<06212>>08215000
THIS ROUTINE WORKS ONLY FOR OBJECTS WHICH ARE SEGMENTS.        <<06212>>08220000
DOESN'T WORK FOR MAPPED DISC DOMAIN OBJECTS.                   <<06212>>08225000
                                                               <<06212>>08230000
IF THE DESIGNATED SEGMENT DESCRIPTOR IS VALID, THE CONDITION   <<06660>>08235000
CODE IS SET TO CCE AND THE SEGMENT TABLE RELATIVE INDEX OF THE <<06660>>08240000
SEGMENT DESCRIPTOR IS RETURNED.                                <<06212>>08245000
                                                               <<01557>>08250000
IF THE DESIGNATED DESCRIPTOR IS UNASSIGNED, THE CONDITION CODE <<01557>>08255000
SET TO CCL AND A ZERO IS RETURNED.                             <<01557>>08260000
                                                               <<01557>>08265000
                                                                        08270000
;                                                                       08275000
                                                                        08280000
BEGIN                                                                   08285000
LOGICAL ARRAY OBJIDENTIFIER(*)=OBJTEMPORARY;                   <<06660>>08290000
INTEGER DESCSTINX=CONVSEGIDTOSTINX,                            <<06212>>08295000
        CONDCODE:=CCE;                                         <<01557>>08300000
                                                               <<06212>>08305000
IF OBJIDENTIFIER(ObjIDTypeField)= OBJIDCDTYPE                  <<06660>>08310000
THEN SUDDENDEATH(SFKernCacheINTBAD);                           <<06212>>08315000
                                                               <<06212>>08320000
IF OBJIDENTIFIER(ObjIDTypeField)=ObjIDdataType                 <<06660>>08325000
THEN CONVSEGIDTOSTINX:=OBJIDENTIFIER(ObjIDnumField)&LSL(2) ELSE<<06660>>08330000
   BEGIN  <<CODE OBJ>>                                         <<06212>>08335000
   IF OBJIDENTIFIER(ObjIDTypeField)=ObjIDpgmType THEN          <<06660>>08340000
      BEGIN <<IN A PROGRAM BLOCK>>                                      08345000
      X:=OBJIDENTIFIER(ObjIDpbxField);                         <<06660>>08350000
      IF CSTXBLK(X)=-1 THEN                                    <<01913>>08355000
         BEGIN                                                 <<01913>>08360000
         CONDCODE:=CCL;                                        <<01913>>08365000
         CONVSEGIDTOSTINX:=0;                                  <<06212>>08370000
         END                                                   <<01913>>08375000
      ELSE                                                     <<01913>>08380000
      CONVSEGIDTOSTINX := CSTXBLK(X) +                         <<06660>>08385000
         INTEGER(OBJIDENTIFIER(ObjIDnumField) & LSL(2));       <<06660>>08390000
      END                                                               08395000
   ELSE                                                                 08400000
      BEGIN <<SL OBJ>>                                         <<06212>>08405000
      CONVSEGIDTOSTINX := OBJIDENTIFIER(OBJIDNUMFIELD) & LSL(2)<<06660>>08410000
                            + ABSOLUTE(SYSDFC);                <<06660>>08415000
      END;                                                              08420000
   END;                                                                 08425000
IF DST(DESCSTINX)=%100000 THEN                                 <<01557>>08430000
   BEGIN  <<UNALLOCATED ENTRY>>                                <<01557>>08435000
   CONDCODE:=CCL;                                              <<01557>>08440000
   DESCSTINX:=0;                                               <<01557>>08445000
   END;                                                        <<01557>>08450000
CC:=CONDCODE;                                                  <<01557>>08455000
END  <<CONVSEGIDTOSTINX>>;                                     <<06212>>08460000
                                                                        08465000
$page "Uncallable Utilities : Is Object Present ? "            <<06212>>08470000
                                                               <<06212>>08475000
LOGICAL PROCEDURE IsObjectAbsent ( obj );                      <<06660>>08480000
VALUE obj;                                                     <<06660>>08485000
DOUBLE  obj;                                                   <<06660>>08490000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06212>>08495000
                                                               <<06212>>08500000
COMMENT                                                        <<06212>>08505000
                                                               <<06212>>08510000
returns true if object is marked absent  else returns false.   <<06212>>08515000
                                                               <<06212>>08520000
;                                                              <<06212>>08525000
                                                               <<06212>>08530000
BEGIN                                                          <<06212>>08535000
LOGICAL ARRAY objid(*) = obj;                                  <<06660>>08540000
INTEGER STINX;                                                 <<*7564>>08545000
                                                               <<*7564>>08550000
IF objid(ObjIDtypeField) = ObjIDcdType THEN                    <<d7738>>08555000
   BEGIN                                                       <<d7738>>08560000
   CDT'ABS'ON'TOS;                                             <<d7738>>08565000
   TOS := TOS + objid(ObjIDNumField) * CDT'ENTRY'SIZE;         <<d7738>>08570000
   TOS := TOS + CDT'MD'FLAGS;                                  <<d7738>>08575000
   ASMB(LSEA;DELB,DELB);                                       <<d7738>>08580000
   IsObjectAbsent := TOS.CDT'ABSENT;                           <<d7738>>08585000
   END                                                         <<d7738>>08590000
ELSE                                                           <<*7564>>08595000
   BEGIN                                                       <<*7564>>08600000
   STINX := CONVSEGIDTOSTINX(OBJ);                             <<*7564>>08605000
   IF < THEN SUDDENDEATH(617);                                 <<*7564>>08610000
   IsObjectAbsent := DST(STINX).ABSENTFLAG;                    <<*7564>>08615000
   END;                                                        <<*7564>>08620000
                                                               <<06212>>08625000
END;  <<IsObjectAbsent>>                                       <<06212>>08630000
$page "Uncallable Utilities : Process Pri"                     <<06212>>08635000
                                                               <<06212>>08640000
INTEGER PROCEDURE ProcessPri(pin);                             <<06212>>08645000
VALUE pin;                                                     <<06212>>08650000
INTEGER pin;                                                   <<06212>>08655000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06212>>08660000
                                                               <<06212>>08665000
BEGIN                                                          <<06212>>08670000
IF pin=0 THEN SuddenDeath(SFKernBadParm);                      <<06212>>08675000
ProcessPri := pcb(pin*pcbsize+queueinginfowordnum).prifield;   <<06212>>08680000
END;  <<ProcessPri>>                                           <<06212>>08685000
                                                               <<06212>>08690000
$page "Uncallable Utilities : Is Object a ROC  ? "             <<06212>>08695000
                                                               <<06212>>08700000
LOGICAL PROCEDURE IsObjectROC ( obj );                         <<06660>>08705000
VALUE obj;                                                     <<06660>>08710000
DOUBLE  obj;                                                   <<06660>>08715000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06212>>08720000
                                                               <<06212>>08725000
COMMENT                                                        <<06212>>08730000
                                                               <<06212>>08735000
returns true if object is marked an roc else returns false.    <<06212>>08740000
                                                               <<06212>>08745000
;                                                              <<06212>>08750000
                                                               <<06212>>08755000
BEGIN                                                          <<06212>>08760000
LOGICAL ARRAY objid(*)=obj;                                    <<06660>>08765000
INTEGER STINX;                                                 <<*7564>>08770000
                                                               <<*7564>>08775000
IF objid(ObjIDTypeField) = ObjIDcdType THEN                    <<d7738>>08780000
   BEGIN                                                       <<d7738>>08785000
   CDT'ABS'ON'TOS;                                             <<d7738>>08790000
   TOS := TOS + objid(ObjIDNumField) * CDT'ENTRY'SIZE;         <<d7738>>08795000
   TOS := TOS + CDT'MD'FLAGS;                                  <<d7738>>08800000
   ASMB(LSEA;DELB,DELB);                                       <<d7738>>08805000
   IsObjectROC := TOS.CDT'ROC;                                 <<d7738>>08810000
   END                                                         <<d7738>>08815000
ELSE                                                           <<*7564>>08820000
   BEGIN                                                       <<*7564>>08825000
   STINX := CONVSEGIDTOSTINX(OBJ);                             <<*7564>>08830000
   IF < THEN SUDDENDEATH(617);                                 <<*7564>>08835000
   IsObjectROC := DST(STINX).ROCFLAG;                          <<*7564>>08840000
   END;                                                        <<*7564>>08845000
                                                               <<06212>>08850000
END;  <<IsObjectROC>>                                          <<06212>>08855000
                                                               <<06212>>08860000
$page "Uncallable Utilities : Is Object In Motion In ? "       <<06411>>08865000
                                                               <<06411>>08870000
LOGICAL PROCEDURE IsObjectIMI ( obj );                         <<06660>>08875000
VALUE obj;                                                     <<06660>>08880000
DOUBLE obj;                                                    <<06660>>08885000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06411>>08890000
                                                               <<06411>>08895000
COMMENT                                                        <<06411>>08900000
                                                               <<06411>>08905000
returns true if object is marked imi     else returns false.   <<06411>>08910000
                                                               <<06411>>08915000
;                                                              <<06411>>08920000
                                                               <<06411>>08925000
BEGIN                                                          <<06411>>08930000
LOGICAL ARRAY objid(*)=obj;                                    <<06660>>08935000
INTEGER STINX;                                                 <<*7564>>08940000
                                                               <<*7564>>08945000
IF objid(ObjIDTypeField) = ObjIDcdType THEN                    <<d7738>>08950000
   BEGIN                                                       <<d7738>>08955000
   CDT'ABS'ON'TOS;                                             <<d7738>>08960000
   TOS := TOS + objid(ObjIDNumField) * CDT'ENTRY'SIZE;         <<d7738>>08965000
   TOS := TOS + CDT'MD'FLAGS;                                  <<d7738>>08970000
   ASMB(LSEA;DELB,DELB);                                       <<d7738>>08975000
   IsObjectIMI := TOS.CDT'IMI;                                 <<d7738>>08980000
   END                                                         <<d7738>>08985000
ELSE                                                           <<*7564>>08990000
   BEGIN                                                       <<*7564>>08995000
   STINX := CONVSEGIDTOSTINX(OBJ);                             <<*7564>>09000000
   IF < THEN SUDDENDEATH(617);                                 <<*7564>>09005000
   IsObjectIMI := DST(STINX).IMIFLAG;                          <<*7564>>09010000
   END;                                                        <<*7564>>09015000
                                                               <<*7564>>09020000
END;      <<IsObjectIMI>>                                      <<*7564>>09025000
$PAGE  "UNCALLABLE UTILITIES : SET PSIF"                       <<06212>>09030000
PROCEDURE SET'PSIF(PCBPT,FLAG);                                         09035000
VALUE PCBPT,FLAG;                                                       09040000
INTEGER PCBPT;                                                          09045000
LOGICAL FLAG;                                                           09050000
OPTION PRIVILEGED,UNCALLABLE;                                           09055000
                                                                        09060000
COMMENT                                                                 09065000
                                                                        09070000
SET'PSIF SETS A FLAG IN THE PSEUDO-INTERRUPT FIELD OF                   09075000
PCBPT'S PCB ENTRY,PROVIDED NO MORE URGENT PI IS IN EFFECT.              09080000
IF THE PROCESS IS IMPEDED, HOLDING A SIR, CRITICAL, OR                  09085000
EXECUTING SYSTEM CODE, THE PIOVRFLAG IS SET.  OTHERWISE,                09090000
THE PROCESS IS QUEUED INTO THE DISPQ, SO IT WILL BE SWAPPED             09095000
IN AND A MARKER TO PSEUDOINT PUT ON ITS STACK BEFORE LAUNCH.            09100000
                                                                        09105000
;                                                                       09110000
                                                                        09115000
BEGIN                                                                   09120000
ENTRY CLEAR'PSIF;                                                       09125000
LOGICAL SETTING:=FALSE,                                                 09130000
        DELAY:=FALSE;                                                   09135000
                                                                        09140000
DISABLE;                                                                09145000
SETTING:=TRUE;                                                          09150000
X:=PCBPT+PROCSTATEWORDNUM;                                              09155000
TOS:=PCB(X):=LOGICAL(PCB(X)) LOR FLAG.PIFLAGSFIELD;                     09160000
TOS:=TOS.PIFLAGSFIELD&LSL(9);                                           09165000
ASMB(SCAN 0;DEL,LDXA);                                                  09170000
X:=PCBPT+PIINFOWORDNUM;                                        <<06650>>09175000
IF S0 >= PCB(X).PSIMFIELD THEN PCB(PCBPT+PROCSTATEWORDNUM)              09180000
.PIFLAGSFIELD:=0 <<MORE URGENT SOFT INTERRUPT IS PENDING>> ELSE         09185000
   BEGIN                                                                09190000
   <<IF HK,SK OR STOP, CLEAR FATHER AND SON WAIT FLAGS>>                09195000
   IF S0 < 3 THEN SPCBABORTWAKE:=0;                            <<03041>>09200000
   IF TOS=5 AND LOG(SPCBWAKESOFT) THEN <<C Y PREEMPT PAUSE/IO>><<03041>>09205000
      SPCBNONCRITWAIT:=0;                                      <<03041>>09210000
   IF LOGICAL(PCB(PCBPT+RESABORTINFOWORDNUM)).HASSIRFLAG                09215000
   OR LOGICAL(PCB(PCBPT+RESABORTINFOWORDNUM)).CRITFLAG                  09220000
   OR LOGICAL(PCB(PCBPT+WAKEMASKWORDNUM)).IMPEDEDWAITFLAG               09225000
   OR LOGICAL(PCB(PCBPT+STKINFOWORDNUM)).INSYSTEMFLAG THEN              09230000
      BEGIN <<PSEUDO-INTERRUPT MUST BE DELAYED>>                        09235000
      DELAY:=TRUE;                                                      09240000
      PCB(PCBPT+RESABORTINFOWORDNUM).PIOVRFLAG:=1;                      09245000
      END;                                                              09250000
   END;                                                                 09255000
                                                                        09260000
CLEAR'PSIF:                                                             09265000
                                                                        09270000
IF NOT SETTING THEN                                                     09275000
   BEGIN  <<CLEARING>>                                                  09280000
   DISABLE;                                                             09285000
   X:=PCBPT+PROCSTATEWORDNUM;                                           09290000
   TOS:=PCB(X):=LOGICAL(PCB(X)) LAND NOT FLAG.PIFLAGSFIELD;             09295000
   IF TOS.PIFLAGSFIELD = 0                                              09300000
   THEN PCB(PCBPT+RESABORTINFOWORDNUM).PIOVRFLAG:=0;                    09305000
   END;                                                                 09310000
                                                                        09315000
READYPROCESS(PCBPT);                                           <<03041>>09320000
END  <<PROCEDURE SET'PSIF>>;                                            09325000
$PAGE "SOFTWARE INTERRUPTS.  DATA STRUCTURES."                          09330000
<<                                                                      09335000
                                                                        09340000
Soft Interrupt Queue Structure.                                         09345000
                                                                        09350000
                   Msg Harbor                                           09355000
   ...........    ............                                          09360000
   .         .    .Port zero .    ........    ........   ........       09365000
   .  PCB    .    ............    .System.    .System.   .System.       09370000
   .         .--->.Port one  .--->.Soft  .--->.Soft  .-->.Soft  .       09375000
   ...........    ............    .Int 0 .    .Int 1 .   .Int 2 .       09380000
                  .Port two  .-   ........    ........   ........       09385000
                  ............                                          09390000
                               -                                        09395000
                                                                        09400000
                                - ........    ........                  09405000
                                  .User  .    .User  .                  09410000
                                 >.Soft  .--->.Soft  .                  09415000
                                  .Int 0 .    .Int 1 .                  09420000
                                  ........    ........                  09425000
                                                                        09430000
                                                                        09435000
Soft Interrupt Queue Entry Format.                                      09440000
                                                                        09445000
     ...............................                                    09450000
   0 . Soft int msg word zero      . 0                                  09455000
     ...............................                                    09460000
   1 . Soft int msg word one       . 1                                  09465000
     ...............................                                    09470000
   2 . Int handler's plabel        . 2                                  09475000
     ...............................                                    09480000
   3 . Soft int subtype            . 3                                  09485000
     ...............................                                    09490000
                                                                        09495000
>>                                                                      09500000
$PAGE "PCB FIELDS USED BY SOFTWARE INTERRUPTS."                         09505000
<<                                                                      09510000
                                                                        09515000
Process Control Block Fields.                                           09520000
----------------------------                                            09525000
                                                                        09530000
                                                                        09535000
Field name    Location      New  Description                            09540000
------------- ------------  ---- --------------------------------       09545000
                                                                        09550000
SPCBCritSir    PCB.(2:2)     No   Nonzero if the process is             09555000
                                  critical or with sir.                 09560000
                                                                        09565000
SPCBPIOvrFlag  PCB.(4:1)     No   Set when the execution of the         09570000
                                  soft interrupt must be postponed      09575000
                                  due to the process's being            09580000
                                  critical, with sir, or impeded.       09585000
                                  Tells the appropriate kernel          09590000
                                  procedure to enter PSEUDOINT.         09595000
                                                                        09600000
SPCBDelaySoft  PCB.(14:1)    Yes  Set when the execution of the         09605000
                                  soft interrupt must be delayed -      09610000
                                  critical, impeded, with sir,          09615000
                                  system code, or privileged code.      09620000
                                  This bit tells the bounds             09625000
                                  violation procedure in ININ that      09630000
                                  a soft interrupt is pending.          09635000
                                  The Dispatcher ignores this bit.      09640000
                                                                        09645000
SPCBWaitField  PCB(4).(0:12) No   Indicates which events (if any)       09650000
                                  that the user process is waiting      09655000
                                  on.  Does not include system          09660000
                                  events such as memory wait.           09665000
                                                                        09670000
SPCBImpede     PCB(4).(12:1) No   Set when the process is impeded.      09675000
                                                                        09680000
SPCBPSim       PCB(8).(0:3)  No   Current value of process's            09685000
                                  pseudo interrupt state.               09690000
                                                                        09695000
SPCBWakeSoft   PCB(8).(3:1)  Yes  Set on when the process will          09700000
                                  accept the soft interrupt even        09705000
                                  though it is waiting on other         09710000
                                  events.                               09715000
                                                                        09720000
SPCBSoftInt    PCB(9).(9:1)       Set when the Dispatcher (and          09725000
                                  PSEUDOINT) should be aware of a       09730000
                                  pending soft interrupt.               09735000
                                                                        09740000
SPCBPIFlags    PCB(9).(10:6) No   Specifies which of the six,           09745000
                                  independent pseudo interrupts         09750000
                                  may be pending against the            09755000
                                  process.                              09760000
                                                                        09765000
SPCBAllowSoft  PCB(13).(7:1) Yes  On implies that the process will      09770000
                                  process user soft interrupts.  A      09775000
                                  zero value postpones processing       09780000
                                  of user soft interrupts (but not      09785000
                                  system soft interrupts).  This        09790000
                                  bit is managed by the user            09795000
                                  through FINTSTATE and FINTEXIT.       09800000
>>                                                                      09805000
$PAGE "SOFTWARE INTERRUPT MMSTAT ENTRY FORMATS."                        09810000
<<                                                                      09815000
                                                                        09820000
MMSTAT Entry Formats.                                                   09825000
--------------------                                                    09830000
                                                                        09835000
MMSTAT tracing for the following types is enabled only if the           09840000
"monitoring" has been turned on by the MON command.                     09845000
                                                                        09850000
Type          Number  Word 0       Word 1        Word 2                 09855000
------------- ------- ------------ ------------- ---------------        09860000
                                                                        09865000
Cause soft    240     (0:4)  level Msg word one  Msg word two           09870000
interrupt             (4:2)  type                                       09875000
                      (6:2)  stype                                      09880000
                      (8:8)  pin                                        09885000
                                                                        09890000
Pseudoint     241     (0:8)  type  Msg word one  Msg word two           09895000
                      (8:8)  stype                                      09900000
                                                                        09905000
                                                                        09910000
Build stack   242     Plabel       Preg word of  Status word of         09915000
                                   prev marker   prev marker            09920000
                                                                        09925000
CHANGE STATE  243     (14:1) old   User's        User's status          09930000
                             state P register    register               09935000
                      (15:1) new                                        09940000
                             state                                      09945000
                                                                        09950000
TIMEOUT       244     Compltn type 16 msb of     16 lsb of              09955000
                      0 timeout    timeout (ms)  timeout (ms)           09960000
                      1 no trlx                                         09965000
                      2 control y                                       09970000
                        soft int                                        09975000
                                                                        09980000
where:                                                                  09985000
                                                                        09990000
   level          The current status of the interrupt/process           09995000
                                                                        10000000
                  0  process is dying (hard kill or soft kill)          10005000
                                                                        10010000
                  1  other soft interrupts are pending                  10015000
                                                                        10020000
                  2  user interrupts are disabled                       10025000
                                                                        10030000
                  3  process is impeded, critical, and/or with          10035000
                     sir                                                10040000
                                                                        10045000
                  4  interrupt was against own process                  10050000
                                                                        10055000
                  5  process was either waiting or ready to             10060000
                     execute                                            10065000
                                                                        10070000
                  6  process would have been readied but wasn't         10075000
                     due to caller's specification                      10080000
                                                                        10085000
                  7  process was readied                                10090000
                                                                        10095000
   type           The type of the soft interrupt.                       10100000
                                                                        10105000
                  0  user                                               10110000
                                                                        10115000
                  1  system                                             10120000
                                                                        10125000
   stype          The subtype of the soft interrupt.                    10130000
                                                                        10135000
                  user type                                             10140000
                                                                        10145000
                    0  no preprocessing                                 10150000
                    1  file system interrupt                            10155000
                                                                        10160000
                  system type                                           10165000
                                                                        10170000
                    0  no preprocessing                                 10175000
                    1  debug invocation                                 10180000
                                                                        10185000
   old state      Previous state of user soft interrupts                10190000
                                                                        10195000
                  0  disabled                                           10200000
                                                                        10205000
                  1  enabled                                            10210000
                                                                        10215000
   new state      New state of user soft interrupts                     10220000
                                                                        10225000
                  0  disabled                                           10230000
                                                                        10235000
                  1 enabled                                             10240000
                                                                        10245000
>>                                                                      10250000
$PAGE "SOFTWARE INTERRUPTS.  PROLOGUE."                                 10255000
<<                                                                      10260000
                                                                        10265000
Software Interrupts                                                     10270000
-------------------                                                     10275000
                                                                        10280000
Software interrupts provide a mechanism to interrupt the                10285000
executing sequence of a selected process, and to cause that             10290000
process to execute a specified sequence of code.  When the soft         10295000
interrupt code completes, the state of the interrupted process is       10300000
restored to that preceding the soft interrupt, and thus the             10305000
process resumes its normal execution.  Multiple simultaneous            10310000
interrupts will be executed in a fifo manner.                           10315000
                                                                        10320000
Soft interrupts may be initiated from any environment; including        10325000
the ICS, since invoking soft interrupts does not wait the caller.       10330000
                                                                        10335000
                                                                        10340000
a) Causing software interrupts.                                         10345000
                                                                        10350000
   The kernel procedure which issues soft interrupts against a          10355000
   target process is CAUSESOFTINT.  Currently it recognizes two         10360000
   types of soft interrupts:                                            10365000
                                                                        10370000
     1) User soft interrupts.                                           10375000
                                                                        10380000
        These interrupts are only processed while in the user's         10385000
        code.  Additionally the user may enable/disable them with       10390000
        the FINTSTATE intrinsic.  File system soft interrupts are       10395000
        are included in this type of interrupt.                         10400000
                                                                        10405000
     2) System soft interrupts.                                         10410000
                                                                        10415000
        System interrupts may execute while in system code (but         10420000
        not while critical, with sir, impeded, or waiting).  The        10425000
        user may not disable them.                                      10430000
                                                                        10435000
                                                                        10440000
   The subtype and plabel of the soft interrupt handler is              10445000
   supplied as an input parameter to CAUSESOFTINT.  This plabel         10450000
   must specify code which is within the interrupted process's          10455000
   code address space.  A short control message (max of two             10460000
   words) may be sent along with the soft interrupt for use by          10465000
   the soft interrupt handler.                                          10470000
                                                                        10475000
   CAUSESOFTINT first checks that the target process is healthy         10480000
   (not in soft or hard kill mode).  It then sends a message to         10485000
   the process's appropriate soft interrupt queue.  Each queue is       10490000
   actually a kernel "in core" ipc port.  User interrupts are           10495000
   sent to port number one whereas system interrupts go to port         10500000
   number two.                                                          10505000
                                                                        10510000
   If this is the first message in the queue and there are no           10515000
   other soft interrupts pending then:                                  10520000
                                                                        10525000
     1. Process is not critical, with sir, impeded, or waiting.         10530000
                                                                        10535000
        The soft interrupt bit is set in its PCB.  Since it is not      10540000
        waiting, it must already be on the dispatcher queue so that     10545000
        no further action is required.                                  10550000
                                                                        10555000
     2. Process is not critical, with sir, or impeded; but it is        10560000
        waiting.                                                        10565000
                                                                        10570000
        If the "wake soft interrupt" bit is set in the PCB, then        10575000
        the process can handle the soft interrupt even though it is     10580000
        waiting on some other event.  The wake-soft-int bit is reset    10585000
        (thus signaling the process that it was awakened by a           10590000
        soft interrupt).  Additionally its wait field is cleared and    10595000
        the "delay soft interrupt" bit is set in the PCB.               10600000
                                                                        10605000
        Processes which are waiting and do not have the                 10610000
        wake-soft-interrupt bit set must be allowed to                  10615000
        finish their processing before the soft interrupt occurs.       10620000
        Thus they should not be awakened until whatever they            10625000
        specified in their wait field occurs.  When the process         10630000
        is ready to launch, the Dispatcher will notice the soft         10635000
        bit and launch the process into PSEUDOINT.                      10640000
                                                                        10645000
     2. The process has some combination of critical, with sir,         10650000
        or impede.                                                      10655000
                                                                        10660000
        The delayed-soft-int bit and the pseudo-interrupt               10665000
        overflow bits are set in the PCB.  This cuts the                10670000
        Dispatcher out of the picture but leaves marks such             10675000
        that when the inhibiting conditions are removed,                10680000
        PSEUDOINT will be invoked.  That is, RELSIR and                 10685000
        RESETCRITICAL both look at the pseudoint overflow flag in       10690000
        the PCB and call PSEUDOINT if the flag is set.                  10695000
                                                                        10700000
b) Servicing soft interrupts                                            10705000
                                                                        10710000
   This subsection describes the action the target process takes        10715000
   to process a software interrupt.                                     10720000
                                                                        10725000
   Dispatcher                                                           10730000
                                                                        10735000
      When the process is about to be launched by the dispatcher,       10740000
      the PCB soft interrupt bit is checked.  If it is set and          10745000
      the process is not critical or with sir, PSEUDOINT is             10750000
      invoked.  Note that RELSIR and RESETCRITICAL will invoke          10755000
      PSEUDOINT later if the process was with sir or critical,          10760000
      respectively.                                                     10765000
                                                                        10770000
   First PSEUDOINT invocation.                                          10775000
                                                                        10780000
      Backing out of PAUSE/IOWAIT.                                      10785000
                                                                        10790000
         If the process was awakened by a soft interrupt instead        10795000
         of the expected event, then the kernel WAIT procedure          10800000
         will note this before exiting to its caller.  It notifies      10805000
         the caller with a CCG condition code.                          10810000
                                                                        10815000
         IOWAIT and PAUSE will note that a soft interrupt               10820000
         occurred, undo any processing they had done (for               10825000
         example, PAUSE will cancel its timeout), set the               10830000
         caller's stack marker to recall the intrinsic, and             10835000
         invoke PSEUDOINT by causing a bounds violation through         10840000
         ININ on the intrinsic's exit (for a complete description       10845000
         of this way, see the paragraph of the delayed PSEUDOINT        10850000
         execution below).                                              10855000
                                                                        10860000
      System soft interrupts.                                           10865000
                                                                        10870000
         As a general rule these interrupts are executed straight       10875000
         away.  They are "pcaled" rather than being exited into.        10880000
                                                                        10885000
         These interrupt procedures must be coded in one of three       10890000
         ways:                                                          10895000
                                                                        10900000
            1. procedure INTHANDLER;                                    10905000
                                                                        10910000
            2. procedure INTHANDLER(Msg)                                10915000
               value Msg;                                               10920000
               integer MSG;                                             10925000
                                                                        10930000
            3. procedure INTHANDLER(Msg0,Msg1);                         10935000
               value Msg0,Msg1;                                         10940000
               integer Msg0,Msg1;                                       10945000
                                                                        10950000
         The above procedure head declarations are for zero, one,       10955000
         and two message parameters, respectively.                      10960000
                                                                        10965000
         Software interrupts with nonzero subtype values will           10970000
         have subtype-specific preprocessing done for them.             10975000
         Since system soft interrupts have their own queue, they        10980000
         are not delayed if user soft interrupts are delayed.           10985000
         All system interrupts are processed before user                10990000
         interrupts are considered.  Note also that system              10995000
         interrupts occur without the process's user code being         11000000
         aware of it.                                                   11005000
                                                                        11010000
      User soft interrupts                                              11015000
                                                                        11020000
         PSEUDOINT checks that the user has soft interrupts             11025000
         enabled.  If not then PSEUDOINT returns to the interrupted     11030000
         code.  When the user reenables soft interrupts with            11035000
         either FINTSTATE or FINTEXIT, they will check for any          11040000
         pending soft interrupts by testing the user soft               11045000
         interrupt port.                                                11050000
                                                                        11055000
         Next it is determined if the interrupt can be executed         11060000
         right away.  That is, the process cannot be executing in       11065000
         system code and if we are interrupting privileged user         11070000
         code, the user interrupt procedure must be privileged.         11075000
         If the procedure is compatible then the code described         11080000
         in "Second PSEUDOINT invocation" is executed.  Delayed         11085000
         execution is effected by setting the delayed soft              11090000
         interrupt bit in the PCB and by setting bit zero of the        11095000
         P register save word of the first eligible stack marker.       11100000
         The exit instruction against this stack marker will            11105000
         cause a bounds violation trap to ININ, which will note         11110000
         that a soft interrupt is pending and invoke PSEUDOINT at       11115000
         its secondary entry point, DELAYEDINT.                         11120000
                                                                        11125000
      Second PSEUDOINT invocation.                                      11130000
                                                                        11135000
         PSEUDOINT gets the interrupt's first in-core ipc message       11140000
         and:                                                           11145000
                                                                        11150000
           1. performs any required preprocessing (subtype <> 0),       11155000
                                                                        11160000
           2. disables user soft interrupts,                            11165000
                                                                        11170000
           3. builds the stack marker for the interrupt handler,        11175000
                                                                        11180000
           4. and exits through it.                                     11185000
                                                                        11190000
>>                                                                      11195000
$PAGE "DATA STRUCTURE INDEPENDENT INFORMATION PROCEDURES"      <<01644>>11200000
$PAGE "SOFT INTERRUPTS. BUILDSTACKMARKER PROCEDURE."                    11205000
PROCEDURE BUILDSTACKMARKER(LOC,PLABEL);                        <<03041>>11210000
VALUE LOC,PLABEL;                                                       11215000
                                                                        11220000
<<FUNCTION                                                              11225000
  BUILDS A STACK MARKER BASED ON THE PLABEL PARAMETER.>>                11230000
                                                                        11235000
<<INPUT>>                                                               11240000
  INTEGER                                                               11245000
    LOC;                  <<LOCATION OF THE DESIRED STACK MARKER        11250000
                            RELATIVE TO THE CALLER'S Q.  IT             11255000
                            IS THE NUMBER OF WORDS FROM THE             11260000
                            CALLER'S Q+0 TO THE FIRST WORD              11265000
                            OF THE STACK MARKER (X REGISTER SAVE).      11270000
                            THIS WORD MUST BE POSITIVE.>>               11275000
  LOGICAL                                                               11280000
    PLABEL;               <<TRAP PROCEDURE'S PLABEL.>>                  11285000
                                                                        11290000
<<OUTPUT                                                                11295000
  THE DESIRED STACK MARKER>>                                            11300000
                                                                        11305000
OPTION PRIVILEGED,UNCALLABLE;                                           11310000
                                                                        11315000
BEGIN                                                                   11320000
INTEGER                                                                 11325000
   DELTAQ=Q+0,INDEX,CSTN;                                               11330000
ARRAY                                                                   11335000
   STACK(*)=Q+0;                                                        11340000
DEFINE                                                                  11345000
   PRIVINTERRUPTEE = LOG(STACK(-STACK-1).(0:1))#;                       11350000
                                                                        11355000
                                                                        11360000
<<INITIALIZE>>                                                          11365000
INDEX:=LOC-DELTAQ;                                                      11370000
IF GLOBALTRACEFLAG THEN                                                 11375000
   MMSTAT'(MMBUILDMARKER,PLABEL,STACK(-DELTAQ-2),STACK(X+1),   <<06948>>11380000
          0,0,0);                                              <<06948>>11385000
                                                                        11390000
<<CONFIGURE THE STATUS WORD>>                                           11395000
TOS:=PLABEL.(8:8);                                             <<06104>>11400000
TOS.(1:1):=1;  <<ENABLE INTERRUPTS>>                                    11405000
IF PRIVINTERRUPTEE THEN  <<INTERRUPTEE PRIVILEGED?>>                    11410000
   TOS.(0:1):=1  <<YES, THEN SO SHALL THE TRAP PROCEDURE>>              11415000
ELSE                                                                    11420000
   BEGIN  <<NO, GET TRAP HANDLER'S TRUE MODE FROM THE CST>>             11425000
      X:=CSTCONV(PLABEL,0);                                    <<06104>>11430000
      TOS.(0:1):=DST(X).(1:1);                                 <<06104>>11435000
   END;                                                                 11440000
STACK(INDEX+2):=TOS;  <<STATUS REGISTER>>                               11445000
                                                                        11450000
<<CONFIGURE REMAINDER OF THE MARKER>>                                   11455000
STACK(INDEX):=0;  <<X REGISTER>>                                        11460000
STACK(INDEX+1):=CONVEXTLABELTODELTAP(PLABEL); <<P-REGISTER>>   <<06104>>11465000
IF MAPPINGFIRMWARE THEN                                        <<06104>>11470000
   STACK(INDEX+1).(1:1):=PLABEL.(0:1); <<MAPPING FLAG>>        <<06104>>11475000
STACK(INDEX+3):=LOC+3;  <<DELTA Q>>                                     11480000
                                                                        11485000
<<HOOK INTO THE NEW MARKER>>                                            11490000
DELTAQ:=DELTAQ-LOC-3;                                                   11495000
END;  <<BUILDSTACKMARKER>>                                              11500000
LOGICAL PROCEDURE SYSTEM'SEGMENT(STATUS',DELTAP);              <<*7950>>11505000
VALUE STATUS',DELTAP;                                          <<*7950>>11510000
LOGICAL STATUS',DELTAP;                                        <<*7950>>11515000
BEGIN                                                          <<*7950>>11520000
INTEGER                                                        <<*7950>>11525000
   SEG'NUM;                                                    <<*7950>>11530000
SYSTEM'SEGMENT := FALSE;                                       <<*7950>>11535000
TOS := 0D; << for the return of MAPPEDCSTTOPHYCST >>           <<*8009>>11540000
TOS := STATUS'.(8:8);                                          <<*7950>>11545000
TOS.(0:1) := DELTAP.(1:1);                                     <<*7950>>11550000
TOS := CURPRC;                                                 <<*7950>>11555000
TOS := MAPPEDCSTTOPHYCST(*,*);                                 <<*7950>>11560000
DELB;                                                          <<*7950>>11565000
SEG'NUM := TOS;                                                <<*7950>>11570000
IF MARKER'IS'SL'SEG(STATUS',DELTAP,0) AND                      <<*7950>>11575000
   LOG(SL(SEG'NUM & LSL(2) + 1).SYSTEMFLAG) THEN               <<*7950>>11580000
   SYSTEM'SEGMENT := TRUE;                                     <<*7950>>11585000
END;                                                           <<*7950>>11590000
$PAGE "SOFTWARE INTERRUPTS.  PSEUDOINT PROCEDURE."                      11595000
PROCEDURE PSEUDOINT;                                           <<03041>>11600000
                                                                        11605000
<<PROCESSES ALL PSEUDO INTERRUPTS AND SOFTWARE INTERRUPTS.  ASSUMES     11610000
  THAT IT IS CALLED PESUDODISABLED WITH INTERRUPTS OFF.  DB MAY BE      11615000
  AT ANY DATA SEGMENT (INCLUDING SYSTEM DB AND THE STACK).>>            11620000
                                                                        11625000
OPTION PRIVILEGED,UNCALLABLE;                                           11630000
                                                                        11635000
BEGIN                                                                   11640000
EQUATE                                                                  11645000
   RETURN0        = %31400,                                             11650000
   STDINLOGDEV    = 8,                                         <<06669>>11655000
   ABTYP          = [8/1,8/5],  <<HARD KILL ABORT CODE>>                11660000
   ENABLELAUNCH   = TRUE,                                               11665000
   NOPENABLE      = FALSE,                                              11670000
   PRIMARYENTRY   = TRUE,                                               11675000
   NOWAITDONE     = -1,                                                 11680000
   PRIVMODE       = FALSE;                                              11685000
                                                                        11690000
EQUATE                                                                  11695000
   SOFTINTERRUPT  = 7;                                                  11700000
                                                                        11705000
ENTRY                                                                   11710000
   DELAYEDINT;                                                          11715000
INTEGER                                                                 11720000
   CUTBACK:=0;  <<MUST BE AT Q+1>>                                      11725000
DOUBLE                                                                  11730000
  MSG0,MSG1;  <<MUST BE AT Q+2>>                                        11735000
INTEGER                                                                 11740000
   NEWINTERRUPT,SON,NEXT,MAIN,STACKMARKERNUM,DEPTHLIMIT,       <<06650>>11745000
   I,PCBXLOC,X=X,DELTAQ,MARKERNUM,PCBPT,PLABEL=MSG1+1,         <<06650>>11750000
   SVALUE;                                                              11755000
LOGICAL                                                                 11760000
   PXFIXEDLOC,                                                 <<06669>>11765000
   PROCESSREQUEST;                                                      11770000
                                                                        11775000
                                                                        11780000
SUBROUTINE PEXIT(ENABLELAUNCH);                                         11785000
VALUE ENABLELAUNCH;                                                     11790000
LOGICAL ENABLELAUNCH;                                                   11795000
   BEGIN                                                                11800000
   IF ENABLELAUNCH THEN PENABLE;                                        11805000
   TOS:=RETURN0+CUTBACK;                                                11810000
   ASMB(XEQ);                                                           11815000
   END;  <<PEXIT>>                                                      11820000
SUBROUTINE INITIALIZE;                                                  11825000
   BEGIN  <<INITIALIZE LOCAL VARIABLES>>                                11830000
   PXFIXED;                                                             11835000
   PCBPT := (CURPRC);                                          <<06650>>11840000
   END;  <<INITIALIZE>>                                                 11845000
                                                                        11850000
                                                                        11855000
LOGICAL SUBROUTINE FINDTARGETMARKER(NONPRIV);                           11860000
VALUE NONPRIV;                                                          11865000
                                                                        11870000
<<SCANS BACKWARD THROUGH THE STACK UNTIL IT FINDS THE FIRST             11875000
  SUITABLE USER STACK MARKER.>>                                         11880000
                                                                        11885000
<<INPUT>>                                                               11890000
  LOGICAL                                                               11895000
    NONPRIV;          <<TRUE IF USER PROCEDURE MUST BE EXECUTING        11900000
                        IN NON-PRIVILEGED MODE.>>                       11905000
                                                                        11910000
<<OUTPUT                                                                11915000
  FINDTARGETMARKER      TRUE  - MARKER WAS THE ONE AT Q+0               11920000
                        FALSE - MARKER WAS FURTHER BACK, BIT ZERO       11925000
                                OF THE P-REGISTER SAVE WORD IS SET      11930000
                                TO FORCE THE EXIT INTO ININ (WITH       11935000
                                BOUNDS VIOLATION).>>                    11940000
                                                                        11945000
   BEGIN                                                                11950000
   PUSH(Q,DL);                                                          11955000
   DEPTHLIMIT:=TOS-TOS;   <<SET MAXIMUM STACK DEPTH LIMIT>>             11960000
   I:=-1; MARKERNUM:=0;                                                 11965000
                                                                        11970000
   <<LOCATE THE MARKER.  CANNOT BE:                                     11975000
     1. IN SYSTEM SL                                                    11980000
     2. HAVE SYSTEM BIT SET ON IN CST                                   11985000
     3. PRIVILEGED, IF TRAP PROCEDURE IS USER MODE>>                    11990000
   WHILE SYSTEM'SEGMENT(STACK(I),STACK(I-1)) OR                <<*7950>>11995000
         NONPRIV AND STACK(I)&CSL(1) DO                        <<*7950>>12000000
      BEGIN  <<INDEX BACK TO THE NEXT MARKER>>                          12005000
      MARKERNUM:=MARKERNUM+1;                                           12010000
      DELTAQ:=STACK(I+1);                                               12015000
      IF DELTAQ < 4 OR -(I:=I-DELTAQ) > DEPTHLIMIT THEN                 12020000
         ABORT(MARKERNUM&LSL(8),22,0);  <<BAD MARKER IN STACK>>         12025000
      END;                                                              12030000
                                                                        12035000
   <<TALLY THE RESULT>>                                                 12040000
   IF MARKERNUM = 0 THEN                                                12045000
      FINDTARGETMARKER:=TRUE                                            12050000
   ELSE                                                                 12055000
      STACK(I-1).(0:1):=1;  <<CAUSE TRAP TO ININ UPON USER MODE>>       12060000
   END;  <<FINDTARGETMARKER>>                                           12065000
SUBROUTINE SPECIALSYSTEMTRAP(PLABEL);                                   12070000
VALUE PLABEL;                                                           12075000
LOGICAL PLABEL;                                                         12080000
                                                                        12085000
<<CAUSES TRAP TO OCCUR ON THE FIRST USER STACK MARKER.                  12090000
  NOTE - IF SUCCESSFUL, IT EXITS THIS PROCEDURE.>>                      12095000
                                                                        12100000
   BEGIN                                                                12105000
   IF FINDTARGETMARKER(PRIVMODE) THEN                                   12110000
      BEGIN  <<CAN EXECUTE THE INTERRUPT NOW>>                          12115000
      IF LOG(PORTSTATUS(SYSTEMSGPORT))                                  12120000
      OR LOG(PORTSTATUS(USERMSGPORT)) AND LOG(SPCBALLOWSOFT) THEN       12125000
         BEGIN  <<ANOTHER SOFT INTERRUPT IS PENDING>>                   12130000
         STACK(-1).(0:1):=1;  <<TRAP TO ININ ON SI PROC'S EXIT>>        12135000
         SPCBDELAYSOFT:=1;                                              12140000
         END;                                                           12145000
      X:=PLABEL;                                                        12150000
      RECEIVEMSG(SYSTEMSGPORT,MAXMSGLEN,DELETEMSG);                     12155000
      BUILDSTACKMARKER(1,X); CUTBACK:=0;                                12160000
      PEXIT(NOPENABLE);                                                 12165000
      END                                                               12170000
   ELSE                                                                 12175000
      BEGIN  <<MUST POSTPONE THE EXECUTION>>                            12180000
      DISABLE;                                                          12185000
      SPCBDELAYSOFT:=1;                                                 12190000
      ENABLE;                                                           12195000
      END;                                                              12200000
   END;  <<SPECIALSYSTEMTRAP>>                                          12205000
INTEGER SUBROUTINE PROCESSYSOFTINT;                                     12210000
                                                                        12215000
<<EAT AWAY AT THE PROCESS'S SYSTEM SOFT INTERRUPT QUEUE UNTIL           12220000
  EITHER:                                                               12225000
                                                                        12230000
   1. THE QUEUE IS EXHAUSTED (RETURNS TRUE),                            12235000
                                                                        12240000
   2. OR THE HEAD INTERRUPT IS STALLED (RETURNS FALSE).                 12245000
                                                                        12250000
  MESSAGE FORMAT (S-REGISTER RELATIVE)                                  12255000
  S0    - REQUEST DEPENDENT PROCESSING TYPE                             12260000
  S1    - INTERRUPT PROCEDURE'S PLABEL                                  12265000
  S2,S3 - INTERRUPT-TYPE DEPENDENT                                      12270000
                                                                        12275000
  NOTE - THE GENERAL CASE IS PCAL THE TRAP PROCEDURE FROM THIS          12280000
         SUBROUTINE (RATHER THAN BUILDING A STACK MARKER AND            12285000
         EXITING THROUGH IT.>>                                          12290000
                                                                        12295000
   BEGIN                                                                12300000
   <<INITIALIZE>>                                                       12305000
   PROCESSREQUEST:=TRUE;                                                12310000
                                                                        12315000
   WHILE PROCESSREQUEST                                                 12320000
   AND (PROCESSYSOFTINT:=PORTSTATUS(-1)) = SYSTEMSGPORT DO              12325000
      BEGIN  <<HAVE AN INTERRUPT TO PROCESS>>                           12330000
      PUSH(S); SVALUE:=TOS; <<TRAP PROCS MAY NOT DELETE THEIR PARAMS>>  12335000
      ASMB(ADDS MAXMSGLEN);  <<SO SAVE THE PROPER S VALUE.>>            12340000
      RECEIVEMSG(SYSTEMSGPORT,MAXMSGLEN,SAVEMSG);                       12345000
      IF <> THEN SUDDENDEATH(UGLYPSEUDOINT);                            12350000
      IF GLOBALTRACEFLAG THEN                                           12355000
         MMSTAT'(MMPROCESS,SYSOFTINT CAT S0(0:8:8),S3,S2,      <<06948>>12360000
                 0,0,0);                                       <<06948>>12365000
      TOS:=TOS.(1:15); <<MASK OFF MODE BIT>>                   <<06104>>12370000
      CASE TOS OF                                                       12375000
         BEGIN  <<REQUEST DEPENDENT PROCESSING>>                        12380000
         ;                    <<0 - NO OPERATION>>                      12385000
         BEGIN                <<1 - DEBUG>>                             12390000
         SPECIALSYSTEMTRAP(LOG(@DEBUG));                                12395000
         PROCESSREQUEST:=FALSE;                                         12400000
         END;                                                           12405000
         END;  <<CASE>>                                                 12410000
      IF PROCESSREQUEST THEN                                            12415000
         BEGIN  <<INVOKE THE TRAP'S HANDLER>>                           12420000
         RECEIVEMSG(SYSTEMSGPORT,MAXMSGLEN,DELETEMSG); DEL;             12425000
         IF S0 <> 0 THEN ASMB(PCAL 0);                                  12430000
         END;                                                           12435000
      TOS:=SVALUE; SET(S);                                              12440000
      END;                                                              12445000
                                                                        12450000
   END;  <<PROCESSYSOFTINT>>                                            12455000
                                                                        12460000
                                                                        12465000
SUBROUTINE PROCESSOFTINT;                                               12470000
                                                                        12475000
<<PROCESS ALL THE PROCESS'S SOFTWARE INTERRUPTS.>>                      12480000
                                                                        12485000
   BEGIN                                                                12490000
   DISABLE; SPCBSOFTINT:=0; SPCBDELAYSOFT:=0; ENABLE;                   12495000
   IF PROCESSYSOFTINT = USERMSGPORT AND LOG(SPCBALLOWSOFT) THEN         12500000
      BEGIN  <<OK TO PROCESS USER MODE SOFT INTERRUPTS>>                12505000
      <<GET HEAD SOFT INTERRUPT                                         12510000
        MESSAGE FORMAT                                                  12515000
        S0    - REQUEST DEPENDENT PROCESSING TYPE  (SUBTYPE)   ((*msg2))12520000
                CauseSoftInt actually uses bit 0 of the        ((*msg2))12525000
                SubType to signify priv/non-priv. This info    ((*msg2))12530000
                will be used by FindTargetMarker.              ((*msg2))12535000
        S1    - Interrupt procedure's Plabel.                  ((*msg2))12540000
        S2,S3 - Interrupt dependent type.                    >><<*8867>>12545000
                                                               <<*8867>>12550000
      ASMB(ADDS 4);                                                     12555000
      RECEIVEMSG(USERMSGPORT,4,SAVEMSG);                                12560000
      IF <> THEN SUDDENDEATH(UGLYPSEUDOINT);                            12565000
      IF GLOBALTRACEFLAG THEN                                           12570000
         MMSTAT'(MMPROCESS,USERSOFTINT CAT S0(0:8:8),S3,S2,    <<06948>>12575000
                0,0,0);                                        <<06948>>12580000
                                                               <<*8867>>12585000
      << NOTE: S0 is the SubType field from CauseSoftInt >>    <<*8867>>12590000
                                                               <<*8867>>12595000
      IF FINDTARGETMARKER(S0.(0:1)) THEN                       <<*8867>>12600000
         BEGIN  <<WILL EXIT INTO THE TRAP PROCEDURE>>                   12605000
         RECEIVEMSG(USERMSGPORT,4,DELETEMSG);                           12610000
         SPCBALLOWSOFT:=0;                                              12615000
                                                               <<*8867>>12620000
                                                               <<*8867>>12625000
         << Get rid of the mode (i.e. priv/non priv) of the >> <<*8867>>12630000
         << interrupt procedure and save the file number.   >> <<*8867>>12635000
                                                               <<*8867>>12640000
         S0 := S0.(1:15); << Get rid of priv/non-priv bit.  >> <<*8867>>12645000
         CASE TOS OF                                                    12650000
            BEGIN  <<REQUEST DEPENDENT PROCESSING>>                     12655000
            ;                                     <<0 - NO ACTION>>     12660000
            BEGIN                                 <<1 - MSG FILE>>      12665000
                                                               <<*8867>>12670000
            << Note : S1 is really the file number           >><<*8867>>12675000
                                                               <<*8867>>12680000
            FCPREPAFT(S1,NOWAITDONE);                                   12685000
            TOS:=DQM3; TOS:=DQM1;  <<REMOVE CUTBACK PARMS (ININ CALL)>> 12690000
            X:=-CUTBACK+1;         <<BUT LEAVE ROOM FOR FILE NUMBER>>   12695000
            STACK(X):=TOS-CUTBACK+1; STACK(X:=X-1):=TOS;                12700000
            STACK(X:=X-1):=TOS; STACK(X:=X-1):=TOS;                     12705000
            PUSH(Q); TOS:=TOS+X+3; SET(Q); INITIALIZE;                  12710000
            QM4:=S1;  <<RETURN FILE NUMBER>>                            12715000
            END;                                                        12720000
                                                               <<06947>>12725000
            BEGIN                        <<2 - PORT PROCEDURE>><<06947>>12730000
            FCPREPAFT(S1,-S2);  << - IOWAIT PORT INDEX >>      <<06947>>12735000
            TOS:=DQM3; TOS:=DQM1;  <<REMOVE CUTBACK PARMS>>    <<06947>>12740000
            X:=-CUTBACK+1;   <<BUT LEAVE ROOM FOR FILE NUMBER>><<06947>>12745000
            STACK(X):=TOS-CUTBACK+1; STACK(X:=X-1):=TOS;       <<06947>>12750000
            STACK(X:=X-1):=TOS; STACK(X:=X-1):=TOS;            <<06947>>12755000
            PUSH(Q); TOS:=TOS+X+3; SET(Q); INITIALIZE;         <<06947>>12760000
            QM4:=S1;  <<RETURN FILE NUMBER>>                   <<06947>>12765000
            END;                                               <<06947>>12770000
            END;  <<CASE>>                                              12775000
         BUILDSTACKMARKER(1,S0); CUTBACK:=0;                            12780000
         DEL; DDEL;                                                     12785000
         END                                                            12790000
      ELSE                                                              12795000
         BEGIN  <<MUST DEFER PROCESSING OF THE INTERRUPT>>              12800000
         DISABLE; SPCBDELAYSOFT:=1; ENABLE;                             12805000
         ASMB(SUBS 4);                                                  12810000
         END;                                                           12815000
      END;                                                              12820000
   END;  <<PROCESSOFTINT>>                                              12825000
                                                                        12830000
                                                                        12835000
SUBROUTINE PROCESSBREAK;                                                12840000
   BEGIN                                                                12845000
   <<GET LOGICAL DEVICE NUMBER FOR $STDIN>>                             12850000
   PUSH(Q,DL);                                                          12855000
   ASMB(XCH,SUB;DUP,STAX;DECX);                                         12860000
   TOS:=-QARRAY(X);                                            <<06635>>12865000
   ASMB(ADD);                                                  <<06650>>12870000
   TOS:=TOS+STDINLOGDEV;                                                12875000
   ASMB(STAX);                                                          12880000
   TOS:=QARRAY(X);                                             <<06635>>12885000
   IF RESABORTINFO.RITBRKFLAG <> 0 THEN                        <<06650>>12890000
      BEGIN                                                             12895000
      DISABLE;                                                          12900000
      PIINFO.OAFIELD := 0;                                     <<06650>>12905000
      ENABLE;                                                           12910000
      END;                                                              12915000
   ATTACHIO(S0,0,0,0,30,0,1,0,%13); <<SETTMODE>>                        12920000
   SYSBREAK;                                                            12925000
   ATTACHIO(S0,0,0,0,30,0,0,0,%13); <<RESETTMODE>>                      12930000
   DEL;                                                                 12935000
   PDISABLE;                                                            12940000
   PIINFO.PSIMFIELD := 7;                                      <<06650>>12945000
                                                                        12950000
   IF SONINFO = 0 THEN                                         <<06650>>12955000
      BEGIN  <<NO EXISTING SON>>                                        12960000
      IF RESABORTINFO.RITBRKFLAG <> 0 THEN                     <<06650>>12965000
         BEGIN  <<RIT BREAK>>                                           12970000
         RESABORTINFO.RITBRKFLAG := 0;                         <<06650>>12975000
         IF PIINFO.OAFIELD <> 3 THEN                           <<06650>>12980000
            BEGIN                                                       12985000
            PENABLE;                                                    12990000
            WAIT(%40,0);                                                12995000
            PEXIT(NOPENABLE);                                           13000000
            END                                                         13005000
         ELSE                                                           13010000
            PEXIT(ENABLELAUNCH);                                        13015000
         END                                                            13020000
      ELSE                                                              13025000
         PEXIT(ENABLELAUNCH);                                           13030000
      END;                                                              13035000
                                                                        13040000
   MAIN := NEXT := (CURPRC)/PCBSIZE;                           <<06650>>13045000
   WHILE (NEXT:=FAMILY(NEXT,MAIN))<>MAIN DO                             13050000
      CLEAR'PSIF(NEXT*PCBSIZE,4);                                       13055000
   END;  <<PROCESSBREAK>>                                               13060000
                                                                        13065000
                                                                        13070000
SUBROUTINE ANALYZEINTERRUPT;                                            13075000
                                                                        13080000
<<GETS THE HIGHEST PRIORITY PENDING PSEUDO/SOFT INTERRUPT.              13085000
  RETURNS THE INTERRUPT TYPE IN "NEWINTERRUPT.">>                       13090000
                                                                        13095000
   BEGIN                                                                13100000
   TOS := PROCSTATE&LSL(10); << PI BITS INTO MSB OF TOS >>     <<06650>>13105000
   IF <> THEN                                                           13110000
      BEGIN  <<PSEUDO INTERRUPT OCCURRED>>                              13115000
      SPCBPIFLAGS:=0;                                                   13120000
      ASMB(SCAN 0); DEL;                                                13125000
      NEWINTERRUPT:=X+1;                                                13130000
      IF NEWINTERRUPT >= SPCBPSIM THEN                                  13135000
         PEXIT(ENABLELAUNCH); <<ALREADY HAVE MORE IMPORTANT PSEUDO INT>>13140000
      SPCBPSIM:=                                                        13145000
       IF NEWINTERRUPT=HARDKILLVALUE THEN NORMALVALUE ELSE NEWINTERRUPT;13150000
      IF NEWINTERRUPT <= SOFTKILL THEN                                  13155000
         BEGIN  <<PROCESS IS DYING, FORGET SOFT INTERRUPTS>>            13160000
         SPCBDELAYSOFT:=0;                                              13165000
         SPCBSOFTINT:=0;                                                13170000
         END;                                                           13175000
      END                                                               13180000
   ELSE                                                                 13185000
      BEGIN  <<ASSUME SOFT INTERRUPT OCCURRED>>                         13190000
      DEL;                                                              13195000
      IF SPCBPSIM < CONTROLYVALUE THEN                                  13200000
         BEGIN  <<ALREADY EXECUTING A PSEUDO INTERRUPT>>                13205000
         IF SPCBPSIM < SOFTKILL THEN                                    13210000
            BEGIN  <<PROCESS IS DYING, FORGET SOFT INT>>                13215000
            SPCBSOFTINT:=0;                                             13220000
            SPCBDELAYSOFT:=0;                                           13225000
            PEXIT(ENABLELAUNCH);                                        13230000
            END;                                                        13235000
         END;                                                           13240000
      NEWINTERRUPT:=SOFTINTERRUPT;                                      13245000
      END;                                                              13250000
   END;  <<ANALYZEINTERRUPT>>                                           13255000
PCBPT := (CURPRC);                                             <<06650>>13260000
IF PROCSTATE.STOVFLAG <> 0 THEN                                <<07320>>13265000
   BEGIN                                                       <<07320>>13270000
   DISABLE;                                                    <<07320>>13275000
   RESABORTINFO.STOVABORTFLAG := 1;                            <<07320>>13280000
   ENABLE;                                                     <<07320>>13285000
   PENABLE;    << Always PDISABLED when get here!!!!! >>       <<*7564>>13290000
   ABORT([8/2,8/4],0,0);                                       <<07320>>13295000
   END;                                                        <<07320>>13300000
IF PRIMARYENTRY THEN                                                    13305000
   BEGIN  <<* * PRI ENTRY (CAUSESOFTINT,DISPATCH,RESETCRITICAL,RELSIR>> 13310000
   INITIALIZE;                                                          13315000
   SPCBPIOVRFLAG:=0;                                                    13320000
   ANALYZEINTERRUPT;                                                    13325000
   PENABLE; ENABLE;                                                     13330000
   END                                                                  13335000
ELSE                                                                    13340000
   BEGIN  <<* * SECONDARY ENTRY (ININ), ENABLED & PSEUDOENABLED>>       13345000
   DELAYEDINT:                                                          13350000
   PUSH(Q); TOS:=TOS-STACK; SET(Q);  <<DELETE ININ'S STACK MARKER>>     13355000
   INITIALIZE;                                                          13360000
   <<GET CAUSE OF INTERRUPT>>                                           13365000
   PXFXDCY := 0;                                               <<07365>>13370000
   IF <> AND (PXFXCTLYPLBL <> 0) THEN                          <<06635>>13375000
      NEWINTERRUPT:=CONTROLYVALUE                                       13380000
   ELSE IF LOG(SPCBDELAYSOFT) THEN                                      13385000
      NEWINTERRUPT:=SOFTINTERRUPT                                       13390000
   ELSE                                                                 13395000
      PEXIT(NOPENABLE);                                                 13400000
   END;                                                                 13405000
                                                                        13410000
<<PROCESS THE PSEUDOINTERRUPT>>                                         13415000
CASE NEWINTERRUPT-1 OF                                                  13420000
   BEGIN                                                                13425000
   BEGIN  <<** HARD KILL>>                                              13430000
   <<PROCESS KILLED BY UCOP, QUITPROG SITUATION>>                       13435000
   MMSTAT'(MMPROCESS,HARDKILLER,0,0,0,0,0);                    <<06948>>13440000
   ABORT(ABTYP,0,0);                                                    13445000
   END;                                                                 13450000
                                                                        13455000
   BEGIN  <<** SOFT KILL>>                                              13460000
   MMSTAT'(MMPROCESS,SOFTKILLER,0,0,0,0,0);                    <<06948>>13465000
   TERMINATE;                                                           13470000
   END;                                                                 13475000
                                                                        13480000
   BEGIN  <<** STOP>>                                                   13485000
   SUDDENDEATH(UGLYPSEUDOINT);                                          13490000
   END;                                                                 13495000
                                                                        13500000
   BEGIN  <<** HYBERNATE>>                                              13505000
   SUDDENDEATH(UGLYPSEUDOINT);                                          13510000
   END;                                                                 13515000
                                                                        13520000
   BEGIN  <<** CONTROL Y>>                                              13525000
   PROCESSYSOFTINT;                                                     13530000
   PLABEL:=PXFXCTLYPLBL;                                       <<06635>>13535000
   IF SPCBWAKESOFT = 0 THEN                                             13540000
      BEGIN                                                             13545000
      MMSTAT'(MMPROCESS,CONTROLY,0,0,0,0,0);                   <<06948>>13550000
      IF FINDTARGETMARKER(PXFXCTLYTRP) THEN                    <<06635>>13555000
         BEGIN                                                          13560000
         PXFXSIFLAG:=SPCBALLOWSOFT;                            <<06635>>13565000
         DISABLE; SPCBALLOWSOFT:=0; ENABLE; <<DISABLE USER SOFT INT>>   13570000
         BUILDSTACKMARKER(2,PLABEL); CUTBACK:=0;                        13575000
         END                                                            13580000
      ELSE                                                              13585000
         PXFXDCY := 1;                                         <<07365>>13590000
      END                                                               13595000
   ELSE                                                                 13600000
      BEGIN                                                    <<03787>>13605000
      SPCBWAKESOFT := 0;                                       <<03787>>13610000
      PXFXDCY := 1; << Pause/Iowait have to clean first >>     <<07365>>13615000
      END;                                                     <<03787>>13620000
   END;                                                                 13625000
                                                                        13630000
   BEGIN  <<** BREAK>>                                                  13635000
   MMSTAT'(MMPROCESS,BREAKER,0,0,0,0,0);                       <<06948>>13640000
   PROCESSBREAK;                                                        13645000
   <<CUT OFF TWO STACK MARKERS>>                                        13650000
   Comment The situation we are in is that of a CI which has   <<05019>>13655000
           been broken from a son wait. CI command executors   <<05019>>13660000
           should always do a joint call to AWAKE and WAIT     <<05019>>13665000
           whenever command executors which spawn processes    <<05019>>13670000
           are written. The cutback on the stack will be than  <<05019>>13675000
           the number of parameters which AWAKE has, namely 3  <<05019>>13680000
   ;                                                           <<05019>>13685000
   TOS:=@STACK-INTEGER(STACK)-INTEGER(STACK(-STACK));                   13690000
   TOS:=S0;                                                             13695000
   SET(Q,S);                                                            13700000
   TOS := 3;       << CUTBACK := 3, See comment above >>       <<07320>>13705000
   WAIT(2,0);  <<WAIT FOR SON ACTIVATION>>                              13710000
   END;                                                                 13715000
                                                                        13720000
   BEGIN  <<** SOFT INTERRUPT>>                                         13725000
   PROCESSOFTINT;                                                       13730000
   END;                                                                 13735000
   END;  <<CASE>>                                                       13740000
                                                                        13745000
PEXIT(NOPENABLE);                                                       13750000
END;   <<PSEUDOINT>>                                                    13755000
$PAGE "SOFTWARE INTERRUPTS.  CAUSESOFTINT PROCEDURE."                   13760000
PROCEDURE CAUSESOFTINT(PIN,TYPE,SUBTYPE,PLABEL,MSGLEN,FLAGS);  <<03041>>13765000
VALUE PIN,TYPE,SUBTYPE,PLABEL,MSGLEN,FLAGS;                             13770000
                                                                        13775000
<<FUNCTION                                                              13780000
  CAUSES A SOFT INTERRUPT TO OCCUR ON THE TARGET PROCESS.>>             13785000
                                                                        13790000
<<INPUT>>                                                               13795000
  INTEGER                                                               13800000
    PIN,                   <<PROCESS ID NUMBER OF TARGET PROCESS.       13805000
                             ZERO IMPLIES OWN PROCESS.>>                13810000
    TYPE,                  <<TYPE OF SOFT INTERRUPT                     13815000
                             0 - INTERRUPTS PROCESSED ONLY WHEN         13820000
                                 USER INTERRUPTS ARE ENABLED AND THE    13825000
                                 PROCESS IS EXECUTING IN USER CODE      13830000
                                 (I.E., EXECUTING IN %3XX CODE OR USER  13835000
                                 SL).                                   13840000
                             1 - INTERRUPTS PROCESSED IN CURRENT STATE  13845000
                                 UNLESS THE TARGET PROCESS:             13850000
                                 1) IS WAITING,                         13855000
                                 2) HAS A SIR,                          13860000
                                 3) IS IMPEDED,                         13865000
                                 4) IS CRITICAL,                        13870000
                                 5) OR PSEUDO INTERRUPT LEVEL           13875000
                                    IS LESS THAN CONTROL Y.             13880000
                             NOTE THAT THE ABOVE CONDITIONS ONLY        13885000
                             DELAY THE SOFT INTERRRUPT, ONCE THEY       13890000
                             GO AWAY THE SOFT INTERRUPT WILL OCCUR.     13895000
                             MULTIPLE, SIMULTANEOUS SOFT INTERRUPTS     13900000
                             ARE SERVICED IN A FIFO MANNER.  ALL TYPE   13905000
                             ONES ARE SERVICED BEFORE TYPE ZEROES.>>    13910000
    SUBTYPE,               <<TYPE OF PREPROCESSING TO BE DONE BY        13915000
                             PSEUDOINT PROCEDURE.  A ZERO IMPLIES       13920000
                             NO PREPROCESSING.>>                        13925000
                          << (0:1) - Execution context of    >><<*8867>>13930000
                          <<         user mode procedures.   >><<*8867>>13935000
                          <<         0 - O.K. execute in priv>><<*8867>>13940000
                          <<             user code.          >><<*8867>>13945000
                          <<         1 - Can only execute in >><<*8867>>13950000
                          <<             non-priv user code. >><<*8867>>13955000
                          <<                                 >><<*8867>>13960000
                          << (1:15) - Subtype info.          >><<*8867>>13965000
                                                               <<*8867>>13970000
    PLABEL,                << Interrupt procedure's PLABEL.  >><<*8867>>13975000
                           << A zero implies no procedure.   >><<*8867>>13980000
    MSGLEN;                <<# WORDS IN THE MESSAGE (MAX OF 2 WORDS)    13985000
                             NOTE: THE MESSAGE IS ASSUMED TO BE         13990000
                                   LOCATED IN THE STACK, JUST ABOVE     13995000
                                   THE PIN PARAMETER.  IT WILL BE       14000000
                                   DELETED BY THIS PROCEDURE.>>         14005000
  LOGICAL                                                               14010000
    FLAGS;                 <<(0:14) - RESERVED FOR FUTURE USE, MUST     14015000
                                      BE SET TO ZERO.                   14020000
                             (0:1)  - 0 - IF APPROPRIATE PLACE PROCESS  14025000
                                          ON THE READY LIST.            14030000
                                      1 - DO NOT PUT ON READY LIST>>    14035000
  <<DB                       MAY BE ANYWHERE.>>                         14040000
                                                                        14045000
<<OUTPUT                                                                14050000
    CONDITION CODE                                                      14055000
       CCE                   SOFT INTERRUPT WAS SET UP.                 14060000
       CCL                   PROCESS IS DYING, NO ACTION WAS TAKEN.     14065000
       CCG                   ONLY RETURNED WHEN FLAGS PARAMETER         14070000
                             SPECIFIES NO WAKE, CCG IMPLIES THAT        14075000
                             THE PROCESS WOULD HAVE BEEN PLACED         14080000
                             ON THE READY LIST HAD IT NOT BEEN          14085000
                             FOR THE FLAGS SPECIFICATION.>>             14090000
                                                                        14095000
OPTION PRIVILEGED,UNCALLABLE;                                           14100000
                                                                        14105000
BEGIN                                                                   14110000
EQUATE                                                                  14115000
   RETURN6        = %31406,                                             14120000
   NOLAUNCH       = %100000,                                            14125000
   HYBERNATE      = 4,                                                  14130000
   SOFTINTBASE    = 1,                                                  14135000
   UGLYPSEUDOINT  = 4,                                                  14140000
   MAXMSGLEN      = 2;                                                  14145000
DEFINE                                                                  14150000
   USERSOFTINT    = (TYPE = 0)#,                                        14155000
   LAUNCHPROCESS  = (NOT FLAGS.(15:1))#;                                14160000
                                                                        14165000
EQUATE  <<MMSTAT DEFINITIONS>>                                          14170000
   PROCESSDEAD    = 0,                                                  14175000
   OTHERSOFTINTS  = 1,                                                  14180000
   INTDISABLED    = 2,                                                  14185000
   IMPEDECRITSIR  = 3,                                                  14190000
   OWNPROCESS     = 4,                                                  14195000
   PROCESSWAITRDY = 5,                                                  14200000
   DELAYLAUNCH    = 6,                                                  14205000
   LAUNCHED       = 7;                                                  14210000
DEFINE                                                                  14215000
   TLEVEL         = TMISC.(0:4)#,                                       14220000
   TTYPE          = TMISC.(4:2)#,                                       14225000
   TSUBTYPE       = TMISC.(6:2)#,                                       14230000
   TPIN           = TMISC.(8:8)#;                                       14235000
                                                                        14240000
DOUBLE                                                                  14245000
   MSG=PIN-2;                                                           14250000
INTEGER                                                                 14255000
   PCBPT;                                                               14260000
INTEGER                                                                 14265000
  MSG0=MSG,MSG1=MSG+1,TMISC,LEVEL:=OTHERSOFTINTS;                       14270000
                                                                        14275000
                                                                        14280000
SUBROUTINE LEAVETRACKS;                                                 14285000
                                                                        14290000
<<FUNCTION                                                              14295000
  LEAVE TRACKS IN PROCESS'S PCB SO THAT SOFT INT WILL BE                14300000
  PROCESSED AT A LATER TIME.>>                                          14305000
                                                                        14310000
   BEGIN                                                                14315000
   LEVEL:=IMPEDECRITSIR;                                                14320000
   SPCBPIOVRFLAG:=1;                                                    14325000
   SPCBDELAYSOFT:=1;                                                    14330000
   END;  <<LEAVE TRACKS>>                                               14335000
                                                                        14340000
                                                                        14345000
SUBROUTINE INTERRUPTSELF;                                               14350000
                                                                        14355000
<<FUNCTION                                                              14360000
  PROCESS SOFT INTERRUPT GENERATED AGAINST OURSELF.>>                   14365000
                                                                        14370000
   BEGIN                                                                14375000
   LEVEL:=OWNPROCESS;                                                   14380000
   SPCBDELAYSOFT:=1;                                                    14385000
   ENABLE;                                                              14390000
   PSEUDOINT;                                                           14395000
   END;  <<INTERRUPTSELF>>                                              14400000
                                                                        14405000
                                                                        14410000
SUBROUTINE WAKEPROCESS;                                                 14415000
                                                                        14420000
<<FUNCTION                                                              14425000
  WAKE THE TARGET PROCESS.>>                                            14430000
                                                                        14435000
   BEGIN                                                                14440000
   SPCBNONCRITWAIT:=0;                                                  14445000
   SPCBDELAYSOFT:=1;                                                    14450000
   ENABLE;                                                              14455000
   IF SPCBPSIM > HYBERNATE THEN                                         14460000
      BEGIN  <<CONTROL Y, BREAK, OR NORMAL>>                            14465000
      IF LAUNCHPROCESS THEN                                             14470000
         BEGIN                                                          14475000
         LEVEL:=LAUNCHED;                                               14480000
         READYPROCESS(PCBPT)                                            14485000
         END                                                            14490000
      ELSE                                                              14495000
         BEGIN                                                          14500000
         LEVEL:=DELAYLAUNCH;                                            14505000
         CC:=CCG;                                                       14510000
         END;                                                           14515000
      END;                                                              14520000
   END;  <<WAKEPROCESS>>                                                14525000
                                                                        14530000
                                                                        14535000
SUBROUTINE SENDSOFTINT;                                                 14540000
                                                                        14545000
<<DOES THE MECHANICS OF QUEUEING THE SOFT INT AND INFORMING             14550000
  THE TARGET PROCESS.>>                                                 14555000
                                                                        14560000
   BEGIN                                                                14565000
   CC:=CCE;                                                             14570000
                                                                        14575000
   <<SEND THE MSG TO THE PROPER IPC PORT>>                              14580000
   CASE MSGLEN OF BEGIN                                        <<F7736>>14585000
      <<0>> ;                                                  <<F7736>>14590000
      <<1>> TOS:=MSG1;                                         <<F7736>>14595000
      <<2>> TOS:=MSG;                                          <<F7736>>14600000
      END;                                                     <<F7736>>14605000
   TOS:=PLABEL;                                                         14610000
   TOS:=SUBTYPE;                                                        14615000
   SENDMSG(PIN,TYPE+SOFTINTBASE,MSGLEN+2,NOLAUNCH);                     14620000
                                                                        14625000
   <<CHECK IF THE PROCESS NEEDS TO BE NOTIFIED OF THE INTERRUPT>>       14630000
   IF NOT LOG(SPCBSOFTINT) AND NOT LOG(SPCBDELAYSOFT) THEN              14635000
      BEGIN  <<NO OTHER SOFT INTERRUPTS PENDING>>                       14640000
      DISABLE;  <<MUST DISABLE INT BECAUSE OF MULTI-FIELD PCB WORDS>>   14645000
      IF LOG(SPCBALLOWSOFT) OR NOT USERSOFTINT THEN                     14650000
         BEGIN  <<PROCESS IS INTERESTED>>                               14655000
         IF (SPCBCRITSIR<>0) OR (SPCBIMPEDE<>0) THEN                    14660000
            LEAVETRACKS  <<PROCESS CAN'T EXEC INT RIGHT NOW>>           14665000
         ELSE                                                           14670000
            BEGIN  <<PROCESS WILL PROCESS INT, CHECK IF SHOULD WAKE>>   14675000
            IF (PCBPT = (CURPRC)) THEN                         <<06650>>14680000
               INTERRUPTSELF  <<CALLER SPECIFIED HIMSELF>>              14685000
            ELSE                                                        14690000
               BEGIN  <<INTERRUPT IS ON PROCESS OTHER THAN OURS>>       14695000
               SPCBWAKESOFT:=0;                                         14700000
               IF <> THEN                                               14705000
                  WAKEPROCESS  <<PROC ASLEEP, OK TO WAKE ON SOFT INT>>  14710000
               ELSE                                                     14715000
                  BEGIN  <<PROCESS IS EITHER 1) ON RDY LIST (NO NEED>>  14720000
                         <<TO WAKE) OR 2) WAITING ON ANOTHER EVENT>>    14725000
                  LEVEL:=PROCESSWAITRDY;                                14730000
                  SPCBSOFTINT:=1;                                       14735000
                  END;                                                  14740000
               END;                                                     14745000
            END;                                                        14750000
         END;                                                           14755000
      ENABLE;                                                           14760000
      END                                                               14765000
   ELSE                                                                 14770000
      LEVEL:=INTDISABLED;                                               14775000
   END;  <<SENDSOFTINT>>                                                14780000
                                                                        14785000
                                                                        14790000
<<INITIALIZE>>                                                          14795000
IF (FLAGS > 1) OR (MSGLEN > MAXMSGLEN) OR NOT (0 <= TYPE <= 1) THEN     14800000
   SUDDENDEATH(UGLYPSEUDOINT);                                          14805000
IF PIN = 0 THEN PIN := (CURPRC)/PCBSIZE;                       <<06650>>14810000
PCBPT:=PIN*PCBSIZE;                                                     14815000
PDISABLE;                                                               14820000
                                                                        14825000
<<PROCESS SOFT INTERRUPT>>                                              14830000
IF SPCBPSIM > SOFTKILLVALUE THEN                                        14835000
   SENDSOFTINT                                                          14840000
ELSE                                                                    14845000
   BEGIN  <<DYING PROCESS, REJECT THE INTERRUPT>>                       14850000
   LEVEL:=PROCESSDEAD;                                                  14855000
   CC:=CCL;                                                             14860000
   END;                                                                 14865000
PENABLE;                                                                14870000
                                                                        14875000
<<EMIT MMSTAT EVENT>>                                                   14880000
IF GLOBALTRACEFLAG THEN                                                 14885000
   BEGIN  <<MONITORING IS ENABLED>>                                     14890000
   TPIN:=PIN; TTYPE:=TYPE; TSUBTYPE:=SUBTYPE; TLEVEL:=LEVEL;            14895000
   MMSTAT'(MMCAUSE,TMISC,MSG0,MSG1,0,0,0);                     <<06948>>14900000
   END;                                                                 14905000
                                                                        14910000
<<RETURN TO THE CALLER>>                                                14915000
TOS:=RETURN6+MSGLEN;                                                    14920000
ASMB(XEQ);                                                              14925000
END;  <<CAUSESOFTINT>>                                                  14930000
$PAGE "SOFTWARE INTERRUPTS.  CHANGEINTSTATE PROCEDURE."                 14935000
LOGICAL PROCEDURE CHANGEINTSTATE(NEWSTATE);                    <<03041>>14940000
VALUE NEWSTATE;                                                         14945000
                                                                        14950000
<<FUNCTION                                                              14955000
  ENABLES/DISABLES USER SOFT INTERRUPTS AGAINST THE PROCESS.>>          14960000
                                                                        14965000
<<INPUT>>                                                               14970000
  LOGICAL                                                               14975000
    NEWSTATE;            <<(15:1):  0 - DISABLE THE INTERRUPT           14980000
                                    1 - ENABLE USER INTERRUPTS          14985000
                           (0:15):  IGNORED.>>                          14990000
<<OUTPUT                                                                14995000
    CHANGEINTSTATE         OLD VALUE OF THE USER INTERRUPT STATE.       15000000
    PREGISTER.(0:1)        SET TO ONE IF NEWSTATE = TRUE AND USER       15005000
    AT CALLER'S Q-2.       SOFT INTERRUPT IS PENDING.  THIS CAUSES      15010000
                           A BOUNDS VIOLATION TO ININ WHEN THE          15015000
                           CALLING PROCEDURE EXITS.                     15020000
                                                                        15025000
  NOTE: THIS PROCEDURE ASSUMES THAT THE USER'S STACK MARKER IS AT       15030000
        Q-0 OF THE CALLING PROCEDURE.  IF THIS IS NOT SO, THEN          15035000
        AN EXTRA CALL TO PSEUDOINT (VIA ININ BOUNDS VIOLATION) WILL     15040000
        RESULT.>>                                                       15045000
                                                                        15050000
OPTION PRIVILEGED,UNCALLABLE;                                           15055000
                                                                        15060000
   BEGIN                                                                15065000
   DEFINE                                                               15070000
      TOLDSTATE   = TMISC.(14:1)#,                                      15075000
      TNEWSTATE   = TMISC.(15:1)#;                                      15080000
   INTEGER                                                              15085000
      OLDSTATE=CHANGEINTSTATE,TMISC:=0,PCBXLOC,PCBPT,          <<06686>>15090000
      PXFIXEDLOC;                                              <<06686>>15095000
                                                                        15100000
   <<INITIALIZE>>                                                       15105000
   PXFIXED;                                                             15110000
   PCBPT := (CURPRC);                                          <<06650>>15115000
                                                                        15120000
   <<UPDATE INTERRUPT STATE>>                                           15125000
   CHANGEINTSTATE:=SPCBALLOWSOFT;                                       15130000
   DISABLE; SPCBALLOWSOFT:=NEWSTATE; ENABLE;                            15135000
   PXFXSIFLAG:=NEWSTATE;                                       <<06635>>15140000
                                                                        15145000
   IF NEWSTATE AND LOG(PORTSTATUS(USERMSGPORT)) THEN                    15150000
      BEGIN  <<GOT AT LEAST ONE PENDING INTERRUPT>>                     15155000
      DISABLE; SPCBDELAYSOFT:=1; ENABLE;                                15160000
      <<CAUSE TRAP TO ININ ON EXIT TO USER>>                   <<06635>>15165000
      QARRAY(-DELTAQ-2).(0:1):=1;                              <<06635>>15170000
      END;                                                              15175000
                                                                        15180000
   IF GLOBALTRACEFLAG THEN                                              15185000
      BEGIN  <<MONITORING IS ON>>                                       15190000
      TNEWSTATE:=NEWSTATE; TOLDSTATE:=OLDSTATE;                         15195000
      MMSTAT'(MMCHANGESTATE,TMISC,QARRAY(-DELTAQ-2),           <<06948>>15200000
              QARRAY(-DELTAQ-1),0,0,0);                        <<06948>>15205000
      END;                                                              15210000
   END;  <<CHANGEINTSTATE>>                                             15215000
$PAGE "DATA STRUCTURE INDEPENDENT INFORMATION PROCEDURES"      <<03041>>15220000
                                                               <<03041>>15225000
LOGICAL PROCEDURE STACKCHECK(DSTNUMBER);                       <<03041>>15230000
VALUE DSTNUMBER;                                               <<03041>>15235000
INTEGER DSTNUMBER;                                             <<03041>>15240000
OPTION PRIVILEGED,UNCALLABLE;                                  <<03041>>15245000
                                                               <<03041>>15250000
COMMENT                                                        <<03041>>15255000
                                                               <<03041>>15260000
RETURNS TRUE IS SPECIFIED DATA SEG IS A STACK ELSE FALSE       <<03041>>15265000
                                                               <<03041>>15270000
;                                                              <<03041>>15275000
                                                               <<03041>>15280000
BEGIN                                                          <<03041>>15285000
STACKCHECK:=DST(DSTNUMBER&LSL(2)+1).STKFLAG;                   <<03041>>15290000
END <<STACKCHECK>>;                                            <<03041>>15295000
                                                               <<01644>>15300000
LOGICAL PROCEDURE CHECKALIVE(PIN);                             <<01644>>15305000
VALUE PIN;                                                     <<01644>>15310000
INTEGER PIN;                                                   <<01644>>15315000
OPTION PRIVILEGED,UNCALLABLE;                                  <<01644>>15320000
                                                               <<01644>>15325000
COMMENT                                                        <<01644>>15330000
                                                               <<01644>>15335000
RETURNS FALSE IF PIN WITH PCB INDEX PCBPT IS UNASSIGNED ELSE TR<<01644>>15340000
                                                               <<01644>>15345000
;                                                              <<01644>>15350000
                                                               <<01644>>15355000
BEGIN                                                          <<01644>>15360000
IF PCB(PIN*PCBSIZE+PQPTRWORDNUM)=-1 THEN CHECKALIVE:=FALSE     <<01644>>15365000
ELSE CHECKALIVE:=TRUE;                                         <<01644>>15370000
END <<CHECKALIVE>> ;                                           <<01644>>15375000
                                                               <<01644>>15380000
PROCEDURE LOCKSEG'(OBJ,BLOCKEDLOCK);                           <<06660>>15385000
VALUE OBJ,BLOCKEDLOCK;                                         <<06660>>15390000
DOUBLE  OBJ;                                                   <<06660>>15395000
LOGICAL BLOCKEDLOCK;                                                    15400000
OPTION PRIVILEGED,UNCALLABLE;                                           15405000
                                                                        15410000
COMMENT                                                                 15415000
                                                                        15420000
LOCKSEG' IS CALLED TO LOCK A SEGMENT IN MAIN MEMORY ON BEHALF           15425000
OF THE CALLING PROCESS. WHEN LOCKSEG' RETURNS TO THE CALLER,            15430000
THE SEGMENT IS IN MAIN MEMORY AND CANNOT BE RELEASED UNTIL THE          15435000
LOCK COUNT FALLS TO ZERO.  THE SEGMENT MAY BE MOVED ABOUT IN            15440000
MAIN MEMORY THOUGH, PROVIDED IT HAS NOT BEEN FROZEN.  THE BLOCKED       15445000
LOCK PARAMETER INDICATES WHETHER THE CALLER INTENDS TO FREEZE           15450000
THE SEGMENT DOWN FOR AN EXTENDED PERIOD AFTER LOCKING IT. IF TRUE,      15455000
LOCKSEG' WILL NOT RETURN UNTIL THE SEGMENT HAS MIGRATED TO A            15460000
BOUNDARY. IF FALSE, LOCKSEG' RETURNS AS SOON AS THE SEG IS              15465000
MADE PRESENT.                                                           15470000
                                                                        15475000
ENTRY FREEZESEG' IS CALLED TO FREEZE A SEGMENT IN MAIN MEMORY ON BEHALF 15480000
OF THE CALLING PROCESS.  ONCE THE SEGMENT IS PRESENT, IT WILL           15485000
NOT BE RELEASED FROM MAIN MEMORY OR MOVED WITHIN MAIN MEMORY            15490000
UNTIL THE FREEZECOUNT IN THE SEGMENT'S REGION HEADER FALLS TO           15495000
ZERO. THE BLOCKEDLOCK FLAG IS IGNORED FOR FREEZESEG' CALLS.             15500000
                                                                        15505000
ONLY SEGMENTS CAN BE LOCKED IN MEMORY, NOT MAPPED DOMAINS.     <<06212>>15510000
;                                                                       15515000
                                                                        15520000
BEGIN                                                                   15525000
INTEGER DESCSTINX,PCBPT;                                       <<06650>>15530000
LOGICAL FREEZE;                                                         15535000
LOGICAL FLAGS := 0;                                            <<06393>>15540000
LOGICAL ARRAY OBJIDENT(*) = OBJ;                               <<06660>>15545000
DOUBLE SAVEDB;                                                 <<06393>>15550000
ENTRY FREEZESEG';                                                       15555000
                                                                        15560000
FREEZE:=FALSE;                                                          15565000
GO OVER;                                                                15570000
                                                                        15575000
FREEZESEG':                                                             15580000
FREEZE:=TRUE;                                                           15585000
                                                                        15590000
OVER:                                                                   15595000
                                                                        15600000
DISABLE;                                                                15605000
X := DESCSTINX := CONVSEGIDTOSTINX(OBJ);                       <<06660>>15610000
IF NOT LOGICAL(DST(X:=X+1)).SEGRESIDENTFLAG THEN                        15615000
   BEGIN  <<NOT RESIDENT>>                                              15620000
   TOS:=%1000D;                                                         15625000
   ASMB(XCHD);                                                          15630000
   SAVEDB := TOS;                                              <<06393>>15635000
   PCBPT := CURPRC;                                            <<06650>>15640000
   TOS := SLLPTR;                                              <<06650>>15645000
   TOS := OBJ;                                                 <<06660>>15650000
   FLAGS := 0;                                                 <<06393>>15655000
   FLAGS.SETMEMREQPTRFLAG := 1;                                <<06393>>15660000
   IF FREEZE THEN FLAGS.SETFZFLAG := 1                         <<06393>>15665000
   ELSE IF BLOCKEDLOCK THEN                                    <<06393>>15670000
      FLAGS.SETBLKLKFLAG := 1 ELSE FLAGS.SETLOCKFLAG := 1;     <<06393>>15675000
   TOS := FLAGS;                                               <<06393>>15680000
   ADDTOLOCALITY(*,*,*);                                                15685000
   TOS := SAVEDB;                                              <<06393>>15690000
   ASMB(XCHD);                                                          15695000
   DDEL;                                                       <<06393>>15700000
   WAIT(MEMORYWAITCODE,MEMTRAP);                                        15705000
   X := DESCSTINX := CONVSEGIDTOSTINX(OBJ);                    <<06660>>15710000
   END;                                                                 15715000
IF DST(DESCSTINX).ABSENTFLAG=0 THEN CC:=CCE ELSE CC:=CCL;               15720000
END  <<LOCKSEG'>>;                                                      15725000
                                                                        15730000
                                                                        15735000
$TITLE "UNCALLABLE UTILITIES : UNLOCKSEG'"                              15740000
                                                                        15745000
PROCEDURE UNLOCKSEG'(OBJ);                                     <<06660>>15750000
VALUE OBJ;                                                     <<06660>>15755000
DOUBLE  OBJ;                                                   <<06660>>15760000
OPTION PRIVILEGED,UNCALLABLE;                                           15765000
                                                                        15770000
BEGIN                                                                   15775000
LOGICAL UNFREEZE;                                                       15780000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>15785000
INTEGER COUNT,                                                          15790000
        TYPE := 0,      << For MMSTAT' >>                      <<*7564>>15795000
        DESCSTINX;                                                      15800000
ENTRY UNFREEZESEG';                                                     15805000
                                                                        15810000
TYPE.(12:4) := 5;   <<UNLOCK TYPE>>                            <<01571>>15815000
UNFREEZE:=FALSE;                                                        15820000
GO OVER;                                                                15825000
                                                                        15830000
UNFREEZESEG':                                                  <<*7564>>15835000
TYPE.(12:4) := 4;                                              <<*7564>>15840000
UNFREEZE:=TRUE;                                                         15845000
                                                                        15850000
OVER:                                                                   15855000
DISABLE;                                                                15860000
DESCSTINX:=CONVSEGIDTOSTINX(OBJ);                              <<06660>>15865000
IF DST(DESCSTINX) < 0 THEN SUDDENDEATH(606);<<ABSENT>>         <<01644>>15870000
IF DST(X:=DESCSTINX+1).SEGRESIDENTFLAG<>1 THEN                          15875000
   BEGIN <<SEG NOT CORE RESIDENT>>                                      15880000
   TOS:=DST(X:=X+1);   <<SEGDESCBANK>>                                  15885000
   TOS:=DST(X:=X+1);                                                    15890000
   TOS:=TOS+RBTOLKFZCNTDISP;                                            15895000
   ASMB(LSEA);                                                          15900000
   COUNT:=TOS;                                                          15905000
                                                               <<*7564>>15910000
   IF UNFREEZE AND COUNT.FZCNTFIELD <= 0  OR                   <<*7564>>15915000
      NOT UNFREEZE AND COUNT.LKCNTFIELD <= 0 THEN              <<*7564>>15920000
      SUDDENDEATH(606);                                        <<*7564>>15925000
                                                               <<*7564>>15930000
   IF UNFREEZE THEN COUNT.FZCNTFIELD:=COUNT.FZCNTFIELD-1                15935000
   ELSE COUNT.LKCNTFIELD:=COUNT.LKCNTFIELD-1;                           15940000
   TOS:=COUNT;                                                          15945000
   ASMB(SSEA);                                                          15950000
   IF COUNT.FZCNTFIELD=0 AND UNFREEZE OR COUNT.LKCNTFIELD=0 AND NOT     15955000
   UNFREEZE THEN                                                        15960000
      BEGIN <<SEG IS COMPLETELY UNLOCKED OR UNFROZEN>>                  15965000
      TOS:=TOS+LKFZCNTTORASDISP;                                        15970000
      ASMB(LSEA);                                                       15975000
      IF UNFREEZE THEN TOS.REGFZFLAG:=0 ELSE TOS.REGLKDFLAG:=0;         15980000
      IF = THEN SUDDENDEATH(606);                              <<01644>>15985000
      ASMB(SSEA);                                                       15990000
      END;                                                              15995000
   END;                                                                 16000000
MMSTAT'(MMSTATSPECREQ,OBJIDENT(OBJIDDESCFIELD),                <<06948>>16005000
       OBJIDENT(OBJIDNUMFIELD),TYPE,COUNT,0,0);                <<06948>>16010000
END  <<UNFREEZE>>;                                                      16015000
                                                                        16020000
$TITLE "UNCALLABLE UTILITIES : LOCKSEG"                                 16025000
                                                                        16030000
PROCEDURE LOCKSEG(ENTRYNUMBER,FLAGS,PINX);                              16035000
VALUE ENTRYNUMBER,FLAGS,PINX;                                           16040000
INTEGER ENTRYNUMBER,PINX;                                               16045000
LOGICAL FLAGS;                                                          16050000
OPTION PRIVILEGED,UNCALLABLE;                                           16055000
                                                                        16060000
COMMENT                                                                 16065000
                                                                        16070000
EMULATES PREV IOFREEZE,IOUNFREEZE,LOCKSEG,FREEZE. WEED OUT CALLS TO IT. 16075000
                                                                        16080000
;                                                                       16085000
BEGIN                                                                   16090000
LOGICAL LOCKCALL:=FALSE;                                                16095000
DOUBLE  OBJ;                                                   <<06660>>16100000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>16105000
INTEGER SEGTYPE;                                               <<06660>>16110000
LOGICAL FREEZECALL,                                                     16115000
        IOFZCALL,                                                       16120000
        IOUNFZCALL,                                                     16125000
        UNFREEZECALL,                                                   16130000
        UNLOCKCALL;                                                     16135000
LOGICAL ARRAY SEGID(*)=OBJ;                                    <<06660>>16140000
ENTRY FREEZE,UNFREEZE,UNLOCKSEG,IOFREEZE,IOUNFREEZE;                    16145000
IOFZCALL:=IOUNFZCALL:=UNLOCKCALL:=UNFREEZECALL:=FREEZECALL:=FALSE;      16150000
LOCKCALL:=TRUE;                                                         16155000
GO OVER;                                                                16160000
FREEZE:                                                                 16165000
FREEZECALL:=TRUE;                                                       16170000
IOFZCALL:=IOUNFZCALL:=LOCKCALL:=UNFREEZECALL:=UNLOCKCALL:=FALSE;        16175000
GO OVER;                                                                16180000
UNFREEZE:                                                               16185000
UNFREEZECALL:=TRUE;                                                     16190000
IOFZCALL:=IOUNFZCALL:=LOCKCALL:=UNLOCKCALL:=FREEZECALL:=FALSE;          16195000
GO OVER;                                                                16200000
UNLOCKSEG:                                                              16205000
UNLOCKCALL:=TRUE;                                                       16210000
IOFZCALL:=IOUNFZCALL:=LOCKCALL:=UNFREEZECALL:=FREEZECALL:=FALSE;        16215000
GO OVER;                                                                16220000
IOFREEZE:                                                               16225000
IOFZCALL:=TRUE;                                                         16230000
UNLOCKCALL:=IOUNFZCALL:=LOCKCALL:=UNFREEZECALL:=FREEZECALL:=FALSE;      16235000
GO OVER;                                                                16240000
IOUNFREEZE:                                                             16245000
IOFZCALL:=UNLOCKCALL:=LOCKCALL:=UNFREEZECALL:=FREEZECALL:=FALSE;        16250000
IOUNFZCALL:=TRUE;                                                       16255000
GO OVER;                                                                16260000
OVER:                                                                   16265000
IF CURPRC = 0  AND NOT IOFZCALL AND NOT IOUNFZCALL             <<06650>>16270000
THEN SUDDENDEATH(607);                                         <<01644>>16275000
IF PINX = 0 THEN PINX:=CURPRC;                                 <<06650>>16280000
IF FLAGS THEN OBJ:=BUILDSEGID(0,ENTRYNUMBER,PINX/PCBSIZE)      <<06660>>16285000
ELSE OBJ:=MAPPEDCSTTOPHYCST(LOGICAL(ENTRYNUMBER)               <<06660>>16290000
                                 ,PINX);                       <<06944>>16295000
IF FREEZECALL THEN                                                      16300000
   BEGIN                                                                16305000
   FREEZESEG'(OBJ,0);                                          <<06660>>16310000
   CC:=CCE;                                                             16315000
   END                                                                  16320000
ELSE IF UNFREEZECALL THEN                                               16325000
   BEGIN                                                                16330000
   UNFREEZESEG'(OBJ);                                          <<06660>>16335000
   CC:=CCE;                                                             16340000
   END                                                                  16345000
ELSE IF UNLOCKCALL THEN                                                 16350000
   BEGIN                                                                16355000
   UNLOCKSEG'(OBJ);                                            <<06660>>16360000
   CC:=CCE;                                                             16365000
   END                                                                  16370000
ELSE IF LOCKCALL THEN                                                   16375000
   BEGIN                                                                16380000
   LOCKSEG'(OBJ,0);       <<FOR NOW ALL UNBLOCKED>>            <<06660>>16385000
   IF = THEN CC:=CCE ELSE CC:=CCL;                                      16390000
   END                                                                  16395000
   comment                                                     <<06212>>16400000
                                                               <<06212>>16405000
   here's some old code                                        <<06212>>16410000
     IF NOT FLAGS.(13:1) AND NOT FLAGS.(14:1) THEN             <<06212>>16415000
      BEGIN                                                             16420000
      LOCKSEG'(OBJ,-1)        DEFAULT BLOCKED LOCK             <<06660>>16425000
      CC:=CCE                                                  <<06212>>16430000
      END                                                               16435000
   ELSE CC:=CCL CAN'T SPECIFY LOCATION                         <<06212>>16440000
                                                               <<06212>>16445000
   ;                                                           <<06212>>16450000
                                                               <<06212>>16455000
ELSE IF IOFZCALL THEN                                                   16460000
   BEGIN                                                                16465000
   IOFREEZE'(OBJ);                                             <<06660>>16470000
   IF < THEN CC:=CCL ELSE IF = THEN CC:=CCE ELSE IF > THEN CC:=CCG;     16475000
   END                                                                  16480000
ELSE IF IOUNFZCALL THEN                                                 16485000
   BEGIN                                                                16490000
   IOUNFREEZE'(OBJ);                                           <<06660>>16495000
   IF < THEN CC:=CCL ELSE IF = THEN CC:=CCE ELSE IF > THEN CC:=CCG;     16500000
   END;                                                        <<01644>>16505000
END <<LOCKSEG>>;                                                        16510000
                                                                        16515000
$TITLE "UNCALLABLE UTILITIES : UPDATE DISC COPY"                        16520000
PROCEDURE UPDATEDISCCOPY(DSTENTRY);                                     16525000
VALUE DSTENTRY;                                                         16530000
INTEGER DSTENTRY;                                                       16535000
OPTION PRIVILEGED,UNCALLABLE;                                           16540000
                                                                        16545000
COMMENT                                                                 16550000
                                                                        16555000
UPDATEDISCCOPY ISSUES A BLOCKED ATTACHIO ON BEHALF OF THE PROCESS       16560000
TO WRITE THE CONTENTS OF THE DATA SEGMENT TO THE COPY OF THE SEGMENT    16565000
IN VIRTUAL MEMORY.  IF THE DISC COPY IS                                 16570000
ALREADY VALID, CONTROL RETURNS IMMEDIATELY TO THE CALLING PROCESS.      16575000
                                                                        16580000
;                                                                       16585000
                                                                        16590000
BEGIN                                                                   16595000
DEFINE RTYPE=(14:2)#;                                                   16600000
ENTRY WRITEDSEG,WRITEDSEG'SERIAL;                              <<*7823>>16605000
INTEGER HODA,                                                           16610000
        LDEVNUM,                                                        16615000
        DESCSTINX,                                                      16620000
        CNT,                                                            16625000
        LODA,                                                  <<*7823>>16630000
        SERIAL'WRITE'QUEUE := %2001;                           <<*7823>>16635000
                                                               <<*7823>>16640000
LOGICAL                                                        <<*7823>>16645000
   USE'SERIAL'WRITE'QUEUE;                                     <<*7823>>16650000
                                                               <<*7823>>16655000
WRITEDSEG:      <<RENAMED TO UPDATEDISCCOPY>>                           16660000
                                                               <<*7823>>16665000
IF (USE'SERIAL'WRITE'QUEUE := FALSE) THEN                      <<*7823>>16670000
   BEGIN                                                       <<*7823>>16675000
                                                               <<*7823>>16680000
WRITEDSEG'SERIAL:                                              <<*7823>>16685000
                                                               <<*7823>>16690000
   USE'SERIAL'WRITE'QUEUE := TRUE;                             <<*7823>>16695000
   END;                                                        <<*7823>>16700000
                                                               <<*7823>>16705000
DESCSTINX:=DSTENTRY&LSL(2);                                             16710000
DISABLE;  <<WHILE FIGURING OUT THE DISC ADDRESS>>                       16715000
IF NOT LOGICAL(DST(X:=DESCSTINX+1)).DISCCOPYVALIDFLAG THEN              16720000
   BEGIN                                                                16725000
   CNT:=(DST(DESCSTINX).DATASIZEFIELD)&LSL(2);                          16730000
   TOS:=DST(X:=DESCSTINX+2);                                            16735000
   TOS:=DST(X:=X+1);                                                    16740000
   IF NOT LOGICAL(DST(DESCSTINX)).ABSENTFLAG                            16745000
   OR LOGICAL(DST(DESCSTINX+1)).IMIFLAG                                 16750000
   OR LOGICAL(DST(DESCSTINX+1)).ROCFLAG THEN                            16755000
      BEGIN <<DISC ADDRESS IS IN MEMORY HEADER>>                        16760000
      TOS:=TOS+RBTOHODADISP;                                            16765000
      ASMB(LDEA);                                                       16770000
      END;                                                              16775000
   ENABLE;                                                              16780000
   LODA:=TOS;                                                           16785000
   HODA:=S0.(8:8);                                                      16790000
   LDEVNUM:=TOS.(0:8);  <<LDEVN>>                                       16795000
                                                               <<*7823>>16800000
   IF USE'SERIAL'WRITE'QUEUE THEN                              <<*7823>>16805000
      TOS := ATTACHIO(LDEVNUM,0,DSTENTRY,0,WRITEREQ,CNT,HODA,  <<*7823>>16810000
                      LODA,SERIAL'WRITE'QUEUE)                 <<*7823>>16815000
   ELSE                                                        <<*7823>>16820000
      TOS := P'ATTACHIO(LDEVNUM,0,DSTENTRY,0,WRITEREQ,CNT,HODA,<<*7823>>16825000
                        LODA,1);                               <<*7823>>16830000
   IF S1.(13:3) <> 1 THEN SUDDENDEATH(654);                    <<01644>>16835000
   END;                                                                 16840000
END  <<UPDATEDISCCOPY>>;                                                16845000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS"                           16850000
                                                                        16855000
                                                                        16860000
                                                                        16865000
PROCEDURE ABORTPROCESS(PROCSYSDBINX,ABORTCODE);                         16870000
VALUE PROCSYSDBINX,ABORTCODE;                                           16875000
INTEGER PROCSYSDBINX,ABORTCODE;                                         16880000
OPTION PRIVILEGED,UNCALLABLE;                                           16885000
                                                                        16890000
BEGIN                                                                   16895000
SUDDENDEATH(608); <<NOT YET SUPPORTED>>                        <<01644>>16900000
END  <<ABORTPROC>>;                                                     16905000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS : QUEUEPROC"               16910000
PROCEDURE QUEUEPROC(PROCSYSDBINX,QUEUENAME,LOCATION);                   16915000
VALUE PROCSYSDBINX,QUEUENAME,LOCATION;                                  16920000
INTEGER PROCSYSDBINX,QUEUENAME,LOCATION;                                16925000
OPTION PRIVILEGED,UNCALLABLE;                                           16930000
                                                                        16935000
COMMENT                                                                 16940000
                                                                        16945000
QUEUEPROC REMOVES A PROCESS FROM ITS CURRENT QUEUE                      16950000
AND MERGES IT INTO THE QUEUE SPECIFIED BY QUEUENAME.                    16955000
LOCATION INDICATES WHETHER THE PROCESS IS TO BE QUEUED                  16960000
AT THE FRONT OR END OF ITS URGENCY CLASS SUBQUEUE FOR                   16965000
THE DISPQ.                                                              16970000
                                                                        16975000
THE PARAMETERS FOLLOW THE FOLLOWING CONVENTIONS:                        16980000
                                                                        16985000
PROCSSYSDBINX IS THE SYSDB INDEX OF THE PROCESS' PCB ENTRY.             16990000
                                                                        16995000
QUEUENAME = 1 ==> QUEUE INTO DISPATCHING QUEUE,                         17000000
          = 0 ==> DON'T PUT ON ANY QUEUE                                17005000
                                                                        17010000
LOCATION = 1 ==> QUEUE AT FRONT OF CLASS SUBQUEUE                       17015000
         = 0 ==> QUEUE AT END OF CLASS SUBQUEUE.                        17020000
                                                                        17025000
DB MUST BE SET AT SYSDB WHEN ENTERING THE PROCEDURE.                    17030000
                                                                        17035000
;                                                                       17040000
                                                                        17045000
                                                                        17050000
BEGIN                                                                   17055000
                                                                        17060000
INTEGER PROCINX:=0,                                                     17065000
        PCBPT,                                                 <<06650>>17070000
        PREV;                                                           17075000
LOGICAL PROCPRI,                                                        17080000
        DISPQ:=FALSE,                                                   17085000
        NOTQUEUED:=FALSE;                                               17090000
                                                                        17095000
<< CHECK RANGE OF PCB >>                                                17100000
                                                                        17105000
TOS := PCBPT := PROCSYSDBINX;                                  <<06650>>17110000
IF <= OR LS0 > LOGICAL(PCB(0)*PCB(1)) THEN SUDDENDEATH(608);   <<01644>>17115000
ASMB(DEL);                                                              17120000
                                                                        17125000
<<FIND OUT IF PROCESS IS ALREADY ON A QUEUE>>                           17130000
                                                                        17135000
DISABLE;                                                                17140000
QUEUEINGINFO.DISPQFLAG := 0;                                   <<06650>>17145000
IF <> THEN DISPQ:=TRUE ELSE NOTQUEUED:=TRUE;                            17150000
                                                                        17155000
IF DISPQ THEN                                                           17160000
   BEGIN  <<PROC IS ON A QUEUE, SO TAKE IT OFF>>                        17165000
   TOS := PQPTR;                                               <<06650>>17170000
   IF = THEN                                                            17175000
      BEGIN  <<FIRST PROC IN Q>>                                        17180000
      TOS := NQPTR;                                            <<06650>>17185000
      IF = THEN                                                         17190000
         BEGIN  <<ONLY PROC IN Q>>                                      17195000
         DISPQHEAD:=TOS;                                                17200000
         DISPQTAIL:=TOS;                                                17205000
         END                                                            17210000
      ELSE                                                              17215000
         BEGIN  <<SOMEBODY BEHIND HIM/HER>>                             17220000
         NQPTR := 0;                                           <<06650>>17225000
         PCBPT := TOS;                                         <<06650>>17230000
         PQPTR := TOS; << ZERO OUT NEXTS PQP >>                <<06650>>17235000
         DISPQHEAD := PCBPT;                                   <<06650>>17240000
         END;                                                           17245000
      END                                                               17250000
   ELSE                                                                 17255000
      BEGIN  <<NOT FIRST IN Q>>                                         17260000
      PQPTR := 0;                                              <<06650>>17265000
      TOS := NQPTR;                                            <<06650>>17270000
      NQPTR := 0;                                              <<06650>>17275000
      ASMB(DUP);                                                        17280000
      IF = THEN                                                         17285000
         BEGIN <<LAST PROC IN QUEUE>>                                   17290000
         ASMB(DEL);                                                     17295000
         PCBPT := S1;                                          <<06650>>17300000
         NQPTR := TOS; << ZERO OUT PREVIOUS NQP >>             <<06650>>17305000
         DISPQTAIL := PCBPT;                                   <<06650>>17310000
         END                                                            17315000
      ELSE                                                              17320000
         BEGIN <<PROC IN MIDDLE OF QUEUE>>                              17325000
         PCBPT := TOS;                                         <<06650>>17330000
         ASMB(XCH);                                                     17335000
         ASMB(DUP);                                                     17340000
         PQPTR := TOS;                                         <<06650>>17345000
         PCBPT := TOS;                                         <<06650>>17350000
         NQPTR := TOS;                                         <<06650>>17355000
         END;                                                           17360000
      END;                                                              17365000
   END;                                                                 17370000
                                                                        17375000
PCBPT := PROCSYSDBINX;                                         <<06650>>17380000
IF QUEUENAME <> 0  THEN                                                 17385000
   BEGIN <<MERGE INTO DISPQ>>                                           17390000
   QUEUEINGINFO.DISPQFLAG := 1;                                <<06650>>17395000
   PROCPRI := QUEUEINGINFO.PRIFIELD;                           <<06650>>17400000
   PCBPT := DISPQHEAD;                                         <<06650>>17405000
   IF = THEN DISPQHEAD := DISPQTAIL := PROCSYSDBINX ELSE       <<06650>>17410000
      BEGIN  <<Q IS NON-EMPTY>>                                         17415000
      IF LOGICAL(LOCATION) THEN                                         17420000
         BEGIN <<QUEUE IN FRONT OF URGENCY SUBQ>>                       17425000
         WHILE PCBPT <> 0 DO                                   <<06650>>17430000
            BEGIN                                                       17435000
            IF QUEUEINGINFO.PRIFIELD < PROCPRI THEN            <<06650>>17440000
               PCBPT := NQPTR ELSE                             <<06650>>17445000
               BEGIN <<INSERT IN FRONT OF THIS PCB>>                    17450000
               PROCINX := PCBPT;                               <<06650>>17455000
               PCBPT := 0; << TO TERMINATE WHILE LOOP >>       <<06650>>17460000
               END;                                                     17465000
            END;                                                        17470000
         END                                                            17475000
      ELSE                                                              17480000
         BEGIN  <<AT END OF CLASS SUBQ>>                                17485000
         WHILE PCBPT <> 0 DO                                   <<06650>>17490000
            BEGIN                                                       17495000
            IF QUEUEINGINFO.PRIFIELD <= PROCPRI THEN           <<06650>>17500000
               PCBPT := NQPTR ELSE                             <<06650>>17505000
               BEGIN <<INSERT IN FRONT OF THIS PCB>>                    17510000
               PROCINX := PCBPT;                               <<06650>>17515000
               PCBPT := 0; << TO TERMINATE WHILE LOOP >>       <<06650>>17520000
               END;                                                     17525000
            END;                                                        17530000
         END;                                                           17535000
      PCBPT := PROCINX;                                        <<06650>>17540000
      IF = THEN                                                         17545000
         BEGIN  <<BELONGS AT END OF QUEUE>>                             17550000
         TOS:=DISPQTAIL;                                                17555000
         DISPQTAIL := PROCSYSDBINX;                            <<06650>>17560000
         PCBPT := PROCSYSDBINX;                                <<06650>>17565000
         PQPTR := S0;                                          <<06650>>17570000
         X := PCBPT;                                           <<06650>>17575000
         ASMB(XAX);                                                     17580000
         PCBPT := X;                                           <<06650>>17585000
         NQPTR := TOS;                                         <<06650>>17590000
         END                                                            17595000
      ELSE                                                              17600000
         BEGIN <<BELONGS IN FRONT OF THAT PCB>>                         17605000
         PREV := PQPTR;                                        <<06650>>17610000
         PQPTR := PROCSYSDBINX;                                <<06650>>17615000
         PCBPT := PREV;                                        <<06650>>17620000
         IF = THEN                                                      17625000
            BEGIN  <<GOES AT FRONT OF Q>>                               17630000
            PCBPT := DISPQHEAD := PROCSYSDBINX;                <<06650>>17635000
            NQPTR := PROCINX;                                  <<06650>>17640000
            END                                                         17645000
         ELSE                                                           17650000
            BEGIN  <<MERGE INTO MIDDLE>>                                17655000
            NQPTR := PROCSYSDBINX;                             <<06650>>17660000
            PCBPT := PROCSYSDBINX;                             <<06650>>17665000
            PQPTR := PREV;                                     <<06650>>17670000
            NQPTR := PROCINX;                                  <<06650>>17675000
            END;                                                        17680000
         END;                                                           17685000
      END;                                                              17690000
   END;                                                                 17695000
END  <<PROCEDURE QUEUEPROC>>;                                           17700000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS : RESETDISPQ"              17705000
PROCEDURE RESETDISPQ;                                                   17710000
OPTION PRIVILEGED,UNCALLABLE;                                           17715000
                                                                        17720000
COMMENT                                                                 17725000
                                                                        17730000
RESETDISPQ IS CALLED BY THE TUNE COMMAND EXECUTOR TO PLACE ALL          17735000
PROCESSES AT THE BASE OF THEIR SCHEDULING CLASSES IN THE DISPQ.         17740000
                                                                        17745000
THIS INITIALIZATION IS NECESSARY IN ORDER TO RESPOND QUICKLY TO         17750000
THE NEWLY DESIRED SCHEDULING CONDITIONS, AND TO KEEP FROM STRANDING     17755000
PROCESSES WHICH MAY HAVE BEEN FILTERED BEYOND THE NEW LIMITS.           17760000
                                                                        17765000
IN ORDER NOT TO HAVE TO HOLD OFF INTERRUPTS TOO LONG, THE DISPQ         17770000
IS SCANNED UNTIL A PROCESS IS FOUND THAT IS NOT AT THE APPROPRIATE      17775000
SCHEDULING BASE.  THIS PROCESS IS QUEUED TO THE PROPER PLACE, THEN      17780000
INTERRUPTS ARE ENABLED, AND THE QUEUE SCAN STARTS OVER.  THE SYSTEM     17785000
IS PDISABLED THROUGHOUT.                                                17790000
                                                                        17795000
;                                                                       17800000
                                                                        17805000
BEGIN                                                                   17810000
                                                                        17815000
DOUBLE SAVEDB;                                                          17820000
                                                                        17825000
LOGICAL CBASE,                                                          17830000
        DBASE,                                                          17835000
        EBASE;                                                          17840000
INTEGER PCBPT;                                                 <<06650>>17845000
                                                                        17850000
PDISABLE;                                                               17855000
                                                                        17860000
<<PUT DB AT SYSDB>>                                                     17865000
                                                                        17870000
TOS:=%1000D;                                                            17875000
ASMB(XCHD);                                                             17880000
SAVEDB:=TOS;                                                            17885000
                                                                        17890000
<<GET THE NEW SCHEDULING BASES FROM THE ICS>>                           17895000
                                                                        17900000
CBASE:=ICS(-ICS'CSCHEDBASECELL);                                        17905000
DBASE:=ICS(-ICS'DSCHEDBASECELL);                                        17910000
EBASE:=ICS(-ICS'ESCHEDBASECELL);                                        17915000
                                                                        17920000
<<MOVE ALL THE PROCESSES ON DISPQ TO THEIR SCHEDULING BASES>>           17925000
                                                                        17930000
DISABLE;                                                                17935000
PCBPT := DISPQHEAD;                                            <<06650>>17940000
WHILE <> DO                                                             17945000
   BEGIN <<LOCATE FIRST PROCESS AT WRONG PLACE AND MOVE IT>>            17950000
   IF QUEUEINGINFO.LSCHEDFLAG THEN PCBPT:=NQPTR                <<06650>>17955000
   ELSE IF QUEUEINGINFO.CSCHEDFLAG=1 AND                       <<06650>>17960000
           QUEUEINGINFO.PRIFIELD=CBASE                         <<06650>>17965000
   THEN PCBPT := NQPTR                                         <<06650>>17970000
   ELSE IF QUEUEINGINFO.DSCHEDFLAG=1 AND                       <<06650>>17975000
           QUEUEINGINFO.PRIFIELD=DBASE                         <<06650>>17980000
   THEN PCBPT := NQPTR                                         <<06650>>17985000
   ELSE IF QUEUEINGINFO.ESCHEDFLAG=1 AND                       <<06650>>17990000
           QUEUEINGINFO.PRIFIELD=EBASE                         <<06650>>17995000
   THEN PCBPT := NQPTR ELSE                                    <<06650>>18000000
      BEGIN  <<THIS GUY IS OUT OF ORDER>>                               18005000
      IF QUEUEINGINFO.CSCHEDFLAG THEN                          <<06650>>18010000
         QUEUEINGINFO.PRIFIELD:=CBASE ELSE                     <<06650>>18015000
      IF QUEUEINGINFO.DSCHEDFLAG THEN                          <<06650>>18020000
         QUEUEINGINFO.PRIFIELD:=DBASE ELSE                     <<06650>>18025000
      IF QUEUEINGINFO.ESCHEDFLAG THEN                          <<06650>>18030000
         QUEUEINGINFO.PRIFIELD:=EBASE;                         <<06650>>18035000
      QUEUEPROC(PCBPT,DISPATCHINGQ,ENDOFCLASS);                <<06650>>18040000
      ENABLE;                                                           18045000
      DISABLE;                                                          18050000
      PCBPT := DISPQHEAD; << START SCAN OVER >>                <<06650>>18055000
      END;                                                              18060000
   END;                                                                 18065000
                                                                        18070000
<<PUT DB BACK TO THE RIGHT PLACE>>                                      18075000
                                                                        18080000
TOS:=SAVEDB;                                                            18085000
ASMB(XCHD);                                                             18090000
                                                                        18095000
PENABLE;                                                                18100000
                                                                        18105000
END  <<RESETDISPQ>>;                                                    18110000
                                                                        18115000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS : WAIT"                    18120000
PROCEDURE WAIT(EVENTMASK,SPECIALINFO);                                  18125000
VALUE EVENTMASK,SPECIALINFO;                                            18130000
INTEGER EVENTMASK;                                                      18135000
LOGICAL SPECIALINFO;                                                    18140000
OPTION PRIVILEGED,UNCALLABLE;                                           18145000
                                                                        18150000
COMMENT                                                                 18155000
                                                                        18160000
WAIT IS CALLED BY THE SYSTEM WHENEVER THE CALLING PROCESS MUST          18165000
BLOCK UNTIL AN EVENT OCCURS. THE EVENTMASK PARAMETER SPECIFIES          18170000
THE EVENT TYPES WHICH THE PROCESS WISHES TO BE AWAKENED ON. THE         18175000
CALLER MAY REQUEST THAT CONTROL BE RETURNED IMMEDIATELY IF AN           18180000
AWAKE ON ONE OF THE EVENT TYPES HAS ALREADY OCCURRED BY PASSING THE     18185000
EVENTMASK AS A NEGATIVE EVENTMASK.                                      18190000
                                                                        18195000
THE SPECIALINFO PARAMETER PASSES ALONG INFORMATION ON THE PROCESS'      18200000
CAUSE OF BLOCKING, ESTIMATES ON HOW LONG THE PROCESS MIGHT BE           18205000
EXPECTED TO STAY BLOCKED, ESTIMATES ON WHETHER THE LOCALITY             18210000
MIGHT BE EXPECTED TO REMAIN ABOUT THE SAME OR UNDERGO A RADICAL         18215000
TRANSITION WHEN THE PROCESS CONTINUES.                                  18220000
                                                               <<03041>>18225000
SPECIALINFO.(3:1) <= 1 ENABLES EITHER SOFT INTERRUPTS OR THE   <<03041>>18230000
SPECIFIED WAIT EVENTS TO WAKE UP THE PROCESS.  WAIT RETURNS A  <<03041>>18235000
CCE CONDITION CODE IF AWAKENED BY A WAIT EVENT, A CCG IS       <<03041>>18240000
RETURNED FOR THE SOFT INTERRUPT CASE.                          <<03041>>18245000
                                                                        18250000
;                                                                       18255000
                                                                        18260000
BEGIN                                                                   18265000
DEFINE                                                         <<03041>>18270000
   ALLOWSOFTINT     = SPECIALINFO.(3:1)#;                      <<03041>>18275000
DOUBLE SAVEDB;                                                          18280000
INTEGER SAVEX;                                                          18285000
INTEGER PCBXLOC,                                               <<06686>>18290000
        PXFIXEDLOC;                                            <<06686>>18295000
INTEGER PCBPT,PROCINX;                                         <<06650>>18300000
                                                                        18305000
TURNOFFTRAPS;                                                  <<01860>>18310000
CC:=CCE;                                                       <<03041>>18315000
PCBPT := CURPRC;                                               <<06650>>18320000
PROCINX := PCBPT;                                              <<06650>>18325000
                                                               <<01860>>18330000
DISABLE;                                                                18335000
IF ALLOWSOFTINT THEN                                           <<03041>>18340000
   BEGIN  <<CHECK IF A SOFT INT HAS OCCURRED>>                 <<03041>>18345000
   PXFIXED;                                                    <<03041>>18350000
   IF LOG(SPCBDELAYSOFT) OR LOG(PXFXCYFLAG) THEN               <<06650>>18355000
      BEGIN  <<SOFT INT HAS ALREADY HAPPENED>>                 <<03041>>18360000
      CC:=CCG;                                                 <<03041>>18365000
      RETURN;                                                  <<03041>>18370000
      END;                                                     <<03041>>18375000
   SPCBWAKESOFT := 1;                                          <<06650>>18380000
   END;                                                        <<03041>>18385000
                                                                        18390000
TOS:=%1000D;                                                            18395000
ASMB(XCHD);                                                             18400000
SAVEDB:=TOS;                                                            18405000
                                                                        18410000
DISABLE;                                                                18415000
IF EVENTMASK < 0 THEN                                                   18420000
   BEGIN <<CALLER WANTS WWS CHECKED>>                                   18425000
   EVENTMASK:=-EVENTMASK;                                               18430000
   IF SPECIALINFO.(2:1) THEN                                            18435000
      BEGIN  <<NEW VERSION OF WAIT>>                                    18440000
      IF EVENTFLAGS LAND LOG(EVENTMASK&CSL(4)) <> 0 THEN       <<06650>>18445000
         BEGIN  <<AN EVENT WHICH THE PROCESS IS                         18450000
                  WAITING FOR HAS ALREADY OCCURRED>>                    18455000
         SUDDENDEATH(604);                                     <<01644>>18460000
         WAITTODISPMSG.PHASETRANSFLAG:=0;                               18465000
         WAITTODISPMSG.DISCWAITFLAG:=0;                                 18470000
         ICS(-ICS'PDISCNTCELL):=0;                                      18475000
         TOS:=SAVEDB;                                                   18480000
         ASMB(XCHD);                                                    18485000
         RETURN;                                                        18490000
         END;                                                           18495000
      END                                                               18500000
   ELSE                                                                 18505000
      BEGIN  <<OLD VERSION>>                                            18510000
      IF EVENTFLAGS.WWS <> 0                                   <<06650>>18515000
       THEN                                                    <<02826>>18520000
         BEGIN   <<EVENT ALREADY OCCURRED-RETURN TO PROCESS>>           18525000
         WAITTODISPMSG.PHASETRANSFLAG:=0;                               18530000
         EVENTFLAGS := 0; << CLEAR WAKE SEMAPHORES >>          <<06650>>18535000
         WAITTODISPMSG.DISCWAITFLAG:=0;                                 18540000
         TOS:=SAVEDB;                                                   18545000
         ASMB(XCHD);                                                    18550000
         ICS(-ICS'PDISCNTCELL):=0;                                      18555000
         RETURN;                                                        18560000
         END;                                                           18565000
      END;                                                              18570000
   END;                                                                 18575000
IF EVENTMASK = 0 THEN                                                   18580000
   BEGIN <<BETTER BE AN IMPEDE OR SHUTDOWN>>                            18585000
   SPECIALINFO.IMPTRAPFLAG:=0;                                          18590000
   IF <> THEN                                                           18595000
      BEGIN                                                             18600000
      EVENTMASK:=IMPWAITCODE;                                           18605000
      IF GCLASSENABLEDMASK.CLASS0 THEN                                  18610000
         BEGIN  <<MEASURE IMPEDE PROCESS STOP EVENT>>                   18615000
         TOS:=MEASSTATXDSBANK;                                          18620000
         TOS:=MEASSTATXDSBASE;                                          18625000
         TOS:=TOS+C0SUB0'SEGRELOFF+C'STOPIMPEDE;               <<RAY.V>>18630000
         ASMB(LSEA);                                                    18635000
         TOS:=TOS+1;                                                    18640000
         ASMB(SSEA;DDEL);                                               18645000
         END;                                                           18650000
      IF GCLASSENABLEDMASK.CLASS15 THEN                        <<01812>>18655000
         BEGIN <<MEASURE STOP FOR IMPEDE>>                     <<01812>>18660000
         TOS:=MEASPROCXDSBANK;                                 <<01812>>18665000
         TOS:=MEASPROCXDSBASE;                                 <<01812>>18670000
         TOS := TOS + CURPRC/PCBSIZE *                         <<06686>>18675000
              CLASS15'SUB0SIZE+CP'STOPIMPEDE;                  <<01812>>18680000
         ASMB(LSEA);                                           <<01812>>18685000
         TOS:=TOS+1;                                           <<01812>>18690000
         ASMB(SSEA;DDEL);                                      <<01812>>18695000
         END;                                                  <<01812>>18700000
      <<STUFF AWAY REASON STOPPED IN PCBX OF IMPEDED PROCESS>> <<01812>>18705000
      <<DONE UNCONDITIONALLY FOR HISTORY FOR MEAS INTERFACE>>  <<01812>>18710000
      TOS:=ICS(-ICS'STKBANKCELL);                              <<01812>>18715000
      TOS:=ICS(-ICS'STKBASECELL);                              <<01812>>18720000
      TOS:=TOS+SBTOMEASSTOPREASON;                             <<01812>>18725000
      TOS:=STOPIMPEDE;                                         <<01812>>18730000
      ASMB(SSEA;DDEL);                                         <<01812>>18735000
      END                                                      <<01799>>18740000
   ELSE QUEUEPROC(PCBPT  ,NOQUEUE,0);  << TOSS FOR EVER >>     <<06650>>18745000
   END;                                                                 18750000
EVENTFLAGS := 0;                                               <<06650>>18755000
WAKEMASK := WAKEMASK LOR (LOGICAL(EVENTMASK) & CSL(4));        <<06945>>18760000
IF WAKEMASK.FATHERSONWAKEFLAGS <> 0                            <<06650>>18765000
THEN WAITTODISPMSG.TRANSCOMPFLAG:=1;                                    18770000
WAITTODISPMSG:=WAITTODISPMSG LOR SPECIALINFO;  <<PASS ALONG INFO>>      18775000
ICS(-ICS'PDISCNTCELL):=0;                                               18780000
TOS:=SAVEDB;                                                            18785000
ASMB(XCHD);                                                             18790000
ASMB (DISP);                                                            18795000
IF INTEGER(PROCSTATE).STOVFLAG = 1                             <<06650>>18800000
   AND NOT RESABORTINFO.STOVABORTFLAG                          <<06650>>18805000
                                                               <<06650>>18810000
AND NOT STKINFO.INSYSTEMFLAG                                   <<06650>>18815000
AND NOT RESABORTINFO.CRITFLAG                                  <<06650>>18820000
AND NOT RESABORTINFO.HASSIRFLAG THEN                           <<06650>>18825000
   BEGIN <<WAS DISABLED OR PDISABLED WHEN OVERFLOWED, NOT IN SYSTEM>>   18830000
      RESABORTINFO.STOVABORTFLAG := 1;                         <<06650>>18835000
                                                               <<06650>>18840000
      ABORT([8/1,8/4],0,0);                                    <<04486>>18845000
   END;                                                                 18850000
                                                               <<03041>>18855000
IF ALLOWSOFTINT THEN                                           <<03041>>18860000
   BEGIN  <<CHECK IF WERE AWAKENED BY A SOFT INTERRUPT>>       <<03041>>18865000
   SPCBWAKESOFT := 0;                                          <<06650>>18870000
   IF = THEN CC:=CCG;  <<WERE AWAKENED BY A SOFT INTERRUPT>>   <<03041>>18875000
   END;                                                        <<03041>>18880000
END  <<PROCEDURE WAIT>>;                                                18885000
                                                                        18890000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS : AWAKE"                   18895000
PROCEDURE AWAKE (PCBPT,WAKECODE,WAITFLAGS);                             18900000
VALUE PCBPT,WAKECODE,WAITFLAGS;                                         18905000
INTEGER PCBPT,WAITFLAGS;                                                18910000
LOGICAL WAKECODE;                                                       18915000
OPTION PRIVILEGED,UNCALLABLE;                                           18920000
                                                                        18925000
COMMENT                                                                 18930000
                                                                        18935000
AWAKE IS CALLED TO AWAKEN A PROCESS ON A GIVEN EVENT TYPE.              18940000
THE CALLER MAY OPTIONALLY REQUEST THAT HE BE WAITED UPON                18945000
THE SUCCESSFUL ACTIVATION OF THE SPECIFIED PROCESS. THE                 18950000
AWAKENED PROCESS IS NOTIFIED OF THE ATTEMPTED AWAKE THROUGH             18955000
THE WAKE UP SEMAPHORES OF THE PCB.                                      18960000
                                                                        18965000
THE CONDITION CODE IS SET AS FOLLOWS:                                   18970000
   IF THE PROCESS IS ALREADY ACTIVE CC:=CCG.                            18975000
   IF THE PROCESS IS WAITING BUT NOT ON THE EVENT                       18980000
      TYPE SPECIFIED CC:=CCL.                                           18985000
   IF THE PROCESS IS WAITING ON THE SPECIFDIED EVENT                    18990000
      TYPE, CC:=CCE.                                                    18995000
;                                                                       19000000
                                                                        19005000
BEGIN                                                                   19010000
                                                                        19015000
INTEGER STATUS=Q-1,                                                     19020000
        PROCINX;                                                        19025000
LOGICAL EVENTMASK;                                                      19030000
DOUBLE SAVEDB;                                                          19035000
                                                                        19040000
TURNOFFTRAPS;                                                  <<01860>>19045000
                                                               <<01860>>19050000
PDISABLE;  <<CAUSE WE'LL PUT DB AT SYSDB FAST>>                         19055000
TOS:=%1000D;                                                            19060000
EXCHDB;                                                                 19065000
SAVEDB:=TOS;                                                            19070000
PROCINX := PCBPT;                                              <<06650>>19075000
EVENTMASK:=WAKECODE&CSL(4);                                             19080000
DISABLE;                                                                19085000
                                                                        19090000
IF LOGICAL(PCBPT) MOD PCBSIZE <> 0  OR  PQPTR = -1 OR          <<07320>>19095000
   PCBPT = 0 THEN                                              <<07320>>19100000
    SUDDENDEATH(623);   <<INVALID OR UNASSIGNED>>              <<02716>>19105000
IF WAKECODE=MEMORYWAITCODE AND RESABORTINFO.SARFLAG THEN       <<06650>>19110000
   BEGIN                                                       <<07320>>19115000
   TOS := SAVEDB;                                              <<07320>>19120000
   EXCHDB;                                                     <<07320>>19125000
   PENABLE;                                                    <<07320>>19130000
   RETURN;                                                     <<07320>>19135000
   END;                                                        <<07320>>19140000
                                                               <<07320>>19145000
IF WAKECODE <> MEMORYWAITCODE THEN                             <<02826>>19150000
EVENTFLAGS := EVENTFLAGS LOR EVENTMASK;                        <<06650>>19155000
IF (WAKEMASK LAND EVENTMASK) = 0 THEN                          <<06650>>19160000
   BEGIN  <<PROCESS ISN'T WAITING FOR THIS EVENT>>                      19165000
   IF EVENTMASK.CRITEVENTFIELD <> 0 and wakecode <> impwaitcode         19170000
      THEN SUDDENDEATH(610);                                   <<01644>>19175000
   <<AWAKE FOR A CRITICAL EVENT WHICH THE                               19180000
     PROCESS WASN'T EXPECTING>>                                         19185000
   EVENTFLAGS.WWS := 1;                                        <<06650>>19190000
   IF WAKEMASK.NONCRITEVENTFIELD = 0 THEN                      <<06650>>19195000
      BEGIN  <<PROCESS IS ACTIVE>>                                      19200000
      TOS:=SAVEDB;                                                      19205000
      EXCHDB;                                                           19210000
      CC:=CCG;                                                          19215000
      TOS:=WAITFLAGS;                                                   19220000
      IF <> THEN WAIT(*,NOINFO) ELSE PENABLE;                  <<*7564>>19225000
      END                                                               19230000
   ELSE                                                                 19235000
      BEGIN                                                             19240000
      CC:=CCL;                                                          19245000
      TOS:=SAVEDB;                                                      19250000
      EXCHDB;                                                           19255000
      PENABLE;                                                          19260000
      END;                                                              19265000
   END                                                                  19270000
ELSE                                                                    19275000
   BEGIN <<PROCESS WAITING FOR THIS EVENT TYPE>>                        19280000
   CC:=CCE;                                                             19285000
   <<SET ORIGIN OF ACTIVATION>>                                         19290000
   TOS:=EVENTMASK.FATHERSONWAKEFLAGS;                                   19295000
   IF = THEN ASMB(DEL) ELSE PIINFO.OAFIELD:=TOS;               <<06650>>19300000
   <<CLEAR WAKEMASK FLAGS CORRESPONDING TO EVENT TYPES OCCURRED>>       19305000
   TOS := WAKEMASK XOR EVENTMASK;                              <<06650>>19310000
   TOS := WAKEMASK; ASMB(AND); WAKEMASK := TOS;                <<06650>>19315000
   IF EVENTMASK.NONCRITEVENTFIELD <> 0                                  19320000
   THEN WAKEMASK.NONCRITEVENTFIELD := 0;                       <<06650>>19325000
   IF NOT WAKEMASK.IMPEDEDWAITFLAG                             <<06650>>19330000
   AND NOT QUEUEINGINFO.DISPQFLAG                              <<06650>>19335000
   THEN QUEUEPROC(PCBPT,DISPATCHINGQ,ENDOFCLASS);              <<06650>>19340000
   IF WAITFLAGS <> 0 THEN                                               19345000
      BEGIN << WAIT CALLER >>                                           19350000
      TOS:=SAVEDB;                                                      19355000
      EXCHDB;                                                           19360000
      WAIT(WAITFLAGS,NOINFO);                                           19365000
      END                                                               19370000
   ELSE                                                                 19375000
      BEGIN                                                             19380000
      ENABLE;                                                           19385000
      DISABLE;                                                          19390000
      IF DISPTOAWAKEMSG.DISPRUNNINGFLAG THEN                            19395000
         BEGIN  <<DISPATCHER IS RUNNING>>                               19400000
         IF DISPTOAWAKEMSG.PAUSEDFLAG THEN                              19405000
            BEGIN <<DISPATCHER IS PAUSED>>                              19410000
            TOS:=SAVEDB;                                                19415000
            EXCHDB;                                                     19420000
            PENABLE;                                                    19425000
            ASMB (DISP);                                                19430000
            END                                                         19435000
         ELSE                                                           19440000
            BEGIN                                                       19445000
            X:=PROCINX;                                                 19450000
            TOS := QUEUEINGINFO.PRIFIELD;                      <<06650>>19455000
            IF AWAKETOSCHEDMSG <= LS0 THEN ASMB(DEL)                    19460000
            ELSE AWAKETOSCHEDMSG:=TOS;                                  19465000
            TOS:=SAVEDB;                                                19470000
            EXCHDB;                                                     19475000
            PENABLE;                                                    19480000
            END;                                                        19485000
         END                                                            19490000
      ELSE                                                              19495000
                                                               <<02827>>19500000
         <<There is a current process - consider preemption>>  <<02827>>19505000
         <<only if new process is in a more urgent queue or>>  <<02827>>19510000
         <<if dispatcher has specifically enabled preemption>> <<02827>>19515000
         <<Then preemption will be based on priority>>         <<02827>>19520000
         BEGIN  <<Should we preempt curr proc?>>               <<02827>>19525000
         IF DISPTOAWAKEMSG.PREEMPTOKFLAG OR                    <<02827>>19530000
         DISPTOAWAKEMSG.CURPROCQUEUE<QUEUEINGINFO.QUEUEFIELD   <<06650>>19535000
         THEN      <<preempt ok flag set or>>                  <<02827>>19540000
            BEGIN  <<curr proc queue less urgent than new q?>> <<02827>>19545000
            IF QUEUEINGINFO.PRIFIELD <                         <<06650>>19550000
                  DISPTOAWAKEMSG.CURPROCPRI THEN               <<02827>>19555000
               BEGIN <<really more urgent?, yes!>>             <<02827>>19560000
               IF GCLASSENABLEDMASK.CLASS0 THEN                         19565000
                  BEGIN  <<MEASURE PREEMPTION EVENT>>                   19570000
                  TOS:=MEASSTATXDSBANK;                                 19575000
                  TOS:=MEASSTATXDSBASE;                                 19580000
                  TOS:=TOS+C0SUB0'SEGRELOFF+C'PREEMPT;         <<RAY.V>>19585000
                  ASMB(LSEA);                                           19590000
                  TOS:=TOS+1;                                           19595000
                  ASMB(SSEA;DDEL);                                      19600000
                  END;                                                  19605000
               IF GCLASSENABLEDMASK.CLASS15 THEN               <<01812>>19610000
                  BEGIN <<PROCESS LEVEL PREEMPTION>>           <<01812>>19615000
                  TOS:=MEASPROCXDSBANK;                        <<01812>>19620000
                  TOS:=MEASPROCXDSBASE;                        <<01812>>19625000
                  TOS := TOS + CURPRC/PCBSIZE *                <<06650>>19630000
                       CLASS15'SUB0SIZE+CP'STOPPREEMPTED;      <<01812>>19635000
                  ASMB(LSEA);                                  <<01812>>19640000
                  TOS:=TOS+1;                                  <<01812>>19645000
                  ASMB(SSEA;DDEL);                             <<01812>>19650000
                  END;                                         <<01812>>19655000
      <<STUFF AWAY REASON STOPPED IN PCBX OF IMPEDED PROCESS>> <<01812>>19660000
      <<DONE UNCONDITIONALLY FOR HISTORY FOR MEAS INTERFACE>>  <<01812>>19665000
               WAITTODISPMSG.PREEMPTEDFLAG:=1;                 <<04774>>19670000
               TOS:=SAVEDB;                                             19675000
               EXCHDB;                                                  19680000
               PENABLE;                                                 19685000
               ASMB(DISP);                                              19690000
               END                                                      19695000
            ELSE                                                        19700000
               BEGIN                                                    19705000
               TOS:=SAVEDB;                                             19710000
               EXCHDB;                                                  19715000
               PENABLE;                                                 19720000
               END;                                                     19725000
            END                                                         19730000
         ELSE                                                           19735000
            BEGIN <<CURRENT PROCESS NOT PREEMPTABLE>>                   19740000
            TOS:=SAVEDB;                                                19745000
            EXCHDB;                                                     19750000
            PENABLE;                                                    19755000
            END;                                                        19760000
         END;                                                           19765000
      END;                                                              19770000
   END;                                                                 19775000
END  <<AWAKE>>;                                                         19780000
                                                                        19785000
$PAGE "PROCESS CONTROL UNCALLABLE INTRINSICS"                           19790000
                                                                        19795000
PROCEDURE IMPEDE(PCBPT);                                                19800000
VALUE PCBPT;                                                            19805000
INTEGER PCBPT;                                                          19810000
OPTION PRIVILEGED, UNCALLABLE;                                          19815000
                                                                        19820000
COMMENT                                                                 19825000
ELIMINATE CALLS TO THIS PROCEDURE. REPLACE WITH CALLS                   19830000
TO WAIT WITH A SPECIFIC WAIT EVENT TYPE.                                19835000
;                                                                       19840000
                                                                        19845000
BEGIN                                                                   19850000
IF PCBPT = 0 THEN                                                       19855000
   BEGIN <<IMPEDING SELF>>                                              19860000
   TOS:=0D;                                                             19865000
   TOS.IMPTRAPFLAG:=1;                                                  19870000
   WAIT(*,*);                                                           19875000
   END                                                                  19880000
ELSE                                                                    19885000
   BEGIN <<IMPEDING SOMEONE ELSE!>>                                     19890000
   DISABLE;                                                             19895000
   PCB(PCBPT+WAKEMASKWORDNUM).IMPEDEDWAITFLAG:=1;                       19900000
   ENABLE;                                                              19905000
   END;                                                                 19910000
END  <<PROCEDURE IMPEDE>>;                                              19915000
                                                                        19920000
                                                                        19925000
PROCEDURE BUMPQPRI(HOLDERPIN,HEADPIN);                                  19930000
VALUE HOLDERPIN,HEADPIN;                                                19935000
INTEGER HOLDERPIN,HEADPIN;                                              19940000
OPTION PRIVILEGED,UNCALLABLE;                                           19945000
                                                                        19950000
BEGIN                                                                   19955000
                                                                        19960000
INTEGER MYPRI;                                                          19965000
INTEGER NEXTPIN;                                                        19970000
DOUBLE SAVEDB;                                                          19975000
INTEGER PCBPT;                                                 <<06650>>19980000
LOGICAL SUBROUTINE CHECKPRI(PRI);                              <<*7952>>19985000
VALUE PRI;                                                     <<*7952>>19990000
INTEGER PRI;                                                   <<*7952>>19995000
BEGIN                                                          <<*7952>>20000000
CHECKPRI := FALSE;                                             <<*7952>>20005000
IF QUEUEINGINFO.LSCHEDFLAG THEN                                <<*7952>>20010000
   CHECKPRI := TRUE                                            <<*7952>>20015000
ELSE                                                           <<*7952>>20020000
<<ALSO RETURN TRUE IF CALLER PRI. IS IN NON LINEAR QUEUE>>     <<P9084>>20025000
IF PRI >= ICS(-ICS'CSCHEDBASECELL) THEN CHECKPRI := TRUE;      <<P9084>>20030000
END;                                                           <<*7952>>20035000
                                                                        20040000
SUBROUTINE BUMPPRI;                                                     20045000
BEGIN                                                                   20050000
PCBPT := NEXTPIN * PCBSIZE;                                    <<06650>>20055000
RESABORTINFO.HOLDIMPPRIFLAG := 1;                              <<06650>>20060000
IF INTEGER(QUEUEINGINFO).PRIFIELD > MYPRI AND                  <<*7952>>20065000
   CHECKPRI(MYPRI) THEN                                        <<*7952>>20070000
   BEGIN                                                                20075000
   QUEUEINGINFO.PRIFIELD:=MYPRI;                                        20080000
   IF QUEUEINGINFO.DISPQFLAG THEN                                       20085000
   QUEUEPROC(PCBPT,DISPATCHINGQ,ENDOFQUEUE);                   <<06650>>20090000
   END;                                                                 20095000
END;                                                                    20100000
                                                                        20105000
DISABLE;                                                                20110000
TOS:=%1000D;                                                            20115000
ASMB(XCHD);                                                             20120000
SAVEDB:=TOS;                                                            20125000
                                                                        20130000
PCBPT := CURPRC;                                               <<06650>>20135000
MYPRI := QUEUEINGINFO.PRIFIELD;                                <<06650>>20140000
IF QUEUEINGINFO.LSCHEDFLAG = 0 THEN                            <<06650>>20145000
   BEGIN<<ADJ MYPRI TO BASE OF SCHEDCLASS>>                    <<06411>>20150000
   IF PCB(X).CSCHEDFLAG=1                                      <<06411>>20155000
   THEN MYPRI:=ICS(-ICS'CSCHEDBASECELL)                        <<06411>>20160000
   ELSE IF PCB(X).DSCHEDFLAG=1                                 <<06411>>20165000
   THEN MYPRI:=ICS(-ICS'DSCHEDBASECELL)                        <<06411>>20170000
   ELSE IF PCB(X).ESCHEDFLAG=1                                 <<06411>>20175000
   THEN MYPRI:=ICS(-ICS'ESCHEDBASECELL);                       <<06411>>20180000
   END;                                                        <<06411>>20185000
NEXTPIN:=HOLDERPIN;                                                     20190000
BUMPPRI;                                                                20195000
NEXTPIN:=HEADPIN;                                                       20200000
DO                                                                      20205000
   BEGIN                                                                20210000
   IF HEADPIN = (CURPRC)/PCBSIZE THEN                          <<06650>>20215000
      NEXTPIN := (CURPRC)/PCBSIZE                              <<06650>>20220000
   ELSE                                                        <<06650>>20225000
      BEGIN                                                             20230000
      BUMPPRI;                                                          20235000
      PCBPT := NEXTPIN * PCBSIZE;                              <<06650>>20240000
      NEXTPIN := NIMPPIN/PCBSIZE;                              <<06650>>20245000
      END;                                                              20250000
   END                                                                  20255000
UNTIL NEXTPIN = (CURPRC)/PCBSIZE;                              <<06650>>20260000
TOS:=SAVEDB;                                                            20265000
ASMB(XCHD);                                                             20270000
END  <<BUMPQPRI>>;                                                      20275000
                                                                        20280000
$page "PCB Impeded List Manipulators : String Pin At Tail"     <<06411>>20285000
                                                               <<06411>>20290000
PROCEDURE StringPinAtTail(headpin,newpin);                     <<06411>>20295000
VALUE headpin,newpin;                                          <<06411>>20300000
INTEGER headpin,newpin;                                        <<06411>>20305000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06411>>20310000
                                                               <<06411>>20315000
COMMENT                                                        <<06411>>20320000
                                                               <<06411>>20325000
StringPinAtTail places the newpin at the end of the list of the<<06411>>20330000
impeded processes which are strung thru the pcb entries.  The  <<06411>>20335000
head of the impeded list is specified in the headpin parameter,<<06411>>20340000
and the newpin specifies the pin to be added to the tail.      <<06411>>20345000
                                                               <<06411>>20350000
StringPinAtTail flips thru the list until it gets to the       <<06411>>20355000
end, then adds the newpin at the tail.                         <<06411>>20360000
                                                               <<06411>>20365000
If the newpin parameter is zero, it is assumed that the pin to <<06411>>20370000
strung is that of the currently executing process.             <<06411>>20375000
No assumption is made on DB location.                          <<06411>>20380000
                                                               <<06411>>20385000
The caller is responsible for pdisabling or disabling if       <<06411>>20390000
process switches or interrupts could cause the list structure  <<06411>>20395000
to be changed.                                                 <<06411>>20400000
                                                               <<06411>>20405000
                                                               <<06411>>20410000
;                                                              <<06411>>20415000
                                                               <<06411>>20420000
BEGIN                                                          <<06411>>20425000
                                                               <<06411>>20430000
INTEGER PREVPIX := 0,                                          <<06945>>20435000
        NEXTPIX;                                               <<06650>>20440000
                                                               <<06411>>20445000
IF newpin=0 THEN newpin := (CURPRC)/PCBSIZE;                   <<06650>>20450000
NEXTPIX := HEADPIN * PCBSIZE;                                  <<06650>>20455000
WHILE NEXTPIX <> 0 DO                                          <<06650>>20460000
   BEGIN <<locate end of impeded list>>                        <<06411>>20465000
   PREVPIX := NEXTPIX;                                         <<06650>>20470000
   NEXTPIX := PCB(NEXTPIX + NIMPPINWORDNUM);                   <<06650>>20475000
   END;                                                        <<06411>>20480000
                                                               <<06411>>20485000
<<prevpin contains the last pin in the list>>                  <<06411>>20490000
                                                               <<06411>>20495000
<<put newpin into next imp ptr of prev pin pcb>>               <<06411>>20500000
                                                               <<06411>>20505000
IF PREVPIX <> 0 THEN                                           <<06650>>20510000
   PCB(PREVPIX + NIMPPINWORDNUM) := NEWPIN * PCBSIZE;          <<06650>>20515000
                                                               <<06411>>20520000
<<zero next ptr of newly added pcb entry>>                     <<06411>>20525000
                                                               <<06411>>20530000
PCB(NEWPIN * PCBSIZE + NIMPPINWORDNUM) := 0;                   <<06650>>20535000
                                                               <<06411>>20540000
END;  <<StringPinAtEnd>>                                       <<06411>>20545000
                                                               <<06411>>20550000
$page "PCB Impeded List Manipulators : String Pin At Tail"     <<06411>>20555000
                                                               <<06411>>20560000
INTEGER PROCEDURE UnstringHeadPIN(headpin);                    <<06411>>20565000
VALUE headpin;                                                 <<06411>>20570000
INTEGER headpin;                                               <<06411>>20575000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06411>>20580000
                                                               <<06411>>20585000
COMMENT                                                        <<06411>>20590000
                                                               <<06411>>20595000
UnstringHeadPIN removes the pcb entry specified by the headpin <<06411>>20600000
parameter from the string of pcb entries on the impeded list.  <<06411>>20605000
The new headpin of the list is returned.                       <<06411>>20610000
No assumption is made on DB location.                          <<06411>>20615000
                                                               <<06411>>20620000
The caller is responsible for pdisabling or disabling if       <<06411>>20625000
process switches or interrupts could cause the list structure  <<06411>>20630000
to be changed.                                                 <<06411>>20635000
                                                               <<06411>>20640000
                                                               <<06411>>20645000
;                                                              <<06411>>20650000
                                                               <<06411>>20655000
BEGIN                                                          <<06411>>20660000
                                                               <<06411>>20665000
IF headpin=0 THEN SuddenDeath(SFKernBadParm);                  <<06411>>20670000
                                                               <<06411>>20675000
UNSTRINGHEADPIN := PCB(HEADPIN * PCBSIZE + NIMPPINWORDNUM)     <<06650>>20680000
                      /PCBSIZE;                                <<06650>>20685000
                                                               <<06411>>20690000
<<zero next ptr of removed pcb entry>>                         <<06411>>20695000
                                                               <<06411>>20700000
PCB(HEADPIN * PCBSIZE + NIMPPINWORDNUM) := 0;                  <<06650>>20705000
                                                               <<06411>>20710000
END;  <<UnstringHeadPIN>>                                      <<06411>>20715000
                                                               <<06411>>20720000
                                                                        20725000
                                                                        20730000
PROCEDURE IMPAIRED(HOLDER'SPIN,RESINDEX,P3);                            20735000
VALUE HOLDER'SPIN,RESINDEX,P3;                                          20740000
INTEGER HOLDER'SPIN,RESINDEX,P3;                                        20745000
OPTION PRIVILEGED,UNCALLABLE;                                           20750000
                                                                        20755000
BEGIN                                                                   20760000
INTEGER HOLDER'SPRI,                                                    20765000
        IMPEDER'SPRI;                                                   20770000
INTEGER POINTER RESPOINTER;                                             20775000
                                                                        20780000
@RESPOINTER:=RESINDEX;                                                  20785000
BUMPQPRI(HOLDER'SPIN,RESPOINTER(1)/PCBSIZE);                   <<06650>>20790000
IMPEDE(0);                                                              20795000
END;                                                                    20800000
                                                                        20805000
PROCEDURE UNIMPEDE(PCBPT);                                              20810000
VALUE PCBPT;                                                            20815000
INTEGER PCBPT;                                                          20820000
OPTION PRIVILEGED,UNCALLABLE;                                           20825000
                                                                        20830000
BEGIN                                                                   20835000
AWAKE(PCBPT,IMPWAITCODE,NOWAIT);                                        20840000
END  <<PROCEDURE UNIMPEDE>>;                                            20845000
                                                                        20850000
                                                                        20855000
PROCEDURE DELAY(INTERVAL);                                              20860000
VALUE INTERVAL;                                                         20865000
DOUBLE INTERVAL;                                                        20870000
OPTION PRIVILEGED,UNCALLABLE;                                           20875000
                                                                        20880000
COMMENT                                                                 20885000
                                                                        20890000
DELAY GETS AN ENTRY IN THE TIMER REQUEST LIST ON BAHALF                 20895000
OF THE CALLING PROCESS, AND WAITS THE CALLING PROCESS                   20900000
UNTIL THE ENTRY IS SERVICED.  THIS WILL OCCUR IN                        20905000
(INTERVAL +/- 100) MS.                                                  20910000
                                                                        20915000
;                                                                       20920000
                                                                        20925000
BEGIN                                                                   20930000
INTEGER PCBPT;                                                          20935000
LOGICAL SAVECRITICAL;                                                   20940000
                                                                        20945000
DISABLE;                                                                20950000
PCBPT := CURPRC;                                               <<06650>>20955000
SAVECRITICAL:=SETCRITICAL;                                              20960000
TOS:=TIMEREQ(5,PCBPT,INTERVAL);                                         20965000
<<                                                                      20970000
TOS:=TIMERWAITCODE                                                      20975000
TOS:=0                                                                  20980000
TOS.TRANSCOMPFLAG:=1                                                    20985000
WAIT(*,*)                                                               20990000
>>                                                                      20995000
IMPEDE(0);                                                              21000000
ENABLE;                                                                 21005000
ABORTTIMEREQ(*);                                                        21010000
RESETCRITICAL(SAVECRITICAL);                                            21015000
END <<PROCEDURE DELAY>>;                                                21020000
LOGICAL PROCEDURE TIMEOUT(DELAY,ALLOWSOFTINT);                 <<03041>>21025000
VALUE DELAY,ALLOWSOFTINT;                                               21030000
                                                                        21035000
<<FUNCTION                                                              21040000
  DELAYS A PROCESS FOR N MILLISECONDS.>>                                21045000
                                                                        21050000
<<INPUT>>                                                               21055000
  DOUBLE                                                                21060000
    DELAY;               <<# MILLISECONDS TO DELAY, -1D IMPLIES         21065000
                           INFINITY>>                                   21070000
  LOGICAL                                                               21075000
    ALLOWSOFTINT;        <<TRUE - SOFT INTERRUPTS OR CONTROL Y MAY      21080000
                                  ABORT THE TIMEOUT                     21085000
                           FALSE- WAIT FOR THE ENTIRE DURATION>>        21090000
                                                                        21095000
<<OUTPUT                                                                21100000
    TIMEOUT                REASON FOR RETURNING                         21105000
                           0 - TIMEOUT OCCURRED                         21110000
                           1 - NO TRLX ENTRIES AVAILABLE                21115000
                           2 - CONTROL Y/SOFT INTERRUPT IS PENDING>>    21120000
                                                                        21125000
OPTION PRIVILEGED,UNCALLABLE;                                           21130000
                                                                        21135000
   BEGIN                                                                21140000
   LOGICAL                                                              21145000
      DONE;                                                             21150000
   INTEGER                                                              21155000
      PCBPT,PCBXLOC,TRLX:=0,RESULT:=TIMEOUTOCCURRED,DELAY0=DELAY,       21160000
      PXFIXEDLOC,                                              <<06686>>21165000
      DELAY1=DELAY+1;                                                   21170000
   LOGICAL                                                              21175000
      SPECIALINFO;                                                      21180000
   DEFINE                                                               21185000
      INFINITY    = -1D#;                                               21190000
   EQUATE                                                               21195000
      TIMEOUTCODE = 10,                                                 21200000
      TIMEOUTWAIT = -%10,                                               21205000
      ALLOWSOFT   = %10000,                                             21210000
      LONGWAIT    = 1;                                                  21215000
   INTEGER                                                     <<06943>>21220000
      TRLPTR;                                                  <<06943>>21225000
                                                                        21230000
                                                                        21235000
   SUBROUTINE TEXIT(RETURNVALUE);                                       21240000
   VALUE RETURNVALUE;                                                   21245000
   INTEGER RETURNVALUE;                                                 21250000
      BEGIN                                                             21255000
      TIMEOUT:=RETURNVALUE;                                             21260000
      IF GLOBALTRACEFLAG THEN                                           21265000
         MMSTAT'(MMTIMEOUT,RETURNVALUE,DELAY0,DELAY1,0,0,0);   <<06948>>21270000
      ASMB(EXIT 3);                                                     21275000
      END;  <<TEXIT>>                                                   21280000
   <<INITIALIZE>>                                                       21285000
   SPECIALINFO := (IF DELAY > 1000D THEN 1 ELSE 0) +           <<*7954>>21290000
                  (IF ALLOWSOFTINT THEN ALLOWSOFT              <<*7954>>21295000
                     ELSE 0);                                  <<*7954>>21300000
   PXFIXED;                                                             21305000
   PCBPT := CURPRC;                                            <<06650>>21310000
                                                                        21315000
   IF DELAY <> 0D THEN                                                  21320000
      BEGIN                                                             21325000
      IF DELAY <> INFINITY THEN                                         21330000
         BEGIN  <<USER DESIRES A DELAY>>                                21335000
         DISABLE;                                                       21340000
         IF NOT CHEKTRLFREE THEN                                        21345000
            BEGIN                                                       21350000
            ENABLE;                                                     21355000
            TEXIT(TRLXEXHAUSTED);                                       21360000
            END;                                                        21365000
         PXFXTRLXTOUT:=TRLX:=TIMEREQ(TIMEOUTCODE,PCBPT,DELAY); <<06635>>21370000
         ENABLE;                                                        21375000
         END;                                                           21380000
                                                                        21385000
      <<WAIT LOOP>>                                                     21390000
      DO                                                                21395000
         BEGIN  <<DO UNTIL TIMEOUT/SOFT INT PENDING>>                   21400000
         DONE:=TRUE;                                                    21405000
         WAIT(TIMEOUTWAIT,SPECIALINFO);                                 21410000
         IF > THEN                                                      21415000
            RESULT:=SOFTINTOCCURRED                                     21420000
         ELSE                                                           21425000
            BEGIN  <<CHECK IF WAIT RETURNED BECAUSE OF PCB WWS>>        21430000
            TRLPTR := TRLX*TRLENTRYSIZE;                       <<06943>>21435000
            IF TRLX=0 OR TRLREQUEST<>0 THEN                    <<06943>>21440000
               DONE:=FALSE;  <<ANOTHER EVENT SET THE WWS>>              21445000
            END                                                         21450000
         END UNTIL DONE;                                                21455000
                                                                        21460000
      <<RETURN THE TIMER REQUEST ENTRY>>                                21465000
      IF TRLX <> 0 THEN                                                 21470000
         BEGIN                                                          21475000
         PDISABLE;  <<PSEUDO DISABLE SO THAT CAN'T BE ABORTED>>         21480000
         ABORTTIMEREQ(TRLX);                                            21485000
         PXFXTRLXTOUT:=0;                                      <<06635>>21490000
         PENABLE;                                                       21495000
         END;                                                           21500000
      END;                                                              21505000
                                                                        21510000
   TEXIT(RESULT);                                                       21515000
   END;  <<TIMEOUT>>                                                    21520000
$PAGE "RESOURCE EXCLUSION AND PROTECTION : SET / RESET CRITICAL"        21525000
                                                                        21530000
                                                                        21535000
                                                                        21540000
LOGICAL PROCEDURE SETCRITICAL;                                          21545000
OPTION PRIVILEGED,UNCALLABLE;                                  <<01696>>21550000
                                                                        21555000
COMMENT                                                                 21560000
SETCRITICAL SETS THE FLAG IN THE PCB WHICH KEEP THE PROCESS             21565000
FROM BEING ABORTED.  THE VALUE OF SETCRITICAL RETURNED TO THE           21570000
CALLER INDICATES WHETHER THE PROCESS WAS ALREADY IN A CRITICAL          21575000
STATE, AND THIS VALUE MUST BE RETURNED WHEN RESETCRITICAL IS            21580000
CALLED SO THAT THE PROCESS MAY BE PROTECTED EVEN THOUGH NESTED          21585000
CALLS TO SETCRITICAL MAY HAVE BEEN MADE.                                21590000
;                                                                       21595000
                                                                        21600000
BEGIN                                                                   21605000
INTEGER PCBPT;                                                 <<06650>>21610000
DISABLE;                                                                21615000
PCBPT := CURPRC;                                               <<06650>>21620000
SETCRITICAL := RESABORTINFO.CRITFLAG;                          <<06650>>21625000
RESABORTINFO.CRITFLAG := 1;                                    <<06650>>21630000
END;  <<PROCEDURE SETCRITICAL>>                                         21635000
                                                                        21640000
PROCEDURE RESETCRITICAL(OLDCRITICAL);                                   21645000
VALUE OLDCRITICAL;                                                      21650000
LOGICAL OLDCRITICAL;                                                    21655000
OPTION PRIVILEGED,UNCALLABLE;                                           21660000
                                                                        21665000
                                                                        21670000
COMMENT                                                                 21675000
RESETCRITICAL RESTORES THE PROCESS TO AN ABORTABLE STATE                21680000
UNLESS THE PROCESS HAD NESTED CALLS TO SETCRITICAL.  IF                 21685000
AN ABORT IS PENDING AGAINST THE PROCESS AND IT IS NO                    21690000
LONGER CRITICAL, PSEUDOINT IS CALLED.                                   21695000
;                                                                       21700000
                                                                        21705000
BEGIN                                                                   21710000
INTEGER PCBPT;                                                 <<06650>>21715000
IF NOT OLDCRITICAL THEN                                                 21720000
   BEGIN                                                                21725000
   DISABLE;                                                             21730000
   PCBPT := CURPRC;                                            <<06650>>21735000
   RESABORTINFO.CRITFLAG := 0;                                 <<06650>>21740000
   RESABORTINFO.HOLDIMPPRIFLAG := 0;                           <<06650>>21745000
   IF RESABORTINFO.PIOVRFLAG THEN                              <<06650>>21750000
      BEGIN                                                             21755000
      IF NOT RESABORTINFO.HASSIRFLAG THEN                      <<06650>>21760000
         BEGIN                                                          21765000
         RESABORTINFO.PIOVRFLAG := 0;                          <<06650>>21770000
         IF ICS(-ICS'PDISCNTCELL) > 0                                   21775000
         OR STATUS.(1:1) = 0 <<PDISABLED OR DISABLED>>                  21780000
         THEN ASMB(DISP) <<DELAY SERVICE TILL NEXT LAUNCH>> ELSE        21785000
            BEGIN                                                       21790000
            IF PROCSTATE.HYBERNATEFLAG                         <<06650>>21795000
            OR PROCSTATE.STOPFLAG THEN ASMB(DISP) ELSE         <<06650>>21800000
               BEGIN                                                    21805000
               PDISABLE;                                                21810000
               ENABLE;                                                  21815000
               PSEUDOINT;                                               21820000
               END;                                                     21825000
            END;                                                        21830000
         END;                                                           21835000
      END;                                                              21840000
   IF PROCSTATE.STOVFLAG = 1                                   <<06650>>21845000
   AND NOT RESABORTINFO.STOVABORTFLAG                          <<06650>>21850000
   AND NOT STKINFO.INSYSTEMFLAG AND NOT                        <<06650>>21855000
   RESABORTINFO.HASSIRFLAG THEN                                <<06650>>21860000
      BEGIN <<WAS DISABLED OR PDISABLED WHEN OVERFLOWED, NOT IN SYSTEM>>21865000
      RESABORTINFO.STOVABORTFLAG := 1;                         <<06650>>21870000
      ABORT([8/1,8/4],0,0);                                    <<04486>>21875000
      END;                                                              21880000
   END;                                                                 21885000
END  <<PROCEDURE RESETCRITICAL>>;                                       21890000
                                                                        21895000
$PAGE "RESOURCE EXCLUSION AND PROTECTION : GET SIR"                     21900000
                                                                        21905000
INTEGER PROCEDURE GETSIR(SIRNUMBER);                                    21910000
VALUE SIRNUMBER;                                                        21915000
INTEGER SIRNUMBER;                                                      21920000
OPTION PRIVILEGED,UNCALLABLE;                                           21925000
                                                                        21930000
COMMENT                                                                 21935000
                                                                        21940000
GETSIR IS CALLED TO OBTAIN EXCLUSIVE ACCESS TO A RESOURCE WHICH         21945000
IS PROTECTED BY THE QUEUEING SEMAPHORE PASSED AS PARAMETER.  IF         21950000
THE SIR IS BUSY, THE PROCESS IS QUEUED BY PRIORITY THROUGH A            21955000
DOUBLY LINKED LIST STRUNG THROUGH PCB ENTRIES.  IF THE HOLDER OF        21960000
THE RESOURCE IS OF LESS URGENT PRIORITY THAN THE REQUESTOR, THE         21965000
HOLDER'S PRIORITY IS TEMPORARILY BUMPED UNTIL HE RELEASES THE           21970000
RESOURCE.                                                               21975000
                                                                        21980000
THE RETURN VALUE INDICATES WHETHER THE PROCESS ALREADY HOLDS A          21985000
SIR, AND WHETHER THE CALLER ALREADY HOLDS THE SIR IT'S CURRENTLY        21990000
REQUESTING.  THIS VALUE SHOULD BE SAVED AND PASSED ALONG TO             21995000
RELSIR SO THAT PROPER ACCOUNTING CAN BE MAINTAINED.                     22000000
                                                                        22005000
   GETSIR = 1 ==> PROCESS ALREADY HELD SOME SIR                         22010000
   GETSIR = 3 ==> PROCESS ALREDAY HOLDS THE SIR ITS REQUESTING          22015000
   GETSIR = 0 ==> PROCESS IS ACQUIRING ITS FIRST SIR                    22020000
                                                                        22025000
;                                                                       22030000
                                                                        22035000
BEGIN                                                                   22040000
INTEGER SIRTABINX,                                                      22045000
        REQPCBPT,                                                       22050000
        REQPRI,                                                         22055000
        PCBPT,                                                 <<06650>>22060000
        REQPROCINX,                                                     22065000
        HOLDERPROCINX,                                         <<06650>>22070000
        HEADPROCINX,                                                    22075000
        PREVPROCINX,                                                    22080000
        NEXTPROCINX;                                                    22085000
DOUBLE SAVEDB;                                                          22090000
INTEGER SIRN=SIRNUMBER;                                                 22095000
INTEGER BUMPPROCINX;                                           <<06650>>22100000
                                                               <<06411>>22105000
                                                               <<06411>>22110000
SUBROUTINE BUMPSIRPROC;                                        <<06411>>22115000
                                                               <<06411>>22120000
COMMENT                                                        <<06411>>22125000
                                                               <<06411>>22130000
RAISES PRI OF BUMPPIN TO AT LEAST REQPIN'S PRI                 <<06411>>22135000
                                                               <<06411>>22140000
;                                                              <<06411>>22145000
                                                               <<06411>>22150000
BEGIN                                                          <<06411>>22155000
PCBPT := BUMPPROCINX;                                          <<06650>>22160000
IF NOT QUEUEINGINFO.LSCHEDFLAG THEN                            <<06411>>22165000
   BEGIN                                                       <<06411>>22170000
   DISABLE;                                                    <<06411>>22175000
   RESABORTINFO.HOLDSIRPRIFLAG:=1;                             <<06411>>22180000
   IF INTEGER(QUEUEINGINFO.PRIFIELD) > REQPRI THEN             <<06411>>22185000
      BEGIN                                                    <<06411>>22190000
      QUEUEINGINFO.PRIFIELD:=REQPRI;                           <<06411>>22195000
      IF QUEUEINGINFO.DISPQFLAG                                <<06411>>22200000
      THEN QUEUEPROC(PCBPT,DISPATCHINGQ,ENDOFQUEUE);           <<06650>>22205000
      END;                                                     <<06411>>22210000
   END;                                                        <<06411>>22215000
END <<BUMPSIRPROC>>;                                           <<06411>>22220000
                                                               <<06411>>22225000
                                                               <<06411>>22230000
                                                                        22235000
TURNOFFTRAPS;                                                  <<01860>>22240000
                                                               <<01860>>22245000
REQPROCINX := PCBPT := (CURPRC);                               <<06650>>22250000
PDISABLE;                                                      <<01846>>22255000
SIRTABINX := SIRNUMBER*SIRTABENTRYLENGTH;                      <<06264>>22260000
HOLDERPROCINX := SIR'HOLDER;                                   <<06650>>22265000
IF HOLDERPROCINX = REQPROCINX THEN                             <<06650>>22270000
   BEGIN <<REQUESTOR ALREADY HOLDS SIR>>                       <<01846>>22275000
   GETSIR:=3; <<SO WE CAN DISTINGUISH AT RELEASE TIME>>        <<01846>>22280000
   PENABLE;                                                    <<01846>>22285000
   END                                                         <<01846>>22290000
ELSE                                                           <<01846>>22295000
   BEGIN  <<GO FOR IT>>                                        <<01846>>22300000
   TOS := RESABORTINFO;                                        <<06650>>22305000
   ASSEMBLE(TBC HASSIRBIT);                                             22310000
   IF <> THEN GETSIR:=1  <<INDICATES PROC ALREADY HELD A SIR>>          22315000
   ELSE GETSIR:=0;                                                      22320000
   IF HOLDERPROCINX = 0 THEN                                   <<06650>>22325000
      BEGIN  <<SIR IS AVAILABLE>>                                       22330000
      <<                                                                22335000
      IF SIRN < %50 THEN                                                22340000
         BEGIN                                                          22345000
         TOS:=%1000D;ASMB(XCHD);X:=SIRN*6+700+1;MEASBUF(X):=TIMER;      22350000
         X:=SIRN*6+700+5;                                               22355000
         MEASBUF(X):=MEASBUF(X)+1D;                                     22360000
         ASMB(XCHD;DDEL);                                               22365000
         END;                                                           22370000
      >>                                                                22375000
      SIR'HOLDER := PCBPT;                                     <<06650>>22380000
      RESABORTINFO.HASSIRFLAG := 1;                            <<06650>>22385000
      PENABLE;                                                          22390000
      END                                                               22395000
   ELSE                                                                 22400000
      BEGIN <<SIR IS BUSY, SO PROCESS MUST QUEUE FOR IT>>               22405000
      TOS:=%1000D;                                                      22410000
      ASSEMBLE(XCHD); <<FOR FAST ADDRESSING>>                           22415000
      SAVEDB:=TOS;                                                      22420000
      IF GCLASSENABLEDMASK.CLASS0 THEN                                  22425000
         BEGIN  <<MEASURE SIR BLOCK PROCESS STOP EVENT>>                22430000
         TOS:=MEASSTATXDSBANK;                                          22435000
         TOS:=MEASSTATXDSBASE;                                          22440000
         TOS:=TOS+C0SUB0'SEGRELOFF+C'STOPSIR;                  <<RAY.V>>22445000
         ASMB(LSEA);                                                    22450000
         TOS:=TOS+1;                                                    22455000
         ASMB(SSEA;DDEL);                                               22460000
         END;                                                           22465000
      <<                                                                22470000
      X:=SIRN*6+700+4;IF SIRN < %50 THEN                                22475000
      MEASBUF(X):=MEASBUF(X)+1D;  #BUSY SIR STOPS ON THIS SIR           22480000
      >>                                                                22485000
      REQPRI:=QUEUEINGINFO.PRIFIELD;                                    22490000
      SIR'QUEUELEN := SIR'QUEUELEN+1; <<BUMP Q LENGTH>>        <<06264>>22495000
      HEADPROCINX := SIR'HEAD;                                 <<06650>>22500000
      IF = THEN                                                         22505000
         BEGIN <<QUEUE IS EMPTY>>                                       22510000
         << REQ AT HEAD AND TAIL >>                            <<06264>>22515000
         SIR'HEAD := SIR'TAIL := REQPROCINX;                   <<06650>>22520000
         <<                                                             22525000
         IF SIRN < %50 THEN                                             22530000
            BEGIN                                                       22535000
            X:=SIRN*6+700;                                              22540000
            MEASBUF(X):=TIMER;                                          22545000
            END;                                                        22550000
         >>                                                             22555000
         NIMPPIN := 0;                                         <<06650>>22560000
         PIMPPIN := 0;                                         <<06650>>22565000
         BUMPPROCINX := HOLDERPROCINX;                         <<06650>>22570000
         BUMPSIRPROC;                                          <<06411>>22575000
         END                                                            22580000
      ELSE                                                              22585000
         BEGIN  <<Q AT TAIL, BUMP PRI OF GUYS IN FRONT>>       <<06411>>22590000
            PREVPROCINX := SIR'TAIL;                           <<06650>>22595000
            SIR'TAIL := REQPROCINX;                            <<06650>>22600000
            PCBPT := PREVPROCINX;                              <<06650>>22605000
            NIMPPIN := REQPROCINX;                             <<06650>>22610000
            PCBPT := REQPROCINX;                               <<06650>>22615000
            PIMPPIN := PREVPROCINX;                            <<06650>>22620000
            NIMPPIN := 0;                                      <<06650>>22625000
            <<BUMP EVERYBODY TO AT LEAST HIS PRI>>             <<06411>>22630000
                                                               <<06411>>22635000
            BUMPPROCINX := HOLDERPROCINX;                      <<06650>>22640000
            BUMPSIRPROC;                                       <<06411>>22645000
            BUMPPROCINX := HEADPROCINX;                        <<06650>>22650000
            WHILE BUMPPROCINX <> REQPROCINX DO                 <<06650>>22655000
               BEGIN                                           <<06411>>22660000
               BUMPSIRPROC;                                    <<06411>>22665000
               PCBPT := BUMPPROCINX;                           <<06650>>22670000
               BUMPPROCINX := NIMPPIN;                         <<06650>>22675000
               END;                                            <<06411>>22680000
         END;                                                  <<02873>>22685000
      <<BUMP HOLDER'S PRIORITY?>>                              <<02873>>22690000
      PCBPT := HOLDERPROCINX;                                  <<06650>>22695000
      IF NOT QUEUEINGINFO.LSCHEDFLAG THEN                      <<06650>>22700000
         BEGIN                                                 <<02873>>22705000
         DISABLE;                                              <<02873>>22710000
         RESABORTINFO.HOLDSIRPRIFLAG := 1;                     <<06650>>22715000
         IF INTEGER(QUEUEINGINFO.PRIFIELD)>REQPRI THEN         <<06650>>22720000
            BEGIN                                              <<02873>>22725000
            QUEUEINGINFO.PRIFIELD := REQPRI;                   <<06650>>22730000
            IF QUEUEINGINFO.DISPQFLAG                          <<06650>>22735000
            THEN QUEUEPROC(PCBPT,DISPATCHINGQ,ENDOFQUEUE);     <<06650>>22740000
            END;                                               <<02873>>22745000
         END;                                                           22750000
      TOS:=SAVEDB;                                                      22755000
      ASMB(XCHD);                                                       22760000
      WAIT(SIRWAITCODE,NOINFO);                                         22765000
      END;                                                              22770000
   END;                                                                 22775000
END  <<PROCEDURE GETSIR>>;                                              22780000
                                                                        22785000
                                                                        22790000
$PAGE "RESOURCE EXCLUSION AND PROTECTION : RELEASE SIR"                 22795000
                                                                        22800000
PROCEDURE RELSIR(SIRNUMBER,SAVEDVALUE);                                 22805000
VALUE SIRNUMBER,SAVEDVALUE;                                             22810000
INTEGER SIRNUMBER,SAVEDVALUE;                                           22815000
OPTION PRIVILEGED,UNCALLABLE;                                           22820000
                                                                        22825000
                                                                        22830000
COMMENT                                                                 22835000
                                                                        22840000
RELSIR RELEASES THE ACCESS LOCK TO THE SYSTEM RESOURCE PROTECTED        22845000
BY THE QUEUEING SEMAPHORE PASSED AS PARAMETER.  THE VALUE RETURNED      22850000
FROM GETSIR IS PASSED ALONG AS PARAMETER, AND IS USED TO DETERMINE      22855000
IF THE PROCESS HAD NESTED CALLS TO THE SAME SIR (IN WHICH CASE THE      22860000
SIR LOCK IS NOT RELEASED) AND WHETHER THE PROCESS IS RELEASING          22865000
ITS LAST SIR (IN WHICH CASE IT CAN FIELD NASTY PSEUDO-INTERRUPTS        22870000
WHICH COULD RESULT IN THE PROCESS BEING ABORTED).                       22875000
                                                                        22880000
THE RESOURCE IS GIVEN TO THE HEAD OF THE SIR QUEUE, WHICH IS THE        22885000
MOST URGENT PROCESS WAITING ON THE SIR DUE TO THE QUEUE'S PRIORITY      22890000
STRUCTURE.                                                              22895000
                                                                        22900000
IF THE PROCESS HAD ITS PRIORITY BUMPED DUE TO MORE URGENT PROCESSES     22905000
QUEUEING FOR THE RESOURCE, THE NEXT RESCHEDULING WILL PUT IT BACK       22910000
WHERE IT BELONGS.                                                       22915000
                                                                        22920000
;                                                                       22925000
                                                                        22930000
BEGIN                                                                   22935000
INTEGER SIRTABINX,                                                      22940000
        HEADPROCINX,                                                    22945000
        TAILPROCINX,                                                    22950000
        PCBPT,                                                 <<06650>>22955000
        RELPROCINX,                                                     22960000
        PREVPROCINX,                                                    22965000
        NEXTPROCINX;                                                    22970000
INTEGER SIRN=SIRNUMBER;                                                 22975000
                                                               <<01860>>22980000
TURNOFFTRAPS;                                                  <<01860>>22985000
                                                               <<01860>>22990000
IF SAVEDVALUE <> 3  THEN                                                22995000
   BEGIN <<PROCESS SHOULD GIVE UP THE SIR>>                             23000000
   PDISABLE;                                                            23005000
   TOS := RELPROCINX := PCBPT := CURPRC;                       <<06650>>23010000
   SIRTABINX := SIRNUMBER*SIRTABENTRYLENGTH;                   <<06264>>23015000
   TOS := SIR'HOLDER;                                          <<06264>>23020000
   ASSEMBLE(CMP);                                                       23025000
   IF <> THEN RESABORTINFO                                     <<06650>>23030000
            .HASSIRFLAG:=SAVEDVALUE ELSE                                23035000
      BEGIN <<CALLER HAD THE SIR>>                                      23040000
      SIR'HOLDER := 0;                                         <<06264>>23045000
      <<GIVE THE SIR TO THE HEAD OF THE QUEUE>>                         23050000
      TOS := SIR'HEAD;                                         <<06264>>23055000
      IF = THEN                                                         23060000
         BEGIN <<QUEUE EMPTY-MEAS END OF BUSY INTERVAL>>                23065000
            <<                                                          23070000
         IF SIRN < %50 THEN                                             23075000
            BEGIN                                                       23080000
            TOS:=%1000D;                                                23085000
            ASMB(XCHD);                                                 23090000
            X:=700+SIRN*6+1;                                            23095000
            TOS:=TIMER-MEASBUF(X);                                      23100000
            X:=700+SIRN*6+2;                                            23105000
            MEASBUF(X):=MEASBUF(X)+TOS;                                 23110000
            ASMB(XCHD;DDEL);                                            23115000
            END;                                                        23120000
            >>                                                          23125000
         END                                                            23130000
      ELSE                                                              23135000
         BEGIN  <<QUEUE IS NON-EMPTY>>                                  23140000
         HEADPROCINX := SIR'HEAD;                              <<06650>>23145000
         TAILPROCINX := SIR'TAIL;                              <<06650>>23150000
         SIR'QUEUELEN := SIR'QUEUELEN-1;                       <<06264>>23155000
         SIR'HOLDER := HEADPROCINX;                            <<06650>>23160000
            <<                                                          23165000
         IF SIRN < %50 AND HEADPIN=TAILPIN THEN                         23170000
            BEGIN                                                       23175000
            TOS:=%1000D;                                                23180000
            ASMB(XCHD);                                                 23185000
            X:=700+SIRN*6;                                              23190000
            TOS:=TIMER-MEASBUF(X);                                      23195000
            X:=700+SIRN*6+3;                                            23200000
            MEASBUF(X):=MEASBUF(X)+TOS;                                 23205000
            ASMB(XCHD;DDEL);                                            23210000
            END;                                                        23215000
            >>                                                          23220000
         IF HEADPROCINX = TAILPROCINX THEN                     <<06650>>23225000
            BEGIN                                              <<06264>>23230000
            SIR'HEAD := 0;                                     <<06264>>23235000
            SIR'TAIL := 0;                                     <<06264>>23240000
            END                                                <<06264>>23245000
         ELSE                                                  <<06264>>23250000
            BEGIN <<MORE THAN ONE IN QUEUE>>                            23255000
            TOS:=PCB(HEADPROCINX+NIMPPINWORDNUM);              <<06650>>23260000
            SIR'HEAD := S0; <<NEW HEAD>>                       <<06264>>23265000
            PCB(S0 + PIMPPINWORDNUM) := 0;                     <<06650>>23270000
            END;                                                        23275000
         PCB(HEADPROCINX+NIMPPINWORDNUM) := 0;                 <<06650>>23280000
         PCBPT := HEADPROCINX;                                 <<06650>>23285000
         RESABORTINFO.HASSIRFLAG := 1;                         <<06650>>23290000
         RESABORTINFO.HOLDSIRPRIFLAG := 1;                     <<06650>>23295000
         AWAKE(HEADPROCINX,SIRWAITCODE,NOWAIT);                <<06650>>23300000
         END;                                                           23305000
      IF NOT LOGICAL(SAVEDVALUE) THEN                                   23310000
         BEGIN <<PROCESS GIVING UP ITS LAST SIR>>                       23315000
         PCBPT := RELPROCINX;                                  <<06650>>23320000
         TOS := RESABORTINFO;                                  <<06650>>23325000
         TOS.HOLDSIRPRIFLAG:=0;                                         23330000
         TOS.HASSIRFLAG:=0;                                             23335000
         RESABORTINFO := S0;                                   <<06650>>23340000
         ASSEMBLE(TBC PIOVRBIT);                                        23345000
         IF <> THEN                                                     23350000
            BEGIN                                                       23355000
            ASSEMBLE(TBC CRITBIT);                                      23360000
            IF = THEN                                                   23365000
               BEGIN                                                    23370000
               RESABORTINFO                                    <<06650>>23375000
               .PIOVRFLAG:=0;                                           23380000
               IF ICS(-ICS'PDISCNTCELL) > 1                             23385000
               OR STATUS.(1:1) = 0 <<PDISABLED OR DISABLED>>            23390000
               THEN ASMB(DISP) <<DELAY SERVICE TILL NEXT LAUNCH>> ELSE  23395000
                  BEGIN                                                 23400000
                  IF PROCSTATE.HYBERNATEFLAG                   <<06650>>23405000
                  OR PROCSTATE.STOPFLAG THEN ASMB(DISP) ELSE   <<06650>>23410000
                     BEGIN                                              23415000
                     ENABLE;                                            23420000
                     PSEUDOINT;                                         23425000
                     PDISABLE;                                          23430000
                     END;                                               23435000
                  END;                                                  23440000
               END;                                                     23445000
            END;                                                        23450000
         END;                                                           23455000
      END;                                                              23460000
   PENABLE;                                                             23465000
   END;                                                                 23470000
END  <<PROCEDURE RELSIR>>;                                              23475000
                                                                        23480000
                                                                        23485000
                                                                        23490000
$PAGE "DB MANIPULATION PROCEDURES"                                      23495000
                                                                        23500000
COMMENT                                                                 23505000
                                                                        23510000
DB MAY BE PLACED AT THE STACK DB, THE BASE OF AN EXTRA DATA SEGMENT,    23515000
OR AT AN ABSOLUTE LOCATION.                                             23520000
                                                                        23525000
TO PLACE DB AT SYSDB, CALL PROCEDURE SETSYSDB, THEN CALL RESETDB        23530000
PASSING THE VALUE RETURNED BY SETSYSDB IN ORDER TO RESTORE THE          23535000
PREVIOUS ENVIRONMENT.                                                   23540000
                                                                        23545000
TO PLACE DB AT AN ABSOLUTE LOCATION IN BANK 0 OTHER THAN AT SYS DB,     23550000
FIRST CALL SETSYSDB, THEN CALL RESETDB WITH THE DESIRED VALUE.          23555000
WHEN DONE, CALL RESETDB WITH THE VALUE RETURNED FROM                    23560000
SETSYSDB.                                                               23565000
                                                                        23570000
TO PLACE DB AT A SPECIFIC DATA SEGMENT, CALL EXCHANGEDB SUPPLYING       23575000
THE DESIRED DATA SEGMENT'S NUMBER (0 IF CALLER'S STACK).  SAVE THE      23580000
VALUE RETURNED AND SUPPLY THIS ON THE CALL TO EXCHANGEDB WHICH IS TO    23585000
RESTORE THE PREVIOUS ENVIRONMENT.                                       23590000
                                                                        23595000
;                                                                       23600000
$PAGE "DB MANIPULATION PROCEDURES : SETSYSDB"                           23605000
LOGICAL PROCEDURE SETSYSDB;                                             23610000
OPTION PRIVILEGED,UNCALLABLE;                                           23615000
                                                                        23620000
COMMENT                                                                 23625000
SETSYSDB LOADS THE DB REGISTER WITH THE SYSBASE VALUE AND               23630000
SETS A FLAG IN THE CALLING PROCESS' PCB TO INDICATE THAT                23635000
DB POINTS AT AN ABSOLUTE LOCATION.                                      23640000
                                                                        23645000
SETSYSDB RETURNS A VALUE WHICH THE CALLER SHOULD SAVE AND PASS AS       23650000
PARAMETER TO RESETDB SO THAT THE PREVIOUS ENVIRONMENT MAY BE            23655000
PROPERLY RESTORED.  THE RETURNED VALUE IS -1 IF DB WAS NOT              23660000
ALREADY SET TO AN ABSOLUTE LOCATION, AND IS THE PREVIOUS DB VALUE       23665000
IF DB WAS AT AN ABSOLUTE LOCATION.                                      23670000
                                                                        23675000
;                                                                       23680000
                                                                        23685000
BEGIN                                                                   23690000
INTEGER PCBPT;                                                 <<06650>>23695000
LOGICAL                                                        <<06650>>23700000
   AT'ABSOLUTE'DB := FALSE;                                    <<06650>>23705000
PDISABLE;                                                               23710000
PCBPT := CURPRC;                                               <<06650>>23715000
AT'ABSOLUTE'DB := DBXDSINFO.ABSDBFLAG;                         <<06650>>23720000
DBXDSINFO.ABSDBFLAG := 1;                                      <<06650>>23725000
IF NOT AT'ABSOLUTE'DB THEN                                     <<06650>>23730000
   BEGIN                                                                23735000
   TOS:=0;                                                              23740000
   TOS:=SYSBASE;                                                        23745000
   EXCHDB;                                                              23750000
   SETSYSDB:=-1;                                                        23755000
   END                                                                  23760000
ELSE                                                                    23765000
   BEGIN <<ALREADY AT AN ABS LOCATION>>                                 23770000
   TOS:=0;                                                              23775000
   TOS:=SYSBASE;                                                        23780000
   ASMB(XCHD);                                                          23785000
   SETSYSDB:=TOS;                                                       23790000
   END;                                                                 23795000
PENABLE;                                                                23800000
END <<PROCEDURE SETSYSDB>>;                                             23805000
$PAGE "DB MANIPULATION PROCEDURES : RESETDB"                            23810000
                                                                        23815000
PROCEDURE RESETDB(WHERE);                                               23820000
VALUE WHERE;                                                            23825000
INTEGER WHERE;                                                          23830000
OPTION PRIVILEGED,UNCALLABLE;                                           23835000
                                                                        23840000
COMMENT                                                                 23845000
                                                                        23850000
RESETDB IS CALLED AFTER CALLING SETSYSDB TO RESTORE DB TO THE           23855000
VALUE THAT WAS EXPECTED UPON CALLING SETSYSDB.                          23860000
                                                                        23865000
THE VALUE RETURNED BY SETSYSDB SHOULD BE SUPPLIED AS THE                23870000
PARAMETER FOR RESETDB.                                                  23875000
                                                                        23880000
;                                                                       23885000
                                                                        23890000
BEGIN                                                                   23895000
INTEGER PCBPT,DSTNUMBER;                                       <<06650>>23900000
                                                               <<01860>>23905000
TURNOFFTRAPS;                                                  <<01860>>23910000
                                                               <<01860>>23915000
TOS:=WHERE;                                                             23920000
IF = THEN SUDDENDEATH(611);                                    <<01644>>23925000
IF S0 <> -1 THEN                                                        23930000
   BEGIN <<PUT PASSED VALUE INTO DB>>                                   23935000
   TOS:=0;                                                              23940000
   ASMB(XCH;XCHD);                                                      23945000
   END                                                                  23950000
ELSE                                                                    23955000
   BEGIN  <<DB BACK TO PCB'S DBINFO>>                                   23960000
   DISABLE;<<PDIS IN MULIT-CPU>>                                        23965000
                                                                        23970000
   CHECKAGAIN:                                                          23975000
   PCBPT := CURPRC;                                            <<06650>>23980000
   TOS := DBXDSINFO;                                           <<06650>>23985000
   TOS.ABSDBFLAG:=0;                                                    23990000
   DBXDSINFO := S0;                                            <<06650>>23995000
   DSTNUMBER:=TOS.XDSDSTFIELD;                                          24000000
   IF <> THEN                                                           24005000
      BEGIN <<XDS>>                                                     24010000
      IF LOGICAL(DST(DSTNUMBER&LSL(2))).ABSENTFLAG THEN                 24015000
         BEGIN <<CLOCK ATE IT UP>>                                      24020000
          QueueOnObject(DOUBLE(DSTNUMBER));                    <<06660>>24025000
          GO CHECKAGAIN;                                                24030000
          END;                                                          24035000
      DST(X).REFERENCEDFLAG:=1;                                         24040000
      TOS:=DST(X:=X+2);                                                 24045000
      TOS:=DST(X:=X+1);                                                 24050000
      END                                                               24055000
   ELSE                                                                 24060000
      BEGIN  <<GOES BACK TO STK>>                                       24065000
      TOS:=ICS(-ICS'STKBANKCELL);                                       24070000
      TOS:=ICS(X:=X+1);                                                 24075000
      END;                                                              24080000
   ASMB(XCHD);                                                          24085000
   END;                                                                 24090000
END  <<PROCEDURE RESETDB>>;                                             24095000
                                                                        24100000
$PAGE "DB MANIPULATION PROCEDURES : EXCHANGEDB"                         24105000
LOGICAL PROCEDURE EXCHANGEDB(WHERE);                                    24110000
VALUE WHERE;                                                            24115000
INTEGER WHERE;                                                          24120000
OPTION PRIVILEGED,UNCALLABLE;                                           24125000
                                                                        24130000
                                                                        24135000
COMMENT                                                                 24140000
                                                                        24145000
EXCHANGEDB IS CALLED TO PUT DB AT THE BASE OF A DATA SEGMENT            24150000
OR TO RETURN DB TO THE CALLER'S STACK DB.  THE DESTINATION DATA         24155000
SEGMENT NUMBER IS SUPPLIED AS PARAMETER IF NOT RETURNING TO THE         24160000
STACK.  IF RETURNING TO THE STACK, SUPPLY 0 AS PARAMETER.               24165000
                                                                        24170000
EXCHANGEDB RETURNS THE DST NUMBER OF WHERE DB WAS (0 IF STACK).         24175000
THIS VALUE MAY BE SAVED AND RETURNED ON THE NEXT CALL TO EXCHANGEDB     24180000
TO RESTORE THE PREVIOUS ENVIRONMENT.                                    24185000
                                                                        24190000
;                                                                       24195000
                                                                        24200000
BEGIN                                                                   24205000
                                                                        24210000
LOGICAL DELTAP=Q-2;                                            <<01571>>24215000
LOGICAL STATUS=Q-1;                                            <<01571>>24220000
INTEGER PROCINX,                                                        24225000
        PCBPT;                                                 <<06660>>24230000
DOUBLE OBJ := 0D;                                              <<06660>>24235000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>24240000
INTEGER DESCSTINX;                                             <<06660>>24245000
                                                                        24250000
TURNOFFTRAPS;                                                  <<01860>>24255000
                                                               <<01860>>24260000
PDISABLE;                                                               24265000
<<MMSTAT'(MMSTATEXCHDB,WHERE,DELTAP,STATUS,0,0,0);>>           <<06948>>24270000
CPUNUM;                                                        <<04663>>24275000
IF TOS= SERIES64 THEN UPDATE'ICS'XDSEGBNKCELL;                 <<04663>>24280000
TOS:=%1000D;                                                            24285000
ASMB(XCHD);  <<FOR FAST ADDRESSING>>                                    24290000
PROCINX := PCBPT := CURPRC;                                    <<06650>>24295000
TOS:=DBXDSINFO;                                                         24300000
IF < THEN SUDDENDEATH(611); <<MUST RESET FIRST>>               <<01644>>24305000
EXCHANGEDB:=TOS.XDSDSTFIELD;                                            24310000
TOS:=WHERE;                                                             24315000
TOS.(0:1):=0;  <<DISCARD CLEAN BIT>>                                    24320000
DBXDSINFO.XDSDSTFIELD := S0;                                   <<06650>>24325000
OBJIDENT(ObjIDnumField):=S0;                                   <<06660>>24330000
IF S0=0 THEN                                                   <<06660>>24335000
   BEGIN  <<DB GOES TO STK>>                                            24340000
   TOS:=ICS(-ICS'STKBANKCELL);                                          24345000
   TOS:=ICS(X:=X+1);                                                    24350000
   ASMB(XCHD);                                                          24355000
   END                                                                  24360000
ELSE                                                                    24365000
   BEGIN <<GOING TO AN XDS>>                                            24370000
      IF DST(0) < S0 THEN SUDDENDEATH(611); <<OUT OF RANGE>>   <<01644>>24375000
   DISABLE;                                                             24380000
   DESCSTINX:=TOS & LSL(2);                                    <<06005>>24385000
   IF DST(DESCSTINX)=%100000 THEN                              <<06005>>24390000
      SUDDENDEATH(625);                                        <<06005>>24395000
   IF NOT LOGICAL(DST(DESCSTINX)).ABSENTFLAG THEN              <<06005>>24400000
      BEGIN  <<NEW DB SEG IS PRESENT>>                                  24405000
      CPUNUM;           << GET CPU NUMBER >>                   <<04663>>24410000
      IF TOS= SERIES64 THEN                                    <<04663>>24415000
                                                               <<04663>>24420000
        BEGIN                                                  <<04663>>24425000
        GET'XDSEG'LIMITS;                                      <<04663>>24430000
        XFER'XDSEG'LIMITS;                                     <<04663>>24435000
        END;                                                   <<04663>>24440000
                                                               <<04663>>24445000
      TOS:=DST(X:=X+2);                                                 24450000
      TOS:=DST(X:=X+1);                                                 24455000
      ASMB(XCHD);                                                       24460000
      END                                                               24465000
   ELSE                                                                 24470000
      BEGIN <<NOT PRESENT>>                                             24475000
      ENABLE;                                                           24480000
      IF LOGICAL(DST(X:=X+1)).ROCFLAG THEN                              24485000
         BEGIN                                                          24490000
         IF GCLASSENABLEDMASK.CLASS0 THEN                               24495000
            BEGIN  <<MEASURE RECOVERY OF DATA SEG BY PROCESS>>          24500000
            TOS:=MEASSTATXDSBANK;                                       24505000
            TOS:=MEASSTATXDSBASE;                                       24510000
            TOS:=TOS+C0SUB0'SEGRELOFF+C'DATARECOVERY;          <<RAY.V>>24515000
            ASMB(LSEA);                                                 24520000
            TOS:=TOS+1;                                                 24525000
            ASMB(SSEA;DDEL);                                            24530000
            END;                                                        24535000
         RECOVEROC(OBJ,DESCSTINX,0D);                          <<06660>>24540000
         END                                                            24545000
      ELSE                                                              24550000
         BEGIN  <<REALLY ABSENT>>                                       24555000
         QueueOnObject(OBJ);                                   <<06660>>24560000
         PDISABLE;                                                      24565000
         END;                                                           24570000
         X:= DESCSTINX;    << SET X = TO DST ENTRY >>          <<04663>>24575000
         CPUNUM;           << GET CPU NUMBER >>                <<04663>>24580000
         IF TOS= SERIES64 THEN                                 <<04663>>24585000
                                                               <<04663>>24590000
           BEGIN                                               <<04663>>24595000
           GET'XDSEG'LIMITS;                                   <<04663>>24600000
           XFER'XDSEG'LIMITS;                                  <<04663>>24605000
           END;                                                <<04663>>24610000
                                                               <<04663>>24615000
      TOS:= DST(X:= X+2);                                      <<04663>>24620000
      TOS:=DST(X:=X+1);                                                 24625000
      ASMB(XCHD);                                                       24630000
      END;                                                              24635000
   DST(DESCSTINX).REFERENCEDFLAG:=1;                                    24640000
   END;                                                                 24645000
PENABLE;                                                                24650000
END  <<PROCEDURE EXCHANGEDB>>;                                          24655000
$PAGE "DB MANIPULATION PROCEDURES : CHANGEDB"                  <<04324>>24660000
double procedure changedb(newdb);                              <<04324>>24665000
value                     newdb ;                              <<04324>>24670000
double                    newdb ;                              <<04324>>24675000
option privileged, uncallable;                                 <<04324>>24680000
begin                                                          <<04324>>24685000
                                                               <<04324>>24690000
COMMENT --George R. O'Connor. HP Boise Division (11/20/81).    <<04324>>24695000
                                                               <<04324>>24700000
Purpose:  Performs  an extended EXCHANGEDB  to handle DB being <<04324>>24705000
set to an absolute address, in bank zero.                      <<04324>>24710000
                                                               <<04324>>24715000
Error   reporting:   No  error  reporting  occurs  explicitly. <<04324>>24720000
SUDDENDEATH's  may result from some  of the KERNELC procedures <<04324>>24725000
which are called.                                              <<04324>>24730000
                                                               <<04324>>24735000
External references:                                           <<04324>>24740000
                     exchangedb                                <<04324>>24745000
                    ,fixed low memory                          <<04324>>24750000
                    ,pcb                                       <<04324>>24755000
                    ,resetdb                                   <<04324>>24760000
                    ,setsysdb                                  <<04324>>24765000
                                                               <<04324>>24770000
Input:                                                         <<04324>>24775000
     newdb  := A double word value which indicates where DB is <<04324>>24780000
to  be set to.  If newdb < 0d  then DB will be set to the data <<04324>>24785000
segment number -newdb.  If newdb = 0d then DB will be returned <<04324>>24790000
to  the process's stack location.  If  newdb = 1d then DB will <<04324>>24795000
be  returned  to the data segment or  stack location it was at <<04324>>24800000
before  being set to an absolute location.  If newdb > 1d then <<04324>>24805000
DB  will  be set to the absolute  address of newdb.  Note that <<04324>>24810000
this  permits  DB  to be set to  absolute locations outside of <<04324>>24815000
bank zero.                                                     <<04324>>24820000
                                                               <<04324>>24825000
Output:                                                        <<04324>>24830000
    changedb  :=  The  value which the  caller should save and <<04324>>24835000
pass  back to changedb so that the previous environment may be <<04324>>24840000
properly  restored.   If  DB  was  at  the  stack  then  0d is <<04324>>24845000
returned.   If  DB was set to the  base of a data segment then <<04324>>24850000
the negative data segment number is returned.  If DB was at an <<04324>>24855000
absolute  location  then  the  absolute  address  location  is <<04324>>24860000
returned.                                                      <<04324>>24865000
                                                               <<04324>>24870000
Side effects:                                                  <<04324>>24875000
     The  dbxdsinfo word of the  current process control block <<04324>>24880000
may be changed.                                                <<04324>>24885000
                                                               <<04324>>24890000
Special considerations:                                        <<04324>>24895000
     Highly privileged.                                        <<04324>>24900000
;                                                              <<04324>>24905000
$PAGE "PROCEDURE: CHANGEDB;  LOCAL DECLARATIONS"               <<04324>>24910000
integer                                                        <<04324>>24915000
        PCBPT                                                  <<06650>>24920000
;                                                              <<04324>>24925000
logical                                                        <<04324>>24930000
        db'is'absolute                                         <<04324>>24935000
;                                                              <<04324>>24940000
$PAGE "DB MANIPULATION PROCEDURES : CHANGEDB"                  <<04324>>24945000
                                                               <<04324>>24950000
<<Determine if db is at an absolute location.Also the x     >> <<04324>>24955000
<<register is set to point to the absolute address of the db>> <<04324>>24960000
<<xds information word in the current process               >> <<06650>>24965000
<<control block (cpcb).  This is done for speed.            >> <<04324>>24970000
                                                               <<04324>>24975000
PCBPT := CURPRC;                                               <<06650>>24980000
DB'IS'ABSOLUTE := DBXDSINFO.ABSDBFLAG;                         <<06650>>24985000
                                                               <<04324>>24990000
if newdb <= 0D then                                            <<04324>>24995000
                                                               <<04324>>25000000
<<newdb is a request for DB to be set to a data segment or  >> <<04324>>25005000
<<stack location.                                           >> <<04324>>25010000
                                                               <<04324>>25015000
  begin                                                        <<04324>>25020000
  if db'is'absolute then                                       <<04324>>25025000
                                                               <<04324>>25030000
<<Return absolute db and reset db to the valid data segment >> <<04324>>25035000
<<base or stack location and then exchangedb to the data    >> <<04324>>25040000
<<segment or stack reqested.                                >> <<04324>>25045000
                                                               <<04324>>25050000
    begin                                                      <<04324>>25055000
                                                               <<04324>>25060000
<<Return absolute db.                                       >> <<04324>>25065000
                                                               <<04324>>25070000
    push(db);                                                  <<04324>>25075000
    changedb := tos;                                           <<04324>>25080000
                                                               <<04324>>25085000
<<Reset db to a valid data segment base or stack location.  >> <<04324>>25090000
                                                               <<04324>>25095000
    resetdb(-1);                                               <<04324>>25100000
    exchangedb( - integer ( newdb ) );                         <<04324>>25105000
    end                                                        <<04324>>25110000
                                                               <<04324>>25115000
  else                                                         <<04324>>25120000
                                                               <<04324>>25125000
<<Return the inverted old data segment/stack number and >>     <<04324>>25130000
<<exchangedb to the data segment or stack requested.    >>     <<04324>>25135000
                                                               <<04324>>25140000
    changedb := double( - integer(                             <<04324>>25145000
                exchangedb( - integer( newdb ) ) ) );          <<04324>>25150000
  end                                                          <<04324>>25155000
else                                                           <<04324>>25160000
                                                               <<04324>>25165000
  if newdb = 1D then                                           <<04324>>25170000
                                                               <<04324>>25175000
<<newdb is a request for DB to be returned to the data >>      <<04324>>25180000
<<segment or stack location it was at before being set >>      <<04324>>25185000
<<to an absolute location.                             >>      <<04324>>25190000
                                                               <<04324>>25195000
    begin                                                      <<04324>>25200000
    if db'is'absolute then                                     <<04324>>25205000
                                                               <<04324>>25210000
<<Return the absolute db location and reset db to the  >>      <<04324>>25215000
<<data segment or stack location it was at before being>>      <<04324>>25220000
<<set to an absolute location.                         >>      <<04324>>25225000
                                                               <<04324>>25230000
      begin                                                    <<04324>>25235000
                                                               <<04324>>25240000
<<Return absolute db. >>                                       <<04324>>25245000
                                                               <<04324>>25250000
      push(db);                                                <<04324>>25255000
      changedb := tos;                                         <<04324>>25260000
                                                               <<04324>>25265000
<<reset db to the data segment or stack location it was >>     <<04324>>25270000
<<at before being set to an absolute location.          >>     <<04324>>25275000
                                                               <<04324>>25280000
      resetdb(-1);                                             <<04324>>25285000
      end                                                      <<04324>>25290000
                                                               <<04324>>25295000
    else                                                       <<04324>>25300000
                                                               <<04324>>25305000
<<The requester is at his request.  If the extra data >>       <<04324>>25310000
<<segment number is zero then db is at its stack.     >>       <<04324>>25315000
                                                               <<04324>>25320000
      CHANGEDB := DOUBLE(-INTEGER(DBXDSINFO));                 <<06751>>25325000
    end                                                        <<04324>>25330000
                                                               <<04324>>25335000
  else                                                         <<04324>>25340000
                                                               <<04324>>25345000
<< newdb is a request for an absolute address db. >>           <<04324>>25350000
                                                               <<04324>>25355000
    begin                                                      <<04324>>25360000
    if db'is'absolute then                                     <<04324>>25365000
                                                               <<04324>>25370000
<<Set db to the absolute address requested and return the>>    <<04324>>25375000
<<old absolute address of db.                            >>    <<04324>>25380000
                                                               <<04324>>25385000
      begin                                                    <<04324>>25390000
      tos := newdb;                                            <<04324>>25395000
      asmb( xchd );                                            <<04324>>25400000
      changedb := tos;                                         <<04324>>25405000
      end                                                      <<04324>>25410000
    else                                                       <<04324>>25415000
                                                               <<04324>>25420000
<<Return the data segment number the caller is at. >>          <<04324>>25425000
<<Set db to an absolute location.                  >>          <<04324>>25430000
      begin                                                    <<04324>>25435000
                                                               <<04324>>25440000
<<Return the data segment number the caller is at. >>          <<04324>>25445000
                                                               <<04324>>25450000
      CHANGEDB := DOUBLE(-INTEGER(DBXDSINFO.XDSDSTFIELD));     <<06751>>25455000
                                                               <<04324>>25460000
<<Mark that db is at an absolute location.         >>          <<04324>>25465000
                                                               <<04324>>25470000
      TOS := DBXDSINFO;                                        <<06650>>25475000
      tos.absdbflag := true;                                   <<04324>>25480000
      DBXDSINFO := TOS;                                        <<06650>>25485000
                                                               <<04324>>25490000
<<Set db to an absolute location.                  >>          <<04324>>25495000
                                                               <<04324>>25500000
      tos := newdb;                                            <<04324>>25505000
      asmb( xchd );                                            <<04324>>25510000
      end                                                      <<04324>>25515000
    end;                                                       <<04324>>25520000
                                                               <<04324>>25525000
end; <<changeDB>>                                              <<04324>>25530000
DOUBLE  PROCEDURE MAPPEDCSTTOPHYCST(MAPCST,PCBPT);             <<06660>>25535000
   VALUE MAPCST, PCBPT;                                        <<06104>>25540000
   INTEGER MAPCST, PCBPT;                                      <<06104>>25545000
   OPTION PRIVILEGED, UNCALLABLE;                              <<06104>>25550000
   COMMENT                                                     <<06104>>25555000
                                                               <<06104>>25560000
        INPUT:                                                 <<06104>>25565000
                                                               <<06104>>25570000
           MAPCST = CODE SEGMENT                               <<06104>>25575000
                    (0:1) = MAPFLAG (IGNORED IF NO MAPPING     <<06104>>25580000
                                     FIRMWARE)                 <<06104>>25585000
                            =1 PHYSICALLY MAPPED               <<06104>>25590000
                               MAPCST.(1:15) = PHYSICAL        <<06104>>25595000
                               CST #                           <<06104>>25600000
                            =0 LOGICAL MAPPED MAPCST.(8:8)     <<06104>>25605000
                               = LOGICAL CST #                 <<06104>>25610000
           PCBPT   = PCB INDEX TO USE FOR MAPPING              <<06104>>25615000
                    = 0 USE CURRENT PIN                        <<06104>>25620000
                    <> 0 USE SPECIFIED PIN                     <<06104>>25625000
                                                               <<06104>>25630000
        OUTPUT:                                                <<06104>>25635000
                                                               <<06104>>25640000
           CCE - VALID CONVERSION                              <<06104>>25645000
           CCL - INVALID MAPCST                                <<06104>>25650000
                                                               <<06104>>25655000
           MAPPEDCSTTOPHYCST = PHYSICAL CST # IF               <<06104>>25660000
                               PROGRAM CST THEN                <<06104>>25665000
                               RETURN IS IN BLKLABEL           <<06104>>25670000
                               FORM                            <<06104>>25675000
                                                               <<06104>>25680000
                                                               <<06104>>25685000
        NOTE: This procedure should not be called in           <<06104>>25690000
              disabled or pdisabled mode to map MAPCST         <<06104>>25695000
              for PIN other than current PIN.                  <<06104>>25700000
;                                                              <<06104>>25705000
BEGIN                                                          <<06104>>25710000
                                                               <<*7564>>25715000
DEFINE                                                         <<*7564>>25720000
   PHYSICAL'MAPPED = (MAPCST < 0)#;                            <<*7564>>25725000
                                                               <<*7564>>25730000
   INTEGER                                                     <<06104>>25735000
      PIN,                                                     <<06104>>25740000
      INX,                                                     <<06104>>25745000
      NRPGMSEGS,                                               <<06104>>25750000
      LSTTDST,                                                 <<06104>>25755000
      DBSAVE := 0;                                             <<06660>>25760000
   LOGICAL                                                     <<06104>>25765000
      DBFIXED := FALSE;                                        <<06104>>25770000
   DOUBLE                                                      <<06104>>25775000
      RESULT = MAPPEDCSTTOPHYCST,                              <<06660>>25780000
      SAVEDB,                                                  <<06660>>25785000
      DBVALUE;                                                 <<06104>>25790000
   INTEGER ARRAY                                               <<06104>>25795000
      LSTT(*) = DB+0;                                          <<06104>>25800000
   LOGICAL ARRAY OBJRESULT(*)=RESULT;                          <<06660>>25805000
   CC := CCE;                                                  <<06104>>25810000
   IF MAPCST = 0 THEN                                          <<07320>>25815000
      BEGIN                                                    <<07320>>25820000
      CC := CCL;                                               <<07320>>25825000
      RETURN;                                                  <<07320>>25830000
      END;                                                     <<07320>>25835000
                                                               <<07320>>25840000
   IF PCBPT = 0 THEN                                           <<06104>>25845000
      IF CURPRC <> 0 THEN                                      <<06650>>25850000
         PCBPT := (CURPRC)                                     <<06650>>25855000
      ELSE                                                     <<06104>>25860000
         IF NOT PHYSICAL'MAPPED THEN SUDDENDEATH(999);         <<*7564>>25865000
   PIN := PCBPT/PCBSIZE;                                       <<06104>>25870000
                                                               <<06104>>25875000
   IF MAPPINGFIRMWARE THEN                                     <<06104>>25880000
      BEGIN                                                    <<06104>>25885000
      IF MAPCST < 0 THEN                                       <<06104>>25890000
         BEGIN      << PHYSICALLY MAPPED >>                    <<06104>>25895000
         RESULT := BUILDSEGID( 1, MAPCST.(8:8), PIN);          <<06104>>25900000
         END                                                   <<06104>>25905000
      ELSE                                                     <<06104>>25910000
         BEGIN      << LOGICALLY MAPPED >>                     <<06104>>25915000
         MAPCST := MAPCST.(8:8);                               <<06104>>25920000
         INX := SPCBPBX;  << GET CST BLOCK INDEX >>            <<06104>>25925000
         PDISABLE;                                             <<06104>>25930000
         NRPGMSEGS := DST(CSTXBLK(INX));                       <<06104>>25935000
         PENABLE;                                              <<06104>>25940000
         IF INX <> 0 AND MAPCST <= NRPGMSEGS THEN              <<06104>>25945000
            BEGIN     << PROGRAM SEGMENT >>                    <<06104>>25950000
            RESULT := BUILDSEGID( 2, MAPCST, PIN);             <<06104>>25955000
            END                                                <<06104>>25960000
         ELSE                                                  <<06104>>25965000
            BEGIN     << SL SEGMENT >>                         <<06104>>25970000
            LSTTDST := SPCBMAPDST;                             <<06104>>25975000
            IF = THEN GO NFG;                                  <<06104>>25980000
            IF CURPRC = 0 THEN                                 <<06650>>25985000
               BEGIN                                           <<06104>>25990000
               TOS := DST( LSTTDST*4+2);                       <<06104>>25995000
               TOS := DST( X:=X+1);                            <<06104>>26000000
               ASSEMBLE( XCHD );                               <<06104>>26005000
               SAVEDB := TOS;                                  <<06104>>26010000
               END                                             <<06104>>26015000
            ELSE                                               <<06104>>26020000
               BEGIN                                           <<06104>>26025000
               IF DBXDSINFO.ABSDBFLAG                          <<06650>>26030000
                  THEN                                                  26035000
                  BEGIN                                        <<06104>>26040000
                  DBFIXED := TRUE;                             <<06104>>26045000
                  PUSH( DB );                                  <<06104>>26050000
                  DBVALUE := TOS;                              <<06104>>26055000
                  RESETDB( -1 );                               <<06104>>26060000
                  END;                                         <<06104>>26065000
               DBSAVE := EXCHANGEDB(LSTTDST) ;                 <<06660>>26070000
               END;                                            <<06104>>26075000
            IF LSTT = 0 OR MAPCST > LSTT THEN GO NFG;          <<06104>>26080000
            << GET PHYSICAL CST FROM LSTT >>                   <<06104>>26085000
            RESULT := DOUBLE(LSTT( MAPCST&LSL(1)));            <<06660>>26090000
            RESULT:=BUILDSEGID(1,OBJRESULT(ObjIDnumField),PIN);<<06660>>26095000
            GO RESTORE;                                        <<06104>>26100000
NFG:        CC := CCL;                                         <<06104>>26105000
RESTORE:                                                       <<06104>>26110000
            << RE-ESTABLISH DB ENVIRONMENT >>                  <<06104>>26115000
            IF CURPRC = 0 THEN                                 <<06650>>26120000
               BEGIN                                           <<06104>>26125000
               TOS := SAVEDB;                                  <<06104>>26130000
               ASSEMBLE( XCHD );                               <<06104>>26135000
               END                                             <<06104>>26140000
            ELSE                                               <<06104>>26145000
               BEGIN                                           <<06104>>26150000
               DBSAVE := EXCHANGEDB( DBSAVE);                  <<06104>>26155000
               IF DBFIXED THEN                                 <<06104>>26160000
                  BEGIN  << SET ABSOLUTE MODE >>               <<06104>>26165000
                  SETSYSDB; << SET ABS BIT IN PCB >>           <<06104>>26170000
                  TOS := DBVALUE;                              <<06104>>26175000
                  SET( DB );                                   <<06104>>26180000
                  END;                                         <<06104>>26185000
               END;                                            <<06104>>26190000
            END;                                               <<06104>>26195000
         END;                                                  <<06104>>26200000
      END                                                      <<06104>>26205000
   ELSE                                                        <<06104>>26210000
      BEGIN         << NO MAPPING FIRMWARE >>                  <<06104>>26215000
      MAPCST := MAPCST.(8:8);                                  <<06104>>26220000
      RESULT := BUILDSEGID( IF MAPCST < %300 THEN 1 ELSE 2,    <<06104>>26225000
                            MAPCST, PIN);                      <<06104>>26230000
      END;                                                     <<06104>>26235000
END;  << MAPPEDCSTTOPHYCST >>                                  <<06660>>26240000
LOGICAL PROCEDURE SYSTEM( CSTNUM );                            <<06104>>26245000
   VALUE CSTNUM;                                               <<06104>>26250000
   INTEGER CSTNUM;                                             <<06104>>26255000
   OPTION UNCALLABLE;                                          <<06282>>26260000
BEGIN                                                          <<06104>>26265000
   <<   RETURN TRUE IF MAPCST IS A SYSTEM SEGMENT   >>         <<06104>>26270000
   <<   MAPCST IS OF THE FORM:                      >>         <<06104>>26275000
   <<                                               >>         <<06104>>26280000
   <<     MAPCST.(0:1)   = MAPFLAG                  >>         <<06104>>26285000
   <<     MAPCST.(8:8)   = CST #                    >>         <<06104>>26290000
                                                               <<06104>>26295000
   DOUBLE  SEG;                                                <<06660>>26300000
   SYSTEM:=FALSE;                                              <<06660>>26305000
   SEG := MAPPEDCSTTOPHYCST( CSTNUM, 0);                       <<06660>>26310000
   IF <> THEN RETURN;      << INVALID CST >>                   <<06660>>26315000
   PDISABLE;                                                   <<06104>>26320000
   SYSTEM := DST(CONVSEGIDTOSTINX(SEG)+1).SYSTEMFLAG;          <<06660>>26325000
   PENABLE;                                                    <<06104>>26330000
END;   << SYSTEM >>                                            <<06104>>26335000
INTEGER PROCEDURE CSTCONV( SEG, PCBPT);                        <<06104>>26340000
   VALUE SEG, PCBPT;                                           <<06104>>26345000
   INTEGER SEG, PCBPT;                                         <<06104>>26350000
   OPTION PRIVILEGED, UNCALLABLE;                              <<06104>>26355000
BEGIN                                                          <<06104>>26360000
   DOUBLE  CLABEL;                                             <<06660>>26365000
                                                               <<06104>>26370000
   CLABEL := MAPPEDCSTTOPHYCST( SEG, PCBPT );                  <<06104>>26375000
   IF <> THEN RETURN;                                          <<06104>>26380000
   CSTCONV := CONVSEGIDTOSTINX( CLABEL );                      <<06104>>26385000
END;    << CSTCONV >>                                          <<06104>>26390000
$PAGE "MEMORY MANAGEMENT INTERFACING PROCEDURES : QUEUE ON SEGMENT"     26395000
PROCEDURE QueueOnObject(OBJ);                                  <<06660>>26400000
VALUE OBJ;                                                     <<06660>>26405000
DOUBLE  OBJ;                                                   <<06660>>26410000
OPTION PRIVILEGED,UNCALLABLE;                                           26415000
                                                                        26420000
COMMENT                                                                 26425000
                                                                        26430000
QueueOnObject IS CALLED FROM ABSENT TRAP HANDLERS AND OTHER    <<06212>>26435000
PLACES WHERE THE CURRENT PROCESS NEEDS AN OBJECT TO BE FETCHED <<06212>>26440000
MAIN MEMORY.  THE PROCESS'S MEMORY                             <<06212>>26445000
REQUEST POINTER IN THE SLL IS SET TO AN SLL ENTRY FOR THE SEGMENT       26450000
VIA A CALL TO ADDTOLOCALITY. THE PROCESS WAITS ON A MEMORY WAIT.        26455000
                                                                        26460000
;                                                                       26465000
                                                                        26470000
BEGIN                                                                   26475000
INTEGER PCBPT;                                                 <<06650>>26480000
ENTRY QueueOnSegment; <<for backwards compatibility>>          <<06212>>26485000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>26490000
LOGICAL SLLHEADINX;     << Sll pointer from PCB >>             <<06660>>26495000
INTEGER ARRAY DELTAQ(*) = Q-0;  <<FOR MMSTAT>>                 <<01571>>26500000
                                                                        26505000
QueueOnSegment :                                               <<06212>>26510000
                                                               <<06212>>26515000
PDISABLE;                                                               26520000
TOS:=%1000D;                                                            26525000
ASMB(XCHD);                                                             26530000
PCBPT := CURPRC;                                               <<06650>>26535000
TOS := SLLPTR;                                                 <<06650>>26540000
SLLHEADINX := S0;                                              <<06660>>26545000
TOS:=OBJ;                                                      <<06660>>26550000
TOS:=0;                                                                 26555000
TOS.SETMEMREQPTRFLAG:=1;                                                26560000
TOS.SETDECCNTFLAG:=1; <<CAUSE PROCESS TO WAIT FOR OBJECT>>     <<07320>>26565000
ADDTOLOCALITY(*,*,*);                                                   26570000
MMSTAT'(MMSTATQONOBJ,OBJIDENT(OBJIDDESCFIELD),                 <<06948>>26575000
     OBJIDENT(OBJIDNUMFIELD),SLLHEADINX,DELTAQ(-DELTAQ-1),0,0);<<06948>>26580000
ASMB(XCHD);                                                             26585000
IF PCBPT <> 0 AND                                               <<MEAS>>26590000
(GCLASSENABLEDMASK.CLASS0 OR GCLASSENABLEDMASK.CLASS15) THEN    <<MEAS>>26595000
  MEAS'OBJFAULT(OBJ);  <<TO UPDATE THE MEAS. COUNTERS>>         <<MEAS>>26600000
<<STUFF AWAY REASON STOPED IN PCBX OF IMPEDED PROCESS>>         <<MEAS>>26605000
<<DONE UNCONDITIONALLY FOR HISTORY FOR MEASUREMENT INTER.>>     <<MEAS>>26610000
TOS := ICS(-ICS'STKBANKCELL);                                   <<MEAS>>26615000
TOS := ICS(-ICS'STKBASECELL);                                   <<MEAS>>26620000
TOS := TOS + SBTOMEASSTOPREASON;                                <<MEAS>>26625000
TOS := STOPSEGFAULT; << TEMPORARY: should be logged to caching>><<MEAS>>26630000
ASMB(SSEA;DDEL);                                                <<MEAS>>26635000
                                                                <<MEAS>>26640000
WAIT(MEMORYWAITCODE,MEMTRAP);                                           26645000
END <<QueueOnObject>>;                                         <<06212>>26650000
$page "CONVERT EXTERNAL LABEL TO DELTA P"                      <<06212>>26655000
INTEGER PROCEDURE CONVEXTLABELTODELTAP(EXTLABEL);                       26660000
VALUE EXTLABEL;                                                         26665000
INTEGER EXTLABEL;                                                       26670000
OPTION PRIVILEGED,UNCALLABLE;                                           26675000
                                                                        26680000
COMMENT                                                                 26685000
                                                                        26690000
CONVEXTLABELTODELTAP QUEUES THE CALLING PROCESS ON THE SEGMENT          26695000
INDICATED IN THE EXTLABEL, AND WHEN THE SEGMENT IS PRESENT LOOKS        26700000
UP THE DELTAP OF THE ENTRY POINT IN THE SEGMENT'S STT.                  26705000
                                                                        26710000
;                                                                       26715000
                                                                        26720000
BEGIN                                                                   26725000
                                                                        26730000
DOUBLE OBJ;                                                    <<06660>>26735000
LOGICAL ARRAY objident(*)=obj;                                 <<06660>>26740000
INTEGER DESCSTINX,                                             <<06660>>26745000
        STTNUMBER;                                             <<06104>>26750000
PDISABLE;                                                      <<06104>>26755000
STTNUMBER:=EXTLABEL.(1:7);                                     <<06104>>26760000
OBJ:=MAPPEDCSTTOPHYCST(EXTLABEL,0);                            <<06660>>26765000
DESCSTINX:=CONVSEGIDTOSTINX(OBJ);                              <<06660>>26770000
DISABLE;                                                       <<06104>>26775000
IF DST(DESCSTINX) < 0 THEN  << SEG ABSENT >>                   <<06104>>26780000
   DO                                                          <<06104>>26785000
      BEGIN  <<ENSURE REQUESTED SEG IS PRESENT>>               <<06104>>26790000
         QUEUEONOBJECT(OBJ);                                   <<06660>>26795000
         PDISABLE;                                             <<06104>>26800000
         IF objident(ObjIDTypeField)=ObjIDpgmType THEN BEGIN   <<06660>>26805000
            X:=objident(ObjIDpbxField);                        <<06660>>26810000
            DESCSTINX:=CSTXBLK(X)+                             <<06660>>26815000
                          integer(objident(ObjIDnumField))*4;  <<06660>>26820000
      END END UNTIL NOT LOGICAL(DST(DESCSTINX)).ABSENTFLAG;    <<06660>>26825000
TOS:=DST(X:=DESCSTINX+2);                                               26830000
TOS:=DST(X:=X+1);                                                       26835000
TOS:=DST(X:=X-3).CODESIZEFIELD&LSL(2)-1;                                26840000
ASMB(LADD); <<ADDR OF PL>>                                              26845000
TOS:=TOS-STTNUMBER;                                                     26850000
ASMB(LSEA);                                                             26855000
IF MAPPINGFIRMWARE THEN                                        <<06104>>26860000
   TOS.(1:1):=EXTLABEL.(0:1)                                   <<06104>>26865000
ELSE                                                           <<06104>>26870000
   TOS.(1:1):=0;<<RESET UNCALLABLE BIT/SET MAPPING FLAG>>      <<06104>>26875000
CONVEXTLABELTODELTAP:=TOS;                                              26880000
PENABLE;                                                                26885000
END <<CONVEXTLABELTODELTAP>>;                                           26890000
                                                                        26895000
$PAGE "DEBUG BREAKPOINT SETTING PROCEDURE"                              26900000
                                                                        26905000
PROCEDURE SETSEGSBKPTS(SEG,     DESCSTINX,BPTINX);             <<06660>>26910000
VALUE SEG,DESCSTINX,BPTINX;                                    <<06660>>26915000
DOUBLE  SEG;                                                   <<06660>>26920000
INTEGER          DESCSTINX,BPTINX;                             <<06660>>26925000
OPTION PRIVILEGED,UNCALLABLE;                                           26930000
                                                                        26935000
COMMENT                                                        <<MM.IV>>26940000
                                                               <<MM.IV>>26945000
THIS PROCEDURE SETS BREAKPOINTS IN THE SPECIFIED SEGMENT.      <<MM.IV>>26950000
IT MUST BE CALLED PDISABLED.                                   <<MM.IV>>26955000
                                                               <<MM.IV>>26960000
    SEGIDENT:  STANDARD FORM OF SEG IDENTIFER                  <<01609>>26965000
    DESCSTINX: DST RELATIVE INDEX OF SEG                       <<01609>>26970000
    BPTINX:    PCB EXTENSION INDEX FOR THE BREAKPOINT TABLE    <<01609>>26975000
                                                               <<MM.IV>>26980000
;                                                              <<MM.IV>>26985000
                                                               <<MM.IV>>26990000
BEGIN                                                                   26995000
LOGICAL ARRAY SEGIDENT(*)=SEG;                                 <<06660>>27000000
INTEGER LIMIT;                                                 <<01609>>27005000
                                                                        27010000
<< CHECK WHETHER THERE ARE BREAKPOINTS TO SET >>               <<MM.IV>>27015000
IF BPTINX = 0 OR                                               <<MM.IV>>27020000
   BPTINX = SYS'BKPT'EXT'X AND NOT SYS'BKPT                    <<MM.IV>>27025000
THEN RETURN;                                                   <<MM.IV>>27030000
<< XCHDB TO BREAKPOINT TABLE   >>                              <<MM.IV>>27035000
<< TABLE BETTER BE PRESENT     >>                              <<MM.IV>>27040000
IF NOT BPT'TAB'LOCKED THEN SUDDENDEATH (199);                  <<MM.IV>>27045000
TOS := DST(BPT'DST'IND + 2);                                   <<MM.IV>>27050000
TOS := DST(X+1);                                               <<MM.IV>>27055000
ASMB( XCHD );                                                  <<MM.IV>>27060000
BPTINX := BPT(BPTINX);  << GET 1ST LINK >>                     <<MM.IV>>27065000
WHILE BPTINX <> 0 DO                                           <<MM.IV>>27070000
   BEGIN                                                                27075000
   IF BPT(BPTINX).BKPT'UPDATING=0 AND                          <<06104>>27080000
      BPT(BPTINX+CLABELOFFSET)=INTEGER(SEGIDENT(0)) AND        <<06660>>27085000
      BPT(BPTINX+CLABELOFFSET+1)=INTEGER(SEGIDENT(1))          <<06660>>27090000
   THEN                                                        <<06660>>27095000
      BEGIN                                                             27100000
      TOS:=BPT(BPTINX);                                        <<06104>>27105000
      ASMB(DEL);                                                        27110000
      IF >= THEN                                                        27115000
         BEGIN                                                          27120000
         TOS:=DST(X:=DESCSTINX+2);                                      27125000
         TOS:=DST(X:=X+1);                                              27130000
         TOS:=TOS+BPT(BPTINX+PLOCOFFSET); <<DELTA P>>          <<06104>>27135000
         ASMB(LSEA);                                                    27140000
         IF  TOS <> %36000  THEN                                        27145000
            BEGIN  << SAVE INSTRUCTION >>                               27150000
            BPT(X:=BPTINX).BKPT'VALID:=1;                      <<06104>>27155000
            ASMB(LSEA);                                                 27160000
            BPT(X:=X+INSTROFFSET):=TOS;                        <<06104>>27165000
            TOS:=%36000;                                                27170000
            ASMB(SSEA);                                                 27175000
            END;                                                        27180000
         DDEL;                                                          27185000
         END;                                                           27190000
      END;                                                              27195000
   BPTINX:=BPT(BPTINX+LINKOFFSET);                             <<06104>>27200000
   END;                                                                 27205000
ASMB( XCHD ); DDEL;          <<RESTORE DB>>                    <<MM.IV>>27210000
END  <<SETSEGSBKPTS>>;                                                  27215000
                                                                        27220000
$PAGE "KERNEL UTILITY PROCEDURES : GET DATA SEG CHANGE STATE"           27225000
PROCEDURE GETDATASEGCHANGESTATE(SEGNUM);                                27230000
VALUE SEGNUM;                                                           27235000
INTEGER SEGNUM;                                                         27240000
OPTION PRIVILEGED,UNCALLABLE;                                           27245000
                                                                        27250000
COMMENT                                                                 27255000
                                                                        27260000
CALLED FROM DLSIZE,ZSIZE,PXFILESIZE TO CLEAR ONGOING I/OS               27265000
FLAG ABSENT, PDISABLE.ALSO FROM THE STACKOVERFLOW INTERRUPT HANDLER.    27270000
                                                                        27275000
;                                                                       27280000
                                                                        27285000
BEGIN                                                                   27290000
                                                                        27295000
IF LOGICAL(DST(X:=SEGNUM&LSL(2)+1)).SEGRESIDENTFLAG THEN                27300000
   CC:=CCL ELSE                                                         27305000
   BEGIN                                                                27310000
   TOS:=DST(X:=X+1);                                                    27315000
   TOS:=DST(X:=X+1);                                                    27320000
   TOS:=TOS+RBTORASDISP;                                                27325000
   DISABLE;                                                    <<01770>>27330000
   PDISABLE;                                                   <<01770>>27335000
   ASMB(LSEA);                                                          27340000
   ASMB(TBC REGFZBIT);                                                  27345000
   IF <> THEN                                                  <<02060>>27350000
      BEGIN                                                    <<02060>>27355000
      CC := CCL;                                               <<02060>>27360000
      PENABLE;                                                 <<02060>>27365000
      END                                                      <<02060>>27370000
   ELSE                                                        <<02060>>27375000
      BEGIN                                                             27380000
      ASMB(TBC REGLKDBIT);                                              27385000
      IF <> THEN                                               <<02060>>27390000
         BEGIN                                                 <<02060>>27395000
         CC := CCL;                                            <<02060>>27400000
         PENABLE;                                              <<02060>>27405000
         END                                                   <<02060>>27410000
      ELSE                                                     <<02060>>27415000
         BEGIN                                                          27420000
         ASMB(TBC REGIOFZBIT);                                          27425000
         IF <> THEN                                                     27430000
            BEGIN                                                       27435000
            TOS.SIZECHANGEPNDGFLAG:=1;                                  27440000
            ASMB(SSEA);                                                 27445000
            TOS:=TOS+RASTOMPQLINKDISP;                         <<06660>>27450000
            TOS := CURPRC;                                     <<06650>>27455000
            ASMB(SSEA);                                                 27460000
            IMPEDE(0);                                                  27465000
            CC:=CCG;                                                    27470000
            END                                                         27475000
        ELSE                                                            27480000
            BEGIN                                                       27485000
            DST(X:=SEGNUM&LSL(2)).ABSENTFLAG:=1;                        27490000
            CC:=CCE;                                                    27495000
            END;                                                        27500000
         END;                                                           27505000
      END;                                                              27510000
   END;                                                                 27515000
END  <<GETDATASEGCHANGESTATE(SEGNUM)>>;                                 27520000
$PAGE "KERNEL UTILITY PROCEDURES : FLAG PROCESS ABSENT"                 27525000
                                                                        27530000
PROCEDURE FlagProcAbsent(pin,obj,specialinst);                 <<06660>>27535000
VALUE pin,obj,specialinst;                                     <<06660>>27540000
INTEGER pin;                                                   <<06660>>27545000
DOUBLE obj;                                                    <<06660>>27550000
LOGICAL specialinst;                                           <<06411>>27555000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06411>>27560000
                                                               <<06411>>27565000
COMMENT                                                        <<06411>>27570000
                                                               <<06411>>27575000
FlagProcAbsent places the specified process into an absent     <<06411>>27580000
state so that the dispatcher will invoke the memory manager    <<06411>>27585000
on behalf of the process.                                      <<06411>>27590000
                                                               <<06411>>27595000
The special instruction parameter indicates whether a full     <<06411>>27600000
swap from scratch should be induced, and whether a specified   <<06411>>27605000
object should be added to the process' locality and the        <<06411>>27610000
process' mem req ptr in the sll pointed at the object's        <<06411>>27615000
sll entry.                                                     <<06411>>27620000
                                                               <<06411>>27625000
If the specified process is the currently executing process,   <<06411>>27630000
a disp is issued.                                              <<06411>>27635000
                                                               <<06411>>27640000
This procedure is called when an element of the process'       <<06411>>27645000
minimal locality is missing when it's needed.  This happens    <<06411>>27650000
at launch time (stack or extra data segment consumed by        <<06411>>27655000
replacment algorithm), on buffer traps for disc I/O, and       <<06411>>27660000
on attempted disc cache moves.                                 <<06411>>27665000
                                                               <<06411>>27670000
It is assumed that DB is at sysdb when invoked.                <<06411>>27675000
                                                               <<06411>>27680000
;                                                              <<06411>>27685000
                                                               <<06411>>27690000
BEGIN                                                          <<06411>>27695000
LOGICAL ARRAY objident(*)=obj;                                 <<06660>>27700000
INTEGER PCBPT,                                                 <<06650>>27705000
        SLLHEADINX,    << Index to SLL header entry >>         <<06625>>27710000
        addflags;                                              <<06411>>27715000
                                                               <<06411>>27720000
PCBPT := PIN * PCBSIZE;                                        <<06650>>27725000
                                                               <<06411>>27730000
<<mark process absent, requiring scheduling attention>>        <<06411>>27735000
                                                               <<06411>>27740000
DISABLE;                                                       <<06411>>27745000
RESABORTINFO.SARFLAG := 1;                                     <<06650>>27750000
WAKEMASK.MEMORYWAITFLAG := 1;                                  <<06650>>27755000
SLLHEADINX := SLLPTR;                                          <<07320>>27760000
                                                               <<06411>>27765000
<<if a full swap required, set it up>>                         <<06411>>27770000
                                                               <<06411>>27775000
IF specialinst.causefullswap THEN                              <<06411>>27780000
   BEGIN <<set swap required, start swap over in sll header>>  <<06411>>27785000
   sll(schedtoiomsg).sllstartoverflag := 1;                    <<06625>>27790000
   sll(schedtoiomsg).sllswapreqflag := 1;                      <<06625>>27795000
   END;                                                        <<06411>>27800000
                                                               <<06411>>27805000
<<if a specific object should be swapped in, add it to loc>>   <<06411>>27810000
                                                               <<06411>>27815000
IF specialinst.fetchspecobj THEN                               <<06411>>27820000
   BEGIN <<add to loc, set mem req ptr>>                       <<06411>>27825000
   addflags:=0;                                                <<06411>>27830000
   addflags.setmemreqptrflag :=1;                              <<06411>>27835000
   addflags.setdeccntflag := 1;                                <<07320>>27840000
   IF CURPRC = 0 THEN ADDFLAGS.NOIMPEDE := 1;                  <<*7822>>27845000
   AddToLocality(SLLHEADINX,obj,addflags);                     <<06660>>27850000
   IF > THEN SUDDENDEATH(602);  << No more SLL entries >>      <<*7822>>27855000
   END;                                                        <<*7822>>27860000
                                                               <<06411>>27865000
<<do a disp if current process>>                               <<06411>>27870000
                                                               <<06411>>27875000
IF PCBPT = (CURPRC) THEN                                        <<MEAS>>27880000
   BEGIN                                                        <<MEAS>>27885000
   IF GCLASSENABLEDMASK.CLASS0 OR GCLASSENABLEDMASK.CLASS15 THEN<<MEAS>>27890000
      MEAS'OBJFAULT(OBJ);  <<TO UPDATE THE MEAS. COUNTERS>>     <<MEAS>>27895000
                                                                <<MEAS>>27900000
   <<STUFF AWAY REASON STOPED IN PCBX OF IMPEDED PROCESS>>      <<MEAS>>27905000
   <<DONE UNCONDITIONALLY FOR HISTORY FOR MEASUREMENT INTER.>>  <<MEAS>>27910000
   TOS := ICS(-ICS'STKBANKCELL);                                <<MEAS>>27915000
   TOS := ICS(-ICS'STKBASECELL);                                <<MEAS>>27920000
   TOS := TOS + SBTOMEASSTOPREASON;                             <<MEAS>>27925000
                                                               <<06411>>27930000
      TOS := STOPSEGFAULT; <<TEMPORARY until cache counter added  MEAS>>27935000
   ASMB(SSEA;DDEL);                                             <<MEAS>>27940000
                                                                <<MEAS>>27945000
   ASMB(DISP);                                                  <<MEAS>>27950000
   END;                                                         <<MEAS>>27955000
END; <<FlagProcAbsent>>                                        <<06411>>27960000
                                                               <<06411>>27965000
$TITLE "KERNEL UTILITY PROCEDURES : GENERATE SPECIAL REQUEST"           27970000
PROCEDURE GENSPECREQ(OBJIDENT,NEWSIZE,READDISP,MOVELENGTH);    <<06620>>27975000
VALUE OBJIDENT,NEWSIZE,READDISP,MOVELENGTH;                    <<06620>>27980000
INTEGER NEWSIZE,READDISP,MOVELENGTH;                           <<06620>>27985000
DOUBLE OBJIDENT;                                               <<06620>>27990000
OPTION PRIVILEGED,UNCALLABLE;                                           27995000
                                                                        28000000
COMMENT                                                                 28005000
                                                                        28010000
USED FOR BUFFERING THE INFORMATION REQUIRED TO EFFECT A SIZE CHANGE     28015000
FOR DATA SEGMENTS AND ANY INTERNAL PCBX MOVES.                          28020000
                                                                        28025000
AN ENTRY FROM THE SPECIAL REQUEST TABLE IS OBTAINED, FILLED IN          28030000
WITH THE PASSED INFORMATION, AND LINKED TO THE HEAD OF THE              28035000
QUEUE OF PENDING REQUESTS.                                              28040000
                                                                        28045000
;                                                                       28050000
                                                                        28055000
BEGIN                                                                   28060000
                                                                        28065000
DOUBLE SAVEDB;                                                          28070000
                                                                        28075000
INTEGER ENTRYINDEX;                                                     28080000
                                                                        28085000
DISABLE;                                                                28090000
TOS:=%1000D;                                                            28095000
ASMB(XCHD);                                                             28100000
SAVEDB:=TOS;                                                            28105000
ENTRYINDEX := GETSYSTABENTRY(SPECREQDST,FALSE,TRUE);           <<06616>>28110000
IF ENTRYINDEX=0 THEN SUDDENDEATH(600);   <<SPEC REQ TAB CONFTOO SMALL>> 28115000
                                                                        28120000
<<LINK TO HEAD OF SPECIAL REQ Q>>                                       28125000
                                                                        28130000
TOS:=SPECQHEAD;                                                         28135000
SPECQHEAD:=ENTRYINDEX;                                                  28140000
                                                                        28145000
<<FILL IN ENTRY>>                                                       28150000
TOS := DST(SPECREQDST&LSL(2) + 2); << BANK >>                  <<06616>>28155000
TOS := DST(X + 1);                                             <<06616>>28160000
ASMB(XCHD);                                                    <<06616>>28165000
DDEL;                                                          <<06616>>28170000
                                                                        28175000
X:=ENTRYINDEX;                                                          28180000
ENTRYWORD00:=TOS;   <<ATTACH REST OF QUEUE>>                            28185000
ENTRYWORD03 := NEWSIZE;                                        <<06620>>28190000
ENTRYWORD04 := READDISP;                                       <<06620>>28195000
ENTRYWORD05 := MOVELENGTH;                                     <<06620>>28200000
X := X & LSR(1);      << Need an index for a double array >>   <<06620>>28205000
DENTRYWORD01 := OBJIDENT;                                      <<06620>>28210000
TOS:=SAVEDB;                                                            28215000
ASMB(XCHD);                                                             28220000
END  <<GENSPECREQ>> ;                                                   28225000
                                                                        28230000
PROCEDURE CLEARWWS;                                                     28235000
OPTION PRIVILEGED,UNCALLABLE;                                           28240000
                                                                        28245000
COMMENT                                                                 28250000
CALLS TO THIS PROCEDURE SHOULD BE ELIMINATED.                           28255000
;                                                                       28260000
                                                                        28265000
BEGIN                                                                   28270000
INTEGER PCBPT;                                                 <<06650>>28275000
DISABLE;                                                                28280000
PCBPT := CURPRC;                                               <<06650>>28285000
EVENTFLAGS.WWS := 0;                                           <<06650>>28290000
END   <<PROCEDURE CLEARWWS>>;                                           28295000
$PAGE "I/O INTERFACE PROCEDURES : AWAKE DEVICE"                         28300000
PROCEDURE AWAKEDEVICE(IOQINX,OBJ,IOSTATUS);                    <<06660>>28305000
VALUE IOQINX,OBJ,IOSTATUS;                                     <<06660>>28310000
INTEGER IOQINX,IOSTATUS;                                       <<06392>>28315000
DOUBLE  OBJ;                                                   <<06660>>28320000
OPTION PRIVILEGED,UNCALLABLE;                                           28325000
                                                                        28330000
COMMENT                                                                 28335000
                                                                        28340000
AWAKEDEVICE IS CALLED TO GIVE INFO ON THE COMPLETION OF A               28345000
SEGMENT FETCH REQUEST TO AN I/O DEVICE MONITOR.  THE DEVICE             28350000
MONITOR IS AWAKENED THROUGH A CALL TO AWAKEIO.                          28355000
                                                                        28360000
THE IOQINX PARAMETER CARRIES either a DRQ or IOQ table index   <<*7567>>28365000
ONLY FOR DATA SEGMENT REQUESTS.  FOR DRIVERS, THIS PARAMETER   <<01770>>28370000
ACTUALLY CARRIES THE LDEV NUMBER.  THIS CHANGE WAS REQUIRED    <<01770>>28375000
SINCE INTERRUPTS REQUIRING THE STARTUP OF AN IDLE CHANNEL      <<01770>>28380000
PROGRAM HAVE NO ASSOCIATED I/O REQUESTS.                       <<01770>>28385000
IF THE IOQINX IS NEGATIVE, THIS IS AN UNBLOCKED                <<07320>>28390000
MAKEPRESENT FOR A PORT PROCEDURE RUNNING ON THE ICS.  THIS     <<06947>>28395000
ASSUME THAT THE IOQ TABLE LIES IN THE FIRST 32K OF OF SYSGLOB. <<06947>>28400000
                                                               <<*7567>>28405000
If IOQINX.(1:1) is set, then this is a DRQ relative index.     <<*7567>>28410000
                                                               <<*7567>>28415000
                                                               <<01770>>28420000
;                                                                       28425000
                                                                        28430000
BEGIN                                                                   28435000
INTEGER POINTER DITPOINTER;                                             28440000
INTEGER DITSYSDBINX,                                                    28445000
        IOQ'ENTRY'INDEX,                                       <<06392>>28450000
        DRQ'ENTRY'INDEX,                                       <<*7567>>28455000
        LDEVNUMBER;                                                     28460000
                                                               <<*7567>>28465000
LOGICAL ADISC := FALSE;                                        <<*7567>>28470000
                                                               <<*7567>>28475000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>28480000
IF IOQINX < 0 THEN                                             <<*7567>>28485000
  BEGIN  << PORT SEGMENT MAKEPRESENT >>                        <<06947>>28490000
  PORTSEG'COMPLETOR(IOQINX);                                   <<06947>>28495000
  RETURN;                                                      <<06947>>28500000
  END;                                                         <<06947>>28505000
                                                               <<06947>>28510000
IF LOGICAL (IOQINX.(1:1)) THEN                                 <<*7567>>28515000
   BEGIN                                                       <<*7567>>28520000
   ADISC := TRUE;                                              <<*7567>>28525000
   DRQ'ENTRY'INDEX := IOQINX.(2:14);                           <<*7567>>28530000
   END                                                         <<*7567>>28535000
ELSE IOQ'ENTRY'INDEX := IOQINX;                                <<*7567>>28540000
                                                               <<*7567>>28545000
IF OBJIDENT(ObjIDTypeField)<>ObjIDdataType                     <<06660>>28550000
   THEN LDEVNUMBER := IOQINX                                   <<*7567>>28555000
ELSE                                                           <<*7567>>28560000
   BEGIN                                                       <<*7567>>28565000
   LDEVNUMBER := IF ADISC THEN DRQ'LDEV ELSE IOQ'LDEV;         <<*7567>>28570000
   END;                                                        <<*7567>>28575000
                                                               <<*7567>>28580000
TOS := LPDT(X := LDEVNUMBER&LSL(2)+LPDT'DITP);                 <<06675>>28585000
DITSYSDBINX:=S0;                                                        28590000
@DITPOINTER := TOS;                                            <<*7567>>28595000
MMSTAT'(MMSTATAWAKEDEV,DITSYSDBINX,MEM(DITSYSDBINX),IOQINX,    <<06948>>28600000
       0,0,0);                                                 <<06948>>28605000
IF OBJIDENT(ObjIDtypeField)<>OBJIDDATATYPE THEN                <<06660>>28610000
   BEGIN <<A DRIVER>>                                                   28615000
   X := DITSYSDBINX;                                           <<07320>>28620000
   X:=DITDLTP;                                                          28625000
   TOS:=DLTFLAGS;                                                       28630000
   IF IOSTATUS<>IOSTATUSOK THEN TOS.DLTMMERRORCFLAG:=1         <<06212>>28635000
   ELSE TOS.DLTDRVRFRZNFLAG:=1;                                         28640000
   DLTFLAGS:=TOS;                                                       28645000
   END                                                                  28650000
ELSE                                                                    28655000
   BEGIN <<A BUFFER>>                                                   28660000
   IF IOSTATUS<>IOSTATUSOK THEN                                <<*7567>>28665000
      BEGIN                                                    <<*7567>>28670000
      IF ADISC THEN DRQ'MAMERR := 1 ELSE IOQ'MAMERR := 1;      <<*7567>>28675000
      END                                                      <<*7567>>28680000
   ELSE                                                        <<*7567>>28685000
      BEGIN                                                    <<*7567>>28690000
      IF ADISC THEN DRQ'DATAFRZN := 1 ELSE IOQ'DATAFRZN := 1;  <<*7567>>28695000
      END;                                                     <<*7567>>28700000
                                                               <<*7567>>28705000
   END;                                                                 28710000
AWAKEIO(DITPOINTER,0);                                                  28715000
END  <<AWAKEDEVICE>>;                                                   28720000
$PAGE "I/O INTERFACE PROCEDURES : UNDEFER OBJECTS MP Q"        <<06212>>28725000
                                                                        28730000
PROCEDURE UNDEFEROBJSMPQ(REGIONBASE,OBJIDENT,IOSTATUS);        <<06212>>28735000
VALUE REGIONBASE,OBJIDENT,IOSTATUS;                            <<06212>>28740000
DOUBLE REGIONBASE,OBJIDENT;                                    <<06660>>28745000
INTEGER IOSTATUS;                                              <<06212>>28750000
OPTION PRIVILEGED,UNCALLABLE;                                           28755000
                                                                        28760000
BEGIN                                                                   28765000
                                                                        28770000
DOUBLE                                                         <<06620>>28775000
   SLL'OBJID,      << Complete object identifier from SLL >>   <<06660>>28780000
   SAVEDB,           << DB at entry/exit >>                    <<06620>>28785000
   SR'TABLEDB;       << DB when at special request table >>    <<06620>>28790000
                                                               <<06620>>28795000
INTEGER                                                        <<06620>>28800000
   DEFERREDPCBPT,                                              <<06620>>28805000
   ENTRYINX,      << Current spec. req. table entry >>         <<06620>>28810000
   I,                                                          <<06620>>28815000
   NEXT'ENTRY,    << Next linked entry if 1st full >>          <<06625>>28820000
   SLLHEADINX,    << Index for header entry of SLL >>          <<06625>>28825000
   SLLINX,        << Index for regular entry of SLL >>         <<06625>>28830000
   NEXTPIN;                                                    <<06625>>28835000
                                                                        28840000
<<UNDEFER PROCESSES WAITING FOR THIS OBJECT>>                <<<<06212>>28845000
                                                                        28850000
TOS:=REGIONBASE;                                                        28855000
TOS:=TOS+RBTOMPQLINKDISP;                                               28860000
ASMB(LSEA);                                                             28865000
WHILE <> DO                                                             28870000
   BEGIN                                                                28875000
   DEFERREDPCBPT := S0;                                        <<06660>>28880000
   X:=TOS+SLLIXWORDNUM;                                                 28885000
   SLLHEADINX := PCB(X);                                       <<06625>>28890000
   SLLINX := SLL(FIRSTINX);                                    <<06625>>28895000
   TOS := SLL(SLL'OBJDESC);                                    <<06660>>28900000
   TOS := SLL(SLL'OBJNUM);                                     <<06660>>28905000
   SLL'OBJID := TOS;                                           <<06660>>28910000
                                                               <<06660>>28915000
   WHILE SLL'OBJID <> OBJIDENT DO                              <<06660>>28920000
      BEGIN                                                    <<06660>>28925000
      SLLINX := SLL(NEXTINX);                                  <<06660>>28930000
      IF SLLINX = 0 THEN SUDDENDEATH(612);                     <<06660>>28935000
      TOS := SLL(SLL'OBJDESC);                                 <<06660>>28940000
      TOS := SLL(SLL'OBJNUM);                                  <<06660>>28945000
      SLL'OBJID := TOS;                                        <<06660>>28950000
      END;                                                     <<06660>>28955000
                                                               <<06660>>28960000
                                                               <<06625>>28965000
   SLL(SLL'FLAGS).SLLIMIFLAG := 0;                             <<06625>>28970000
   NEXTPIN := SLL(NEXTIMPPIN);                                 <<06625>>28975000
   SLL(NEXTIMPPIN) := 0;                                       <<07320>>28980000
   IF IOSTATUS <> IOSTATUSOK THEN ABORTPROCESS(DEFERREDPCBPT   <<06650>>28985000
                          ,MAKEPRESIOERR) ELSE                 <<06650>>28990000
   IF SLL(SLL'FLAGS).SLLDECCNTFLAG = 1 THEN                    <<06625>>28995000
      BEGIN <<DEC PROCS COUNT OF I/O COMP TO AWAKE>>                    29000000
      SLL(SLL'FLAGS).SLLDECCNTFLAG := 0;                       <<06945>>29005000
      TOS := SLL(SCHEDTOIOMSG).SLLIOCOMPTOAWAKECNT - 1;        <<06625>>29010000
      SLL(SCHEDTOIOMSG).SLLIOCOMPTOAWAKECNT := S0;             <<06625>>29015000
      ASMB(TEST,DEL);                                                   29020000
      IF < THEN SUDDENDEATH(612);                              <<01644>>29025000
      IF = THEN                                                         29030000
         BEGIN <<PROCESS IS BEING SWAPPED IN OR IS READY FOR LAUNCH>>   29035000
         IF NOT SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG                <<06625>>29040000
         THEN AWAKE(DEFERREDPCBPT,MEMORYWAITCODE,NOWAIT);               29045000
         END;                                                           29050000
      END;                                                              29055000
   TOS:=NEXTPIN;                                               <<06411>>29060000
   END;                                                                 29065000
                                                                        29070000
<<                                                                      29075000
AWAKEIO ON DEVICES QUEUED FOR THIS SEGMENT                              29080000
>>                                                                      29085000
                                                                        29090000
TOS:=REGIONBASE;                                                        29095000
TOS:=TOS+RBTOCOMPMSGDISP;                                               29100000
ASMB(LSEA);                                                             29105000
ASMB(TBC COMPMSGIOWAKEBIT);                                             29110000
IF <> THEN                                                              29115000
   BEGIN  <<DEVICES WAITING FOR SEGMENT>>                               29120000
   ASMB(DEL);                                                           29125000
   TOS:=TOS+COMPMSGTOIOREQQDISP;                                        29130000
   ASMB(LSEA);                                                          29135000
   IF = THEN SUDDENDEATH(612);                                 <<01644>>29140000
   ENTRYINX := TOS;                                            <<06616>>29145000
   TOS := DST(SPECREQDST & LSL(2) + 2);    << Bank >>          <<06620>>29150000
   TOS := DST(X := X+1);                   << Address >>       <<06620>>29155000
   ASMB(XCHD);                                                 <<06620>>29160000
   SAVEDB := TOS;                                              <<06620>>29165000
                                                               <<06620>>29170000
   WHILE ENTRYINX <> 0 DO                                      <<06620>>29175000
      BEGIN                                                    <<06620>>29180000
      NEXT'ENTRY := SYSTABENTRY(ENTRYINX);                     <<06620>>29185000
      I := 1;                                                  <<06620>>29190000
      WHILE SYSTABENTRY(X := ENTRYINX + I) <> 0 AND I <= 5 DO  <<06620>>29195000
         BEGIN                                                 <<06620>>29200000
         TOS := SYSTABENTRY(X);  << Ioqinx >>                  <<06620>>29205000
         TOS := SAVEDB;                                        <<06620>>29210000
         ASMB(XCHD);                                           <<06620>>29215000
         SR'TABLEDB := TOS;                                    <<06620>>29220000
                                                               <<06620>>29225000
         AWAKEDEVICE(*,OBJIDENT,IOSTATUS);                     <<06620>>29230000
                                                               <<06620>>29235000
         TOS := SR'TABLEDB;                                    <<06620>>29240000
         ASMB(XCHD);                                           <<06620>>29245000
         SAVEDB := TOS;                                        <<06620>>29250000
                                                               <<06620>>29255000
         I := I + 1;                                           <<06620>>29260000
         END;                                                  <<06620>>29265000
                                                               <<06620>>29270000
      RELSYSTABENTRY(SPECREQDST,ENTRYINX);                     <<06620>>29275000
      DISABLE;                                                 <<06620>>29280000
      ENTRYINX := NEXT'ENTRY;     << Ready to undefer entry >> <<06620>>29285000
      ENABLE;                                                  <<06620>>29290000
      END;                                                     <<06620>>29295000
                                                               <<06620>>29300000
   TOS := SAVEDB;                                              <<06620>>29305000
   ASMB(XCHD);                                                 <<06620>>29310000
   DDEL;                                                       <<06620>>29315000
   END;                                                        <<06620>>29320000
END  <<PROCEDURE UNDEFEROBJSMPQ>>;                             <<06212>>29325000
                                                               <<06212>>29330000
$PAGE "I/O SYSTEM INTERFACE PROCEDURES"                                 29335000
PROCEDURE IOFREEZE'(OBJ);                                      <<06660>>29340000
VALUE OBJ;                                                     <<06660>>29345000
DOUBLE  OBJ;                                                   <<06660>>29350000
OPTION PRIVILEGED,UNCALLABLE;                                           29355000
                                                                        29360000
COMMENT                                                                 29365000
                                                                        29370000
IOFREEZE' IS CALLED FROM I/O SYSTEM MONITORS TO FREEZE' A               29375000
SEGMENT IN MEMORY SO THAT INSTRUCTION FETCH AND DATA                    29380000
TRANSFER BY DMA I/O SYSTEM DEVICES MAY TAKE PLACE.  IF                  29385000
THE REQUIRED SEGMENT IS PRESENT, THE SEGMENT GETS IO FROZEN             29390000
IF IT IS ABSENT, STATUS THROUGH THE CONDITION CODE IS RETURNED          29395000
AND NOTHING IS DONE.  THE MONITOR MUST MAKE A SPECIAL                   29400000
REQUEST FOR THE SEGMENT TO THE SCHEDULER, SINCE BLOCKING                29405000
THE MONITOR ON THE ICS IN IOFREEZE' WOULDN'T WORK.                      29410000
                                                                        29415000
;                                                                       29420000
                                                                        29425000
BEGIN                                                                   29430000
INTEGER NEWIOFZCNT,                                                     29435000
        DESCSTINX;                                                      29440000
INTEGER CONDCODE:=CCE;                                                  29445000
INTEGER TYPE := 0;      << For MMSTAT' >>                      <<*7564>>29450000
LOGICAL FREEZE':=TRUE;                                                  29455000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>29460000
ENTRY IOUNFREEZE';                                                      29465000
                                                                        29470000
TYPE.(12:4) := 0;    <<TYPE FOR IOFREEZE>>                     <<01571>>29475000
GO OVER;                                                                29480000
IOUNFREEZE':FREEZE':=FALSE;                                             29485000
TYPE.(12:4) := 3;    <<TYPE FOR IOUNFREEZE>>                   <<01571>>29490000
OVER:                                                                   29495000
IF OBJIDENT(ObjIDTypeField)=OBJIDDATATYPE                      <<06660>>29500000
THEN DESCSTINX:=OBJIDENT(ObjIDnumField)&LSL(2)                 <<06660>>29505000
ELSE DESCSTINX:=CONVSEGIDTOSTINX(OBJ);                         <<06660>>29510000
X:=DESCSTINX;                                                           29515000
DISABLE;                                                                29520000
TOS:=DST(X);                                                            29525000
ASMB(DEL);                                                              29530000
IF < THEN CONDCODE:=CCL  <<SEGMENT ABSENT>> ELSE                        29535000
   BEGIN  <<SEGMENT IS PRESENT>>                                        29540000
   TOS:=DST(X:=X+1);                                                    29545000
   ASMB(TBC SEGRESIDENTBIT);                                            29550000
   IF = THEN                                                            29555000
      BEGIN <<SEG NOT CORE RESIDENT>>                                   29560000
      TOS:=DST(X:=X+1);                                                 29565000
      TOS:=DST(X:=X+1);                                                 29570000
      TOS:=TOS+RBTOWDIOFZCNTDISP;                                       29575000
      ASMB(LSEA);                                                       29580000
      IF FREEZE' THEN                                                   29585000
         BEGIN                                                          29590000
         NEWIOFZCNT:=S0.IOFZCNTFIELD+1;                                 29595000
         TOS.IOFZCNTFIELD:=NEWIOFZCNT;                                  29600000
         ASMB(SSEA);                                                    29605000
         TOS:=TOS+WDIOFZCNTTORASDISP;                                   29610000
         ASMB(LSEA);                                                    29615000
         TOS.REGIOFZFLAG:=1;                                            29620000
         ASMB(SSEA);                                                    29625000
         END                                                            29630000
      ELSE                                                              29635000
         BEGIN  <<UNFREEZE'>>                                           29640000
         NEWIOFZCNT:=S0.IOFZCNTFIELD-1;                                 29645000
         TOS.IOFZCNTFIELD:=NEWIOFZCNT;                                  29650000
         ASMB(SSEA);                                                    29655000
         TOS:=TOS+WDIOFZCNTTORASDISP;                                   29660000
         ASMB(LSEA);                                                    29665000
         TOS.REGIOFZFLAG:=0;                                            29670000
         IF = THEN CONDCODE:=CCL; <<REG WASN'T I/O FROZEN>>             29675000
         IF NEWIOFZCNT = 0 THEN                                         29680000
            BEGIN                                                       29685000
            TOS.SIZECHANGEPNDGFLAG:=0;                                  29690000
            ASMB(SSEA);                                                 29695000
            IF <> THEN                                                  29700000
               BEGIN                                                    29705000
               TOS := TOS + RASTOMPQLINKDISP;                  <<06660>>29710000
               ASMB(LSEA);                                              29715000
               UNIMPEDE(*);                                             29720000
               END;                                                     29725000
            END;                                                        29730000
         END;                                                           29735000
      END;                                                              29740000
   END;                                                                 29745000
CC:=CONDCODE;                                                           29750000
MMSTAT'(MMSTATSPECREQ,OBJIDENT(OBJIDDESCFIELD),                <<06948>>29755000
       OBJIDENT(OBJIDNUMFIELD),TYPE,NEWIOFZCNT,0,0);           <<06948>>29760000
END  <<IOFREEZE'>>;                                                     29765000
$PAGE "I/O INTERFACE PROCEDURES : TEST I/O FROZEN"                      29770000
LOGICAL PROCEDURE TESTIOFROZEN(OBJ);                           <<06660>>29775000
VALUE OBJ;                                                     <<06660>>29780000
DOUBLE  OBJ;                                                   <<06660>>29785000
OPTION PRIVILEGED,UNCALLABLE;                                           29790000
                                                                        29795000
COMMENT                                                                 29800000
                                                                        29805000
USED BY CS TO SEE IF A DRIVER HAS ALREADY BEEN FROZEN. FOR PERFORMANCE. 29810000
;                                                                       29815000
                                                                        29820000
BEGIN                                                                   29825000
                                                                        29830000
INTEGER DESCSTINX;                                                      29835000
DESCSTINX:=CONVSEGIDTOSTINX(OBJ);                              <<06660>>29840000
DISABLE;                                                                29845000
TOS:=DST(X:=DESCSTINX);                                                 29850000
ASMB(DEL);                                                              29855000
IF > THEN                                                               29860000
   BEGIN  <<SEGMENT IS PRESENT>>                                        29865000
   TOS:=DST(X:=X+1);                                                    29870000
   ASMB(TBC SEGRESIDENTBIT);                                            29875000
   IF <> THEN TESTIOFROZEN:=TRUE ELSE                                   29880000
      BEGIN <<NOT RESIDENT>>                                            29885000
      TOS:=DST(X:=X+1);                                                 29890000
      TOS:=DST(X:=X+1);                                                 29895000
      TOS:=TOS+RBTORASDISP;                                             29900000
      ASMB(LSEA);                                                       29905000
      TOS.REGIOFZFLAG:=0;                                               29910000
      IF <> THEN TESTIOFROZEN:=TRUE;                                    29915000
      END;                                                              29920000
   END;                                                                 29925000
END  <<TESTIOFROZEN>>;                                                  29930000
$PAGE "I/O INTERFACING PROCEDURES : FETCHIOSEG"                         29935000
PROCEDURE FETCHIOSEG(OBJ,LDEV,IOREQINX,FLAGS);                 <<*7567>>29940000
VALUE OBJ,LDEV,IOREQINX,FLAGS;                                 <<*7567>>29945000
DOUBLE  OBJ;                                                   <<06660>>29950000
INTEGER       LDEV,IOREQINX,FLAGS;                             <<*7567>>29955000
OPTION PRIVILEGED,UNCALLABLE;                                           29960000
                                                                        29965000
COMMENT                                                                 29970000
                                                                        29975000
FETCHIOSEG IS USED BY I/O SYSTEM MONITORS TO REQUEST SEGMENTS ON        29980000
BEHALF OF DEVICES.  THIS INTERFACE ALLOWS THE CALLER TO REQUEST         29985000
A DRIVER OR BUFFER DATA SEGMENT IN AN UNBLOCKED MANNER.  WHEN THE       29990000
SEGMENT ARRIVES, IT IS IOFROZEN IF THIS HAD BEEN REQUESTED, AND         29995000
AWAKEIO IS CALLED ON THE APPROPRIATE DEVICE. ALSO, THE DATA FROZEN      30000000
BIT IN THE SPECIFIED I/O REQUEST FLAGS WORD IS SET FOR DATA SEGMENT     30005000
REQUESTS, AND THE DRIVER FROZEN BIT IN THE ILT IS SET FOR DRIVER        30010000
FETCH REQUESTS.                                                         30015000
                                                                        30020000
PARAMETER SPECIFICATION :                                               30025000
                                                                        30030000
   OBJ : Standard object identifier format.                    <<*7567>>30035000
                                                                        30040000
   LDEV : LOGICAL DEVICE NUMBER OF DEVICE REQUIRING SEGMENT             30045000
                                                                        30050000
   IOREQINX : Table relative index of IOQ or DRQ request       <<*7567>>30055000
              element associated with the segment fetch        <<*7567>>30060000
              request (only required for data segment fetch    <<*7567>>30065000
              requests).                                       <<*7567>>30070000
              Bit (1:1) = 1 then this is a DRQ.                <<*7567>>30075000
                                                                        30080000
   FLAGS : .(0:1) = 1 ==> IOFREEZE SEGMENT WHEN IT ARRIVES              30085000
                                                                        30090000
CONDITION CODE RETURN SPECIFICATION :                                   30095000
                                                                        30100000
   RETURN CC = CCE ==> SEGMENT IS PRESENT, AND HAS BEEN I/O FROZEN      30105000
                       IF SO REQUESTED (BUT DATA FROZEN, DRIVER FROZEN  30110000
                       BITS NOT SET, AWAKEIO NOT CALLED)                30115000
             = CCG ==> SEGMENT NOT AROUND, AND REQUEST FOR SEGMENT      30120000
                       HAS BEEN ISSUED.                                 30125000
;                                                                       30130000
                                                                        30135000
BEGIN                                                          <<JBIV>> 30140000
LOGICAL ARRAY OBJID(*)=OBJ;                                    <<06660>>30145000
INTEGER SEGDESCSTINX;                                                   30150000
                                                                        30155000
                                                               <<JBIV>> 30160000
SEGDESCSTINX:=CONVSEGIDTOSTINX(OBJ);                           <<06660>>30165000
IF < THEN SUDDENDEATH(624);  << SEGMENT IS NOT ALLOCATED>>     <<04643>>30170000
DISABLE;                                                       <<JBIV>> 30175000
IF NOT LOGICAL(DST(SEGDESCSTINX)).ABSENTFLAG THEN              <<JBIV>> 30180000
   BEGIN  <<SEG IS AROUND>>                                    <<JBIV>> 30185000
   CC:=CCE;                                                    <<JBIV>> 30190000
   IF LOGICAL(FLAGS).MSGIOFZREQFLAG THEN IOFREEZE'(OBJ);       <<06660>>30195000
   END                                                         <<JBIV>> 30200000
ELSE                                                           <<JBIV>> 30205000
   BEGIN <<MUST SEND OFF A REQUEST FOR THE SEGMENT>>           <<JBIV>> 30210000
   CC:=CCG;                                                    <<JBIV>> 30215000
   TOS:=OBJ;                                                   <<06660>>30220000
   IF OBJID(ObjIDTypeField)<> OBJIDDATATYPE THEN TOS:=LDEV     <<06660>>30225000
   ELSE TOS:=IOREQINX;                                         <<*7567>>30230000
   TOS:=FLAGS;                                                 <<JBIV>> 30235000
   SENDMSG(SCHEDPIN,IOSEGREQPORT,4,0);                         <<06660>>30240000
   END;                                                        <<JBIV>> 30245000
END <<FETCHIOSEG>>;                                            <<JBIV>> 30250000
                                                               <<JBIV>> 30255000
                                                                        30260000
$PAGE "I/O INTERFACE PROCEDURES : CHECK FOR DEFERRED DISC REQ" <<06212>>30265000
                                                                        30270000
PROCEDURE CheckForDeferredDiscreq(obj);                        <<06660>>30275000
VALUE obj;                                                     <<06660>>30280000
DOUBLE  obj;                                                   <<06660>>30285000
OPTION PRIVILEGED,UNCALLABLE;                                           30290000
                                                                        30295000
COMMENT                                                                 30300000
                                                               <<06212>>30305000
CheckForDeferredDiscreq scans the list of deferred discrequests<<06212>>30310000
searching for requests which involve this object.              <<06212>>30315000
                                                               <<06212>>30320000
For any deferred physical requests involving this segment,     <<06212>>30325000
the disc request is removed from the deferred queue and inserte<<06212>>30330000
into the active disc request queue attached to the device's dit<<06212>>30335000
                                                               <<06212>>30340000
For logical requests (fulfilled via move with cached disc domai<<06212>>30345000
involving this segment, the related logical disc request elemen<<06212>>30350000
is removed from the deferredqueue and reinserted into the pendi<<06212>>30355000
queue attached to the CDT entry mapping the disc domain        <<06212>>30360000
involved in the trasfer.  A message is sent to the dispatcher  <<06212>>30365000
to try the move between the segment and the mapped disc domain.<<06212>>30370000
This could be needed due to garbage collection of a data segmen<<06212>>30375000
during which the mapped domain involved in a logical xfer      <<06212>>30380000
arrives.                                                       <<06212>>30385000
                                                               <<06212>>30390000
                                                               <<06212>>30395000
;                                                                       30400000
                                                                        30405000
BEGIN                                                                   30410000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>30415000
INTEGER NEXT,                                                           30420000
        SLLHEADINX,                                            <<*8400>>30425000
        drq'entry'index,                                       <<06392>>30430000
        REQP;                                                           30435000
DEFINE LDR'ENTRY'INDEX = DRQ'ENTRY'INDEX#;                     <<06941>>30440000
                                                                        30445000
<<head of deferred phys queue is located in the header entry>> <<06212>>30450000
<<of the disc request table>>                                  <<06212>>30455000
                                                               <<06212>>30460000
                                                               <<06212>>30465000
DISABLE;                                                       <<06212>>30470000
                                                               <<06212>>30475000
DRQ'ENTRY'INDEX:=DQH'DISAHEAD;      <<head of deferred queue>> <<06392>>30480000
                                                                        30485000
                                                               <<06212>>30490000
LOOP  :                                                        <<06212>>30495000
                                                                        30500000
WHILE DRQ'ENTRY'INDEX <> 0 AND                                 <<06660>>30505000
      DOUBLE(DRQ'BUF'DSTN) <> OBJ                              <<07320>>30510000
DO DRQ'ENTRY'INDEX := DRQ'NEXTQ;                               <<07320>>30515000
                                                               <<06212>>30520000
IF DRQ'ENTRY'INDEX <> 0 THEN                                   <<06392>>30525000
   BEGIN                                                                30530000
   REQP:=DRQ'ENTRY'INDEX;                                      <<06392>>30535000
   NEXT:=DRQ'NEXTQ;                                            <<06392>>30540000
                                                               <<06212>>30545000
   <<TAKE REQUEST OFF OF DEFERRED REQ Q>>                      <<06212>>30550000
                                                               <<06212>>30555000
   DEQUEUEDISCREQ(reqp, deferredreqq, noinfo);                 <<06212>>30560000
   LDR'DISABLE := 0;   << Turn off req disabled bit >>         <<06411>>30565000
   IF LDR'LDREQ THEN                                           <<06627>>30570000
      BEGIN <<LOGICAL REQUEST>>                                <<06212>>30575000
                                                               <<06212>>30580000
      <<ATTACH THE REQUEST TO THE CDT ENTRY'S PENDING QUEUE>>  <<06212>>30585000
                                                               <<06212>>30590000
      QUEUEDISCREQ(reqp,cdtreqq,LDR'CDT);                      <<07320>>30595000
                                                               <<06212>>30600000
      SLLHEADINX := LPCB(LDR'PCB*PCBSIZE+SLLIXWORDNUM);        <<*8400>>30605000
      IF SLL(SCHEDTOIOMSG).SLLIOCOMPTOAWAKECNT = 0 AND         <<*8400>>30610000
         NOT SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG AND               <<*8400>>30615000
         LPCB(LDR'PCB*PCBSIZE+WAKEMASKWORDNUM).                <<*8400>>30620000
                                       MEMORYWAITFLAG THEN     <<*8400>>30625000
         AWAKE(LDR'PCB*PCBSIZE,MEMORYWAITCODE,NOWAIT);         <<*8400>>30630000
      <<INFORM DISP TO TRY A CACHE MOVE>>                      <<06212>>30635000
                                                               <<06212>>30640000
      TOS := LDR'CDT;                                          <<07320>>30645000
      TOS := IOSTATUSOK;                                       <<06941>>30650000
      TOS := CACHEMOVEREADYCODE;                               <<06212>>30655000
      SENDMSG(SCHEDPIN,CACHEMOVEPORT,3,0);                     <<06212>>30660000
                                                               <<06212>>30665000
      END                                                      <<06212>>30670000
                                                               <<06212>>30675000
   ELSE QUEUEDISCREQ(REQP,DITREQQ,                             <<06675>>30680000
                     LPDT(LDR'LDEV & LSL(2)+LPDT'DITP));       <<06675>>30685000
                                                               <<06212>>30690000
   drq'entry'index := next;                                    <<06392>>30695000
                                                               <<06212>>30700000
   GO LOOP;                                                             30705000
   END;                                                                 30710000
                                                               <<06212>>30715000
END; <<CheckForDeferredDiscreq>>                               <<06212>>30720000
                                                                        30725000
$PAGE "I/O INTERFACE PROCEDURES : START OBJECT WRITE"          <<06212>>30730000
                                                               <<06212>>30735000
PROCEDURE StartObjWrite(obj, urgclass, regionbase,             <<06660>>30740000
                        ldr'entry'index,discreqinx);           <<06212>>30745000
VALUE obj,urgclass,regionbase, ldr'entry'index, discreqinx;    <<06660>>30750000
DOUBLE  obj;                                                   <<06660>>30755000
INTEGER urgclass, ldr'entry'index, discreqinx;                 <<06212>>30760000
DOUBLE regionbase;                                             <<06212>>30765000
OPTION PRIVILEGED,UNCALLABLE;                                           30770000
                                                                        30775000
COMMENT                                                                 30780000
                                                                        30785000
STARTOBJWRITE BUILDS A DISC WRITE REQUEST FOR THE SPECIFIED CAC<<06212>>30790000
DOMAIN OR DATA SEGMENT, AND QUEUES THE WRITE REQUEST INTO THE  <<06212>>30795000
APPROPRIATE DISC QUEUE VIA A CALL TO QUEUEDISCREQ TO START THE <<06212>>30800000
PHYSICAL WRITE. FOR WRITES OF CACHED DISC DOMAINS, THE XFER    <<06212>>30805000
REQUEST ELEMENT IS PROVIDED IN THE CALLING SEQUENCE, WHEREAS   <<06212>>30810000
THE XFER REQUEST ELEMENT FOR THE PHYSICAL WRITE UPDATE OF A    <<06212>>30815000
DATA SEGMENT IS OBTAINED IN THE ROUTINE. THIS IS DONE SINCE    <<06212>>30820000
THE XFER REQ ELT FOR A MAPPED DOMAIN IS OBTAINED IN ATTACHIO AN<<06212>>30825000
THE SAME ELEMENT IS USED FOR ALL DISC READS AND WRITES OF THEED<<06212>>30830000
MAPPED DOMAIN.  THIS PREVENTS THE STRAIN ON THE CRITICAL POOL  <<06212>>30835000
OF MEMORY MANAGEMENT DISC XFER REQUESTS FOR MOVEMENT OF        <<06212>>30840000
CACHED DOMAINS.                                                <<06212>>30845000
                                                               <<06212>>30850000
THE REQUEST WILL BE ISSUED WITH THE PRIORITY PASSED IN THE URG<<<06212>>30855000
PARAMETER.  THIS WILL CONTROL THE LOCATION IN THE DISC QUEUE, AND       30860000
THEREBY THE URGENCY OF SERVICE FOR THE REQUEST SINCE DISC QUEUES        30865000
ARE SERVICED FROM THE HEAD.                                    <<06212>>30870000
                                                                        30875000
THE DATA SEGMENT OR CACHED DISC DOMAIN IS MARKED AS HAVING A WR<<06212>>30880000
IN PROGRESS SO THAT AN OVERLAY OF THE CORRESPONDING REGION WILL<<06212>>30885000
BE HELD OFF UNTIL THE WRITE COMPLETES.                         <<06212>>30890000
                                                                        30895000
THE LOGXFERREQ PARAMETER POINTS TO THE ASSOCIATED LOGICAL DISC <<06212>>30900000
ACCESS REQUEST FOR CACHED DISC DOMAINS.  THE PARAMETER IS NOT  <<06212>>30905000
USED FOR DATA SEGMENT WRITES.  IT IS NEEDED FOR MAPPED DOMAIN  <<06212>>30910000
WRITES SINCE THE DISC ADDRESS AND XFER COUNTS ARE OBTAINED     <<06212>>30915000
BY LOOKING INTO THE ASSOCIATED LOGICAL XFER REQ ELT.  THE WRITE<<06212>>30920000
OF A MAPPED OBJECT IS PERFORMED ONLY FOR THE PORTION OF THE    <<06212>>30925000
MODIFIED BY THE LOGICAL XFER REQUEST.                          <<06212>>30930000
                                                               <<06212>>30935000
                                                               <<06212>>30940000
***  This procedure assumes db is at sysdb on entry.           <<06212>>30945000
                                                               <<06212>>30950000
;                                                              <<06212>>30955000
                                                               <<06212>>30960000
BEGIN                                                                   30965000
LOGICAL ARRAY objid(*)=obj;                                    <<06660>>30970000
equate serwq=4;  <<temp-delete with mpev>>                     <<06945>>30975000
DOUBLE  XFERBASE;                                              <<06212>>30980000
                                                               <<06212>>30985000
INTEGER                                                        <<06212>>30990000
        drq'entry'index,                                       <<06392>>30995000
        MSTATPARM4,                                            <<06948>>31000000
        DSTENTRYNUMBER,                                        <<06212>>31005000
                                                               <<06411>>31010000
        LDEV,                                                  <<06212>>31015000
        REGIONSIZE,                                            <<06212>>31020000
        MMBASE=XFERBASE+1,                                     <<06212>>31025000
        MMBANK=XFERBASE,                                       <<06212>>31030000
        XFERCOUNT,                                             <<06212>>31035000
        XFEROFFSET,                                            <<06212>>31040000
        REGHODA,                                               <<06212>>31045000
        REGLODA,                                               <<06212>>31050000
        XFERHODA,                                              <<06212>>31055000
        XFERLODA;                                              <<06212>>31060000
                                                               <<06212>>31065000
DOUBLE XFERDA=XFERHODA,                                        <<06212>>31070000
       REGIONDA=REGHODA;                                       <<06212>>31075000
                                                               <<06212>>31080000
<<GET THE INFO NEEDED FOR THE TRANSFER>>                       <<06212>>31085000
                                                               <<06212>>31090000
TOS:=REGIONBASE;                                               <<06212>>31095000
TOS:=TOS+RBTOHODADISP;                                         <<06212>>31100000
ASMB(LDEA);                                                    <<06212>>31105000
REGLODA:=TOS;  <<REGION'S DISC ADDRESS>>                       <<06212>>31110000
REGHODA:=S0.REGHODAFIELD;                                      <<06212>>31115000
LDEV:=TOS.REGLDEVFIELD;     <<LDEV>>                           <<06212>>31120000
TOS:=TOS+HODATORSDISP;                                         <<06212>>31125000
ASMB(LSEA);                                                    <<06212>>31130000
REGIONSIZE := TOS*MMPAGESIZE;                                  <<06212>>31135000
ASMB(DDEL);                                                    <<06212>>31140000
                                                               <<06212>>31145000
IF NOT OBJID(ObjIDtypeField)=OBJIDDATATYPE                     <<06660>>31150000
AND NOT OBJID(ObjIDTypeField)=OBJIDCDTYPE                      <<06660>>31155000
THEN SUDDENDEATH(SFKernBadParm);                               <<06212>>31160000
IF OBJID(ObjIDTypeField)=OBJIDDATATYPE THEN                    <<06660>>31165000
   BEGIN <<A DATA SEG>>                                        <<06212>>31170000
   DSTENTRYNUMBER := OBJID(ObjIDnumField);                     <<06660>>31175000
   XFERDA:=REGIONDA; <<XFER ENTIRE OBJECT>>                    <<06212>>31180000
   X:=DSTENTRYNUMBER&LSL(2)+DSTSYSBASEINX;                     <<06212>>31185000
   XFERCOUNT:=SEGDESCFIRMINFO.DATASIZEFIELD&LSL(2);            <<06212>>31190000
   XFEROFFSET:=0;                                              <<06212>>31195000
   END;                                                        <<06660>>31200000
IF OBJID(ObjIDTypeField)=OBJIDCDTYPE THEN                      <<06660>>31205000
   BEGIN <<A MAPPED DOMAIN>>                                   <<06212>>31210000
   XFERHODA:=ldr'parm1;   <<XFER DISC ADDRESS>>                <<d7738>>31215000
   XFERLODA:=ldr(X:=X+1);  << (ldr'parm2) >>                   <<d7738>>31220000
   IF INTEGER(LDR'LDEV) <> LDEV                                <<06212>>31225000
   THEN SUDDENDEATH(SFKERNCACHEINTBAD);                        <<06212>>31230000
                                                               <<06212>>31235000
   <<FIGURE OUT XFER OFFSET AND XFER COUNT>>                   <<06212>>31240000
                                                               <<06212>>31245000
   TOS:=XFERDA-REGIONDA;                                       <<06212>>31250000
   XFEROFFSET := TOS*SECTORSIZEINWORDS;                        <<06212>>31255000
   IF < THEN SUDDENDEATH(SFKERNCACHEINTBAD);                   <<06212>>31260000
   XFERCOUNT:=ldr'count;                                       <<06212>>31265000
   IF < THEN xfercount:=((-xfercount)+1) & ASR(1);             <<06411>>31270000
   END;                                                        <<06212>>31275000
                                                               <<06212>>31280000
TOS := REGIONBASE;                                             <<06212>>31285000
TOS:=TOS+XFEROFFSET;                                           <<06212>>31290000
XFERBASE:=TOS;                                                 <<06212>>31295000
IF LOGICAL(XFEROFFSET+XFERCOUNT) > LOGICAL(REGIONSIZE)         <<06212>>31300000
AND OBJID(ObjIDTypeField)=OBJIDCDTYPE                          <<06660>>31305000
                      <<seg expansions go over, but ok>>       <<06660>>31310000
THEN SUDDENDEATH(SFKERNCACHEINTBAD);                           <<06212>>31315000
                                                               <<06212>>31320000
                                                               <<06212>>31325000
<<GET A DISC TRANSFER REQUEST ELEMENT AND FILL IT IN>>                  31330000
                                                                        31335000
IF DISCREQINX = 0                                              <<06392>>31340000
THEN DISCREQINX := GETDISCREQ(2);  <<NO IMPEDE>>               <<06392>>31345000
drq'entry'index := discreqinx;                                 <<06392>>31350000
IF = THEN SUDDENDEATH(601); <<DISC REQ TAB CONFIG TOO SMALL>>  <<06392>>31355000
<<FILL IN THE DISC REQUEST ELEMENT>>                                    31360000
DRQ'PARM2:=XFERLODA;                                           <<06392>>31365000
DRQ'PARM1:=XFERHODA;                                           <<06392>>31370000
DRQ'LDEV:=LDEV;                                                <<06392>>31375000
DRQ'BUFADR:=MMBASE; <<XFERBASE>>                               <<06392>>31380000
DRQ'BUFDST:=MMBANK; <<XFERBANK>>                               <<06392>>31385000
DRQ'COUNT:=XFERCOUNT; <<XFERCOUNT>>                            <<06392>>31390000
DRQ'SEGDISP := XFEROFFSET;                                     <<06392>>31395000
TOS:=0;                                                        <<06392>>31400000
DRQ'FLAGS:=TOS;                                                <<06392>>31405000
DRQ'STAT := 0;                                                 <<06941>>31410000
DRQ'PCB := 0;        <<NECESSARY FOR SIODM FUNCTION>>          <<08803>>31415000
DRQ'QMISC := 0;                                                <<07320>>31420000
DRQ'MMREQ:=1;                                                  <<06392>>31425000
DRQ'FUNC:=WRITEREQ;                                            <<06392>>31430000
DRQ'SEGID1 := OBJID(OBJIDDESCFIELD);                           <<06941>>31435000
DRQ'SEGID2 := OBJID(OBJIDNUMFIELD);                            <<06941>>31440000
DRQ'URGCLAS:=URGCLASS;                                         <<06392>>31445000
                                                                        31450000
<<SET BACKGROUND WRITE SEMAPHORE FOR DATA SEGS>>               <<06212>>31455000
                                                               <<06212>>31460000
IF OBJID(ObjIDTypeField)=OBJIDDATATYPE                         <<06660>>31465000
THEN DST(DSTENTRYNUMBER&LSL(2)+1).DISCCOPYVALIDFLAG:=0;        <<06212>>31470000
                                                                        31475000
<<SET IMOFLAG FOR THE DISC UPDATE OF A CACHED DISC DOMAIN>>    <<06212>>31480000
                                                               <<06212>>31485000
IF OBJID(ObjIDTypeField)=OBJIDCDTYPE THEN                      <<06660>>31490000
   BEGIN                                                       <<06212>>31495000
   CDT'ABS'ON'TOS;                                             <<d7738>>31500000
   tos := tos + (OBJID(ObjIDNumField) * CDT'ENTRY'SIZE) +      <<d7738>>31505000
          CDT'MD'FLAGS;                                        <<d7738>>31510000
   ASMB(LSEA);   << Load domain flags on tos >>                <<d7738>>31515000
   tos.(CDT'IMO'BIT:1) := 1;                                   <<d7738>>31520000
   ASMB(SSEA;DDEL);  << Store back flags word >>               <<d7738>>31525000
   IF <> << IMO bit was set beforehand >>                      <<d7738>>31530000
   THEN SUDDENDEATH(SFKernCachesyncbad);                       <<06212>>31535000
   END;                                                        <<06212>>31540000
                                                               <<06212>>31545000
<<RECORD THE WRITE REQ POINTER IN THE REGION HEADER>>          <<06212>>31550000
                                                               <<06212>>31555000
TOS:=REGIONBASE;                                               <<06212>>31560000
TOS:=TOS+RBTOWREQPDISP;                                        <<06212>>31565000
TOS:=DISCREQINX;                                               <<06212>>31570000
ASMB(SSEA);                                                    <<06212>>31575000
                                                               <<06212>>31580000
                                                               <<06212>>31585000
<<LOG THE WRITE INITIATION EVENT>>                             <<06212>>31590000
                                                                        31595000
MSTATPARM4 := LDEV;                                            <<06948>>31600000
MSTATPARM4.(0:1) := 1;   << Write >>                           <<06948>>31605000
MMSTAT'(MMSTATSEGIOINIT,OBJID(OBJIDDESCFIELD),                 <<06948>>31610000
       OBJID(OBJIDNUMFIELD),DISCREQINX,MSTATPARM4,0,0);        <<06948>>31615000
                                                               <<06212>>31620000
<<QUEUE THE WRITE REQUEST>>                                    <<06212>>31625000
                                                               <<06212>>31630000
QueueDiscReq(discreqinx,IF (objid(OBJIDTYPEFIELD)=OBJIDCDTYPE  <<06945>>31635000
             LAND ldr'serial'post) THEN serwq ELSE ditreqq,    <<06945>>31640000
             lpdt(ldev&lsl(2) +lpdt'ditp));                    <<06945>>31645000
                                                               <<06212>>31650000
END  <<PROCEDURE STARTOBJWRITE>>;                              <<06212>>31655000
                                                                        31660000
$PAGE "I/O INTERFACE PROCEDURES : PROCESS INITIATION MESSAGE"           31665000
PROCEDURE PROCESSINITMSG(REGIONBASE);                                   31670000
VALUE REGIONBASE;                                                       31675000
DOUBLE REGIONBASE;                                                      31680000
OPTION PRIVILEGED,UNCALLABLE;                                           31685000
                                                                        31690000
COMMENT                                                                 31695000
                                                                        31700000
THIS PROCEDURE EXAMINES THE INITIATION MESSAGE IN THE REGION            31705000
HEADER TO SEE IF THE ACTION FOR WHICH THE REGION WAS RESERVED           31710000
MAY BE INITIATED.  IF THE REGION IS FREE OF ON-GOING I/O, AND           31715000
THE ACTION IS NOT EXTERNALLY DISABLED (DUE TO THE DISC COPY             31720000
NOT YET BEING CURRENT) THEN THE APPROPRIATE ACTION (REQUEST             31725000
A MOVE OR QUEUE A READ) IS TAKEN.                                       31730000
                                                                        31735000
;                                                                       31740000
                                                                        31745000
BEGIN                                                                   31750000
                                                                        31755000
INTEGER RESREGSIZE,                                                     31760000
        drq'entry'index,                                       <<06392>>31765000
        REQP,                                                           31770000
        ORIGREGSIZE,                                                    31775000
        NEWREGSIZE;                                                     31780000
DOUBLE RELREGBASE;                                             <<06660>>31785000
DOUBLE OBJ;                                                    <<06660>>31790000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>31795000
LOGICAL INITMSG,                                               <<06212>>31800000
        TIMEFORCOMPMSG:=FALSE;                                 <<06212>>31805000
                                                               <<06212>>31810000
                                                                        31815000
TOS := REGIONBASE;                                             <<01571>>31820000
TOS := TOS + RBTOOBJIDENTDISP;                                 <<06212>>31825000
ASMB(LDEA);            <<GRAB OBJIDENT FROM REGION HEADER>>    <<06660>>31830000
OBJ := TOS;                                                    <<06660>>31835000
TOS:=REGIONBASE;                                                        31840000
TOS:=TOS+RBTOINITMSGDISP;                                               31845000
DISABLE;                                                                31850000
ASMB(LSEA);                                                             31855000
INITMSG:=TOS;                                                           31860000
IF INITMSG.INITMSGTOGGLESWITCH THEN SUDDENDEATH(613);          <<01644>>31865000
IF NOT INITMSG.MSGEXTDISABLEDFLAG THEN                                  31870000
   BEGIN                                                                31875000
   IF NOT INITMSG.MSGONGOINGIODISABLEDFLAG THEN                         31880000
      BEGIN                                                             31885000
      IF INITMSG.MSGVALIDYETFLAG THEN                                   31890000
         BEGIN   <<MESSAGE IS READY TO GO>>                             31895000
         INITMSG.INITMSGTOGGLESWITCH:=1;                                31900000
         TOS:=INITMSG;                                                  31905000
         TOS.INITMSGRELRESPAGESFLAG:=0; <<CLEAR SEMAPHORE>>             31910000
         ASMB(SSEA);                                                    31915000
         IF INITMSG.QUEUEREADREQFLAG THEN                               31920000
            BEGIN <<START UP THE READ>>                        <<06212>>31925000
            ENABLE;                                                     31930000
            TIMEFORCOMPMSG:=FALSE;                             <<06212>>31935000
            TOS:=TOS+INITMSGTOINITINFODISP;                             31940000
            ASMB(LSEA);                                                 31945000
            DRQ'ENTRY'INDEX:=REQP:=TOS;                        <<06392>>31950000
            MMSTAT'(MMSTATSEGIOINIT,OBJIDENT(OBJIDDESCFIELD),  <<06948>>31955000
                   OBJIDENT(OBJIDNUMFIELD),REQP,DRQ'LDEV,0,0); <<06948>>31960000
            QUEUEDISCREQ                                       <<06660>>31965000
               (REQP,DITREQQ,LPDT(DRQ'LDEV&LSL(2)+LPDT'DITP)); <<06675>>31970000
            END                                                <<06212>>31975000
         ELSE IF INITMSG.INITMSGSTARTCOMPFLAG                  <<06212>>31980000
              THEN TIMEFORCOMPMSG := TRUE;                     <<06212>>31985000
                                                                        31990000
         <<                                                             31995000
         FIX HEADER, CHECK IF SOME PAGES SHOULD BE RELEASED             32000000
         >>                                                             32005000
                                                                        32010000
         TOS:=REGIONBASE;                                               32015000
         TOS:=TOS+RBTORPAGECNTDISP;                                     32020000
         ASMB(LSEA);                                                    32025000
         RESREGSIZE:=TOS;                                               32030000
         TOS:=0;                                                        32035000
         ASMB(SSEA);                                                    32040000
         INITMSG.INITMSGRELRESPAGESFLAG:=0;                             32045000
         IF <> THEN                                                     32050000
            BEGIN                                                       32055000
            IF RESREGSIZE=0 THEN SUDDENDEATH(612);             <<01644>>32060000
            END                                                         32065000
         ELSE IF RESREGSIZE<>0 THEN SUDDENDEATH(612);          <<01644>>32070000
                                                                        32075000
         <<FIX UP SELECTED REGION'S HEADER AND TRAILER>>                32080000
                                                                        32085000
         TOS:=TOS+RPAGECNTTORSDISP;                                     32090000
         ASMB(LSEA);                                                    32095000
         ORIGREGSIZE:=S0;                                               32100000
         TOS:=TOS-RESREGSIZE;                                           32105000
         NEWREGSIZE:=S0;                                                32110000
         ASMB(SSEA);                                                    32115000
         TOS:=TOS+RSTOSSDISP;                                           32120000
         TOS:=NEWREGSIZE;                                               32125000
         ASMB(SSEA);                                                    32130000
         TOS:=TOS+SSTOPTRASDISP+NEWREGSIZE&LSL(PAGEPOWER);              32135000
         TOS:=REGRESERVEDCODE;                                          32140000
         ASMB(SSEA);                                                    32145000
         TOS:=TOS+TRASTOTRSDISP;                                        32150000
         TOS:=NEWREGSIZE;                                               32155000
         ASMB(SSEA);                                                    32160000
         TOS:=TOS+TRSTOTSSDISP;                                         32165000
         TOS:=NEWREGSIZE;                                               32170000
         ASMB(SSEA);                                                    32175000
                                                                        32180000
         <<                                                             32185000
         RELEASE EXTRA PAGES OFF END OF REGION                          32190000
         >>                                                             32195000
                                                                        32200000
         IF RESREGSIZE <> 0 THEN                                        32205000
            BEGIN                                                       32210000
                                                                        32215000
            <<FIX UP RELEASE REGION HEADER AND TRAILER>>                32220000
                                                                        32225000
            TOS:=REGIONBASE;                                            32230000
            TOS:=TOS+NEWREGSIZE&LSL(PAGEPOWER);                         32235000
            ASMB(DDUP);                                                 32240000
            RELREGBASE:=TOS;                                            32245000
            TOS:=TOS+RBTORASDISP;                                       32250000
            TOS:=REGRESERVEDCODE;                                       32255000
            ASMB(SSEA);                                                 32260000
            TOS:=TOS+RASTOSSDISP;                                       32265000
            TOS:=RESREGSIZE;                                            32270000
            ASMB(SSEA);                                                 32275000
            TOS:=TOS+SSTORSDISP;                                        32280000
            TOS:=RESREGSIZE;                                            32285000
            ASMB(SSEA);                                                 32290000
            TOS:=TOS+RSTOOBJIDENTDISP;                         <<06212>>32295000
            TOS :=0D;                                          <<06660>>32300000
            ASMB(SDEA);                                        <<06660>>32305000
            TOS:=TOS+OBJIDENTTOPTSSDISP+RESREGSIZE             <<06212>>32310000
                        &LSL(PAGEPOWER);                       <<06212>>32315000
            TOS:=RESREGSIZE;                                            32320000
            ASMB(SSEA);                                                 32325000
            TOS:=TOS+TSSTOTRASDISP;                                     32330000
            TOS:=REGRESERVEDCODE;                                       32335000
            ASMB(SSEA);                                                 32340000
            TOS:=TOS+TRASTOTRSDISP;                                     32345000
            TOS:=RESREGSIZE;                                            32350000
            ASMB(SSEA);                                                 32355000
            TOS:=RELREGBASE;                                            32360000
            SENDMSG(SCHEDPIN,RELREGREQPORT,2,0);                        32365000
            END;                                                        32370000
                                                               <<06212>>32375000
         IF TIMEFORCOMPMSG THEN                                <<06212>>32380000
            BEGIN<<NO READ NEEDED-BETTER BE A VIRGIN MAPPED D>><<06212>>32385000
            IF OBJIDENT(ObjIDTypeField)<> ObjIdCDtype          <<07320>>32390000
            OR OBJIDENT(ObjIDnumField)= 0                      <<06660>>32395000
            THEN SUDDENDEATH(SFKERNCACHEINTBAD);               <<06212>>32400000
            PROCESSCOMPMSG(REGIONBASE,OBJ,0,IOSTATUSOK);       <<06660>>32405000
            END;                                               <<06212>>32410000
         END;                                                           32415000
      END;                                                              32420000
   END;                                                                 32425000
END  <<PROCEDURE PROCESSINITMSG>>;                                      32430000
$PAGE "I/O INTERFACE PROCEDURES : OBJECT WRITE COMPLETOR"      <<06212>>32435000
                                                                        32440000
PROCEDURE OBJWRITECOMPLETOR(REQP);                             <<06212>>32445000
VALUE REQP;                                                             32450000
INTEGER REQP;                                                           32455000
OPTION PRIVILEGED,UNCALLABLE;                                           32460000
                                                                        32465000
                                                                        32470000
COMMENT                                                                 32475000
                                                                        32480000
THIS PROCEDURE IS CALLED FROM THE DISC MONITOR (SIODM)                  32485000
WHEN A OBJECT WRITE ON BEHALF OF MEMORY MANAGEMENT             <<06212>>32490000
HAS COMPLETED. IF THE REGION CONTAINING THE WRITTEN                     32495000
OBJECT HAS BEEN CLEARED, AND THE REGION'S ON-GOING             <<06212>>32500000
I/O COUNT FALLS TO ZERO AS A RESULT OF THIS WRITE                       32505000
COMPLETION, PROCESSINITMSG IS CALLED TO START UP                        32510000
THE ACTIVITY FOR WHICH THE REGION WAS CLEARED. IF                       32515000
ANOTHER REGION HAS BEEN RESERVED FOR THE OBJECT WHICH          <<06212>>32520000
WAS WRITTEN OUT, THE READ IS ENABLED AND PROCESSINITMSG                 32525000
IS CALLED TO GET IT STARTED.                                            32530000
                                                                        32535000
;                                                                       32540000
                                                                        32545000
                                                                        32550000
BEGIN                                                                   32555000
                                                                        32560000
                                                                        32565000
DEFINE                                                         <<07320>>32570000
   DRQ'ABORT'FLAG = FLAGS.(0:1)#;                              <<07320>>32575000
                                                               <<07320>>32580000
DOUBLE REGIONBASE,                                             <<06660>>32585000
        OBJ;                                                   <<06660>>32590000
                                                               <<d7738>>32595000
DOUBLE MAPD'ABS'ADDR;  << Abs addr of mapped domain entry >>   <<d7738>>32600000
                                                               <<d7738>>32605000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>32610000
INTEGER                                                        <<06212>>32615000
        IOPIN,                                                 <<06411>>32620000
        CURRENTPIN,                                            <<06411>>32625000
        LDR'ENTRY'INDEX,                                       <<06411>>32630000
        drq'entry'index,                                       <<06392>>32635000
        OLDCDTIMOFLAG,                                         <<06212>>32640000
        OLDCDTXFERSTATUS,                                      <<06212>>32645000
        OLDCDTFWIPFLAG,                                        <<06212>>32650000
        CDTENTRYNUMBER,                                        <<06212>>32655000
        STINX,                                                 <<06212>>32660000
        XFERSTATUS;                                            <<06212>>32665000
                                                               <<06212>>32670000
                                                               <<06212>>32675000
LOGICAL FORCEDWRITE,                                           <<06212>>32680000
        DATASEG',                                              <<06613>>32685000
        SENDMSGFLAGS,                                          <<06212>>32690000
        imi:= FALSE,                                           <<06411>>32695000
        FLAGS;                                                 <<06212>>32700000
DOUBLE newregionbase;                                          <<06411>>32705000
                                                                        32710000
<< *** DB ASSUMED TO BE AT SYSDB *** >>                        <<06212>>32715000
                                                                        32720000
<<                                                                      32725000
INITIALIZE LOCAL VARIABLES FROM DISC REQ INFO                           32730000
>>                                                                      32735000
                                                               <<06212>>32740000
drq'entry'index :=REQP;                                        <<06392>>32745000
TOS:=DRQ'BUFDST;   <<REGIONBASE>>                              <<06392>>32750000
TOS:=DRQ'BUFADR;                                               <<06392>>32755000
TOS:=DRQ'SEGDISP;                                              <<06392>>32760000
IF = THEN ASMB(DEL) ELSE ASMB(SUB); <<REGION BASE>>            <<06212>>32765000
REGIONBASE:=TOS;                                               <<06212>>32770000
OBJIDENT(OBJIDDESCFIELD) := DRQ'SEGID1;                        <<06941>>32775000
OBJIDENT(OBJIDNUMFIELD) := DRQ'SEGID2;                         <<06941>>32780000
IF OBJIDENT(ObjIDTypeField)<> OBJIDDATATYPE                    <<06660>>32785000
AND OBJIDENT(ObjIDTypeField) <> ObjIdCDtype                    <<07320>>32790000
THEN SUDDENDEATH(SFKERNBADPARM);                               <<06212>>32795000
                                                               <<06212>>32800000
IF OBJIDENT(ObjIDTypeField)=OBJIDCDTYPE THEN                   <<06660>>32805000
   BEGIN                                                       <<06212>>32810000
   DATASEG' := FALSE;                                          <<06613>>32815000
   CDTENTRYNUMBER := OBJIDENT(ObjIDNumField);                  <<d7738>>32820000
   CDT'ABS'ON'TOS;                                             <<d7738>>32825000
   tos := tos + (CDTENTRYNUMBER * CDT'ENTRY'SIZE);             <<d7738>>32830000
   MAPD'ABS'ADDR := tos;                                       <<d7738>>32835000
   << Reload index register for REQP addressing >>             <<d7738>>32840000
   X := REQP;                                                  <<d7738>>32845000
   END                                                         <<06212>>32850000
ELSE                                                           <<06212>>32855000
   BEGIN                                                       <<06212>>32860000
   DATASEG' := TRUE;                                           <<06613>>32865000
   STINX:=OBJIDENT(ObjIDnumField)&LSL(2);  <<STINX>>           <<06660>>32870000
   END;                                                        <<06212>>32875000
XFERSTATUS := DRQ'STAT;                                        <<06392>>32880000
FLAGS:=DRQ'FLAGS; <<LOCAL VARIABLE FLAGS>>                     <<06392>>32885000
                                                               <<06212>>32890000
<<LOG WRITE COMPLETION EVENT>>                                 <<06212>>32895000
                                                               <<06212>>32900000
MMSTAT'(MMSTATSEGIODONE,OBJIDENT(OBJIDDESCFIELD),              <<06948>>32905000
       OBJIDENT(OBJIDNUMFIELD),REQP,%100000,0,0);              <<06948>>32910000
                                                               <<06212>>32915000
<<HANDLE THE CASE OF A DATASEG TRANSFER FAILURE>>              <<06212>>32920000
                                                               <<06212>>32925000
IF XFERSTATUS <> IOSTATUSOK                                    <<06945>>32930000
THEN SUDDENDEATH (SFKERNDATASEGWRITEFAIL);                     <<06212>>32935000
                                                               <<06212>>32940000
<<                                                                      32945000
RELEASE THE DISC REQUEST ELEMENT                                        32950000
>>                                                                      32955000
                                                               <<06212>>32960000
IF DATASEG' THEN                                               <<06613>>32965000
   BEGIN  <<RETURN DISC REQ ENTRY>>                            <<06212>>32970000
   TOS:=REQP;  <<FAKE THE PTR PARM>>                           <<06212>>32975000
   RETURNDISCREQ(*);                                           <<06212>>32980000
   END;                                                        <<06212>>32985000
                                                               <<06411>>32990000
                                                               <<06212>>32995000
<<                                                                      33000000
DESTROY REFERENCE TO WRITE REQUEST INDEX IN REGION HEADER               33005000
>>                                                                      33010000
                                                               <<06212>>33015000
TOS:=REGIONBASE;                                                        33020000
TOS:=TOS+RBTOWREQPDISP;                                                 33025000
ASMB(LSEA);                                                             33030000
IF TOS <> REQP AND NOT DRQ'ABORT'FLAG                          <<07320>>33035000
THEN SUDDENDEATH(613);                                         <<01644>>33040000
TOS:=0;                                                                 33045000
IF NOT DRQ'ABORT'FLAG THEN                                     <<07320>>33050000
ASMB(SSEA;DDEL);  <<IF ABORTED, FIELD REUSED SO DON'T ZAP>>    <<06212>>33055000
IF NOT DRQ'ABORT'FLAG THEN                                     <<07320>>33060000
   BEGIN  <<WRITE WASN'T CALLED OFF>>                                   33065000
                                                               <<06212>>33070000
   <<INDICATE IN DESCRIPTOR THAT WRITE HAS COMPLETED>>         <<06212>>33075000
                                                               <<06212>>33080000
   IF NOT DATASEG' THEN                                        <<06613>>33085000
      BEGIN <<CLEAR IN MOTION OUT BIT IN CDT ENTRY>>           <<06212>>33090000
      tos := MAPD'ABS'ADDR;                                    <<d7738>>33095000
      tos := tos + CDT'MD'FLAGS;                               <<d7738>>33100000
      ASMB(LSEA);                                              <<d7738>>33105000
      tos.(CDT'IMO'BIT:1) := 0;                                <<d7738>>33110000
      if = then SUDDENDEATH(SFKernCacheSYNCBAD);               <<d7738>>33115000
      ASMB(SSEA;DDEL);  << Store back flags word >>            <<d7738>>33120000
      END                                                      <<06212>>33125000
   ELSE                                                        <<06212>>33130000
      BEGIN  <<SET DISC COPY VALID FLAG IN DST ENTRY>>         <<06212>>33135000
      DST(STINX+1).DISCCOPYVALIDFLAG:=1;                       <<06212>>33140000
      IF <> THEN SUDDENDEATH(613);                             <<06212>>33145000
      END;                                                     <<06212>>33150000
                                                               <<06212>>33155000
   <<                                                                   33160000
   INITIATE ACTION PENDING ON THIS WRITE COMPLETION                     33165000
   >>                                                                   33170000
                                                               <<06212>>33175000
   <<CHECK FOR IMI OBJECT>>                                    <<06411>>33180000
                                                               <<06411>>33185000
   IF NOT DATASEG' THEN                                        <<06613>>33190000
      BEGIN <<mapped domain>>                                  <<06411>>33195000
      tos := MAPD'ABS'ADDR;                                    <<d7738>>33200000
      EXCHDB;                                                  <<d7738>>33205000
      IF CDT'ARRAY(CDT'MD'FLAGS).(CDT'IMI'BIT:1) = 1 THEN      <<d7738>>33210000
         BEGIN <<it's on its way in somewhere>>                <<06411>>33215000
         NEWREGIONBASE:=CDT'DARRAY(CDT'MD'MEM'ADDR & asr(1));  <<d7738>>33220000
                                                               <<d7738>>33225000
         imi:=TRUE;                                            <<06411>>33230000
         END;                                                  <<06411>>33235000
      EXCHDB;  << Back to original DB >>                       <<d7738>>33240000
      ASMB(DDEL);  << Get rid of abs address >>                <<d7738>>33245000
      end;                                                     <<d7738>>33250000
   IF DATASEG' THEN                                            <<06613>>33255000
      BEGIN <<CHECK FOR READ OF DATASEG INTO OTHER REGION>>    <<06212>>33260000
                                                               <<06212>>33265000
   <<CHECK FOR A PENDING READ OF THE DATA SEGMENT INTO ANOTHER><<06212>>33270000
   <<MEMORY REGION.  THIS HAPPENS WHEN THE DATA SEGMENT WAS ON><<06212>>33275000
   <<ITS WAY OUT BUT NOT RECOVERABLE SINCE THE MEMORY REGION  ><<06212>>33280000
   <<IT WAS SITTING IN WAS RESERVED FOR SOMETHING ELSE, BUT   ><<06212>>33285000
   <<THE SEGMENT WAS NEEDED AGAIN SO A DIFFERENT REGION WAS   ><<06212>>33290000
   <<RESERVED FOR IT AND THE READ TO THAT REGION IS WAITING   ><<06212>>33295000
   <<THIS WRITE TO COMPLETE. (A LONG SENTENCE,HUH?).          ><<06212>>33300000
                                                               <<06212>>33305000
   X:=STINX+DSTSYSBASEINX;<<FOR DIRECT ACCESS TO DESCRIPTOR>>           33310000
   TOS:=SEGDESCFLAGS;                                                   33315000
                                                               <<06212>>33320000
   <<SEE IF SEG IS IN MOTION IN, I.E., A READ INTO A DIFFERENT          33325000
     REGION FOR THE SEG IS PENDING, WAITING FOR THE DISK COPY TO        33330000
     BECOME VALID.  IF SO, TRY TO GET THE READ STARTED.>>               33335000
   ASMB(TBC IMIBIT); <<IN MOTION IN FLAG>>                              33340000
   SEGDESCFLAGS:=TOS;                                                   33345000
   IF <> THEN                                                           33350000
      BEGIN<<A DIFFERENT REGION HAS BEEN RESERVED FOR THE SEG>>         33355000
      TOS:=SEGDESCBANK;                                                 33360000
      TOS:=SEGDESCADDR;                                                 33365000
      newregionbase:=TOS;                                      <<06411>>33370000
      imi:=TRUE;                                               <<06411>>33375000
      END;                                                     <<06411>>33380000
   END;                                                        <<06411>>33385000
   IF imi THEN                                                 <<06411>>33390000
      BEGIN                                                    <<06411>>33395000
      TOS := newregionbase;                                    <<06411>>33400000
      IF XFERSTATUS <> IOSTATUSOK THEN                         <<06212>>33405000
         BEGIN <<WRITE TO DISC FAILED>>                        <<06212>>33410000
                                                               <<06212>>33415000
         <<RELEASE NEW REGION AND ABORT WAITING PROCS>>        <<06212>>33420000
                                                               <<06212>>33425000
         UNDEFEROBJSMPQ(REGIONBASE,OBJ,XFERSTATUS);            <<06660>>33430000
         SENDMSG(SCHEDPIN,RELREGREQPORT,2,0);                           33435000
         SUDDENDEATH(SFKernNotSupported);<<SHOULD RECOVER SOFT><<06212>>33440000
         ENABLE;                                                        33445000
         END                                                            33450000
      ELSE                                                              33455000
         BEGIN  <<ENABLE READ>>                                         33460000
         DISABLE;                                              <<07320>>33465000
         TOS:=TOS+RBTOINITMSGDISP;                                      33470000
         ASMB(LSEA);                                                    33475000
         TOS.MSGEXTDISABLEDFLAG:=0;                                     33480000
         ASMB(SSEA);                                                    33485000
         TOS:=TOS+INITMSGTORBDISP;                                      33490000
         PROCESSINITMSG(*);                                             33495000
         END;                                                           33500000
      END;                                                              33505000
                                                               <<06411>>33510000
   <<NOW CHECK IF THE REGION IN WHICH THIS DATASEG OR MAPPED >><<06212>>33515000
   <<DISC DOMAIN IS SITTING HAS BEEN RESERVED FOR SOMETHING  >><<06212>>33520000
                                                                        33525000
   IF DATASEG' THEN                                            <<06613>>33530000
      BEGIN  <<CLEAR FORCED WRITE FLAG IN DST ENTRY>>          <<06212>>33535000
      DST(STINX+1).FWIPFLAG := 0;                              <<06212>>33540000
      IF <> THEN FORCEDWRITE := TRUE ELSE FORCEDWRITE := FALSE;<<06212>>33545000
      END                                                      <<06212>>33550000
   ELSE                                                        <<06212>>33555000
      BEGIN                                                    <<06212>>33560000
      tos := MAPD'ABS'ADDR;                                    <<d7738>>33565000
      tos := tos + CDT'MD'FLAGS;                               <<d7738>>33570000
      ASMB(LSEA);  << Load domain's flags word >>              <<d7738>>33575000
      tos.(CDT'FWIP'BIT:1) := 0;                               <<d7738>>33580000
      ASMB(SSEA;DDEL);  << Store back flags word >>            <<d7738>>33585000
      IF <> << FWIP was 1 >>                                   <<d7738>>33590000
      THEN FORCEDWRITE := TRUE                                 <<06212>>33595000
      ELSE FORCEDWRITE := FALSE;                               <<06212>>33600000
      END;                                                     <<06212>>33605000
                                                               <<06212>>33610000
   TOS:=REGIONBASE;                                                     33615000
                                                               <<06212>>33620000
   IF NOT FORCEDWRITE THEN TOS:=TOS+RBTOSDDISP ELSE            <<06212>>33625000
      BEGIN <<NOT AN OC, SO ZERO OBJIDENT IN REG HEAD>>        <<06212>>33630000
      TOS:=TOS+RBTORASDISP;                                             33635000
      ASMB(LSEA);                                                       33640000
      TOS.REGRESERVEDFLAG:=0; <<SET IF FIRST SUBREGION>>       <<06212>>33645000
      ASMB(DEL);                                                        33650000
      IF <> THEN TOS:=TOS+RASTOSDDISP ELSE                              33655000
         BEGIN <<THERE AREN'T TWO OBJID CELLS IN REG HEAD>>    <<06212>>33660000
               <<SO THAT IF RESERVED, THE NEW OBJID IS THERE>> <<06212>>33665000
         TOS:=TOS+RASTOOBJIDENTDISP;                           <<06212>>33670000
         TOS:=0D;                                              <<06660>>33675000
         ASMB(SDEA);  <<ZAP THE INDICATION THAT IT WAS HERE>>  <<06660>>33680000
         TOS:=TOS+OBJIDENTTOSDDISP;                            <<06212>>33685000
         END;                                                           33690000
      END;                                                              33695000
                                                               <<06212>>33700000
   <<SEE IF PART OF A CLEANED REGION>>                                  33705000
                                                               <<06212>>33710000
   DISABLE;                                                             33715000
   ASMB(LSEA);                                                          33720000
   TOS.SDVALIDFLAG:=0;                                                  33725000
   IF <> THEN                                                           33730000
      BEGIN  <<SUBREGION MAY HAVE BEEN CLEANED. FLIP TO START>><<06212>>33735000
             <<OF REGION AND DECREMENT IT'S ONGOING I/O COUNT>><<06212>>33740000
             <<IF A RESERVED REGION>>                          <<06212>>33745000
                                                               <<06212>>33750000
      TOS:=TOS&LSL(PAGEPOWER);                                          33755000
      ASMB(SUB);                                                        33760000
      TOS:=TOS+SDTORASDISP;                                    <<06212>>33765000
      ASMB(LSEA);                                              <<06212>>33770000
      TOS.REGRESERVEDFLAG:=0;                                  <<06212>>33775000
      IF <> THEN                                               <<06212>>33780000
         BEGIN  <<REGION IS RESERVED>>                         <<06212>>33785000
         ASMB(DEL);                                            <<06212>>33790000
         TOS:=TOS+RASTOIOCNTDISP;                              <<06212>>33795000
         ASMB(LSEA);                                           <<06212>>33800000
         IF <= THEN SUDDENDEATH(613); <<DIDN'T WAIT>>          <<06212>>33805000
         TOS:=TOS-1;                                           <<06212>>33810000
         ASMB(SSEA);                                           <<06212>>33815000
         IF = THEN                                             <<06212>>33820000
            BEGIN  <<REGION IS FREE OF ONGOING INTERNAL I/O>>  <<06212>>33825000
                                                               <<06212>>33830000
            <<START PROCESSING FOR THE READ INTO THIS REGION>> <<06212>>33835000
                                                               <<06212>>33840000
            TOS:=TOS+IOCNTTOINITMSGDISP;                       <<06212>>33845000
            ASMB(LSEA);                                        <<06212>>33850000
            TOS.MSGONGOINGIODISABLED:=0;                       <<06212>>33855000
            ASMB(SSEA);                                        <<06212>>33860000
            TOS:=TOS+INITMSGTORBDISP;                          <<06212>>33865000
            PROCESSINITMSG(*);                                 <<06212>>33870000
            END;                                               <<06212>>33875000
         END;                                                  <<06212>>33880000
      END;                                                     <<06212>>33885000
   END;                                                        <<06212>>33890000
                                                               <<06212>>33895000
<<INVOKE CACHE WRITE COMPLETOR FOR MAPPED DISC DOMAINS>>       <<06212>>33900000
                                                               <<06212>>33905000
IF NOT DATASEG' THEN                                           <<06613>>33910000
   BEGIN <<SEND DISP WRITE COMP MSG>>                          <<06212>>33915000
   TOS:=CDTENTRYNUMBER;                                        <<06411>>33920000
   TOS:=XFERSTATUS;                                            <<06212>>33925000
   TOS:=CACHEWRITEDONECODE;                                    <<06212>>33930000
   SENDMSGFLAGS:=0;                                            <<06212>>33935000
   IF CURPRC <> 0 THEN                                         <<06650>>33940000
      BEGIN <<DETERMINE WHETHER TO PREMPT OR NOT>>             <<06411>>33945000
      CURRENTPIN := (CURPRC)/PCBSIZE;                          <<06650>>33950000
      tos := MAPD'ABS'ADDR;                                    <<d7738>>33955000
      tos := tos + CDT'MD'LDR'HEAD;                            <<d7738>>33960000
      ASMB(LSEA;DELB,DELB);  << Load LDR head on mapped entry ><<d7738>>33965000
      IF (LDR'ENTRY'INDEX:=tos) <> 0 THEN BEGIN                <<d7738>>33970000
         IOPIN:=LDR'PCB;                                       <<06411>>33975000
         IF PROCESSPRI(IOPIN) >= PROCESSPRI(CURRENTPIN)        <<06411>>33980000
         THEN SENDMSGFLAGS.MSGDON'TPREEMPTFLAG:=1;             <<06411>>33985000
         END;                                                  <<06411>>33990000
      END;                                                     <<06411>>33995000
   SENDMSG(SCHEDPIN,CACHEMOVEPORT,3,SENDMSGFLAGS);             <<06212>>34000000
   END;                                                        <<06212>>34005000
                                                               <<06212>>34010000
END  <<PROCEDURE OBJWRITECOMPLETOR>>;                          <<06212>>34015000
                                                                        34020000
$PAGE "I/O INTERFACE PROCEDURES : PROCESS COMPLETION MESSAGE"  <<06212>>34025000
COMMENT                                                                 34030000
                                                                        34035000
PROCESSCOMPMSG IS CALLED TO PERFORM THE ACTIONS WHICH OCCUR    <<06212>>34040000
WHEN A SEGMENT OR MAPPED DISC DOMAIN BECOMES PRESENT.          <<06212>>34045000
                                                               <<06212>>34050000
THE REGION IN WHICH THE SEGMENT OR MAPPED DOMAIN RESIDES IS    <<06212>>34055000
MARKED ASSIGNED. THE SEGMENT OR MAPPED DOMAIN IS FLAGGED PRESEN<<06212>>34060000
FOR A SEG, PROCESSES AND DEVICES QUEUED ON THE SEGMENT'S MAKEPR<<06212>>34065000
ARE UNDEFERRED. DATASEGS ARE MARKED DIRTY, AND PNDG DISC REQUES<<06212>>34070000
AGAINST THEM ARE REINITIATED.  BREAKPOINTS ARE SET FOR CODE SEG<<06212>>34075000
                                                               <<06212>>34080000
FOR MAPPED DOMAINS, A MESSAGE IS SENT TO THE DISPATCHER INFORMI<<06212>>34085000
HIM OF THE ARRIVAL OF THE MAPPED DOMAIN AND REQUESTING THAT CAC<<06212>>34090000
MOVES AGAINST IT BE PERFORMED.                                 <<06212>>34095000
                                                               <<06212>>34100000
;                                                                       34105000
                                                                        34110000
PROCEDURE PROCESSCOMPMSG(REGIONBASE,OBJ,DESCSTINX,IOSTAT);     <<06660>>34115000
VALUE REGIONBASE,OBJ,DESCSTINX,IOSTAT;                         <<06660>>34120000
DOUBLE REGIONBASE;                                                      34125000
DOUBLE  OBJ;                                                   <<06660>>34130000
INTEGER DESCSTINX,IOSTAT;                                      <<06212>>34135000
OPTION PRIVILEGED,UNCALLABLE;                                  <<01696>>34140000
                                                                        34145000
BEGIN                                                                   34150000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>34155000
INTEGER NEXT,                                                           34160000
        IOPIN,                                                 <<06411>>34165000
        SLLHEADINX,                                            <<*8400>>34170000
        PCBPT,                                                 <<06650>>34175000
        CURRENTPIN,                                            <<06411>>34180000
        LDR'ENTRY'INDEX,                                       <<06411>>34185000
        SENDMSGFLAGS,                                          <<06411>>34190000
        REGIONSIZE,                                                     34195000
        BPTINX;                                                         34200000
                                                               <<d7738>>34205000
DOUBLE MAPD'ABS'ADDR;  << Abs addr of mapped domain entry >>   <<d7738>>34210000
                                                               <<d7738>>34215000
LOGICAL dataseg' := false,                                     <<06613>>34220000
        mappeddomain := FALSE,                                 <<06212>>34225000
        codeseg := FALSE;                                      <<06212>>34230000
                                                               <<06212>>34235000
                                                                        34240000
                                                                        34245000
SUBROUTINE MARKREGIONASSIGNED;                                          34250000
                                                                        34255000
BEGIN                                                                   34260000
TOS:=REGIONBASE;                                                        34265000
TOS:=TOS+RBTORASDISP;                                                   34270000
ASMB(LSEA);                                                             34275000
TOS.REGRESERVEDFLAG:=0;                                                 34280000
IF = THEN SUDDENDEATH(614);                                    <<01644>>34285000
TOS.REGASSIGNEDFLAG:=1;                                                 34290000
X:=S0;                                                                  34295000
ASMB(SSEA);                                                             34300000
TOS:=TOS+RASTORSDISP;                                                   34305000
ASMB(LSEA);                                                             34310000
REGIONSIZE:=S0;                                                         34315000
TOS:=TOS&LSL(PAGEPOWER)+RSTOPTRASDISP;<<DISP TO TRAS>>                  34320000
ASMB(ADD,LDXA;SSEA); <<MARK ASSIGENED IN REG TRAILER>>                  34325000
TOS:=TOS+TRASTOTRSDISP;                                                 34330000
ASMB(LSEA);                                                             34335000
IF TOS<>REGIONSIZE THEN SUDDENDEATH(614);                      <<01644>>34340000
TOS:=TOS+TRSTOTSSDISP;                                                  34345000
TOS:=REGIONSIZE;                                                        34350000
ASMB(SSEA;DDEL);                                                        34355000
END  <<SUBROUTINE MARKREGIONASSIGNED>>;                                 34360000
                                                               <<06212>>34365000
SUBROUTINE MarkPresentClearIMI;                                <<06212>>34370000
                                                               <<06212>>34375000
<< flags object as present and clears in motion in flag >>     <<06212>>34380000
                                                               <<06212>>34385000
BEGIN                                                          <<06212>>34390000
                                                               <<06212>>34395000
IF mappeddomain THEN                                           <<06212>>34400000
   BEGIN  <<a mapped domain>>                                  <<06212>>34405000
   tos := MAPD'ABS'ADDR;                                       <<d7738>>34410000
   tos := tos + CDT'MD'FLAGS;                                  <<d7738>>34415000
   ASMB(LSEA);     << Load mapped domain flags word >>         <<d7738>>34420000
   tos.(CDT'ABS'BIT:1) := 0;                                   <<d7738>>34425000
   if = then SUDDENDEATH(SFKernCacheSyncBad);                  <<d7738>>34430000
   tos.(CDT'IMI'BIT:1) := 0;                                   <<d7738>>34435000
   if = then SUDDENDEATH(SFKernCacheSyncBad);                  <<d7738>>34440000
   ASMB(SSEA;DDEL);   << Store back mapped domain flags >>     <<d7738>>34445000
   << Turn on reference bit in region header >>                <<*7564>>34450000
   tos := REGIONBASE;                                          <<*7564>>34455000
   tos := tos + RBTOSASDISP;                                   <<*7564>>34460000
   ASMB(LSEA);                                                 <<*7564>>34465000
   tos.REGREFFLAG := 1;                                        <<*7564>>34470000
   ASMB(SSEA;DDEL);                                            <<*7564>>34475000
   END                                                         <<06212>>34480000
ELSE                                                           <<06212>>34485000
   BEGIN  <<a Seg>>                                            <<06212>>34490000
   X:=DESCSTINX+DSTSYSBASEINX;                                 <<06212>>34495000
   SEGDESCFIRMINFO.ABSENTFLAG:=0;                              <<06212>>34500000
   IF = THEN SUDDENDEATH(613);                                 <<06212>>34505000
   SEGDESCFIRMINFO.REFERENCEDFLAG:=1;  <<TRY NOT DOING>>       <<06212>>34510000
   SEGDESCFLAGS.IMIFLAG:=0;                                    <<06212>>34515000
   IF =  THEN SUDDENDEATH(613);                                <<06212>>34520000
   END;                                                        <<06212>>34525000
                                                               <<06212>>34530000
END;  <<Subroutine MarkObjectPresent>>                         <<06212>>34535000
                                                               <<06212>>34540000
<<Initialize Local Variables>>                                 <<06212>>34545000
                                                               <<06212>>34550000
CASE objident(ObjIDTypeField) OF                               <<06660>>34555000
   BEGIN                                                       <<06660>>34560000
   DATASEG' := TRUE;                                           <<06660>>34565000
   CODESEG := TRUE;                                            <<06660>>34570000
   CODESEG := TRUE;                                            <<06660>>34575000
   MAPPEDDOMAIN := TRUE;                                       <<06660>>34580000
   END;                                                        <<06660>>34585000
                                                               <<06212>>34590000
<< If mapped domain, calculate entry's abs addr >>             <<d7738>>34595000
if MAPPEDDOMAIN then                                           <<d7738>>34600000
   begin                                                       <<d7738>>34605000
   CDT'ABS'ON'TOS;                                             <<d7738>>34610000
   tos := tos + (OBJIDENT(ObjIDNumField) * CDT'ENTRY'SIZE);    <<d7738>>34615000
   MAPD'ABS'ADDR := tos;                                       <<d7738>>34620000
   end;                                                        <<d7738>>34625000
                                                               <<d7738>>34630000
<<SET COMPLETION MESSAGE PROCESSED TOGGLE SWITCH>>             <<06212>>34635000
                                                               <<06212>>34640000
TOS:=REGIONBASE;                                                        34645000
TOS:=TOS+RBTOCOMPMSGDISP;                                               34650000
ASMB(LSEA);                                                             34655000
TOS.COMPMSGTOGGLESWITCH:=1;                                             34660000
IF <> THEN SUDDENDEATH(613);                                   <<01644>>34665000
ASMB(SSEA);                                                             34670000
                                                               <<06212>>34675000
<<RECORD ARRIVAL TIME OF THIS OBJECT >>                        <<06212>>34680000
                                                               <<06212>>34685000
TOS:=TOS+COMPMSGTOARRTIMEDISP;                                 <<06212>>34690000
TOS:=TIMER;                                                    <<06212>>34695000
ASMB(SDEA);                                                    <<06212>>34700000
                                                               <<06212>>34705000
<<MARK THE REGION ASSIGNED>>                                   <<06212>>34710000
                                                               <<06212>>34715000
MARKREGIONASSIGNED;                                                     34720000
                                                                        34725000
<<mark Object Present, Clear In Motion In Indicator>>          <<06212>>34730000
                                                               <<06212>>34735000
MarkPresentClearIMI;                                           <<06212>>34740000
                                                               <<06212>>34745000
                                                               <<06212>>34750000
                                                               <<06212>>34755000
<<SPECIAL HANDLING DEPENDING ON OBJECT TYPE>>                  <<06212>>34760000
                                                               <<06212>>34765000
                                                               <<06212>>34770000
IF mappeddomain THEN                                           <<06212>>34775000
   BEGIN  << Mapped disc domain >>                             <<d7738>>34780000
   tos := MAPD'ABS'ADDR;                                       <<d7738>>34785000
   tos := tos + CDT'MD'LDR'HEAD;                               <<d7738>>34790000
   ASMB(LSEA;DELB,DELB);   << Load LDR head to process >>      <<d7738>>34795000
   LDR'ENTRY'INDEX := tos;                                     <<d7738>>34800000
                                                               <<d7738>>34805000
   IF <> <<LDR'ENTRY'INDEX <> 0>> THEN                         <<d7738>>34810000
   BEGIN <<NOT A DEFERRED DISC REQUEST PENDING>>               <<06945>>34815000
   TOS := LDR'ENTRY'INDEX;                                     <<*8400>>34820000
   WHILE LDR'ENTRY'INDEX <> 0 DO                               <<*8400>>34825000
      BEGIN                                                    <<*8400>>34830000
      SLLHEADINX := LPCB(LDR'PCB*PCBSIZE+SLLIXWORDNUM);        <<*8400>>34835000
      IF SLL(SCHEDTOIOMSG).SLLIOCOMPTOAWAKECNT = 0 AND         <<*8400>>34840000
         NOT SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG AND               <<*8400>>34845000
         LPCB(LDR'PCB*PCBSIZE+WAKEMASKWORDNUM).                <<*8400>>34850000
                                       MEMORYWAITFLAG THEN     <<*8400>>34855000
         AWAKE(LDR'PCB*PCBSIZE,MEMORYWAITCODE,NOWAIT);         <<*8400>>34860000
      LDR'ENTRY'INDEX := LDR'NEXTQ;                            <<*8400>>34865000
      END;                                                     <<*8400>>34870000
   LDR'ENTRY'INDEX := TOS;                                     <<*8400>>34875000
   <<INFORM DISP OF PENDING CACHE MOVES>>                      <<06212>>34880000
   TOS := objident(ObjIDnumField);                             <<06660>>34885000
   TOS := IOSTAT;                                              <<06212>>34890000
   TOS := CACHEMOVEREADYCODE;                                  <<06212>>34895000
   SENDMSGFLAGS:=0;                                            <<06411>>34900000
   IF CURPRC <> 0 THEN                                         <<06650>>34905000
      BEGIN <<DETERMINE WHETHER TO PREMPT OR NOT>>             <<06411>>34910000
      CURRENTPIN := (CURPRC)/PCBSIZE;                          <<06650>>34915000
      IOPIN:=LDR'PCB;                                          <<06411>>34920000
      IF PROCESSPRI(IOPIN) >= PROCESSPRI(CURRENTPIN)           <<06411>>34925000
      THEN SENDMSGFLAGS.MSGDON'TPREEMPTFLAG:=1;                <<06411>>34930000
      END;                                                     <<06411>>34935000
   SENDMSG(SCHEDPIN,CACHEMOVEPORT,3,SENDMSGFLAGS);             <<06411>>34940000
   END;                                                        <<06945>>34945000
   END;                                                        <<06212>>34950000
                                                               <<06212>>34955000
IF dataseg' THEN                                               <<06613>>34960000
   BEGIN <<DATA SEGMENT>>                                               34965000
   DST(X:=DESCSTINX+1).DISCCOPYVALIDFLAG:=0; <<MARK DIRTY>>    <<06212>>34970000
   IF =  THEN SUDDENDEATH(613);                                <<06212>>34975000
   IF dqh'disahead <> 0                                        <<06392>>34980000
   THEN CheckForDeferredDiscreq(obj);                          <<06660>>34985000
   END;                                                                 34990000
                                                               <<06212>>34995000
                                                                        35000000
IF codeseg THEN                                                <<06212>>35005000
   BEGIN <<check for pending breakpoints>>                     <<06212>>35010000
   TOS := CURPRC;                                              <<06650>>35015000
   IF = THEN ASMB(DEL) ELSE                                             35020000
      BEGIN                                                             35025000
      PCBPT := CURPRC;                                         <<06650>>35030000
      TOS := BPTLINK;                                          <<06650>>35035000
      IF = THEN ASMB(DEL) ELSE                                          35040000
         BEGIN <<SEE IF CURRENT PROCESS HAS A BKPT IN OBJIDENT><<06212>>35045000
         BPTINX:=TOS;                                          <<MM.IV>>35050000
         SETSEGSBKPTS(OBJ,DESCSTINX,BPTINX);                   <<06660>>35055000
         END;                                                           35060000
      END;                                                              35065000
   IF SYS'BKPT THEN SETSEGSBKPTS(OBJ,DESCSTINX,                <<06660>>35070000
                                 SYS'BKPT'EXT'X);              <<MM.IV>>35075000
   END;                                                                 35080000
                                                                        35085000
<< UNDEFER WAITING PROCESSES AND DEVICES >>                    <<06212>>35090000
                                                               <<06212>>35095000
UNDEFEROBJSMPQ(REGIONBASE,OBJ,IOSTAT);                         <<06660>>35100000
                                                               <<06212>>35105000
END  <<PROCESSCOMPMSG>>;                                                35110000
                                                                        35115000
$PAGE "I/O INTERFACE PROCEDURES : OBJ READ COMPLETOR"          <<06212>>35120000
                                                                        35125000
PROCEDURE OBJREADCOMPLETOR(REQP);                              <<06212>>35130000
VALUE REQP;                                                             35135000
LOGICAL REQP;                                                           35140000
OPTION PRIVILEGED,UNCALLABLE;                                           35145000
                                                                        35150000
COMMENT                                                                 35155000
                                                                        35160000
THIS PROCEDURE IS CALLED FROM THE DISC MONITOR WHEN                     35165000
THE READ OF AN OBJECT ON BEHALF OF MEMORY MANAGEMENT           <<06212>>35170000
HAS BEEN COMPLETED.  IF THE OBJECT IS A DATA SEGMENT,          <<06212>>35175000
IT IS CHECKED IF AN INTERNAL MOVE IS REQUIRED, AND IF SO,      <<06212>>35180000
A MESSAGE IS SENT TO THE DISPATCHER TO PERFORM THE MOVE.       <<06212>>35185000
OTHERWISE, THE COMPLETION MESSAGE PROCESSOR IS INVOKED         <<06212>>35190000
TO PERFORM THE ACTIVITIES PENDING ON THE ARRIVAL OF THIS       <<06212>>35195000
OBJECT.                                                        <<06212>>35200000
                                                                        35205000
;                                                                       35210000
                                                                        35215000
                                                                        35220000
BEGIN                                                                   35225000
DOUBLE  REGIONBASE;                                            <<06212>>35230000
                                                               <<06212>>35235000
INTEGER REGIONBANK=REGIONBASE,                                 <<06212>>35240000
        REGIONADDR=REGIONBASE+1;                               <<06212>>35245000
                                                               <<06212>>35250000
DOUBLE  OBJ;                                                   <<06660>>35255000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>35260000
INTEGER STINX,                                                 <<06212>>35265000
        drq'entry'index,                                       <<06392>>35270000
        XFERSTATUS,                                            <<06212>>35275000
        XFERCOUNT,                                             <<06212>>35280000
        CDTENTRYNUM;                                           <<06212>>35285000
                                                               <<06212>>35290000
LOGICAL DATASEG' := FALSE,                                     <<06613>>35295000
                                                               <<06212>>35300000
        READABORTFLAG: = FALSE,                                <<06212>>35305000
        mappeddomain := FALSE;                                 <<06212>>35310000
                                                               <<06212>>35315000
<<GET INFO FROM I/O REQUEST ELEMENT                                     35320000
  AND INITIALIZE LOCAL VARIABLES>>                                      35325000
                                                                        35330000
drq'entry'index:=reqp;                                         <<06392>>35335000
TOS:=DRQ'BUFDST;                                               <<06392>>35340000
TOS:=DRQ'BUFADR;                                               <<06392>>35345000
TOS:=DRQ'SEGDISP;                                              <<06392>>35350000
IF = THEN ASMB(DEL) ELSE ASMB(SUB); <<REGION BASE>>                     35355000
REGIONBASE:=TOS;                                               <<06212>>35360000
OBJIDENT(OBJIDDESCFIELD) := DRQ'SEGID1;                        <<06941>>35365000
OBJIDENT(OBJIDNUMFIELD) := DRQ'SEGID2;                         <<06941>>35370000
IF OBJIDENT(ObjIDTypeField)=OBJIDCDTYPE THEN                   <<06660>>35375000
      BEGIN <<mapped domain arriving>>                         <<06212>>35380000
      mappeddomain := TRUE;                                    <<06212>>35385000
      CDTENTRYNUM:=OBJIDENT(ObjIDnumField);                    <<06660>>35390000
      END;                                                     <<06660>>35395000
                                                               <<06212>>35400000
IF OBJIDENT(ObjIDTypeField)=OBJIDDATATYPE THEN                 <<06660>>35405000
      BEGIN  <<data segment arriving>>                         <<06212>>35410000
      dataseg' := TRUE;                                        <<06613>>35415000
      STINX:=OBJIDENT(ObjIDnumField)&LSL(2)                    <<06660>>35420000
      END;                                                     <<06212>>35425000
IF OBJIDENT(ObjIDTypeField)=ObjIDslType or                     <<06660>>35430000
   OBJIDENT(ObjIDTypeField)=ObjIDpgmType THEN                  <<06660>>35435000
     STINX:=CONVSEGIDTOSTINX(obj); <<code seg>>                <<06660>>35440000
drq'entry'index:=reqp;                                         <<06392>>35445000
XFERSTATUS := DRQ'STAT;                                        <<06392>>35450000
XFERCOUNT := DRQ'COUNT;                                        <<06392>>35455000
IF LOGICAL(DRQ'ABORT)                                          <<06392>>35460000
THEN readabortflag := TRUE;                                    <<06212>>35465000
                                                               <<06212>>35470000
IF readabortflag THEN SuddenDeath(SFKernNotSupported);         <<06212>>35475000
                                                               <<06212>>35480000
                                                                        35485000
<<LOG SEGMENT READ COMPLETION EVENT>>                          <<06212>>35490000
                                                               <<06212>>35495000
MMSTAT'(MMSTATSEGIODONE,DRQ'SEGID1,DRQ'SEGID2,REQP,0,0,0);     <<06948>>35500000
                                                               <<06212>>35505000
<<KILL THE SYSTEM IF DISC READ OF SEGMENT FAILED>>             <<06212>>35510000
                                                               <<06212>>35515000
IF xferstatus <> iostatusok                                    <<06212>>35520000
AND NOT mappeddomain                                           <<06212>>35525000
THEN SuddenDeath(SFKernSegReadFail);                           <<06212>>35530000
                                                               <<06212>>35535000
<<stuff fetch iostatus into region header>>                    <<06212>>35540000
                                                               <<06212>>35545000
TOS:=regionbase;                                               <<06212>>35550000
TOS:=TOS+rbtosasdisp;                                          <<06212>>35555000
ASMB(LSEA);                                                    <<06212>>35560000
TOS.regfetchiostatus := xferstatus;                            <<06212>>35565000
ASMB(SSEA;DDEL);                                               <<06212>>35570000
                                                               <<06212>>35575000
<<RETURN DISK REQUEST ENTRY TO SYSTEM>>                        <<06212>>35580000
                                                               <<06212>>35585000
IF NOT MAPPEDDOMAIN THEN                                       <<06212>>35590000
   BEGIN  <<RETURN DISC REQ ENTRY>>                            <<06212>>35595000
   TOS:=REQP;  <<FAKE THE PTR PARM>>                           <<06212>>35600000
   RETURNDISCREQ(*);                                           <<06212>>35605000
   END;                                                        <<06212>>35610000
                                                               <<06212>>35615000
<<GET THINGS GOING THAT ARE WAITING FOR THIS READ TO COMPLETE>><<06212>>35620000
                                                               <<06212>>35625000
IF mappeddomain                                                <<06212>>35630000
THEN PROCESSCOMPMSG(REGIONBASE,OBJ,0,XFERSTATUS)               <<06660>>35635000
ELSE                                                           <<06212>>35640000
   BEGIN  <<seg read completion>>                              <<06212>>35645000
                                                               <<06212>>35650000
   <<CHECK FOR A PENDING INTERNAL MOVE FOR STACK EXP/CONT>>    <<06212>>35655000
   TOS:=REGIONBASE;                                                     35660000
   TOS:=TOS+RBTOCOMPMSGDISP;                                            35665000
   ASMB(LSEA);                                                          35670000
   TOS.COMPMSGMODFLAG:=0;                                               35675000
   IF = THEN PROCESSCOMPMSG(REGIONBASE,OBJ,STINX,XFERSTATUS)   <<06660>>35680000
   ELSE                                                        <<06212>>35685000
      BEGIN  <<MOD TO SEG REQUIRED BEFORE FLAGGED PRESENT>>             35690000
      TOS:=OBJ;                                                <<06660>>35695000
      SENDMSG(SCHEDPIN,SEGMODREADYPORT,2,0);                   <<06660>>35700000
      END;                                                              35705000
   END;                                                                 35710000
END   <<OBJREADCOMPLETOR>>;                                    <<06212>>35715000
$PAGE "Memory Allocation Procedures: TakeOffARL"               <<06945>>35720000
PROCEDURE TAKEOFFARL(ADDRESS,SIZE);                            <<06945>>35725000
VALUE ADDRESS,SIZE;                                            <<06945>>35730000
DOUBLE ADDRESS;                                                <<06945>>35735000
INTEGER SIZE;                                                  <<06945>>35740000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06945>>35745000
                                                               <<06945>>35750000
COMMENT                                                        <<06945>>35755000
                                                               <<06945>>35760000
TAKEOFFARL is called by RECOVEROC, MAKEOC, RESERVEREGION,      <<06945>>35765000
and RELEASEREGION to remove the region whose base is given     <<06945>>35770000
by the address parameter from the list of available regions.   <<06945>>35775000
                                                               <<06945>>35780000
DB is assumed to be at SYSDB.                                  <<06945>>35785000
                                                               <<06945>>35790000
The condition code is not affected by this procedure.          <<06945>>35795000
                                                               <<06945>>35800000
;                                                              <<06945>>35805000
                                                               <<06945>>35810000
   BEGIN                                                       <<06945>>35815000
   DOUBLE NEXTLINK,                                            <<06945>>35820000
          PREVLINK;                                            <<06945>>35825000
                                                               <<06945>>35830000
   IF SIZE > MAXAVAILREG THEN SUDDENDEATH(0);                  <<06945>>35835000
                                                               <<06945>>35840000
   HOLECOUNT := HOLECOUNT-1;                                   <<06945>>35845000
   IF < THEN SUDDENDEATH(619);                                 <<06945>>35850000
                                                               <<06945>>35855000
<< Look up addresses of prev hole and next link from header >> <<06945>>35860000
                                                               <<06945>>35865000
   TOS := ADDRESS;                                             <<06945>>35870000
   TOS := TOS+RBTOPLDISP;                                      <<06945>>35875000
   ASMB(LDEA);                                                 <<06945>>35880000
   PREVLINK := TOS;                                            <<06945>>35885000
   TOS := TOS+PLTONLDISP;                                      <<06945>>35890000
   ASMB(LDEA);                                                 <<06945>>35895000
   NEXTLINK := TOS;                                            <<06945>>35900000
   ASMB(DDEL);                                                 <<06945>>35905000
                                                               <<06945>>35910000
<< Take the region off the free hole list >>                   <<06945>>35915000
                                                               <<06945>>35920000
   IF PREVLINK <> 0D THEN                                      <<06945>>35925000
      BEGIN   << Region is not the first in the list. >>       <<06945>>35930000
                                                               <<06945>>35935000
<< Place next link into previous hole's next link >>           <<06945>>35940000
                                                               <<06945>>35945000
      TOS := PREVLINK;                                         <<06945>>35950000
      TOS := TOS+PLTONLDISP;                                   <<06945>>35955000
      TOS := NEXTLINK;                                         <<06945>>35960000
      ASMB(SDEA;DDEL);                                         <<06945>>35965000
                                                               <<06945>>35970000
<< Place Previnlist into next hole's Previous pointer >>       <<06945>>35975000
                                                               <<06945>>35980000
      IF NEXTLINK=0D THEN                                      <<06945>>35985000
         BEGIN   << That was the last hole in the list. >>     <<06945>>35990000
                                                               <<06945>>35995000
<< Update hole list tail and max avail region size >>          <<06945>>36000000
                                                               <<06945>>36005000
         TOS := PREVLINK;                                      <<06945>>36010000
         TOS := TOS + PLTONLDISP;                              <<06945>>36015000
         HOLELISTTAIL := TOS;                                  <<06945>>36020000
         TOS := PREVLINK;                                      <<06945>>36025000
         TOS := TOS+PLTORSDISP;                                <<06945>>36030000
         ASMB(LSEA);                                           <<06945>>36035000
         MAXAVAILREG := TOS;                                   <<06945>>36040000
         END                                                   <<06945>>36045000
      ELSE                                                     <<06945>>36050000
         BEGIN    << Not the last hole in the list >>          <<06945>>36055000
         TOS := NEXTLINK;                                      <<06945>>36060000
         TOS := TOS+NLTOPLDISP;                                <<06945>>36065000
         TOS := PREVLINK;                                      <<06945>>36070000
         ASMB(SDEA;DDEL);   << new Prev link for next in list ><<06945>>36075000
         END;                                                  <<06945>>36080000
      END                                                      <<06945>>36085000
   ELSE                                                        <<06945>>36090000
      BEGIN        << Removing first in list >>                <<06945>>36095000
      IF NEXTLINK = 0D THEN                                    <<06945>>36100000
         BEGIN     << System is out of holes. >>               <<06945>>36105000
         MAXAVAILREG := 0;                                     <<06945>>36110000
         HOLELISTTAIL := HOLELISTHEAD := 0D;                   <<06945>>36115000
         END                                                   <<06945>>36120000
      ELSE                                                     <<06945>>36125000
         BEGIN    << There's a hole after this one >>          <<06945>>36130000
                                                               <<06945>>36135000
<< Make next hole the new head. >>                             <<06945>>36140000
                                                               <<06945>>36145000
         HOLELISTHEAD := NEXTLINK;                             <<06945>>36150000
         TOS := NEXTLINK;                                      <<06945>>36155000
         TOS := TOS+NLTOPLDISP;                                <<06945>>36160000
         TOS := 0D;                                            <<06945>>36165000
         ASMB(SDEA;DDEL);   << erase previous link >>          <<06945>>36170000
         END;                                                  <<06945>>36175000
      END;                                                     <<06945>>36180000
   END;    << procedure TAKEOFFARL >>                          <<06945>>36185000
$PAGE "Memory allocation procedures: put on avail reg list"    <<06945>>36190000
$INCLUDE INCLPARL                                              <<06945>>36195000
                                                               <<06945>>36200000
                                                               <<06945>>36205000
                                                               <<06945>>36210000
$PAGE "MEMORY ALLOCATION PROCEDURES : RELEASE REGION "                  36215000
PROCEDURE RELEASEREGION(REGIONBASE,REQSIZE);                            36220000
VALUE REGIONBASE,REQSIZE;                                               36225000
DOUBLE REGIONBASE;                                                      36230000
INTEGER REQSIZE;                                                        36235000
OPTION PRIVILEGED,UNCALLABLE;                                           36240000
                                                                        36245000
COMMENT                                                                 36250000
                                                                        36255000
THIS PROCEDURE COMBINES THE REGION BEGINNING AT                         36260000
REGIONBASE WITH NEIGHBORING AVAILABLE REGIONS AND LINKS                 36265000
THE RESULTANT INTO THE APPROPRIATE AVAILABLE REGION LIST.               36270000
                                                                        36275000
;                                                                       36280000
                                                                        36285000
                                                                        36290000
BEGIN                                                                   36295000
                                                                        36300000
<<DB ASSUMED AT SYSDB ON ENTRY>>                                        36305000
                                                                        36310000
INTEGER RSIZEINPAGES,                                                   36315000
        SREG,                                                  <<06945>>36320000
        ZREG,                                                  <<06945>>36325000
        TURNEDOFFSIZE:=0;                                               36330000
DOUBLE TRAILERADDR,                                                     36335000
       NEXTADDR;                                                        36340000
LOGICAL GARBCOLLOK := TRUE;                                    <<06945>>36345000
                                                                        36350000
                                                                        36355000
SUBROUTINE TURNOFFSDVALIDFLAGS;                                         36360000
                                                                        36365000
COMMENT                                                                 36370000
                                                                        36375000
TURNOFFSDVALIDFLAGS IS CALLED TO TURN OFF THE SUBREGION                 36380000
DISPLACEMENT VALID FLAGS FOR THE SUBREGIONS WHICH ARE PART              36385000
OF A RESERVED REGION WHICH IS BEING RETURNED TO THE AVAILABLE           36390000
REGION POOL.  THE RESERVE ON THE REGION HAD BEEN ABORTED, AND           36395000
THE SUBREGION DISPLACEMENTS AND INITIATION MESSAGE ARE NO LONGER        36400000
VALID.                                                                  36405000
                                                                        36410000
;                                                                       36415000
                                                                        36420000
BEGIN                                                                   36425000
TOS:=REGIONBASE;                                                        36430000
TOS:=TOS+RBTORSDISP;                                                    36435000
ASMB(LSEA);                                                             36440000
RSIZEINPAGES:=TOS;                                                      36445000
TOS:=TOS+RSTOSDDISP;                                                    36450000
DISABLE;                                                                36455000
WHILE TURNEDOFFSIZE < RSIZEINPAGES DO                                   36460000
   BEGIN                                                                36465000
   TOS:=0;                                                              36470000
   ASMB(SSEA);                                                          36475000
   TOS:=TOS+SDTOSSDISP;                                                 36480000
   ASMB(LSEA);                                                          36485000
   TURNEDOFFSIZE:=TURNEDOFFSIZE+S0;                                     36490000
   TOS:=TOS&LSL(PAGEPOWER);                                             36495000
   TOS:=TOS+SSTOSDDISP;                                                 36500000
   ASMB(LADD);                                                          36505000
   IF CARRY AND TURNEDOFFSIZE<>RSIZEINPAGES                    <<01644>>36510000
   THEN SUDDENDEATH(614); <<OFF BANK>>                         <<01644>>36515000
   END;                                                                 36520000
ASMB(DDEL);                                                             36525000
END <<TURNOFFSDVALIDFLAGS>>;                                            36530000
                                                                        36535000
<< LOG THE RELEASE REGION EVENT>>                              <<06212>>36540000
                                                               <<06212>>36545000
                                                               <<06212>>36550000
                                                               <<06212>>36555000
                                                                        36560000
TOS := 13;    <<***>>                                          <<06948>>36565000
TOS := REQSIZE; <<***>>                                        <<06948>>36570000
TOS := REGIONBASE;  <<***>>                                    <<06948>>36575000
MMSTAT'(*,*,*,*,0,0,0);                                        <<06948>>36580000
                                                               <<06212>>36585000
<< INVALIDATE CONTROL CELLS IN THE REGION >>                   <<06212>>36590000
                                                               <<06212>>36595000
TOS:=REGIONBASE;                                                        36600000
TOS:=TOS+RBTOINITMSGDISP;                                               36605000
TOS:=0;                                                                 36610000
ASMB(SSEA); <<ZERO OUT INIT MSG FOR CLEAN REGION>>                      36615000
TOS:=TOS+INITMSGTORASDISP;                                              36620000
TOS:=REGAVAILABLECODE; <<MARK REGION AVAILABLE>>               <<06212>>36625000
ASMB(SSEA);                                                             36630000
TOS:=TOS+RASTORSDISP;                                                   36635000
ASMB(LSEA);                                                             36640000
RSIZEINPAGES:=TOS;                                                      36645000
ASMB(DDEL);                                                             36650000
                                                               <<06212>>36655000
TURNOFFSDVALIDFLAGS;                                                    36660000
                                                                        36665000
IF BUGCATCH THEN                                                        36670000
   BEGIN  <<CHECK INTEGRITY>>                                           36675000
   TOS:=REGIONBASE;                                                     36680000
   TOS:=TOS+RBTOSSDISP;                                                 36685000
   ASMB(LSEA);                                                          36690000
   X:=S0;                                                               36695000
   TOS:=TOS&LSL(PAGEPOWER)+SSTORASDISP+RASTOPTSSDISP;                   36700000
   ASMB(LADD;LSEA);                                                     36705000
   IF TOS<>X THEN SUDDENDEATH(614);                            <<01644>>36710000
   TOS:=X;                                                              36715000
   ASMB(SSEA;DDEL);                                                     36720000
                                                                        36725000
   TOS:=REGIONBASE;                                                     36730000
   ASMB(XCH,DEL);                                                       36735000
   IF S0.(10:6) <> HEADERLENGTH THEN SUDDENDEATH(614);         <<01644>>36740000
   TOS:=TOS&LSR(PAGEPOWER);                                             36745000
   X:=TOS;                                                              36750000
   IF RSIZEINPAGES=MAXHOLESIZE AND X<>0                        <<01644>>36755000
   THEN SUDDENDEATH(614);                                      <<01644>>36760000
   IF RSIZEINPAGES+X>MAXHOLESIZE THEN SUDDENDEATH(614);        <<01644>>36765000
   END;                                                                 36770000
                                                                        36775000
<<                                                                      36780000
TRY TO COMBINE WITH AVAILABLE REGION ABOVE                              36785000
>>                                                                      36790000
                                                                        36795000
TOS:=REGIONBASE;                                                        36800000
TOS:=TOS+RBTORSDISP;                                                    36805000
ASMB(LSEA);                                                             36810000
TOS:=TOS&LSL(PAGEPOWER);<<REGION SIZE IN WORDS>>                        36815000
IF = THEN                                                               36820000
   BEGIN <<A WHOLE BANK OR INVALID>>                                    36825000
   IF RSIZEINPAGES <> MAXHOLESIZE THEN SUDDENDEATH(614);       <<01644>>36830000
   S0:=-1;<<FORCE A CARRY BELOW>>                                       36835000
   END;                                                                 36840000
ASMB(LADD);                                                             36845000
IF CARRY THEN ASMB(DDEL) <<END OF BANK>> ELSE                           36850000
   BEGIN                                                                36855000
   <<CHECK IF PAST PARTIAL LAST BANK>>                                  36860000
   ASMB(DDUP,DDUP);                                                     36865000
   NEXTADDR:=TOS;                                              <<06212>>36870000
   IF LASTMEMORYADDRESS<=NEXTADDR THEN ASMB(DDEL) <<END MEM>> ELSE      36875000
      BEGIN <<THERE'S A REGION ABOVE>>                                  36880000
      TOS:=TOS+RSTOPTRASDISP;                                           36885000
      TOS:=REGAVAILABLECODE;                                            36890000
      ASMB(SSEA);  <<MARK REG AVAILABLE IN TRAILER FOR RECOVEROC>>      36895000
      TOS:=TOS+TRASTOTRSDISP;                                           36900000
      TOS:=RSIZEINPAGES;                                                36905000
      ASMB(SSEA);                                                       36910000
      TOS:=TOS+PTRSTORASDISP;                                           36915000
      ASMB(LSEA);                                                       36920000
      TOS.REGAVAILABLEFLAG:=0;                                          36925000
      ASMB(DEL);                                                        36930000
      IF = THEN ASMB(DDEL) ELSE                                         36935000
         BEGIN  <<FOLLOWING REGION IS AVAILABLE>>                       36940000
         TOS:=TOS+RASTORSDISP;                                          36945000
         ASMB(LSEA); <<NEXT REGION'S SIZE>>                             36950000
         RSIZEINPAGES:=RSIZEINPAGES+S0;                                 36955000
         S1:=S1+RSTORBDISP;                                             36960000
         TAKEOFFARL(*,*);                                               36965000
         END;                                                           36970000
      END;                                                              36975000
   END;                                                                 36980000
                                                                        36985000
<<                                                                      36990000
TRY TO COMBINE WITH PREVIOUS REGION                                     36995000
>>                                                                      37000000
                                                                        37005000
TOS:=REGIONBASE;                                                        37010000
IF PTRASTORBDISP > LS0 THEN ASMB(DDEL) ELSE                             37015000
   BEGIN  <<REGION BEING RELEASED IS NOT THE FIRST IN THE BANK>>        37020000
   IF BUGCATCH THEN                                                     37025000
      BEGIN  <<CHECK INTEGRITY>>                                        37030000
      TOS:=REGIONBASE;                                                  37035000
      TOS:=TOS+RBTOPTRSDISP;                                            37040000
      ASMB(LSEA);                                                       37045000
      X:=TOS;                                                           37050000
      TOS:=TOS+PTRSTORSDISP;                                            37055000
      TOS:=X&LSL(PAGEPOWER);                                            37060000
      ASMB(LSUB;LSEA);                                                  37065000
      TOS:=X;                                                           37070000
      ASMB(CMP);                                                        37075000
      IF <> AND S1<>0 THEN SUDDENDEATH(614);                   <<01644>>37080000
      ASMB(DDEL);                                                       37085000
      END;                                                              37090000
   TOS:=TOS+RBTOPTRASDISP;                                              37095000
   ASMB(LSEA);                                                          37100000
   TOS.REGAVAILABLEFLAG:=0;                                             37105000
   ASMB(DEL);                                                           37110000
   IF = THEN ASMB(DDEL) ELSE                                            37115000
      BEGIN  <<PREVIOUS REGION IS AVAILABLE>>                           37120000
      TOS:=TOS+TRASTOTRSDISP;                                           37125000
      ASMB(LSEA);                                                       37130000
      RSIZEINPAGES:=RSIZEINPAGES+S0;                                    37135000
      X:=S0;                                                            37140000
      TOS:=TOS&LSL(PAGEPOWER);                                          37145000
      S1:=S1+PTRSTORBDISP;                                              37150000
      ASMB(LSUB,DDUP); <<YIELDS REGION BASE OF PREV AVAILABLE REGION>>  37155000
      REGIONBASE:=TOS;  <<NEW BEGINNING OF AVAIL REG>> <<***>>          37160000
      TAKEOFFARL(*,X);                                                  37165000
      END;                                                              37170000
   END;                                                                 37175000
                                                                        37180000
<<                                                                      37185000
FIX UP COMBINED REGION'S HEADER AND TRAILER                             37190000
>>                                                                      37195000
                                                                        37200000
TOS:=REGIONBASE;                                                        37205000
TOS:=TOS+RBTORSDISP;                                                    37210000
TOS:=RSIZEINPAGES;                                                      37215000
ASMB(SSEA);  <<FIX UP NEW REGION HEADER>>                               37220000
TOS:=TOS+RSTORASDISP;                                                   37225000
TOS:=REGAVAILABLECODE;                                                  37230000
ASMB(SSEA);                                                             37235000
TOS:=TOS+RASTOPTRASDISP;                                                37240000
TOS:=RSIZEINPAGES&LSL(PAGEPOWER);                                       37245000
IF <> THEN ASMB(ADD) ELSE                                               37250000
   BEGIN <<A WHOLE BANK IS FREE>>                                       37255000
   IF RSIZEINPAGES<>MAXHOLESIZE THEN SUDDENDEATH(614);         <<01644>>37260000
   ASMB(DDEL);                                                          37265000
   TOS:=LASTTRASADDR;                                                   37270000
   END;                                                                 37275000
ASMB(DDUP);                                                             37280000
TRAILERADDR:=TOS;                                                       37285000
<<ADDRESS OF NEW REGION'S TRAILER STATE CELL ON TOS>>                   37290000
TOS:=REGAVAILABLECODE;                                                  37295000
ASMB(SSEA);                                                             37300000
TOS:=TOS+TRASTOTRSDISP;                                                 37305000
TOS:=RSIZEINPAGES;                                                      37310000
ASMB(SSEA);                                                             37315000
PUTONARL(REGIONBASE,RSIZEINPAGES,PUTATEND);                             37320000
IF REQSIZE > MAXAVAILREG THEN                                  <<06945>>37325000
   BEGIN <<CONSIDER COLLECTING GARBAGE AROUND THIS HOLE>>      <<06945>>37330000
   IF CURPRC <> 0 THEN                                         <<06945>>37335000
      BEGIN <<SEE IF ENOUGH SPACE FOR GARB COLL>>              <<06945>>37340000
      PUSH (S);                                                <<06945>>37345000
      SREG := TOS;                                             <<06945>>37350000
      PUSH (Z);                                                <<06945>>37355000
      ZREG := TOS;                                             <<06945>>37360000
      IF ZREG-SREG < 380 THEN GARBCOLLOK := FALSE;             <<06945>>37365000
      END;                                                     <<06945>>37370000
   IF GARBCOLLOK THEN COLLECTGARBAGE(REGIONBASE);              <<06945>>37375000
   END;                                                        <<06945>>37380000
IF SCANPOINT > REGIONBASE AND SCANPOINT < TRAILERADDR                   37385000
THEN SCANPOINT:=REGIONBASE;                                             37390000
END  <<RELEASEREGION>>;                                                 37395000
$PAGE "MEMORY ALLOCATION PROCEDURES : CLEANREGION"                      37400000
                                                                        37405000
PROCEDURE CLEANREGION(REGIONBASE,CLEANPAGECNT,URGCLASS,                 37410000
   SPECIALCLEANINFO);                                                   37415000
VALUE REGIONBASE,CLEANPAGECNT,URGCLASS,SPECIALCLEANINFO;                37420000
DOUBLE REGIONBASE;                                                      37425000
INTEGER CLEANPAGECNT,URGCLASS,SPECIALCLEANINFO;                         37430000
OPTION PRIVILEGED,UNCALLABLE;                                           37435000
                                                                        37440000
COMMENT                                                                 37445000
                                                                        37450000
CLEANREGION IS INVOKED BY RESERVEREGION AND COLLECTGARBAGE              37455000
TO PREPARE A RESERVED REGION FOR A SEGMENT READ OR AN AVAIL-            37460000
ABLE REGION FOR A POSSIBLE SEGMENT MOVE.                                37465000
                                                                        37470000
CLEANREGION IS CALLED BY RESERVEREGION AFTER A SUCCEEFUL                37475000
ALLOCATION OF AN AVAILABLE REGION OF ADEQUATE SIZE FOR A                37480000
REQUEST MADE BY THE SCHEDULER AND CALLED BY COLLECTGARBAGE              37485000
TO CLEAN A REGION SO THAT MEMORY COMPACTION MAY TAKE                    37490000
PLACE OVER IT.                                                          37495000
                                                                        37500000
CLEANREGION MAKES ALL OVERLAY CANDIDATES IN A RESERVED                  37505000
REGION NON-RECOVERABLE, CAUSES DISC REQUESTS FOR SEGMENT                37510000
WRITES IN THE REGION WHICH HAVE NOT YET COMPLETED TO BE                 37515000
PLACED INTO THE DEVICE'S PREEMPTIVE SUBQUEUE(IF CLEAN NOT               37520000
FOR GARBAGE COLLECTION), AND RELEASES ANY LEFTOVER PAGES                37525000
WHICH EXCEED THE REQUESTED CLEANPAGECNT.                                37530000
                                                                        37535000
;                                                                       37540000
                                                                        37545000
BEGIN                                                                   37550000
                                                               <<06212>>37555000
<<DB IS PLACED AT THE FIRST WORD OF THE REGION>>                        37560000
<<IDENTIFIERS FOR ACCESSING GLOBAL REGION HEADER WORDS>>       <<06212>>37565000
<<WITH DB DIRECT REFERENCES                           >>       <<06212>>37570000
                                                               <<06212>>37575000
INTEGER IOCNT=DB+RASTOIOCNTDISP,                                        37580000
        REGIONSTATE=DB+0,                                               37585000
        REGIONSIZE=DB+RASTORSDISP,                                      37590000
        RELEASEPAGECNT=DB+RASTORPAGECNTDISP,                            37595000
        MAKEPRESENTLINK=DB+RASTOMPQLINKDISP,                            37600000
        LKFZCOUNTERS=DB+RASTOLKFZCNTDISP,                               37605000
        WDIOFZCOUNTERS=DB+RASTOWDIOFZCNTDISP,                           37610000
        REGOBJIDENT=DB+RASTOOBJIDENTDISP,                      <<06212>>37615000
                                                               <<06212>>37620000
        COMPMSG=DB+RASTOCOMPMSGDISP,                                    37625000
        IOREQQ=DB+RASTOIOREQQDISP,                                      37630000
        INITMSG=DB+RASTOINITMSGDISP;                                    37635000
                                                                        37640000
<<IDENTIFIERS FOR ACCESSING SUBREGION HEADER FIELDS>>          <<06212>>37645000
<<WITH DB DIRECT INDEXED REFERENCES                >>          <<06212>>37650000
                                                               <<06212>>37655000
INTEGER ARRAY SUBREGOBJIDENT(*)=DB+RASTOOBJIDENTDISP,          <<06660>>37660000
              SUBREGASSSTATE(*)=DB+RASTOSASDISP,               <<06212>>37665000
              SSIZE(*)=DB+RASTOSSDISP,                                  37670000
              SUBREGHODA(*)=DB+RASTOHODADISP,                           37675000
              SUBREGLODA(*)=DB+RASTOLODADISP,                           37680000
              SUBREGWREQP(*)=DB+RASTOWREQPDISP,                         37685000
              SUBREGSD(*)=DB+RASTOSDDISP,                      <<06212>>37690000
              SUBREGTIME(*)=DB+RASTOARRTIMEDISP;               <<06212>>37695000
                                                                        37700000
<<Defines to access subregion fields with db at base of reg and<<06212>>37705000
<<and X at the base of the header of the subregion>>           <<06212>>37710000
                                                               <<06212>>37715000
DEFINE OCHODA=SUBREGHODA(X)#,                                           37720000
       OCLODA=SUBREGLODA(X)#,                                           37725000
       OCWREQP=SUBREGWREQP(X)#,                                         37730000
       SUBREGDISP=SUBREGSD(X)#,                                         37735000
       SUBREGSIZE=SSIZE(X)#,                                            37740000
       SUBREGSTATE=SUBREGASSSTATE(X)#,                         <<06212>>37745000
       OCOBJIDENT=SUBREGOBJIDENT(X)#,                          <<06212>>37750000
       ARRIVALTIME=SUBREGTIME(X)#;                             <<06212>>37755000
                                                                        37760000
DOUBLE SAVEDB,                                                          37765000
        OBJ,                                                   <<06660>>37770000
       OCDISCADDRESS;                                                   37775000
LOGICAL ARRAY OBJIDENTIFIER(*) = OBJ;                          <<06660>>37780000
LOGICAL DATAIMFLG,                                                      37785000
        CACHEDDISCDOMAIN,                                      <<06212>>37790000
        OVERLAYCAND,                                           <<06212>>37795000
        FWIP,                                                  <<06945>>37800000
        DATASEGFLG;                                                     37805000
                                                                        37810000
INTEGER STINX,                                                          37815000
        drq'entry'index,                                       <<06392>>37820000
        CDTENTRYNUMBER,                                        <<06212>>37825000
        OCWRITEREQPTR,                                                  37830000
        NEWREGSIZE,                                                     37835000
        SUBREGWORDDISP,                                                 37840000
        RESIDUE,                                                        37845000
        OLDREGSIZE,                                                     37850000
        RESIDUALSIZE,                                                   37855000
        PAGEDISPCNT:=0,                                                 37860000
        SUBREGSTATE'0=SUBREGASSSTATE,                          <<06212>>37865000
        WRITECNT:=0;                                                    37870000
                                                                        37875000
                                                               <<02056>>37880000
                                                               <<06212>>37885000
TOS:=REGIONBASE;                                                        37890000
TOS:=TOS+RBTORASDISP;                                                   37895000
EXCHDB; <<DB TO BEGINNING OF REGION'S GLOBAL HEADER>>                   37900000
SAVEDB:=TOS;                                                            37905000
OLDREGSIZE:=REGIONSIZE;                                                 37910000
IOCNT:=RELEASEPAGECNT:=0;<<INIT COUNTER CELLS IN THE REGION HEADER>>    37915000
INITMSG:=COMPMSG:=IOREQQ:=0;                                            37920000
IF SPECIALCLEANINFO=GARBCOLLCODE THEN INITMSG.GARBCOLLFLAG:=1;          37925000
                                                                        37930000
                                                               <<06212>>37935000
                                                                        37940000
DO                                                                      37945000
   BEGIN  <<CLEAN NEXT SUBREGION>>                                      37950000
                                                               <<06212>>37955000
   <<ZAP CONTROL FLAGS RELATED TO SUBREGION>>                  <<06212>>37960000
   DISABLE;  <<ENABLE AFTER EACH SUBREGION>>                   <<06212>>37965000
                                                               <<06212>>37970000
   DATASEGFLG:=DATAIMFLG:=CACHEDDISCDOMAIN :=                  <<06212>>37975000
      FWIP:=                                                   <<06945>>37980000
      OVERLAYCAND:=FALSE;                                      <<06212>>37985000
                                                               <<06212>>37990000
   <<GET STATIC INFO FROM SUBREG HEADER WHILE CONVENIENT>>     <<06212>>37995000
                                                               <<06212>>38000000
   X:=SUBREGWORDDISP:=PAGEDISPCNT&LSL(PAGEPOWER);<<FOR ADDRESSI<<06212>>38005000
                                                               <<06212>>38010000
                                                               <<06212>>38015000
                                                               <<06212>>38020000
                                                               <<06212>>38025000
   TOS:=OCHODA; <<FOR ST DESCRIPTOR>>                                   38030000
   TOS:=OCLODA; <<SAVE LODA FOR LATER INSERTION INTO ST DESCR>>         38035000
   OCDISCADDRESS:=TOS;                                                  38040000
                                                               <<06212>>38045000
   OCWRITEREQPTR:=OCWREQP;                                     <<06212>>38050000
                                                               <<06212>>38055000
    << FILL IN THE SUBREGION'S DISPLACEMENT FROM BASE>>                 38060000
                                                               <<06212>>38065000
   TOS:=PAGEDISPCNT;                                                    38070000
   TOS.SDVALIDFLAG:=1;                                                  38075000
   SUBREGDISP:=TOS; <<NEEDED FOR SEGMENTS IN MOTION SO THAT             38080000
                      ONGOING I/OCOUNT CAN BE DECREMENTED               38085000
                      WHEN MOTION COMPLETES.>>                          38090000
                                                               <<06212>>38095000
                                                               <<06212>>38100000
   TOS:=SUBREGSIZE;                                                     38105000
   IF = THEN SUDDENDEATH(614);                                 <<01644>>38110000
   PAGEDISPCNT:=PAGEDISPCNT+TOS; <<HOW FAR UP ARE WE?>>        <<06212>>38115000
   IF PAGEDISPCNT>OLDREGSIZE THEN SUDDENDEATH(614);            <<01644>>38120000
                                                               <<06212>>38125000
   <<LET'S SEE WHAT'S IN HERE>>                                <<06212>>38130000
                                                               <<06212>>38135000
   TOS:=SUBREGOBJIDENT(X);                                     <<06660>>38140000
   TOS:=SUBREGOBJIDENT(X+1);                                   <<06660>>38145000
   ASMB(DECX);                                                 <<06660>>38150000
   OBJ:=TOS;                                                   <<06660>>38155000
   IF OBJIDENTIFIER(ObjIDTypeField)= OBJIDCDTYPE THEN          <<06660>>38160000
      BEGIN  <<A CACHED DISC DOMAIN IS SITTING HERE>>          <<06212>>38165000
      CACHEDDISCDOMAIN := TRUE;                                <<06212>>38170000
      CDTENTRYNUMBER := OBJIDENTIFIER(ObjIDnumField);          <<06660>>38175000
      END;                                                     <<06212>>38180000
                                                               <<06212>>38185000
   IF obj <> 0D THEN                                           <<06660>>38190000
      BEGIN <<THERE'S SOMETHING IN THE SUB-REGION>>            <<06212>>38195000
                                                               <<06212>>38200000
      <<DECODE OBJIDENT AND MARK OBJECT AS UNRECOVERABLE>>     <<06212>>38205000
                                                               <<06212>>38210000
      IF cacheddiscdomain THEN                                 <<06212>>38215000
         BEGIN  <<A CACHED DISC DOMAIN IS SITTING HERE>>       <<06212>>38220000
         X:=SUBREGWORDDISP; <<FOR ADDRESSING>>                 <<06212>>38225000
                                                               <<06212>>38230000
         IF CDTENTRYNUMBER <> 0 THEN                           <<06212>>38235000
            BEGIN  <<CACHED DISC DOMAIN IS MAPPED IN>>         <<06212>>38240000
                                                               <<06212>>38245000
            <<CLEAR ROC FLAG IN REGION HEADER,cdtentry>>       <<06212>>38250000
                                                               <<06212>>38255000
            SUBREGSTATE.REGROCFLAG:=0;<<Domain's ROCflag>>     <<06945>>38260000
            IF = THEN                                          <<06945>>38265000
               BEGIN <<NOT AN OVERLAY CAND>>                   <<06945>>38270000
               IF CDT'GET'BIT(CDTENTRYNUMBER,CDT'FWIP'BIT,0)   <<06945>>38275000
               <> 1 THEN SUDDENDEATH(SFKERNCACHESYNCBAD);      <<06945>>38280000
               FWIP:=TRUE; <<ALREADY GOING OUT>>               <<06945>>38285000
               END                                             <<06945>>38290000
            ELSE                                               <<06945>>38295000
               BEGIN                                           <<06945>>38300000
            IF CDT'SET'BIT(OBJIDENTIFIER(ObjIDnumField),       <<06660>>38305000
                           CDT'ROC'BIT, 0) <> 1                <<06212>>38310000
            THEN SUDDENDEATH(SFKernCacheSyncBad);              <<06212>>38315000
            OVERLAYCAND := TRUE;                               <<06212>>38320000
            END;                                               <<06212>>38325000
               END;                                            <<06945>>38330000
                                                               <<06212>>38335000
         <<NOW UNHOOK FROM CACHED DISC DOMAIN LIST IF NEED BE>><<06212>>38340000
                                                               <<06212>>38345000
         tos:=regionbase;                                      <<06212>>38350000
         tos:=tos+subregworddisp;                              <<06212>>38355000
            IF NOT FWIP THEN                                   <<06945>>38360000
         UnlinkCachedRegion (*);                               <<06212>>38365000
                                                               <<06212>>38370000
         END                                                   <<06212>>38375000
      ELSE                                                     <<06212>>38380000
         BEGIN <<A SEGMENT IS SITTING HERE>>                   <<06212>>38385000
                                                               <<06212>>38390000
         IF OBJIDENTIFIER(ObjIDTypeField)=OBJIDDATATYPE THEN   <<06660>>38395000
            BEGIN  <<DAT SEG>>                                 <<06212>>38400000
            DATASEGFLG:=TRUE;                                  <<06212>>38405000
            STINX:=OBJIDENTIFIER(ObjIDnumField)&LSL(2);        <<06660>>38410000
                                                               <<06212>>38415000
                                                               <<06212>>38420000
            END                                                <<06212>>38425000
         ELSE STINX:=CONVSEGIDTOSTINX(OBJ);                    <<06660>>38430000
                                                               <<06212>>38435000
         <<CLEAR ROC FLAG IN SEG DESCRIPTOR>>                  <<06212>>38440000
                                                               <<06212>>38445000
         X:=STINX;                                             <<06212>>38450000
         DST(X:=X+1).ROCFLAG:=0;                               <<06212>>38455000
         IF <> THEN OVERLAYCAND := TRUE ELSE                   <<06212>>38460000
            BEGIN  <<OBJ IN SUBREGION WASN'T AN OVERLAY CAND>> <<06212>>38465000
                   <<RATHER, SUBREGION AVAILABLE DUE TO AN ABOR<<06212>>38470000
                   <<SPACE RESERVATION OR FORCED WRITE DUE TO G<<06212>>38475000
                                                               <<06212>>38480000
            IF NOT DATASEGFLG THEN SUDDENDEATH(614);           <<06212>>38485000
            IF DST(X).DISCCOPYVALIDFLAG =1                     <<06212>>38490000
            AND OCWRITEREQPTR =  0 THEN SUDDENDEATH(614);      <<06212>>38495000
            END;                                               <<06212>>38500000
         END;                                                  <<06212>>38505000
                                                               <<06212>>38510000
      <<IF A WRITE OF THE OBJ IS PENDING, BUMP THE WRITE'S>>   <<06212>>38515000
      <<PRIORITY AND INC THE REGION'S ON-GOING I/O COUNT>>     <<06212>>38520000
                                                               <<06212>>38525000
      IF DATASEGFLG OR CACHEDDISCDOMAINFLAG THEN               <<06212>>38530000
         BEGIN <<FIND OUT IF WRITE IS ON-GOING>>               <<06212>>38535000
         IF OCWRITEREQPTR <> 0 THEN                            <<06212>>38540000
            BEGIN                                              <<06212>>38545000
            DATAIMFLG := TRUE; <<CAN'T SPLIT THIS SUBREGION>>  <<06212>>38550000
            IOCNT:=IOCNT+1;                                    <<06212>>38555000
            INITMSG.MSGONGOINGIODISABLED:=1;                   <<06212>>38560000
            TOS :=%1000D;   << Must go to SYSDB for this call>><<06945>>38565000
            ASMB(XCHD);                                        <<06945>>38570000
            BumpWritePri(ocwritereqptr,                        <<06945>>38575000
                         forcedwritepri);                      <<06945>>38580000
            ASMB(XCHD;DDEL); << Put DB back to region >>       <<06945>>38585000
            IF DATASEGFLG THEN                                 <<06212>>38590000
               BEGIN                                           <<06212>>38595000
               IF LOGICAL(DST(X:=STINX+1)).DISCCOPYVALIDFLAG   <<06212>>38600000
               THEN SUDDENDEATH(618);                          <<06212>>38605000
               DST(X).FWIPFLAG:=1; <<SIGNAL WRITE COMP>>       <<06212>>38610000
               END                                             <<06212>>38615000
            ELSE                                               <<06212>>38620000
               BEGIN <<CACHED DOMAIN>>                         <<06212>>38625000
               CDT'SET'BIT(CDTENTRYNUMBER,CDT'FWIP'BIT,1);     <<06945>>38630000
               <<ACTUALLY THIS CAN OCCUR-FIRST GC RESERVE, THEN<<06212>>38635000
               <<REGULAR RESERVE WITH WRITE ON-GOING IN BOTH>> <<06212>>38640000
               END;                                            <<06212>>38645000
            END;                                               <<06212>>38650000
         END;                                                  <<06212>>38655000
                                                               <<06212>>38660000
      IF OVERLAYCAND OR CACHEDDISCDOMAINFLAG THEN              <<06411>>38665000
         BEGIN  <<SEG WAS AN OVERLAY CANDIDATE>>               <<06212>>38670000
                                                               <<06212>>38675000
         <<MEASURE OVERLAY OF THIS TYPE OF OBJECT>>            <<06212>>38680000
                                                               <<06212>>38685000
         IF GCLASSENABLEDMASK.CLASS0 THEN                               38690000
            BEGIN  <<MEASURE RELEASE OF OBJ>>                  <<06212>>38695000
            TOS:=MEASSTATXDSBANK;                                       38700000
            TOS:=MEASSTATXDSBASE;                                       38705000
            TOS:=TOS+C0SUB0'SEGRELOFF;                                  38710000
            IF CACHEDDISCDOMAIN THEN TOS:=TOS+C'CACHERELEASE   <<06212>>38715000
            ELSE IF DATASEGFLG THEN TOS:=TOS+C'DATARELEASE     <<06212>>38720000
            ELSE TOS:=TOS+C'CODERELEASE;                       <<06212>>38725000
            ASMB(LSEA);                                                 38730000
            TOS:=TOS+1;                                                 38735000
            ASMB(SSEA;DDEL);                                            38740000
            END;                                                        38745000
                                                               <<06212>>38750000
         <<MEASURE OVERLAY ON BEHALF OF THIS PROCESS>>         <<06212>>38755000
                                                               <<06212>>38760000
         IF GCLASSENABLEDMASK.CLASS15 THEN                     <<06212>>38765000
            BEGIN <<PRCOCESS LEVEL OVLY CAUSED>>               <<06212>>38770000
            TOS:=MEASPROCXDSBANK;                              <<06212>>38775000
            TOS:=MEASPROCXDSBASE;                              <<06212>>38780000
            TOS:=ICS(-ICS'CANDPINCELL);                        <<06212>>38785000
            TOS:=TOS*CLASS15'SUB0SIZE+CP'OVERLAYCAUSED;        <<06212>>38790000
            ASMB(LADD);                                        <<06212>>38795000
            ASMB(LSEA);                                        <<06212>>38800000
            TOS:=TOS+1;                                        <<06212>>38805000
            ASMB(SSEA;DDEL);                                   <<06212>>38810000
            END;                                               <<06212>>38815000
         IF OVERLAYCAND AND NOT CACHEDDISCDOMAIN THEN          <<06212>>38820000
            BEGIN <<PUT DISC ADDRESS INTO SEG DESCRIPTOR>>     <<06212>>38825000
            TOS:=OCDISCADDRESS;                                <<06212>>38830000
            DST(X:=STINX+3):=TOS;  <<PUT LODA OF OC INTO ST DES<<06212>>38835000
            DST(X:=X-1):=TOS;  <<PUT HODA OF OC INTO ST DESC>> <<06212>>38840000
            END;                                               <<06212>>38845000
         END;                                                  <<06212>>38850000
      END;                                                              38855000
                                                               <<06212>>38860000
   X:=SUBREGWORDDISP; <<FOR ADDRESSING INTO SUBREGION'S HEADER><<06212>>38865000
                                                               <<06212>>38870000
   <<IF SUBREGION FREE OF ON-GOING WRITE, DELETE OBJECT'S TRACE<<06212>>38875000
                                                               <<06212>>38880000
   IF NOT DATAIMFLG THEN                                                38885000
      BEGIN                                                             38890000
      SUBREGOBJIDENT(X):=0; SUBREGOBJIDENT(X+1):=0;            <<06660>>38895000
      ASMB(DECX);                                              <<06660>>38900000
      OCWREQP:=0;                                                       38905000
      END;                                                              38910000
                                                               <<06212>>38915000
   <<HOW MUCH MORE NEEDS TO BE CLEANED?>>                      <<06212>>38920000
                                                               <<06212>>38925000
   RESIDUE:=PAGEDISPCNT-CLEANPAGECNT; <<FOR CC AND BELOW>>              38930000
   ENABLE;                                                     <<06212>>38935000
                                                               <<06212>>38940000
   END                                                                  38945000
                                                               <<06212>>38950000
UNTIL >=; <<DO UNTIL CLEANED ENOUGH SPACE>>                    <<06212>>38955000
                                                                        38960000
DISABLE;                                                       <<06212>>38965000
                                                               <<06212>>38970000
IF iocnt = 0 THEN                                              <<06212>>38975000
   BEGIN  <<write may have completed in mean time>>            <<06212>>38980000
   dataimflg := FALSE;  <<no longer>>                          <<06212>>38985000
   initmsg.msgongoingiodisable := 0; <<turn off>>              <<06212>>38990000
   END;                                                        <<06212>>38995000
                                                               <<06212>>39000000
<<NOW TAKE CARE OF EXTRA SPACE IN THE LAST SUBREGION CLEANED>> <<06212>>39005000
                                                               <<06212>>39010000
IF DATAIMFLG THEN                                                       39015000
   BEGIN <<CANNOT SPLIT LAST SUBREGION>>                                39020000
   NEWREGSIZE:=PAGEDISPCNT; <<MAKE REGION BIGGER TEMPORARILY>> <<06212>>39025000
   RELEASEPAGECNT:=RESIDUE; <<I/O COMPLETOR WILL RELEASE>>              39030000
   IF <> THEN INITMSG.INITMSGRELRESPAGESFLAG:=1;                        39035000
   END                                                                  39040000
ELSE                                                                    39045000
   BEGIN <<LAST SUBREGION CAN BE SPLIT>>                                39050000
                                                               <<06212>>39055000
   NEWREGSIZE:=CLEANPAGECNT; <<CLEANED A REGION OF RIGHT SIZE>><<06212>>39060000
   RELEASEPAGECNT:=0; <<NOTHING FOR READ COMPLETOR TO RELEASE>><<06212>>39065000
                                                               <<06212>>39070000
   <<IF SPLIT THE LAST SUBREGION,FIX UP ITS HEADERS/TRAILERS>>          39075000
                                                               <<06212>>39080000
   IF RESIDUE <> 0 THEN                                                 39085000
      BEGIN  <<SPLIT LAST SUBREGION>>                                   39090000
      X:=SUBREGWORDDISP;                                                39095000
      TOS:=SUBREGSIZE:=SUBREGSIZE-RESIDUE;<<SIZE OF LEFT SUBREGION>>    39100000
      X:=X+RASTOPTSSDISP;                                               39105000
      X:=X+S0&LSL(PAGEPOWER);                                           39110000
      MEM(X):=TOS;<<LEFT SUBREGION'S TRAILER>>                          39115000
      X:=CLEANPAGECNT&LSL(PAGEPOWER);                                   39120000
      SUBREGSIZE:=RESIDUE;<<SUBREGION SIZE OF RIGHT SUBREGION>>         39125000
      SUBREGOBJIDENT(X):=0;  <<two word object identifiers>>   <<06660>>39130000
      SUBREGOBJIDENT(X+1):=0;<<so two zero stores>>            <<06660>>39135000
      ASMB(DECX);                                              <<06660>>39140000
      X:=X+RESIDUE&LSL(PAGEPOWER)+RASTOPTSSDISP;                        39145000
      MEM(X):=RESIDUE; <<SUB SIZE IN RIGHT TRAILER>>                    39150000
      X:=X+TSSTOTRASDISP;                                               39155000
      MEM(X):=REGAVAILABLECODE;                                         39160000
      END;                                                              39165000
   END;                                                                 39170000
                                                                        39175000
INITMSG.MSGVALIDYETFLAG:=1; <<SIGNALS WRITE COMPLETOR>>        <<06212>>39180000
                                                                        39185000
<<                                                                      39190000
PUT NEW REGION SIZES IN GLOBAL HEADERS AND TRAILERS                     39195000
>>                                                                      39200000
                                                                        39205000
X:=0;  <<FOR ADDRESSING CONVENIENCE>>                                   39210000
REGIONSIZE:=NEWREGSIZE; <<PUT NEW REGION SIZE IN HEADER>>               39215000
REGIONSTATE.REGCLEAREDFLAG:=1; <<FOR GARBAGE COLLECTION>>               39220000
X:=NEWREGSIZE&LSL(PAGEPOWER)+RASTOPTRSDISP;                             39225000
MEM(X):=NEWREGSIZE; <<PUT NEW REGION SIZE INTO TRAILER>>                39230000
MEM(X:=X+TRSTOTRASDISP):=REGIONSTATE; <<NEW REGION STATE INTO TRAILER>> 39235000
                                                                        39240000
<<                                                                      39245000
ZERO OUT CELLS OF HEADER NOT CONTAINING CURRENT INFO                    39250000
>>                                                                      39255000
                                                                        39260000
WDIOFZCOUNTERS:=LKFZCOUNTERS:=MAKEPRESENTLINK:=0;              <<06212>>39265000
SUBREGSTATE'0 := 0;                                            <<06212>>39270000
                                                               <<06212>>39275000
                                                                        39280000
<<                                                                      39285000
RELEASE EXTRA PAGES ABOVE REQUIRED PORTION OF REGION                    39290000
>>                                                                      39295000
                                                                        39300000
RESIDUALSIZE:=OLDREGSIZE-NEWREGSIZE;                                    39305000
IF = THEN                                                               39310000
   BEGIN  <<NO EXTRA SPACE ABOVE REGION TO RELEASE>>                    39315000
   TOS:=SAVEDB;                                                         39320000
   EXCHDB;                                                              39325000
   END                                                                  39330000
ELSE                                                                    39335000
   BEGIN  <<RELEASE XTRA PAGES>>                                        39340000
   MEM(X).REGAVAILABLEFLAG:=0; <<PREVENT CONCATENATION IN RELREG>>      39345000
   X:=X+PTRASTORSDISP;                                                  39350000
   MEM(X):=RESIDUALSIZE;                                                39355000
   X:=X+RESIDUALSIZE&LSL(PAGEPOWER)+RSTOPTRSDISP;                       39360000
   MEM(X):=RESIDUALSIZE;                                                39365000
   TOS:=SAVEDB;                                                         39370000
   EXCHDB;                                                              39375000
   TOS:=REGIONBASE;                                                     39380000
   TOS:=TOS+NEWREGSIZE&LSL(PAGEPOWER);                                  39385000
   RELEASEREGION(*,0);                                                  39390000
   END;                                                                 39395000
END   <<CLEANREGION>>;                                                  39400000
$PAGE "MEMORY ALLOCATION PROCEDURES : RESERVE REGION"                   39405000
DOUBLE PROCEDURE RESERVEREGION(REQSIZE,UPPERLIMITSIZE,URGCLASS,         39410000
   SPECIALINFO,PASSED'REGIONBASE);                             <<06945>>39415000
VALUE REQSIZE,UPPERLIMITSIZE,URGCLASS,SPECIALINFO,             <<06945>>39420000
      PASSED'REGIONBASE;                                       <<06945>>39425000
INTEGER REQSIZE,UPPERLIMITSIZE,URGCLASS,SPECIALINFO;                    39430000
DOUBLE PASSED'REGIONBASE;                                      <<06945>>39435000
OPTION PRIVILEGED,UNCALLABLE;                                           39440000
                                                                        39445000
                                                                        39450000
                                                                        39455000
COMMENT                                                                 39460000
                                                                        39465000
RESERVEREGION IS CALLED FROM FETCHOBJECT TO PROCURE AN         <<06212>>39470000
AVAILABLE REGION FOR A PENDING SEGMENT FETCH REQUEST, AND FROM          39475000
COLLECTGARBAGE TO PROCURE AN AVAILABLE REGION FOR A MOVE OF             39480000
ASSIGNED REGIONS WHICH ARE SITTING BETWEEN TWO HOLES.                   39485000
                                                                        39490000
FOR LOCK REQUESTS, THE REGIONBASE TO BE RESERVED IS PASSED IN THE       39495000
REGIONBASE PARAMETER.  FOR NORMAL REGION RESERVATION REQUESTS,          39500000
RESERVEREGION CHECKS THE MAXAVAIL CELL OF THE MAIN MEMORY STATE         39505000
TABLE TO SEE IF IF A REGION OF ADEQUATE SIZE IS AVAILABLE.              39510000
IF NOT, CONTROL IS RETURNED WITH RESERVEREGION VALUE OF 0.              39515000
IF AN AVAILABLE REGION OF ADEQUATE SIZE IS AROUND, THE AVAILABLE        39520000
REGION SIZE BITMAP (ARSBM) IS SCANNED FROM THE REQUEST SIZE UP          39525000
TO DETERMINE THE SIZE OF THE BEST FIT AVAILABLE REGION. THE REGION      39530000
AT THE HEAD OF THAT LIST IS UNLINKED.                                   39535000
                                                                        39540000
AFTER THE REGION TO BE RESERVED IS SELECTED, CLEANREGION IS CALLED TO   39545000
TO FORCE THE WRITES PENDING IN THE REGION AND TO UPDATE THE             39550000
ONGOING I/O COUNT IN THE REGION.  ANY RESIDUAL PAGES ARE RELEASED,      39555000
AND THE DOUBLE WORD ADDRESS OF THE REGION'S BASE IS RETURNED.           39560000
                                                                        39565000
;                                                                       39570000
                                                                        39575000
BEGIN                                                                   39580000
INTEGER WORDINX,                                                        39585000
        BESTFITSIZE;                                                    39590000
DOUBLE                                                         <<06945>>39595000
   REGIONBASE;                                                 <<06945>>39600000
                                                               <<06945>>39605000
SUBROUTINE FINDBESTFITHOLE;                                    <<06945>>39610000
                                                               <<06945>>39615000
   BEGIN                                                       <<06945>>39620000
                                                               <<06945>>39625000
   IF REQSIZE = MAXAVAILREG THEN                               <<06945>>39630000
      BEGIN      << give the tail of the list >>               <<06945>>39635000
      TOS := HOLELISTTAIL;                                     <<06945>>39640000
      TOS := TOS + NLTORBDISP;                                 <<06945>>39645000
      REGIONBASE := TOS;                                       <<06945>>39650000
      BESTFITSIZE := MAXAVAILREG;                              <<06945>>39655000
      END                                                      <<06945>>39660000
   ELSE                                                        <<06945>>39665000
      BEGIN          << must chase through list >>             <<06945>>39670000
      TOS := NLTORSDISP;    << offset to size >>               <<06945>>39675000
      TOS := REQSIZE;       << test word >>                    <<06945>>39680000
      TOS := HOLELISTHEAD;  << addr of first link >>           <<06945>>39685000
      X := HOLECOUNT;       << link count >>                   <<06945>>39690000
      ASMB(LLSH);                                              <<06945>>39695000
      IF <> THEN SUDDENDEATH(619);                             <<06945>>39700000
                                                               <<06945>>39705000
      TOS := TOS+NLTORSDISP;                                   <<06945>>39710000
      ASMB(LSEA);                                              <<06945>>39715000
      BESTFITSIZE := TOS;                                      <<06945>>39720000
      TOS := TOS+RSTORBDISP;                                   <<06945>>39725000
      REGIONBASE := TOS;                                       <<06945>>39730000
      ASMB(DDEL);                                              <<06945>>39735000
      END;                                                     <<06945>>39740000
   END;      << subroutine FINDBESTFITHOLE >>                  <<06945>>39745000
                                                               <<06945>>39750000
                                                               <<06945>>39755000
IF REQSIZE>MAXAVAILREG THEN SUDDENDEATH(619);                  <<01644>>39760000
IF SPECIALINFO = LOCKCODE THEN                                          39765000
   BEGIN  <<ALREADY KNOW WHICH REGION TO USE>>                          39770000
   TOS := RESERVEREGION := REGIONBASE := PASSED'REGIONBASE;    <<06945>>39775000
   TOS:=TOS+RBTORSDISP;                                                 39780000
   ASMB(LSEA);                                                          39785000
   BESTFITSIZE:=TOS;                                                    39790000
   ASMB(DDEL);                                                          39795000
   END                                                                  39800000
ELSE                                                                    39805000
   BEGIN <<MUST SELECT REGION TO BE RESERVED>>                          39810000
   FINDBESTFITHOLE;                                            <<06945>>39815000
   IF (UPPERLIMITSIZE < BESTFITSIZE) LOR                       <<06945>>39820000
      (SPECIALINFO = GARBCOLLCODE LAND                         <<06945>>39825000
       REGIONBASE = PASSED'REGIONBASE) THEN                    <<06945>>39830000
      RESERVEREGION := REGIONBASE := 0D                        <<06945>>39835000
   ELSE                                                                 39840000
      BEGIN <<SELECTED SIZE IS OK>>                                     39845000
      RESERVEREGION := REGIONBASE;                             <<06945>>39850000
      IF = THEN SUDDENDEATH(619);                              <<01644>>39855000
      END;                                                              39860000
   END;                                                                 39865000
                                                                        39870000
TOS:=REGIONBASE;                                                        39875000
IF <> THEN                                                              39880000
   BEGIN <<GOT A REGION>>                                      <<06212>>39885000
                                                               <<06212>>39890000
   <<TAKE IT OFF THE AVAILABLE REGION LIST>>                   <<06212>>39895000
                                                               <<06212>>39900000
   TOS := MMSTATALLOCMEM;  <<***>>                             <<06948>>39905000
   TOS := REQSIZE;  <<***>>                                    <<06948>>39910000
   TOS := REGIONBASE; <<***>>                                  <<06948>>39915000
   MMSTAT'(*,*,*,*,0,0,0);                                     <<06948>>39920000
   TAKEOFFARL(REGIONBASE,BESTFITSIZE);                                  39925000
                                                               <<06212>>39930000
                                                               <<06212>>39935000
   <<MARK REGION RESERVED IN HEADER FOR CLEANING>>             <<06212>>39940000
                                                               <<06212>>39945000
   TOS:=TOS+RBTORASDISP;                                       <<06212>>39950000
   TOS:=REGRESERVEDCODE;                                       <<06212>>39955000
   DISABLE; <<reserved code used by write completor>>          <<06212>>39960000
   ASMB(SSEA);                                                 <<06212>>39965000
                                                               <<06212>>39970000
   <<NOW GET THE REGION CLEANED OUT>>                          <<06212>>39975000
                                                               <<06212>>39980000
   CLEANREGION(REGIONBASE,REQSIZE,URGCLASS,SPECIALINFO);                39985000
                                                               <<06212>>39990000
   <<NOW MARK RESERVED IN TRAILER>>                            <<06212>>39995000
   TOS:=TOS+RASTORSDISP;                                                40000000
   ASMB(LSEA); <<SIZE OF REGION ALLOCATED>>                             40005000
   TOS:=TOS&LSL(PAGEPOWER);                                             40010000
   IF = THEN                                                            40015000
      BEGIN <<WHOLE BANK ALLOCATED FOR THE SEG>>                        40020000
      ASMB(DDEL);                                                       40025000
      TOS:=LASTTRASADDR;                                                40030000
      END                                                               40035000
   ELSE                                                                 40040000
      BEGIN                                                             40045000
      ASMB(LADD);                                                       40050000
      IF NOCARRY THEN TOS:=TOS+RSTOPTRASDISP ELSE                       40055000
         BEGIN <<ALLOCATED REGION EXTENDS TO END OF BANK>>              40060000
         ASMB(DEL);                                                     40065000
         TOS:=LASTTRASADDR;                                             40070000
         END;                                                           40075000
      END;                                                              40080000
   TOS:=REGRESERVEDCODE;                                                40085000
   ASMB(SSEA);                                                          40090000
   END;                                                                 40095000
END   <<RESERVEREGION>>;                                                40100000
$PAGE "MEMORY ALLOCATION PROCEDURES : RECOVER OVERLAY CANDIDATE"        40105000
PROCEDURE RECOVEROC (OBJ,SEGDESCSTINX, OCREGIONBASE);          <<06660>>40110000
VALUE OBJ, SEGDESCSTINX, OCREGIONBASE;                         <<06660>>40115000
DOUBLE OCREGIONBASE,OBJ;                                       <<06660>>40120000
INTEGER SEGDESCSTINX;                                          <<06660>>40125000
OPTION PRIVILEGED,UNCALLABLE;                                           40130000
                                                                        40135000
COMMENT                                                                 40140000
                                                                        40145000
RECOVEROC IS CALLED BY FETCHOBJECT, ABSENCE TRAP HANDLERS AND  <<06212>>40150000
MAPDISCDOMAIN TO RECOVER A SEGMENT OR CACHED DISC DOMAIN WHICH <<06212>>40155000
IS SITTING IN AN AVAILABLE SUBREGION BUT NOT YET CONSUMED BY   <<06212>>40160000
RESERVEREGION.                                                 <<06212>>40165000
                                                               <<06212>>40170000
THE PROCESS OF RECOVERING THE REGION CONSISTS OF BREAKING THE  <<06212>>40175000
AMBIENT AVAILABLE REGION, AND RELEASING THE AVAILABLE SUBREGION<<06212>>40180000
ABOVE AND BELOW THE REQUIRED SUBREGION, IF ANY EXIST.  THE     <<06212>>40185000
REQUIRED SUBREGION IS MARKED ASSIGNED, AND IF IT IS A SEGMENT O<<06212>>40190000
A MAPPED DISC DOMAIN THE RELATED DESCRIPTOR IS FLAGGED PRESENT.<<06212>>40195000
                                                               <<06212>>40200000
                                                                        40205000
;                                                                       40210000
                                                                        40215000
BEGIN                                                                   40220000
                                                                        40225000
<<DB ASSUMED AT SYSDB ON ENTRY>>                                        40230000
                                                                        40235000
LOGICAL ARRAY OBJID(*)=OBJ;                                    <<06660>>40240000
INTEGER SIZEBELOW,                                                      40245000
        SIZEABOVE,                                                      40250000
        NEXT,                                                           40255000
        PCBPT,                                                 <<06650>>40260000
        SEGALLOC,                                                       40265000
        CDTENTRYNUMBER,                                        <<06212>>40270000
        REGIONSIZE;                                                     40275000
                                                                        40280000
LOGICAL DATASEG',                                              <<06613>>40285000
        CODESEG,                                               <<06212>>40290000
        CACHEDDOMAIN;                                          <<06212>>40295000
                                                                        40300000
                                                               <<06212>>40305000
DOUBLE REGIONBASE;                                             <<06212>>40310000
                                                                        40315000
INTEGER BPTINX;                                                         40320000
                                                                        40325000
                                                                        40330000
<<DB ASSUMED TO BE AT SYSDB>>                                           40335000
                                                               <<06212>>40340000
<<TURN OFF TRAPS SINCE CAN EXECUTE ON PROCESS' STACK FROM ININ><<06212>>40345000
                                                               <<06212>>40350000
TURNOFFTRAPS;                                                  <<01644>>40355000
                                                               <<06212>>40360000
<<WHAT TYPE OF OBJECT ARE WE DEALING WITH>>                    <<06212>>40365000
                                                               <<06212>>40370000
CACHEDDOMAIN := CODESEG := DATASEG' := FALSE;                  <<06613>>40375000
                                                               <<06212>>40380000
IF OBJID(ObjIDTypeField)= ObjIDdataType THEN DATASEG':= TRUE   <<07320>>40385000
ELSE                                                           <<07320>>40390000
   IF OBJID(ObjIDTypeField)= ObjIDcdType THEN                  <<07320>>40395000
      BEGIN <<CACHED DISC DOMAIN>>                             <<06212>>40400000
      CACHEDDOMAIN := TRUE;                                    <<06212>>40405000
      CDTENTRYNUMBER := OBJID(ObjIDnumField);                  <<06660>>40410000
      END                                                      <<06660>>40415000
                                                               <<06411>>40420000
   ELSE codeseg := TRUE;                                       <<07320>>40425000
DISABLE; <<IN CASE BACKGROUND WRITE COMPLETES DURING RECOVERY>><<06212>>40430000
                                                               <<06212>>40435000
<<CLEAR THE ROC FLAG, SET THE PRESENT FLAG>>                   <<06212>>40440000
                                                               <<06212>>40445000
IF CACHEDDOMAIN THEN                                           <<06212>>40450000
   BEGIN <<ROC FLAG IS IN THE REGION HEADER AND IN CDT ENTRY>> <<06212>>40455000
   IF GCLASSENABLEDMASK.CLASS0 THEN                            <<06411>>40460000
      IF UPDATESTATISTICS(MEASCLASS0,MEASSUBCLASS0,MEASENTRY1, <<06411>>40465000
                C'CACHERECOVERY,NOTNEWVALUE,1D,NOTDOUBLE)      <<06411>>40470000
      <> 0 THEN SUDDENDEATH(SFKERNCACHEINTBAD);                <<06411>>40475000
   TOS:=OCREGIONBASE;                                          <<06212>>40480000
   TOS:=TOS+RBTOSASDISP;                                       <<06212>>40485000
   ASMB(LSEA);                                                 <<06212>>40490000
   TOS.REGROCFLAG := 0;                                        <<06212>>40495000
   IF = THEN SUDDENDEATH(SFKernCacheINTBAD);                   <<06212>>40500000
   ASMB(SSEA;DDEL);                                            <<06212>>40505000
   IF CDTENTRYNUMBER <> 0 THEN                                 <<06212>>40510000
      BEGIN  <<CACHED DISC DOMAIN IS MAPPED IN>>               <<06212>>40515000
      IF CDT'SET'BIT(OBJID(ObjIDnumField),CDT'ROC'BIT,0)<>1    <<06660>>40520000
      THEN SUDDENDEATH(SFKernCacheSyncBad);                    <<06212>>40525000
      END;                                                     <<06212>>40530000
   TOS:=OCREGIONBASE;                                          <<06212>>40535000
   END                                                         <<06212>>40540000
ELSE                                                           <<06212>>40545000
   BEGIN  <<SEGMENT>>                                          <<06212>>40550000
   X:=SEGDESCSTINX+DSTSYSBASEINX;                              <<06212>>40555000
   SEGDESCFLAGS.ROCFLAG:=0;                                    <<06212>>40560000
   IF = THEN SUDDENDEATH(619);                                 <<06212>>40565000
   TOS:=SEGDESCBANK; <<BANK>>                                  <<06212>>40570000
   TOS:=SEGDESCADDR;     <<SEG BASE>>                          <<06212>>40575000
   ASMB(DDUP);                                                 <<06212>>40580000
   OCREGIONBASE:=TOS;<<FILL IN THE REGBASE PARM FOR SEGS>>     <<06212>>40585000
                                                               <<06212>>40590000
   <<KILL BACKGORUND WRITE IF DATASEG>>                        <<06212>>40595000
                                                               <<06212>>40600000
   IF DATASEG' THEN                                            <<06613>>40605000
      BEGIN <<TRY TO KILL ONGOING WRITE>>                      <<06212>>40610000
      TOS:=TOS+RBTOWREQPDISP;                                  <<06212>>40615000
      ASMB(LSEA);                                              <<06212>>40620000
      IF = THEN                                                <<06212>>40625000
         BEGIN                                                 <<06212>>40630000
         IF NOT LOGICAL(DST(SEGDESCSTINX+1)).DISCCOPYVALIDFLAG <<06212>>40635000
         THEN SUDDENDEATH(618);                                <<06212>>40640000
         ASMB(DEL);                                            <<06212>>40645000
         END                                                   <<06212>>40650000
      ELSE                                                     <<06212>>40655000
         BEGIN                                                 <<06212>>40660000
         IF LOGICAL(DST(SEGDESCSTINX+1)).DISCCOPYVALIDFLAG     <<06212>>40665000
         THEN SUDDENDEATH(618);                                <<06212>>40670000
         DISCQMANAGER(*,ABORTREQCODE);<<ABORT WRITE>>          <<06212>>40675000
         IF < THEN SUDDENDEATH(618);                           <<06212>>40680000
         TOS:=0;                                               <<06212>>40685000
         ASMB(SSEA); <<WIPE OUT REFERENCE TO THAT REQP>>       <<06212>>40690000
         END;                                                  <<06212>>40695000
      DST(SEGDESCSTINX+1).DISCCOPYVALIDFLAG:=0;<<MARK DIRTY>>  <<06212>>40700000
      TOS:=TOS+WREQPTORBDISP;                                  <<06212>>40705000
      END;                                                     <<06212>>40710000
   END;                                                        <<06212>>40715000
                                                               <<06212>>40720000
ENABLE;                                                                 40725000
                                                                        40730000
<<LOCATE THE BEGINNING OF THE AVAILABLE REGION OF                       40735000
  WHICH THE SEGMENT BEING RECOVERED IS A PART>>                         40740000
                                                                        40745000
IF LS0 <= HEADERLENGTH THEN                                             40750000
   BEGIN  <<THE OBJECT IS AT THE FRONT OF THE BANK>>           <<06212>>40755000
   ASMB(DEL);                                                           40760000
   TOS:=RASTORSDISP; <<ADDR OF RS CELL>>                                40765000
   END                                                                  40770000
ELSE                                                                    40775000
   BEGIN  <<OBJECT IN THE MIDDLE OF AN AVAIL REG>>             <<06212>>40780000
                                                                        40785000
   LOOKBACK:  <<SEE IF PREVIOUS SUBREGION IN BANK IS AVAIL>>            40790000
                                                                        40795000
   TOS:=TOS+RBTOPTRASDISP;<<ADDRESS OF PREV REG STATE>>                 40800000
   ASMB(LSEA);                                                          40805000
   TOS.REGAVAILABLEFLAG:=0;                                             40810000
   ASMB(DEL);                                                           40815000
   IF = THEN TOS:=TOS+PTRASTORSDISP <<GOT TO BEGINNING>> ELSE           40820000
      BEGIN  <<PRECEDING SEG PART OF THE AVAIL REG>>                    40825000
      TOS:=TOS+TRASTOTSSDISP;                                           40830000
      ASMB(LSEA);                                                       40835000
      TOS:=TOS&LSL(PAGEPOWER);<<PREV SUBREGION'S SIZE>>                 40840000
      S1:=S1+PTSSTORBDISP;                                              40845000
      ASMB(SUB);                                                        40850000
      IF LS0 > HEADERLENGTH THEN GO LOOKBACK ELSE                       40855000
         BEGIN <<AVAILABLE REGION IS FIRST REGION IN BANK>>             40860000
         ASMB(DEL);                                                     40865000
         TOS:=RASTORSDISP; <<ADDR OF RS CELL>>                          40870000
         END;                                                           40875000
      END;                                                              40880000
   END;                                                                 40885000
                                                                        40890000
<<THE ABS ADDRESS OF THE REGION SIZE CELL OF THE REGION                 40895000
  HEADER OF WHICH THE OC IS A PART IS ON TOS>>                          40900000
                                                                        40905000
<<                                                                      40910000
TAKE THE ENTIRE AVAILABLE REGION OFF THE AVAILABLE REGION LIST          40915000
>>                                                                      40920000
                                                                        40925000
ASMB(LSEA);                                                             40930000
REGIONSIZE:=TOS;                                                        40935000
TOS:=TOS+RSTORBDISP;                                                    40940000
REGIONBASE:=TOS;                                                        40945000
TOS:=OCREGIONBASE-REGIONBASE;                                  <<06212>>40950000
ASMB(XCH,DEL);                                                          40955000
IF <> THEN SUDDENDEATH(614);                                   <<01644>>40960000
SIZEBELOW:=TOS&LSR(PAGEPOWER);                                          40965000
TAKEOFFARL(REGIONBASE,REGIONSIZE);                                      40970000
                                                                        40975000
<<                                                                      40980000
FIX UP HEADER                                                           40985000
>>                                                                      40990000
                                                                        40995000
TOS:=OCREGIONBASE;                                             <<06212>>41000000
TOS:=TOS+RBTOSSDISP;                                                    41005000
ASMB(LSEA);                                                             41010000
SEGALLOC:=TOS;                                                          41015000
TOS:=TOS+SSTORSDISP;                                                    41020000
TOS:=SEGALLOC;                                                          41025000
ASMB(SSEA); <<NEW REGION SIZE>>                                         41030000
TOS:=TOS+RSTORASDISP;                                                   41035000
TOS:=REGASSIGNEDCODE;                                                   41040000
ASMB(SSEA);                                                             41045000
                                                                        41050000
<<                                                                      41055000
RETURN THE REGION BELOW SEG                                             41060000
>>                                                                      41065000
                                                                        41070000
IF SIZEBELOW <> 0  THEN                                                 41075000
   BEGIN <<OC IS IN THE MIDDLE OF AN AR,RETURN PREV TO ARL>>            41080000
   TOS:=REGIONBASE;                                                     41085000
   TOS:=TOS+RBTORSDISP;                                                 41090000
   TOS:=SIZEBELOW;                                                      41095000
   ASMB(SSEA;DDEL);                                                     41100000
   TOS:=OCREGIONBASE;                                          <<06212>>41105000
   TOS:=TOS+RBTOPTRSDISP;                                               41110000
   TOS:=SIZEBELOW;                                                      41115000
   ASMB(SSEA);                                                          41120000
   TOS:=TOS+TRSTOTRASDISP;                                              41125000
   TOS:=REGAVAILABLECODE;                                               41130000
   ASMB(SSEA;DDEL);                                                     41135000
   RELEASEREGION(REGIONBASE,0);                                         41140000
   END;                                                                 41145000
                                                                        41150000
                                                                        41155000
<<                                                                      41160000
FIX UP TRAILER                                                          41165000
>>                                                                      41170000
                                                                        41175000
TOS:=TOS+RASTOPTRASDISP+SEGALLOC&LSL(PAGEPOWER);                        41180000
TOS:=REGASSIGNEDCODE;                                                   41185000
ASMB(SSEA);                                                             41190000
TOS:=TOS+TRASTOTRSDISP;                                                 41195000
TOS:=SEGALLOC;                                                          41200000
ASMB(SSEA);                                                             41205000
                                                                        41210000
<<                                                                      41215000
RELEASE REGION ABOVE                                                    41220000
>>                                                                      41225000
                                                                        41230000
X:=SIZEABOVE:=REGIONSIZE-(SEGALLOC+SIZEBELOW);                          41235000
IF < THEN SUDDENDEATH(614);                                    <<01644>>41240000
IF > THEN                                                               41245000
   BEGIN <<RETURN PORTION OF REGION ABOVE TO ARL>>                      41250000
   TOS:=TOS+PTRSTORASDISP;                                              41255000
   TOS:=REGAVAILABLECODE;                                               41260000
   ASMB(SSEA);                                                          41265000
   TOS:=TOS+RASTORSDISP;                                                41270000
   TOS:=SIZEABOVE;                                                      41275000
   ASMB(SSEA);                                                          41280000
   TOS:=TOS+RSTORBDISP;                                                 41285000
   ASMB(DDUP);                                                          41290000
   TOS:=TOS+RBTOPTRSDISP;                                               41295000
   TOS:=TOS+SIZEABOVE&LSL(PAGEPOWER);                                   41300000
   TOS:=SIZEABOVE;                                                      41305000
   ASMB(SSEA;DDEL);                                                     41310000
   RELEASEREGION(*,0);                                                  41315000
   END;                                                                 41320000
                                                                        41325000
<<NOW MARK THE OBJECT PRESENT>>                                <<06212>>41330000
                                                               <<06212>>41335000
DISABLE;                                                       <<01788>>41340000
                                                               <<06212>>41345000
IF CACHEDDOMAIN THEN                                           <<06212>>41350000
   BEGIN <<CACHED DISC DOMAIN HAS PRESENT BIT IN CDT ENTRY>>   <<06212>>41355000
   IF CDTENTRYNUMBER <> 0 THEN                                 <<06212>>41360000
      BEGIN <<CACHED DISC DOMAIN IS MAPPED IN >>               <<06212>>41365000
      IF CDT'SET'BIT(OBJID(ObjIDnumField),CDT'ABS'BIT,0) <> 1  <<06660>>41370000
      THEN SUDDENDEATH(SFKernCacheSYNCBAD);                    <<06212>>41375000
      END;                                                     <<06212>>41380000
   END                                                         <<06212>>41385000
ELSE                                                           <<06212>>41390000
   BEGIN  <<SEGMENT HAS PRES BIT IN SEG DESC>>                 <<06212>>41395000
   DST(SEGDESCSTINX).ABSENTFLAG:=0;                            <<06212>>41400000
   IF = THEN SUDDENDEATH(619);  <<ALREADY PRESENT?>>           <<06212>>41405000
   END;                                                        <<06212>>41410000
                                                               <<06212>>41415000
                                                               <<06212>>41420000
<<CHECK FOR BREAK POINTS SET AGAINST A CODE SEGMENT>>          <<06212>>41425000
                                                               <<06212>>41430000
                                                                        41435000
IF CODESEG THEN                                                <<07320>>41440000
   BEGIN  <<CODESEG>>                                          <<06212>>41445000
   TOS := CURPRC;                                              <<06650>>41450000
   IF = THEN ASMB(DEL) ELSE                                             41455000
      BEGIN                                                             41460000
      PCBPT := CURPRC;                                         <<06650>>41465000
      TOS := BPTLINK;                                          <<06650>>41470000
      IF = THEN ASMB(DEL) ELSE                                          41475000
         BEGIN <<SEE IF CURRENT PROCESS HAS A BKPT IN OBJIDENT><<06212>>41480000
         BPTINX:=TOS;                                          <<MM.IV>>41485000
         SETSEGSBKPTS(OBJ,SEGDESCSTINX,BPTINX);                <<06660>>41490000
         END;                                                           41495000
      END;                                                              41500000
   IF SYS'BKPT THEN SETSEGSBKPTS(OBJ,SEGDESCSTINX,             <<06660>>41505000
                                 SYS'BKPT'EXT'X);              <<MM.IV>>41510000
   END;                                                                 41515000
                                                                        41520000
                                                               <<06212>>41525000
<<REENABLE PNDG DISC REQUESTS IF A DATASEG>>                   <<06212>>41530000
                                                               <<06212>>41535000
                                                                        41540000
IF DATASEG' THEN                                               <<06613>>41545000
   BEGIN                                                                41550000
   IF DQH'DISAHEAD <> 0 THEN                                   <<07320>>41555000
      CHECKFORDEFERREDDISCREQ(OBJ);                            <<06627>>41560000
   END;                                                                 41565000
END   <<RECOVEROC>>;                                                    41570000
                                                                        41575000
$PAGE "MEMORY ALLOCATION PROCEDURES : ADDTOLOCALITY"                    41580000
                                                                        41585000
PROCEDURE ADDTOLOCALITY(SLLHEADINX,OBJIDENTIFIER,FLAGS);       <<06625>>41590000
VALUE SLLHEADINX,OBJIDENTIFIER,FLAGS;                          <<06625>>41595000
INTEGER SLLHEADINX,FLAGS;                                      <<06625>>41600000
DOUBLE OBJIDENTIFIER;                                          <<06660>>41605000
OPTION PRIVILEGED,UNCALLABLE;                                           41610000
                                                                        41615000
COMMENT                                                                 41620000
                                                                        41625000
ADDTOLOCALITY IS CALLED FROM VARIOUS PLACES TO GET AN OBJECT   <<06212>>41630000
PLACED INTO THE LOCALITY OF A PROCESS.  THE FLAGS PARAMETER    <<06212>>41635000
DETERMINES : WHETHER THE SLL'S MEMORY REQUEST POINTER          <<06212>>41640000
SHOULD BE POINTED AT THE NEW ENTRY, WHETHER A LOCK             <<06212>>41645000
REQUEST (BLOCKED OR UNBLOCKED) IS PENDING AGAINST THE OBJ      <<06212>>41650000
FOR THE PROCESS, WHETHER A FREEZE REQUEST IS PENDING           <<06212>>41655000
AGAINST THE SEG FOR THE PROCESS, WHETHER A WAKE-UP DISC        <<06212>>41660000
I/O REQUEST AGAINST THE SEG HAS BEEN ISSUED ON BEHALF OF THE            41665000
PROCESS, OR WHETHER THE SLLENTRY SHOULD BE FLAGGED AS A PREFETC<<06212>>41670000
REQUEST.                                                       <<06212>>41675000
IF THE OBJECT IS ALREADY ON ITS WAY IN FOR THE PROCESS,        <<06411>>41680000
THE CC IS SET TO CCL, OTHERWISE SET TO CCE.                    <<06411>>41685000
CCG is returned if the NOIMPEDE bit in the flags is set and    <<h7928>>41690000
there are no SLL entries currently available. It is the        <<h7928>>41695000
caller's responsability to handle this situation.              <<h7928>>41700000
                                                               <<h7928>>41705000
                                                               <<06411>>41710000
Format of the FLAGS parameter:                                 <<06625>>41715000
                                                               <<06625>>41720000
    (0:1)  - Set memory request pointer                        <<06625>>41725000
    (1:1)  - Set disc I/O pending flag                         <<06625>>41730000
    (2:1)  - Set process's stack flag                          <<06625>>41735000
    (3:1)  - Set DB at segment flag                            <<06625>>41740000
    (4:1)  - Set blk lk flag                                   <<06625>>41745000
    (5:1)  - Set lock flag                                     <<06625>>41750000
    (6:1)  - Set freeze flag                                   <<06625>>41755000
    (14:1) - Call GETSYSTABENTRY with nowait                   <<07320>>41760000
                                                               <<06625>>41765000
;                                                              <<06411>>41770000
                                                                        41775000
                                                                        41780000
                                                               <<06660>>41785000
BEGIN                                                                   41790000
                                                               <<06625>>41795000
LOGICAL LFLAGS = FLAGS;                                        <<07320>>41800000
LOGICAL IMPEDE'ME'FLAG;                                        <<h7928>>41805000
LOGICAL ARRAY OBJECTID(*) = OBJIDENTIFIER;                     <<06660>>41810000
DOUBLE SLL'OBJID;      << Object id from the SLL >>            <<06660>>41815000
                                                               <<06660>>41820000
LOGICAL MEMREQ:=FALSE;                                                  41825000
                                                               <<06625>>41830000
                                                               <<06625>>41835000
INTEGER OBJSINX,                                               <<06625>>41840000
        SLLINX,       << Index to regular SLL entry >>         <<06625>>41845000
        OBJSENTRYINX;                                          <<06212>>41850000
                                                                        41855000
<<                                                                      41860000
DB ASSUMED TO BE POINTING TO SYSDB                                      41865000
>>                                                                      41870000
                                                                        41875000
                                                                        41880000
<<FLIP THRU THE LIST AND SEE IF ALREADY AN ENTRY FOR THE OBJ>> <<06212>>41885000
                                                                        41890000
DISABLE; <<CAUSE ADDED/DELETED ON ICS TOO>>                    <<06411>>41895000
IMPEDE'ME'FLAG := IF LFLAGS.NOIMPEDE OR                        <<h7928>>41900000
                     ICS(-ICS'PDISCNTCELL) > 0                 <<h7928>>41905000
                  THEN FALSE ELSE TRUE;                        <<h7928>>41910000
                                                               <<h7928>>41915000
SLLINX := SLL(FIRSTINX);                                       <<06625>>41920000
                                                               <<06411>>41925000
TOS := SLL(SLL'OBJDESC);                                       <<06660>>41930000
TOS := SLL(SLL'OBJNUM);                                        <<06660>>41935000
SLL'OBJID := TOS;                                              <<06660>>41940000
                                                               <<06660>>41945000
WHILE SLLINX <> 0  AND  SLL'OBJID <> OBJIDENTIFIER DO          <<06660>>41950000
   BEGIN                                                       <<06660>>41955000
   SLLINX := SLL(NEXTINX);                                     <<06660>>41960000
   TOS := SLL(SLL'OBJDESC);                                    <<06660>>41965000
   TOS := SLL(SLL'OBJNUM);                                     <<06660>>41970000
   SLL'OBJID := TOS;                                           <<06660>>41975000
   END;                                                        <<06660>>41980000
                                                               <<06625>>41985000
IF SLLINX <> 0 THEN OBJSINX := SLLINX ELSE                     <<06625>>41990000
   BEGIN << NO ENTRY YET, SO BUILD ONE AND PUT AT HEAD>>                41995000
                                                               <<07320>>42000000
   << Do Not want to wait for SLL entry if called from Disp. >><<07320>>42005000
                                                               <<07320>>42010000
   OBJSINX := GETSYSTABENTRY(SLLDST,FALSE,IMPEDE'ME'FLAG);     <<h7928>>42015000
   IF OBJSINX = 0 THEN                                         <<07320>>42020000
      IF LFLAGS.NOIMPEDE THEN                                  <<*7822>>42025000
         BEGIN                                                 <<*7822>>42030000
         CC := CCG;                                            <<*7822>>42035000
         RETURN;                                               <<*7822>>42040000
         END                                                   <<*7822>>42045000
      ELSE SUDDENDEATH(602);                                   <<07320>>42050000
   SLL(SEGCOUNT) := SLL(SEGCOUNT) + 1;                         <<06625>>42055000
   TOS := SLL(FIRSTINX);                                       <<06625>>42060000
   SLL(FIRSTINX) := OBJSINX;                                   <<06625>>42065000
   SLLINX := OBJSINX;                                          <<06625>>42070000
   SLL(NEXTINX) := S0;                                         <<06625>>42075000
   TOS := OBJIDENTIFIER;                                       <<06660>>42080000
   SLL(SLL'OBJNUM) := TOS;                                     <<06660>>42085000
   SLL(SLL'OBJDESC) := TOS;                                    <<06660>>42090000
   SLLINX := TOS;                                              <<06625>>42095000
   SLL(PREVINX) := OBJSINX;                                    <<06625>>42100000
   END;                                                                 42105000
                                                                        42110000
<<DO ANYTHING SPECIAL AS REQUIRED BY THE FLAGS PARAMETER>>              42115000
                                                                        42120000
LFLAGS.NOIMPEDE := 0;    << Don't need this bit anymore >>     <<07320>>42125000
SLLINX := OBJSINX;                                             <<06625>>42130000
IF SLL(SLL'FLAGS).SLLIMIFLAG THEN CC:=CCL ELSE CC:=CCE;        <<06625>>42135000
TOS:=FLAGS;                                                             42140000
ASMB(TEST);                                                             42145000
IF <> THEN                                                              42150000
   BEGIN <<SOME SPECIAL STATE OF ALLOCATION>>                           42155000
   TOS.SETMEMREQPTRFLAG:=0;                                             42160000
   IF <> THEN                                                           42165000
      BEGIN                                                             42170000
      MEMREQ:=TRUE;                                                     42175000
      SLL(MEMREQINX) := OBJSINX;                               <<06625>>42180000
      END;                                                              42185000
   TOS.SETDECCNTFLAG:=0;                                       <<06945>>42190000
   IF <> THEN SLL(SLL'FLAGS).SLLDECCNTFLAG := 1;               <<06945>>42195000
   ASMB(TEST);                                                          42200000
   IF <> THEN                                                           42205000
      BEGIN                                                             42210000
      TOS.SETDISCIOSEGFLAG:=0;                                          42215000
      IF <> THEN                                                        42220000
         BEGIN                                                          42225000
         SLL(SLL'FLAGS).SLLDISCIOSEGFLAG := 1;                 <<06625>>42230000
          TOS := SLL(SLL'FLAGS).SLLPREFETCHCOUNT;              <<*7577>>42235000
          IF S0 = MAXPREFETCHCOUNT THEN SUDDENDEATH(619);      <<*7577>>42240000
          TOS := TOS + 1;                                      <<*7577>>42245000
          SLL(SLL'FLAGS).SLLPREFETCHCOUNT := TOS;              <<*7577>>42250000
         END;                                                           42255000
      ASMB(TEST);                                                       42260000
      IF <> THEN                                                        42265000
         BEGIN                                                          42270000
         TOS.PROCSSTKFLAG:=0;                                           42275000
         IF <> THEN SLL(SLL'FLAGS).SLLSTKENTRYFLAG := 1;       <<06625>>42280000
         ASMB(TEST);                                                    42285000
         IF <> THEN                                                     42290000
            BEGIN                                                       42295000
            TOS.SETLOCKFLAG:=0;                                         42300000
            IF <> THEN SLL(SLL'FLAGS).SLLLKREQFLAG := 1;       <<06625>>42305000
            ASMB(TEST);                                                 42310000
            IF <> THEN                                                  42315000
               BEGIN                                                    42320000
               TOS.SETBLKLKFLAG:=0;                                     42325000
               IF <> THEN SLL(SLL'FLAGS).SLLBLKLOCKREQFLAG:=1; <<06625>>42330000
               ASMB(TEST);                                              42335000
               IF <> THEN                                               42340000
                  BEGIN                                                 42345000
                  TOS.SETFZFLAG:=0;                                     42350000
                  IF <> THEN SLL(SLL'FLAGS).SLLFZREQFLAG := 1; <<07320>>42355000
                  ASMB(TEST);                                  <<06104>>42360000
                  IF <> THEN                                   <<06104>>42365000
                     BEGIN                                     <<06104>>42370000
                     TOS.SETMAPSEGFLAG := 0;                   <<06104>>42375000
                     IF <> THEN                                <<07320>>42380000
                     SLL(SLL'FLAGS).SLLMAPSEGFLAG := 1;        <<06625>>42385000
                                                               <<06411>>42390000
                     ASMB(TEST);                               <<07320>>42395000
                     IF <> THEN                                <<07320>>42400000
                        BEGIN                                  <<07320>>42405000
                        TOS.BUMPPREFETCHCNTFLAG:=0;            <<07320>>42410000
                        IF = THEN SUDDENDEATH(619);            <<07320>>42415000
                        IF SLL(SLL'FLAGS).SLLPREFETCHCOUNT     <<07320>>42420000
                           = MAXPREFETCHCOUNT                  <<07320>>42425000
                        THEN SUDDENDEATH(SFKernCacheSyncBad);  <<07320>>42430000
                        SLL(SLL'FLAGS).SLLPREFETCHCOUNT :=     <<07320>>42435000
                           SLL(SLL'FLAGS).SLLPREFETCHCOUNT + 1;<<07320>>42440000
                        END;                                   <<07320>>42445000
                     END;                                      <<07320>>42450000
                  END;                                                  42455000
               END;                                                     42460000
            END;                                                        42465000
         END;                                                           42470000
      END;                                                              42475000
   END;                                                                 42480000
END  <<PROCEDURE ADDTOLOCALITY>>;                                       42485000
$PAGE "Memory Allocation Procedures : Pre Fetch Object"        <<06212>>42490000
                                                               <<06212>>42495000
PROCEDURE PreFetchObject(Pin, Obj);                            <<06660>>42500000
VALUE Pin, Obj;                                                <<06660>>42505000
INTEGER Pin;                                                   <<06212>>42510000
DOUBLE  OBJ;                                                   <<06660>>42515000
OPTION PRIVILEGED,UNCALLABLE;                                  <<06212>>42520000
                                                               <<06212>>42525000
COMMENT                                                        <<06212>>42530000
                                                               <<06212>>42535000
PreFetchObject adds the object to the specified process' sll   <<06212>>42540000
and bumps the prefetch count of the object in the specified    <<06212>>42545000
process' sll entry for the object.                             <<06212>>42550000
                                                               <<06212>>42555000
If the object is not present, the process requiring the prefetc<<06212>>42560000
is flagged absent if not the current process and waited if the <<06212>>42565000
current process.                                               <<06212>>42570000
                                                               <<06212>>42575000
If the object is present: if the object is a mapped disc domain<<06212>>42580000
the CDT queue processor is invoked to attempt a cache move- in <<06212>>42585000
any case for a present object, the caller is returned to, and  <<06212>>42590000
nobody is flagged absent.                                      <<06212>>42595000
                                                               <<06212>>42600000
A prefetch causes the memory manager to initiate an object     <<06212>>42605000
fetch.    The process may be relaunched before the object      <<06212>>42610000
arrives.                                                       <<06212>>42615000
                                                               <<06212>>42620000
PreFetchObject is called from the cache management system to   <<06212>>42625000
associate a mapped disc domain with a process and to initiate  <<06212>>42630000
a fetch of the indicated disc domain.  PreFetchObject could    <<06212>>42635000
also be called in other circumstances in which an unblocked    <<06212>>42640000
segment fetch is required.                                     <<06212>>42645000
                                                               <<06212>>42650000
 When the object is no longer required, the PreFetch should be <<06212>>42655000
offset by a call to AdjustLocality which will decrement the    <<06212>>42660000
prefetch count in the sll list of the process for the specified<<06212>>42665000
object.                                                        <<06212>>42670000
                                                               <<06212>>42675000
PreFetchObject assumes the current process is the one requestin<<06212>>42680000
that the prefetch be performed if the pin parameter is zero.   <<06212>>42685000
                                                               <<06212>>42690000
A non-zero prefetch count for an object in an sll list locks   <<06212>>42695000
the entry in the process'  sll list and causes the object to   <<06212>>42700000
continue to get prefetched until the prefetch count falls to   <<06212>>42705000
zero via offsetting calls in AdjustLocality.                   <<06212>>42710000
                                                               <<06212>>42715000
;                                                              <<06212>>42720000
                                                               <<06212>>42725000
                                                               <<06212>>42730000
BEGIN                                                          <<06212>>42735000
LOGICAL flags := FALSE;                                        <<06411>>42740000
INTEGER SWAPFLAGS:=0, <<SOFTSWAP,NO WAKEUP>>                   <<06411>>42745000
        PCBPT;                                                 <<06650>>42750000
LOGICAL ARRAY ObjID(*)=Obj;                                    <<06660>>42755000
INTEGER SLLHEADINX;                                            <<06625>>42760000
INTEGER segdescstinx;                                          <<06212>>42765000
INTEGER iostatus;                                              <<06212>>42770000
DOUBLE regionbase;                                             <<06212>>42775000
DOUBLE  savedb;                                                <<06212>>42780000
                                                               <<06212>>42785000
                                                               <<06212>>42790000
<<set up environment>>                                         <<06212>>42795000
                                                               <<06212>>42800000
turnofftraps;                                                  <<06212>>42805000
pdisable;                                                      <<06212>>42810000
disable;                                                       <<06411>>42815000
tos:=%1000d;                                                   <<06212>>42820000
asmb(xchd);                                                    <<06212>>42825000
savedb:=tos;                                                   <<06212>>42830000
                                                               <<06212>>42835000
IF PIN = 0 THEN PIN := (PCBPT := CURPRC/PCBSIZE)               <<06945>>42840000
ELSE PCBPT := PIN * PCBSIZE;                                   <<06945>>42845000
                                                               <<06945>>42850000
<<add object to process' sll with prefetch>>                   <<06212>>42855000
SLLHEADINX := SLLPTR;                                          <<06650>>42860000
flags.setmemreqptrflag:=1;                                     <<06411>>42865000
flags.bumpprefetchcntflag := 1;                                <<06212>>42870000
AddToLocality(sllheadinx,obj,flags);                           <<06660>>42875000
                                                               <<06411>>42880000
IF IsObjectAbsent(obj) AND NOT IsObjectIMI(obj) THEN           <<06660>>42885000
   BEGIN <<must get the object fetch initiated>>               <<06411>>42890000
   IF SWAPIN(PCBPT,SWAPFLAGS) <> MMOK THEN                     <<06650>>42895000
      BEGIN <<initiate swapin through normal channels>>        <<06411>>42900000
      FlagProcAbsent(pin,Obj,0);                                <<MEAS>>42905000
      END                                                      <<*8803>>42910000
   ELSE     << Swapin was successful >>                        <<*8803>>42915000
      WAITTODISPMSG.MEMTRAPFLAG := 0;                          <<*8803>>42920000
   END;                                                        <<06411>>42925000
                                                               <<06411>>42930000
                                                               <<06411>>42935000
                                                               <<s8699>>42940000
IF NOT IsObjectAbsent(obj) THEN                                <<s8699>>42945000
   BEGIN <<object already around>>                             <<06212>>42950000
   IF objid(ObjIDTypeField)= objidcdtype  THEN                 <<06660>>42955000
      BEGIN <<disc cache hit>>                                 <<06212>>42960000
      CDT'ABS'ON'TOS;                                          <<d7738>>42965000
      tos := tos + (OBJID(ObjIDNumField) * CDT'ENTRY'SIZE) +   <<d7738>>42970000
             CDT'MD'MEM'ADDR;                                  <<d7738>>42975000
      ASMB(LDEA;DXCH,DDEL);                                    <<d7738>>42980000
      << Mapped domain memory address is on TOS >>             <<d7738>>42985000
      TOS:=TOS+RBTOSASDISP;                                    <<06212>>42990000
      ASMB(LSEA);                                              <<06212>>42995000
      iostatus:=TOS.regfetchiostatus;                          <<06212>>43000000
      ProcessCDTLogReqQ(objid(ObjIDnumField),iostatus,0);      <<06660>>43005000
      END;                                                     <<06212>>43010000
   END;                                                        <<06411>>43015000
                                                               <<06411>>43020000
tos:=savedb;                                                   <<06212>>43025000
asmb(xchd);                                                    <<06212>>43030000
penable;                                                       <<06212>>43035000
                                                               <<06212>>43040000
END;  <<PreFetchObject>>                                       <<06212>>43045000
$PAGE "MEMORY ALLOCATION PROCEDURES : MAKE OVERLAY CANDIDATE"  <<06212>>43050000
                                                                        43055000
PROCEDURE MAKEOC(DESCSTINX,OBJ,REQSIZE,REGIONBASE);            <<06660>>43060000
VALUE DESCSTINX,OBJ,REQSIZE,REGIONBASE;                        <<06660>>43065000
INTEGER DESCSTINX,REQSIZE;                                     <<06660>>43070000
DOUBLE REGIONBASE,OBJ;                                         <<06660>>43075000
OPTION PRIVILEGED,UNCALLABLE;                                           43080000
                                                                        43085000
COMMENT                                                                 43090000
                                                                        43095000
MAKEOC RELEASES THE SPECIFIED REGION TO THE POOL OF            <<06212>>43100000
AVAILABLE SPACE.  MAKEOC IS CALLED FROM MAKEROOM WHEN THE REPLACEMENT   43105000
ALGORITHM HAS BEEN INVOKED AND HAS SELECTED AN ASSIGNED REGION <<06212>>43110000
NO LONGER BEING REQUIRED BY THE CURRENT MULTIPROGRAMMING SET.           43115000
ALSO CALLED FROM CREATELOCKSPACE WHEN CLEARING OUT A LOCK REGION        43120000
                                                               <<06212>>43125000
                                                                        43130000
WHEN INVOKED, MAKEOC RELEASES THE ASSIGNED MAIN MEMORY REGION  <<06212>>43135000
TO THE AVAILABLE REGION LISTS VIA A CALL TO RELEASEREGION.     <<06212>>43140000
                                                                        43145000
IF THE REGION BEING RELEASED IS OCCUPIED BY A CACHED DISC      <<06212>>43150000
DOMAIN, THE DOMAIN IS FLAGGED AS AN OVERLAY CANDIDATE IN THE   <<06212>>43155000
SUBREGION ASSIGNMENT STATE OF THE REGION HEADER, AND THE DOMAIN<<06212>>43160000
CDT ENTRY IS MARKED ABSENT, ROC.                               <<06212>>43165000
                                                               <<06212>>43170000
IF THE REGION BEING MADE INTO AN OVERLAY CANDIDATE CONTAINS A  <<06212>>43175000
DATA SEGMENT,                                                  <<06212>>43180000
A WRITE IS QUEUED INTO THE BACKGROUND QUEUE. WHEN THE REGION OCCUPIED   43185000
BY THE DATA SEGMENT IS ACTUALLY SELECTED AS THE TARGET FOR A SEGMENT    43190000
READ, THE PRIORITY OF THIS SEGMENT WRITE REQUEST GETS BUMPED.           43195000
IF THE DATA SEGMENT IS RECOVERED, THE WRITE REQUEST WILL BE ABORTED.    43200000
                                                                        43205000
;                                                                       43210000
                                                                        43215000
                                                                        43220000
BEGIN                                                                   43225000
                                                                        43230000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>43235000
INTEGER DESCSYSDBINX,                                                   43240000
        MMBANK=REGIONBASE,                                     <<06212>>43245000
        MMBASE=REGIONBASE+1;                                   <<06212>>43250000
                                                                        43255000
                                                               <<06212>>43260000
                                                                        43265000
INTEGER WRITREQSYSDBINX,                                                43270000
        XFERCOUNT,                                                      43275000
        WRITEDISABLEDCOUNT:=0;                                          43280000
                                                                        43285000
                                                                        43290000
DEFINE PEXIT = ASSEMBLE(EXIT 6)#;                              <<*7766>>43295000
                                                               <<*7766>>43300000
SUBROUTINE RELEASESEG;                                         <<06212>>43305000
                                                               <<06212>>43310000
BEGIN                                                          <<06212>>43315000
                                                               <<06212>>43320000
X:=DESCSYSDBINX:=DESCSTINX+DSTSYSBASEINX;                               43325000
MMBANK:=SEGDESCBANK; <<fill in the regionbase parm>>           <<06212>>43330000
MMBASE:=SEGDESCADDR;                                                    43335000
DISABLE;                                                                43340000
IF SEGDESCFLAGS.IMIFLAG THEN SUDDENDEATH(619);                 <<01644>>43345000
<<TRYING TO CANCEL A SEGMENT RESERVATION-NO LONGER ALLOWED>>   <<01557>>43350000
IF LOGICAL(SEGDESCFLAGS).SEGRESIDENTFLAG                       <<01644>>43355000
THEN SUDDENDEATH(616) ELSE                                     <<01644>>43360000
   BEGIN <<SEG NOT RESIDENT-MAKE SURE NOT LOCKED,FROZEN,IOFZN>>         43365000
   TOS:=REGIONBASE;                                                     43370000
   TOS:=TOS+RBTORASDISP;                                                43375000
   ASMB(LSEA);                                                          43380000
                                                               <<*7766>>43385000
   IF LS0.REGMAPFLAG = 1 AND NOT MEMPRESSURE'CELL THEN PEXIT;  <<*7766>>43390000
                                                               <<*7766>>43395000
   TOS.REGLKDFLAG:=0;                                                   43400000
   IF <> THEN SUDDENDEATH(616) ELSE                            <<01644>>43405000
      BEGIN                                                             43410000
      TOS.REGFZFLAG:=0;                                                 43415000
      IF <> THEN SUDDENDEATH(616) ELSE                         <<01644>>43420000
         BEGIN                                                          43425000
         TOS.REGIOFZFLAG:=0;                                            43430000
         IF <> THEN SUDDENDEATH(616) ELSE                      <<01644>>43435000
            BEGIN <<MARK ABSENT,FLAG AS ROC,RELEASE REGION,WRITE>>      43440000
            ASMB(DEL);                                                  43445000
            TOS:=TOS+RASTOSDDISP;                                       43450000
            ASMB(LSEA);                                                 43455000
            TOS.SDVALIDFLAG:=0;                                         43460000
            ASMB(SSEA;DDEL); <<SIGNAL WRITCOMP NOTHING TO DO>> <<06212>>43465000
            X:=DESCSYSDBINX;                                            43470000
            SEGDESCFLAGS.ROCFLAG:=1; <<FLAG AS OC IN DESC>>             43475000
            SEGDESCFIRMINFO.ABSENTFLAG:=1;                              43480000
            IF <> THEN SUDDENDEATH(616) ELSE                   <<01644>>43485000
            IF OBJIDENT(ObjIDTypeField)=OBJIDDATATYPE THEN     <<06660>>43490000
            STARTOBJWRITE(OBJ,BKGRNDPRI,REGIONBASE,0,0);       <<06660>>43495000
            ENABLE;                                                     43500000
            RELEASEREGION(REGIONBASE,REQSIZE);                          43505000
            END;                                                        43510000
         END;                                                           43515000
      END;                                                              43520000
   END;                                                        <<06212>>43525000
END; <<SUBROUTINE RELEASESEG>>                                 <<06212>>43530000
                                                               <<06212>>43535000
SUBROUTINE RELEASECACHEDDOMAIN;                                <<06212>>43540000
                                                               <<06212>>43545000
BEGIN                                                          <<06212>>43550000
                                                               <<06212>>43555000
<<MARK DOMAIN AS AN OVERLAY CANDIDATE>>                        <<06212>>43560000
                                                               <<06212>>43565000
TOS:=REGIONBASE;                                               <<06212>>43570000
TOS:=TOS+RBTOSASDISP;                                          <<06212>>43575000
DISABLE;                                                       <<06212>>43580000
ASMB(LSEA);                                                    <<06212>>43585000
TOS.regrocflag := 1;                                           <<06212>>43590000
IF <> THEN SUDDENDEATH(SFKernCacheSyncBad);                    <<06212>>43595000
ASMB(SSEA);                                                    <<06212>>43600000
                                                               <<06212>>43605000
<<MARK SUBREGION DISP INVALID FOR WRITE COMP>>                 <<06212>>43610000
                                                               <<06212>>43615000
TOS:=TOS+SASTOSDDISP;                                          <<06212>>43620000
ASMB(LSEA);                                                    <<06212>>43625000
TOS.SDVALIDFLAG:=0;                                            <<06212>>43630000
ASMB(SSEA;DDEL);                                               <<06212>>43635000
                                                               <<06212>>43640000
<<MARK CDT ENTRY ABSENT, ROC IF CACHED DOMAIN MAPPED IN>>      <<06212>>43645000
                                                               <<06212>>43650000
IF OBJIDENT(ObjIDnumField)<> 0 THEN                            <<06660>>43655000
   BEGIN <<CACHED DISC DOMAIN HAS A CDT ENTRY>>                <<06212>>43660000
   CDT'ABS'ON'TOS;                                             <<d7738>>43665000
   tos := tos + (OBJIDENT(ObjIDNumField) * CDT'ENTRY'SIZE) +   <<d7738>>43670000
          CDT'MD'FLAGS;                                        <<d7738>>43675000
   ASMB(LSEA);   << Put flags word on TOS >>                   <<d7738>>43680000
   tos.(CDT'ROC'BIT:1) := 1;                                   <<d7738>>43685000
   if <> then SUDDENDEATH(SFKernCacheSYNCBAD);                 <<d7738>>43690000
   tos.(CDT'ABS'BIT:1) := 1;                                   <<d7738>>43695000
   if <> then SUDDENDEATH(SFKernCacheSYNCBAD);                 <<d7738>>43700000
   ASMB(SSEA;DDEL);  << Store back flags word >>               <<d7738>>43705000
   END;                                                        <<06212>>43710000
<<NOW RELEASE THE MAIN MEMORY REGION>>                         <<06212>>43715000
ENABLE;                                                        <<06212>>43720000
RELEASEREGION(REGIONBASE,REQSIZE);                             <<06212>>43725000
                                                               <<06212>>43730000
END;  <<SUBROUTINE RELEASECACHEDDOMAIN>>                       <<06212>>43735000
                                                               <<06212>>43740000
                                                               <<06212>>43745000
MMSTAT'(MMSTATMAKEOC,OBJIDENT(OBJIDDESCFIELD),                 <<06948>>43750000
       OBJIDENT(OBJIDNUMFIELD),MMBANK,MMBASE,0,0);             <<06948>>43755000
                                                               <<06212>>43760000
IF OBJIDENT(ObjIDTypeField)=OBJIDCDTYPE                        <<06660>>43765000
THEN RELEASECACHEDDOMAIN                                       <<06212>>43770000
ELSE RELEASESEG;                                               <<06212>>43775000
                                                               <<06212>>43780000
END  <<PROCEDURE MAKEOC>>;                                              43785000
$PAGE "MEMORY ALLOCATION PROCEDURES : PUT PROCESS ON OBJ'S Q"  <<06212>>43790000
PROCEDURE PutProcOnObjectsMPQ(PROCPIN,OBJIDENT,REGIONBASE,     <<06212>>43795000
   SLLHEADINX,SLLINX,PREFETCHREQ);                             <<06625>>43800000
VALUE PROCPIN,OBJIDENT,REGIONBASE,SLLHEADINX,SLLINX,           <<06625>>43805000
   prefetchreq;                                                <<06411>>43810000
INTEGER PROCPIN,SLLHEADINX,SLLINX;                             <<06625>>43815000
LOGICAL PREFETCHREQ;                                           <<06660>>43820000
DOUBLE OBJIDENT,REGIONBASE;                                    <<06660>>43825000
OPTION PRIVILEGED,UNCALLABLE;                                           43830000
                                                                        43835000
                                                                        43840000
COMMENT                                                                 43845000
                                                                        43850000
PUTPROCONSEGSMPQ IS CALLED BY FETCHOBJECT WHEN A PROCESS REQUIR<<06212>>43855000
SEGMENT WHICH IS ALREADY IN MOTION IN.  THE PROCESS IS QUEUED           43860000
THROUGH THE SLL ENTRIES OF THE WAITING PROCESSES.                       43865000
                                                                        43870000
;                                                                       43875000
                                                                        43880000
                                                                        43885000
BEGIN                                                                   43890000
                                                               <<06660>>43895000
DOUBLE SLL'OBJID;                                              <<06660>>43900000
                                                               <<06660>>43905000
INTEGER PCBPT;                                                 <<06751>>43910000
                                                               <<06660>>43915000
                                                               <<06625>>43920000
                                                               <<06625>>43925000
DISABLE;                                                                43930000
IF SLL(SLL'FLAGS).SLLIMIFLAG  THEN SUDDENDEATH(613);           <<06625>>43935000
SLL(SLL'FLAGS).SLLIMIFLAG := 1;                                <<06625>>43940000
IF PREFETCHREQ THEN SLL(SLL'FLAGS).SLLDECCNTFLAG := 0          <<06625>>43945000
ELSE SLL(SLL'FLAGS).SLLDECCNTFLAG := 1;                        <<06625>>43950000
IF NOT prefetchreq THEN                                        <<06411>>43955000
SLL(SCHEDTOIOMSG):=SLL(SCHEDTOIOMSG)+1;<< # I/Os before awake>><<06625>>43960000
TOS:=REGIONBASE;                                                        43965000
TOS:=TOS+RBTOMPQLINKDISP;                                               43970000
ASMB(LSEA);                                                             43975000
IF = THEN                                                               43980000
   BEGIN <<FIRST PROCESS WAITING FOR THIS SEG>>                         43985000
   ASMB(DEL);                                                           43990000
   TOS := PROCPIN * PCBSIZE;                                   <<06660>>43995000
   ASMB(SSEA);                                                          44000000
   SLL(NEXTIMPPIN) := 0;                                       <<06625>>44005000
   END                                                                  44010000
ELSE                                                                    44015000
   BEGIN <<MUST LINK TO TAIL>>                                          44020000
   SLL(NEXTIMPPIN) := 0;  << This guy is last >>               <<06751>>44025000
   ASMB(DELB,DELB);       << Del RB, save queue head >>        <<06751>>44030000
                                                               <<06751>>44035000
   WHILE (PCBPT := TOS) <> 0 DO                                <<06751>>44040000
      BEGIN                                                    <<06751>>44045000
      SLLHEADINX := INTEGER(SLLPTR);                           <<06751>>44050000
      SLLINX := SLL(FIRSTINX);                                 <<06751>>44055000
                                                               <<06751>>44060000
      TOS := SLL(SLL'OBJDESC);                                 <<06751>>44065000
      TOS := SLL(SLL'OBJNUM);                                  <<06751>>44070000
      SLL'OBJID := TOS;                                        <<06751>>44075000
                                                               <<06751>>44080000
      WHILE SLL'OBJID <> OBJIDENT DO                           <<06751>>44085000
         BEGIN                                                 <<06751>>44090000
         SLLINX := SLL(NEXTINX);                               <<06751>>44095000
         IF = THEN SUDDENDEATH(2001);                          <<06751>>44100000
         TOS := SLL(SLL'OBJDESC);                              <<06751>>44105000
         TOS := SLL(SLL'OBJNUM);                               <<06751>>44110000
         SLL'OBJID := TOS;                                     <<06751>>44115000
         END;                                                  <<06751>>44120000
                                                               <<06751>>44125000
      TOS := SLL(NEXTIMPPIN);                                  <<06751>>44130000
      END;                                                     <<06751>>44135000
                                                               <<06751>>44140000
   SLL(NEXTIMPPIN) := PROCPIN * PCBSIZE;                       <<06751>>44145000
   END;                                                                 44150000
END  <<PROCEDURE PutProcOnObjectsMPQ>>;                        <<06212>>44155000
                                                                        44160000
$PAGE  "MEMORY ALLOCATION PROCEDURES : PUT DEVICE ON SEG'S Q"  <<06212>>44165000
PROCEDURE PutDeviceOnObjectsMPQ(ioqinx,regionbase);            <<06620>>44170000
VALUE IOQINX,REGIONBASE;                                       <<06620>>44175000
INTEGER IOQINX;                                                <<06620>>44180000
DOUBLE REGIONBASE;                                                      44185000
OPTION PRIVILEGED,UNCALLABLE;                                           44190000
                                                                        44195000
COMMENT                                                                 44200000
                                                                        44205000
AN ENTRY FROM THE SPECIAL REQ TABLE IS USED TO MAINTAIN A LIST          44210000
OF THE DEVICES IN WAITING THE SPECIFIED SEGMENT TO ARRIVE.  THE         44215000
IOQ RELATIVE INDEX OF THIS ENTRY IS KEPT IN THE SEGMENT'S REGIO<<06620>>44220000
HEADER.                                                                 44225000
                                                                        44230000
;                                                                       44235000
                                                                        44240000
BEGIN                                                                   44245000
                                                                        44250000
DEFINE                                                         <<*7606>>44255000
   ADISC   = LOGICAL(IOQINX).(1:1)#;                           <<*7606>>44260000
                                                               <<*7606>>44265000
INTEGER                                                        <<06620>>44270000
   DRQ'ENTRY'INDEX,                                            <<*7606>>44275000
   FULL'ENTRY'PTR;  << Table rel. ptr to last full SRT entry >><<06620>>44280000
                                                               <<06620>>44285000
DOUBLE                                                         <<06620>>44290000
   SAVEDB,         << DB at entry/exit >>                      <<06620>>44295000
   SR'TABLEDB;     << DB when at special request table >>      <<06620>>44300000
                                                                        44305000
                                                               <<*7606>>44310000
IF ADISC THEN                                                  <<*7606>>44315000
   BEGIN                                                       <<*7606>>44320000
   DRQ'ENTRY'INDEX := IOQINX.(2:14);                           <<*7606>>44325000
   IF DRQ'DATAFRZN OR DRQ'DONE THEN RETURN;                    <<*7606>>44330000
   END;                                                        <<*7606>>44335000
                                                               <<*7606>>44340000
TOS := DST(SPECREQDST&LSL(2) + 2); << BANK >>                  <<06616>>44345000
TOS := DST(X + 1);                                             <<06616>>44350000
ASMB(XCHD);                                                    <<06616>>44355000
SAVEDB := TOS;                                                 <<06616>>44360000
TOS:=REGIONBASE;                                                        44365000
TOS:=TOS+RBTOCOMPMSGDISP;                                               44370000
ASMB(LSEA);                                                             44375000
TOS.COMPMSGIOWAKEFLAG:=1;                                               44380000
ASMB(SSEA);                                                             44385000
TOS:=TOS+COMPMSGTOIOREQQDISP;                                           44390000
ASMB(LSEA);                                                             44395000
IF = THEN                                                               44400000
   BEGIN <<FIRST DEVICE IN LINE>>                                       44405000
   ASMB(DEL);                                                           44410000
   X := GETSYSTABENTRY(SPECREQDST,TRUE,FALSE); << P,NW >>      <<06616>>44415000
   IF X=0 THEN SUDDENDEATH(600);<<SPEC REQ TAB CONF TOO SMALL>>         44420000
   ENTRYWORD01 := IOQINX;                                      <<06620>>44425000
   TOS:=X;                                                              44430000
   ASMB(SSEA);       << Table rel ptr to spec. req. entry >>   <<06620>>44435000
   END                                                                  44440000
ELSE                                                                    44445000
   BEGIN  <<MUST GET IN LINE>>                                          44450000
   X := TOS;                                                   <<06620>>44455000
   WHILE ENTRYWORD00 <> 0 DO                                   <<06620>>44460000
      BEGIN      << This entry full already >>                 <<06620>>44465000
      X := ENTRYWORD00;       << Try next entry >>             <<06620>>44470000
      END;                                                     <<06620>>44475000
                                                               <<06620>>44480000
   IF ENTRYWORD01=0 THEN SUDDENDEATH(612);                     <<06620>>44485000
   IF ENTRYWORD02 = 0 THEN ENTRYWORD02 := IOQINX               <<06620>>44490000
   ELSE IF ENTRYWORD03 = 0 THEN ENTRYWORD03 := IOQINX          <<06620>>44495000
   ELSE IF ENTRYWORD04 = 0 THEN ENTRYWORD04 := IOQINX          <<06620>>44500000
   ELSE IF ENTRYWORD05 = 0 THEN ENTRYWORD05 := IOQINX          <<06620>>44505000
   ELSE                                                        <<06620>>44510000
      BEGIN    << Entry is now full -- get another >>          <<06620>>44515000
      DISABLE;                                                 <<06620>>44520000
      FULL'ENTRY'PTR := X;                                     <<06620>>44525000
      X := GETSYSTABENTRY(SPECREQDST,TRUE,FALSE); << Primary >><<06620>>44530000
      IF X = 0 THEN SUDDENDEATH(600);                          <<06620>>44535000
      ENTRYWORD00 := 0;    << New entry NOT full >>            <<06620>>44540000
      ENTRYWORD01 := IOQINX;                                   <<06620>>44545000
      TOS := X;            << New entry ptr >>                 <<06620>>44550000
      X := FULL'ENTRY'PTR;                                     <<06620>>44555000
      ENTRYWORD00 := TOS;   << Link previous to the new entry>><<06620>>44560000
      ENABLE;                                                  <<06620>>44565000
      END;    << Entry was full >>                             <<06620>>44570000
   END;                                                                 44575000
TOS := SAVEDB;                                                 <<06616>>44580000
ASMB(XCHD);                                                    <<06616>>44585000
DDEL;                                                          <<06620>>44590000
END  <<PUTDEVICEONOBJECTSMPQ>>;                                <<06212>>44595000
                                                                        44600000
$PAGE "MEMORY ALLOCATION PROCEDURES : ADJUSTLOCALITY"                   44605000
PROCEDURE ADJUSTLOCALITY(PCBPT,OBJIDENT,REQSIZE,FLAGS);        <<06650>>44610000
VALUE PCBPT,OBJIDENT,REQSIZE,FLAGS;                            <<06650>>44615000
LOGICAL PCBPT,REQSIZE,FLAGS;                                   <<06660>>44620000
DOUBLE OBJIDENT;                                               <<06660>>44625000
OPTION PRIVILEGED,UNCALLABLE;                                           44630000
                                                                        44635000
COMMENT                                                                 44640000
                                                                        44645000
ADJUSTLOCALITY IS CALLED TO MAKE MODIFICATIONS TO THE LOCALITY          44650000
OF A PROCESS.  THE PROCEDURE MAKES A SCAN THROUGH THE LOCALITY          44655000
LIST AND PERFORMS THE FUNCTION INDICATED BY THE FLAGS PARAMETER.        44660000
THE PROCEDURE IS CALLED FROM THE FOLLOWING PLACES TO PERFORM            44665000
THE FOLLOWING FUNCTIONS :                                               44670000
   (I) SIODM TOCLEAR THE DISC I/O SEG FLAG AGAINST THE SEGMENT          44675000
       FOR THE PROCESS                                                  44680000
  (II) FROM TERMINATE TO FLUSH THE LOCALITY LIST                        44685000
 (III) FROM SWAP-IN TO INITIALIZE THE LOCALITY LIST OF A PROCESS        44690000
  (IV) FROM DISPATCHER TO REFERENCE THE MINIMAL LOCALITY OF A           44695000
       PROCESS WHEN WHIPPING HTHROUGH THE DISPATCHING QUEUE TO          44700000
       KEEP THAT PROCESS' SEGS FROM GETTING EATEN BY THE CLOCK          44705000
       FOR LESS URGENT PROCESSES.                                       44710000
   (V) FROM THE CACHE MOVE ROUTINE WHEN THE DISC DOMAIN NEED NO<<06212>>44715000
       BE KEPT IN THE PROCESS' LOCALITY ANY LONGER (DECS THE   <<06212>>44720000
       PREFETCH COUNT).                                        <<06212>>44725000
                                                               <<06625>>44730000
                                                               <<06625>>44735000
Format of FLAGS parameter:                                     <<06625>>44740000
                                                               <<06625>>44745000
     (1:1)  - Init locallity list                              <<06625>>44750000
     (2:1)  - Flush locallity list                             <<06625>>44755000
     (3:1)  - Clear disc I/O pending flag                      <<06625>>44760000
     (8:1)  - Release SLL entry until there's room             <<06625>>44765000
     (9:1)  - Reference min. locallity (for clock)             <<06625>>44770000
    (15:1)  - Release SLL entry                                <<06625>>44775000
                                                               <<06625>>44780000
;                                                                       44785000
                                                                        44790000
BEGIN                                                                   44795000
                                                                        44800000
DOUBLE                                                         <<06660>>44805000
   DBSEG,                                                      <<06660>>44810000
   SLL'OBJID;                                                  <<06660>>44815000
DOUBLE LASTREFSWAPSEG;                                         <<06650>>44820000
LOGICAL FOUNDIT;                                               <<06660>>44825000
                                                               <<06625>>44830000
INTEGER DESCSTINX,                                                      44835000
        SLLHEADINX,      << Index to SLL header entry >>       <<06625>>44840000
        SLLINX,                                                         44845000
        NEXTSLLENTRYINX,                                                44850000
        SLLENTRYINX,                                                    44855000
        MEMREQENTRYINX,                                        <<06625>>44860000
        COUNT;                                                          44865000
                                                                        44870000
SUBROUTINE RELSLLENTRY;                                                 44875000
                                                                        44880000
BEGIN                                                                   44885000
<<UNLINK ENTRY FROM ITS SLL>>                                           44890000
SLLENTRYINX := SLLINX;      << Entry to be removed >>          <<06625>>44895000
SLL(SEGCOUNT) := SLL(SEGCOUNT) - 1;                            <<06625>>44900000
IF INTEGER(SLL(MEMREQINX)) = SLLENTRYINX THEN                  <<*7564>>44905000
   BEGIN                                                       <<*7564>>44910000
   SLL(MEMREQINX) := 0;                                        <<*7564>>44915000
   SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG := 0;                       <<*7564>>44920000
   END;                                                        <<*7564>>44925000
                                                               <<*7564>>44930000
TOS := SLL(NEXTINX);                                           <<06625>>44935000
TOS := SLL(PREVINX);                                           <<06625>>44940000
IF SLL(PREVINX) = 0 THEN                                       <<06625>>44945000
   BEGIN <<FIRST IN LIST>>                                              44950000
   SLL(FIRSTINX) := S1;                                        <<06625>>44955000
   END                                                                  44960000
ELSE                                                                    44965000
   BEGIN                                                                44970000
   SLLINX := TOS;                                              <<06625>>44975000
   SLL(NEXTINX) := S0;                                         <<06625>>44980000
   TOS := SLLINX;                                              <<06625>>44985000
   END;                                                                 44990000
                                                               <<06625>>44995000
ASMB(XCH);                                                     <<06625>>45000000
SLLINX := TOS;                                                 <<06625>>45005000
IF SLLINX <> 0 THEN SLL(PREVINX) := TOS  ELSE ASMB(DEL);       <<06625>>45010000
RELSYSTABENTRY(SLLDST,SLLENTRYINX);                            <<06625>>45015000
END  <<SUBROUTINE RELSLLENTRY>>;                                        45020000
                                                                        45025000
                                                                        45030000
FOUNDIT := FALSE;                                              <<06212>>45035000
DBSEG := DOUBLE(DBXDSINFO.XDSDSTFIELD);                        <<06660>>45040000
                                                               <<06660>>45045000
                                                               <<06660>>45050000
TOS := LASTREFCODESEG0;                                        <<06650>>45055000
TOS := LASTREFCODESEG1;                                        <<06650>>45060000
LASTREFSWAPSEG := TOS;                                         <<06650>>45065000
SLLHEADINX := SLLPTR;                                          <<06625>>45070000
DISABLE;                                                                45075000
MEMREQENTRYINX := SLL(MEMREQINX);                              <<06625>>45080000
IF FLAGS.INITLOCFLAG THEN SLL(SCHEDTOIOMSG).SLLLOCINITFLAG:=1; <<06625>>45085000
IF FLAGS.RELLOCFLAG OR FLAGS.RELTILLROOMFLAG                            45090000
   THEN SLL(MEMREQINX) := SLL(FIRSTINX);                       <<06625>>45095000
SLLINX := SLL(FIRSTINX);                                       <<06625>>45100000
WHILE SLLINX <> 0 DO                                           <<06625>>45105000
   BEGIN                                                                45110000
                                                               <<06660>>45115000
   TOS := SLL(SLL'OBJDESC);                                    <<06660>>45120000
   TOS := SLL(SLL'OBJNUM);                                     <<06660>>45125000
   SLL'OBJID := TOS;                                           <<06660>>45130000
                                                               <<06660>>45135000
   TOS:=FLAGS;                                                          45140000
   ASMB (TRBC CLEARDISCSEGBIT);                                         45145000
   IF <> THEN                                                           45150000
      BEGIN                                                             45155000
      IF OBJIDENT <> SLL'OBJID                                 <<06660>>45160000
         THEN NEXTSLLENTRYINX := SLL(NEXTINX)                  <<06625>>45165000
      ELSE                                                              45170000
         BEGIN                                                 <<*7577>>45175000
         TOS := INTEGER(SLL(SLL'FLAGS).SLLPREFETCHCOUNT) - 1;  <<*7577>>45180000
         IF = THEN                                             <<*7577>>45185000
            BEGIN  << Turn-off the discio pending bit >>       <<*7577>>45190000
                                                               <<06625>>45195000
            IF NOT SLL(SLL'FLAGS).SLLDISCIOSEGFLAG THEN        <<*7577>>45200000
               SUDDENDEATH(619);                               <<*7577>>45205000
            SLL(SLL'FLAGS).SLLDISCIOSEGFLAG := 0;              <<*7577>>45210000
            END                                                <<*7577>>45215000
         ELSE IF < THEN SUDDENDEATH(619);<< Too many DECs >>   <<*7577>>45220000
         SLL(SLL'FLAGS).SLLPREFETCHCOUNT := TOS; <<New count >><<*7577>>45225000
         FOUNDIT := TRUE;                                      <<06212>>45230000
         NEXTSLLENTRYINX:=0;<<TO TERMINATE WHILE LOOP>>                 45235000
         END;                                                           45240000
      END;                                                              45245000
   ASMB(TEST);                                                          45250000
   IF <> THEN                                                           45255000
      BEGIN                                                             45260000
      ASMB (TRBC DECPREFETCHCNTBIT);                           <<06212>>45265000
      IF <> THEN                                               <<06212>>45270000
         BEGIN                                                 <<06212>>45275000
         IF OBJIDENT <> SLL'OBJID                              <<06660>>45280000
            THEN NEXTSLLENTRYINX := SLL(NEXTINX)               <<06625>>45285000
         ELSE                                                  <<06212>>45290000
            BEGIN                                              <<06212>>45295000
            TOS := SLL(SLL'FLAGS).SLLPREFETCHCOUNT;            <<*7564>>45300000
            TOS := TOS - 1;                                    <<06625>>45305000
            IF < THEN SUDDENDEATH(619)                         <<*7564>>45310000
            ELSE                                               <<*7564>>45315000
            IF = THEN                                         <<<*7564>>45320000
               BEGIN  << Remove it from the locality >>        <<06411>>45325000
               SLL(SLL'FLAGS).SLLPREFETCHCOUNT := TOS;         <<*7564>>45330000
               RELSLLENTRY;                                    <<06411>>45335000
               END                                             <<06411>>45340000
            ELSE                                               <<06625>>45345000
               BEGIN                                           <<06625>>45350000
               SLL(SLL'FLAGS).SLLPREFETCHCOUNT := TOS;         <<*7564>>45355000
               END;                                            <<06411>>45360000
            NEXTSLLENTRYINX:=0;<<TO TERMINATE WHILE LOOP>>     <<06212>>45365000
            FOUNDIT := TRUE;                                   <<06212>>45370000
            END;                                               <<06212>>45375000
         END;                                                  <<06212>>45380000
      ASMB(TRBC FLUSHLOCBIT);                                           45385000
      IF <> THEN                                                        45390000
         BEGIN <<PROC TERMINATION CLEANUP-RELEASE SLL ENTRIES>>         45395000
         ASMB(TEST);                                                    45400000
         IF <> THEN SUDDENDEATH(619);                          <<01644>>45405000
         NEXTSLLENTRYINX := SLL(NEXTINX);  << For while loop >><<06625>>45410000
         OBJIDENT := SLL'OBJID;                                <<06660>>45415000
         RELSLLENTRY;                                                   45420000
         END;                                                           45425000
      ASMB(TRBC REFMINLOCBIT);                                          45430000
      IF <> THEN                                                        45435000
         BEGIN <<REFERENCE MIN LOCALITY FOR CLOCK>>                     45440000
         IF SLLINX = MEMREQENTRYINX                            <<06625>>45445000
   << OR SLL(SLL'FLAGS).SLLPREFETCHCOUNT<>0 IF INCLUDE DECODE>><<06625>>45450000
            OR SLL'OBJID = DBSEG OR                            <<06660>>45455000
            SLL(SLL'FLAGS).SLLMAPSEGFLAG OR                    <<06625>>45460000
            SLL(SLL'FLAGS).SLLSTKENTRYFLAG OR                  <<06625>>45465000
            SLL(SLL'FLAGS).SLLDISCIOSEGFLAG OR                 <<06625>>45470000
            SLL'OBJID = LASTREFSWAPSEG  THEN                   <<06660>>45475000
            BEGIN <<IN MIN LOCALITY>>                                   45480000
            IF SLL(SLL'OBJDESC).OBJIDTYPE = OBJIDCDTYPE        <<06660>>45485000
               THEN DESCSTINX := 0                             <<07320>>45490000
            ELSE                                               <<07320>>45495000
            IF SLL(SLL'OBJDESC).OBJIDTYPE = OBJIDDATATYPE      <<06660>>45500000
               THEN DESCSTINX := SLL(SLL'OBJDESC) & LSL(2)     <<06660>>45505000
            ELSE DESCSTINX := CONVSEGIDTOSTINX(SLL'OBJID);     <<06660>>45510000
            DISABLE;                                                    45515000
            IF DESCSTINX <> 0 <<NOT A CACHED DOMAIN >>         <<06212>>45520000
            THEN DST(DESCSTINX).REFERENCEDFLAG:=1;             <<06212>>45525000
            END;                                                        45530000
         NEXTSLLENTRYINX := SLL(NEXTINX);                      <<06625>>45535000
         END;                                                           45540000
      ASMB(TRBC INITLOCBIT);                                            45545000
      IF <> THEN                                                        45550000
         BEGIN                                                          45555000
         ASMB(TEST);                                                    45560000
         IF <> THEN SUDDENDEATH(619);                          <<01644>>45565000
         NEXTSLLENTRYINX := SLL(NEXTINX); << For while loop >> <<06625>>45570000
         IF SLLINX <> MEMREQENTRYINX AND                       <<06625>>45575000
            SLL'OBJID <> DBSEG  AND                            <<06660>>45580000
            NOT SLL(SLL'FLAGS).SLLMAPSEGFLAG  AND              <<06625>>45585000
            NOT SLL(SLL'FLAGS).SLLSTKENTRYFLAG AND             <<06625>>45590000
            NOT SLL(SLL'FLAGS).SLLDISCIOSEGFLAG AND            <<06625>>45595000
         NOT SLL(SLL'FLAGS).SLLIMIFLAG AND                     <<06945>>45600000
            SLL'OBJID <> LASTREFSWAPSEG AND                    <<06660>>45605000
            SLL(SLL'FLAGS).SLLPREFETCHCOUNT = 0 THEN           <<06625>>45610000
            BEGIN<<NOT IN MIN LOCALITY>>                                45615000
            RELSLLENTRY;                                                45620000
            END;                                                        45625000
         END;                                                           45630000
                                                               <<06754>>45635000
      ASMB(TRBC RELLOCBIT);                                    <<06754>>45640000
      IF <> THEN                                               <<06754>>45645000
         BEGIN                                                 <<06754>>45650000
         IF OBJIDENT = SLL'OBJID THEN                          <<06754>>45655000
            BEGIN                                              <<06754>>45660000
            RELSLLENTRY;                                       <<06754>>45665000
            NEXTSLLENTRYINX := 0;  << Terminate WHILE loop >>  <<06754>>45670000
            FOUNDIT := TRUE;                                   <<06754>>45675000
            END                                                <<06754>>45680000
         ELSE                                                  <<06754>>45685000
            NEXTSLLENTRYINX := SLL(NEXTINX);                   <<06754>>45690000
         END;                                                  <<06754>>45695000
                                                               <<06754>>45700000
      ASMB(TEST,DEL); <<COPY OF FLAGS THAT WE GRADUALLY ZEROED>>        45705000
      IF <> THEN SUDDENDEATH(619);                             <<01644>>45710000
      END;                                                              45715000
   SLLINX := NEXTSLLENTRYINX;                                  <<06625>>45720000
   END;                                                                 45725000
IF FLAGS.FLUSHLOCFLAG <<TOSS THE PROC'S SLL HEADER IF DYING>>           45730000
   THEN RELSYSTABENTRY(SLLDST,SLLHEADINX);                     <<06625>>45735000
IF (FLAGS.CLEARDISCSEGFLAG OR FLAGS.DECPREFETCHCNTFLAG)        <<06212>>45740000
   AND (NOT FOUNDIT) THEN SUDDENDEATH(SFKERNCACHESYNCBAD);     <<06625>>45745000
IF FLAGS.RELLOCFLAG AND NOT FOUNDIT THEN SUDDENDEATH(619);     <<06754>>45750000
END  <<PROCEDURE ADJUSTLOCALITY>>;                                      45755000
                                                                        45760000
$PAGE "MEMORY ALLOCATION PROCEDURES : MAKEROOM"                         45765000
                                                                        45770000
LOGICAL PROCEDURE MAKEROOM(PROCINX,REQSIZE,HARDREQUEST);                45775000
VALUE PROCINX,REQSIZE,HARDREQUEST;                                      45780000
INTEGER PROCINX,REQSIZE;                                                45785000
LOGICAL HARDREQUEST;                                                    45790000
OPTION PRIVILEGED,UNCALLABLE;                                           45795000
                                                                        45800000
COMMENT                                                        <<06212>>45805000
                                                               <<06212>>45810000
MAKEROOM APPLIES THE RELACEMENT ALGORITHM TO FREE UP SPACE FOR <<06212>>45815000
FOR A PENDING FETCH REQUEST.  MAKEROOM TRIES TO FREE UP SPACE  <<06212>>45820000
BY RELEASING ASSIGNED REGIONS UNTIL AN AVAILABLE REGION OF     <<06212>>45825000
SIZE LARGER THAN THE REQUIRED SIZE (AS INDICATED BY THE REQSIZE<<06212>>45830000
PARAMETER) IS CREATED, OR UNTIL AN ACTIVITY MORE URGENT THAT TH<<06212>>45835000
PRIORITY OF THE PROCESS REQUIRING THE FETCH BECOMES PENDING.   <<06212>>45840000
                                                               <<06212>>45845000
MAKEROOM MAY ALSO GIVE UP IF THRASH DANGER IS DETECTED.  THIS  <<06212>>45850000
TYPE OF GIVEUP CAN BE TURNED OFF BY SETTING THE HARDREQ PARM   <<06212>>45855000
TO TRUE.                                                       <<06212>>45860000
                                                               <<06212>>45865000
MAKEROOM APPLIES THE CLOCK ALGORITHM, CYCLING THROUGH MEMORY,  <<06212>>45870000
TURNING OFF THE REFERENCE BIT ASSOCIATED WITH THE REGION       <<06212>>45875000
WHERE THE SCAN POINT IS CURRENTLY LOCATED, AND RELEASING       <<06212>>45880000
THE SEGMENT OR CACHED DOMAIN SITTING IN THE REGION IF THE      <<06212>>45885000
REFERENEC BIT WAS FOUND OFF.                                   <<06212>>45890000
                                                               <<06212>>45895000
THE CLOCK ALGORITHM IS CURRENTLY APPLIED UNIFORMLY FOR         <<06212>>45900000
SEGMENTS AND CACHED DOMAINS.  THIS MAY CHANGE IN THE TUNING    <<06212>>45905000
PROCESS. (eg a separate clock ptr for replacing cached domains <<06212>>45910000
than the one for replacing segments)                           <<06212>>45915000
;                                                              <<06212>>45920000
                                                               <<06212>>45925000
BEGIN                                                                   45930000
DOUBLE CURRENTTIME,                                                     45935000
       OBJ,                                                    <<06660>>45940000
       NEXTREGION,                                                      45945000
       TSLCYCLED;                                                       45950000
INTEGER DESCSTINX;                                                      45955000
LOGICAL REGFLAGS,                                              <<06212>>45960000
        SUBREGFLAGS,                                           <<06212>>45965000
        OK,                                                             45970000
        CURRENTSTK:=FALSE,                                     <<06945>>45975000
        CURRENTDBSEG:=FALSE,                                   <<06945>>45980000
        NEED'IT := FALSE,                                      <<07320>>45985000
        CURRENTMAPSEG := FALSE,                                <<07320>>45990000
        GIVEUP:=FALSE;                                                  45995000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>46000000
                                                                        46005000
                                                                        46010000
                                                                        46015000
SUBROUTINE UPDATESCANPOINT;                                             46020000
                                                                        46025000
BEGIN                                                                   46030000
OK:=FALSE;                                                              46035000
TOS:=SCANPOINT;                                                         46040000
TOS:=TOS+RBTORSDISP;                                                    46045000
ASMB(LSEA);                                                             46050000
IF S0=MAXHOLESIZE THEN S0:=-1 <<FORCE CARRY>> ELSE             <<01616>>46055000
   BEGIN <<WHOLE BANK NOT FREE>>                               <<01799>>46060000
   TOS:=TOS&LSL(PAGEPOWER);                                    <<01616>>46065000
   TOS:=TOS+RSTORBDISP;                                        <<01616>>46070000
   END;                                                        <<01616>>46075000
ASMB(LADD);                                                             46080000
IF NOCARRY THEN                                                         46085000
   BEGIN <<IN SAME BANK>>                                               46090000
                                                                        46095000
   << LOCATE NEXT UNAVAILABLE REGION IN BANK FOR                        46100000
      NEW SCAN POINT >>                                                 46105000
                                                                        46110000
   WHILE NOT OK DO                                                      46115000
      BEGIN                                                             46120000
      <<CHECK IF HALF-BANK>>                                            46125000
      ASMB(DDUP);                                                       46130000
      NEXTREGION:=TOS;                                                  46135000
      IF NEXTREGION >= LASTMEMORYADDRESS THEN GO TO NEXTBANK;           46140000
      TOS:=TOS+RBTORASDISP;                                             46145000
      ASMB(LSEA);                                                       46150000
      REGFLAGS:=TOS;                                           <<06212>>46155000
      IF NOT REGFLAGS.REGAVAILABLEFLAG THEN                    <<06212>>46160000
         BEGIN                                                          46165000
         TOS:=TOS+RASTORBDISP;                                          46170000
         SCANPOINT:=TOS;                                                46175000
         OK:=TRUE;                                                      46180000
         END                                                            46185000
      ELSE                                                              46190000
         BEGIN  <<MUST SKIP OVER THIS ONE>>                             46195000
         TOS:=TOS+RASTORSDISP;                                          46200000
         ASMB(LSEA);                                                    46205000
         TOS:=TOS&LSL(PAGEPOWER);                                       46210000
         TOS:=TOS+RSTORBDISP;                                           46215000
         ASMB(LADD);                                                    46220000
         IF CARRY THEN GO TO NEXTBANK;                                  46225000
         END;                                                           46230000
      END;                                                              46235000
   END                                                                  46240000
ELSE                                                                    46245000
   BEGIN  <<LAST REGION IN BANK>>                                       46250000
                                                                        46255000
   NEXTBANK:                                                            46260000
                                                                        46265000
   IF S1=NBANKS THEN                                                    46270000
      BEGIN  <<CYCLED>>                                                 46275000
      ASMB(DDEL);                                                       46280000
      SCANPOINT:=FIRSTMEMADDR;                                          46285000
      LASTCYCLEDURATION:=TSLCYCLED;                                     46290000
      TIMEOFLASTCYCLE:=CURRENTTIME;                                     46295000
      IF LASTCYCLEDURATION < CYCLETHRESHOLD AND NOT HARDREQUEST<<01987>>46300000
      THEN GIVEUP := TRUE;  <<AFRAID OF THRASHING>>            <<01987>>46305000
      IF GCLASSENABLEDMASK.CLASS0 THEN                         <<RAY.V>>46310000
         BEGIN <<COUNT # OF CYCLES>>                           <<RAY.V>>46315000
         TOS:=MEASSTATXDSBANK;                                 <<RAY.V>>46320000
         TOS:=MEASSTATXDSBASE;                                 <<RAY.V>>46325000
         TOS:=TOS+C0SUB0'SEGRELOFF+C'CLOCKCYCLE;               <<RAY.V>>46330000
         ASMB(LSEA;INCA;SSEA;DDEL);                            <<RAY.V>>46335000
         END;                                                  <<RAY.V>>46340000
      END                                                               46345000
   ELSE                                                                 46350000
      BEGIN                                                             46355000
      S1:=S1+1; <<BUMP TO NEXT BANK>>                                   46360000
      S0:=HEADERLENGTH;                                        <<01799>>46365000
      SCANPOINT:=TOS;                                                   46370000
      END;                                                              46375000
   END;                                                                 46380000
END << SUBROUTINE UPDATESCANPOINT>>;                                    46385000
                                                                        46390000
                                                               <<01925>>46395000
HOTIMELASTMAKEROOM:=TRLDTIME1;                                 <<06943>>46400000
LOTIMELASTMAKEROOM:=TRLDTIME2;                                 <<06943>>46405000
CURRENTTIME:=TIMER;                                                     46410000
TSLCYCLED:=CURRENTTIME-TIMEOFLASTCYCLE;                                 46415000
IF LASTCYCLEDURATION > CYCLETHRESHOLD OR TSLCYCLED > CYCLETHRESHOLD     46420000
OR HARDREQUEST THEN                                                     46425000
   BEGIN  <<OK TO MAKE ROOM>>                                           46430000
   IF CURPRC <> 0 THEN                                         <<06945>>46435000
      BEGIN <<MEM MGT FROM STK==>FILL IN STK, DB LOCAL VAR>>   <<06945>>46440000
      CURRENTSTK := ICS(-ICS'STKDSTCELL);                      <<06945>>46445000
      CURRENTDBSEG := PCB(CURPRC + DBXDSINFOWORDNUM)           <<06945>>46450000
                           .XDSDSTFIELD;                       <<06945>>46455000
      CURRENTMAPSEG := PCB(CURPRC + MAPDSTWORDNUM);            <<07320>>46460000
      END;                                                     <<06945>>46465000
   WHILE REQSIZE > MAXAVAILREG AND AWAKETOSCHEDMSG >= CURRACTPRI        46470000
   AND NOT GIVEUP DO                                                    46475000
      BEGIN                                                             46480000
      IF (DQH'TOT'ENT-DQH'CUR'NUSE) < 3 THEN                   <<06392>>46485000
         BEGIN <<NOT ENOUGH DISC REQUEST ENTRIES TO PROCEDE>>  <<01987>>46490000
         MAKEROOM:=MMOUTOFDISCREQ;                             <<01987>>46495000
         RETURN;                                               <<01987>>46500000
         END;                                                  <<01987>>46505000
      TOS:=SCANPOINT;                                                   46510000
      TOS:=TOS+RBTORASDISP;                                             46515000
      DISABLE; <<MIGHT I/O FREEZE BEFORE MAKEOC>>              <<01562>>46520000
      ASMB(LSEA);                                                       46525000
      REGFLAGS:=TOS;                                           <<06212>>46530000
      IF NOT REGFLAGS.REGAVAILABLEFLAG                         <<06212>>46535000
      AND NOT REGFLAGS.REGRESERVEDFLAG                         <<06212>>46540000
      AND REGFLAGS.REGNONMOVEFLAGS=0 THEN                      <<06212>>46545000
         BEGIN <<THIS REGION CAN BE OVERLAYED-CHECK USAGE>>    <<06212>>46550000
         TOS:=TOS+RASTOOBJIDENTDISP;                           <<06212>>46555000
         ASMB(LDEA);                                           <<06660>>46560000
                                                               <<06212>>46565000
         IF = THEN SUDDENDEATH(614);                           <<06212>>46570000
         OBJ:=TOS;                                             <<06660>>46575000
         TOS:=TOS+OBJIDENTTOSASDISP;                           <<06212>>46580000
         ASMB(LSEA);                                           <<06212>>46585000
         SUBREGFLAGS:=TOS;                                     <<06212>>46590000
         IF SUBREGFLAGS.REGCACHEDFLAG THEN                     <<06212>>46595000
            BEGIN <<CACHED DOMAIN>>                            <<06212>>46600000
            SUBREGFLAGS.REGREFFLAG:=0;                         <<06212>>46605000
            IF = THEN  MAKEOC(0,OBJ,REQSIZE,SCANPOINT)         <<06660>>46610000
            ELSE                                               <<06212>>46615000
               BEGIN <<BEEN USED RECENTLY SO SKIP IT>>         <<06212>>46620000
               TOS:=SUBREGFLAGS;                               <<06212>>46625000
               ASMB(SSEA); <<UPDATE REFERENCE BIT>>            <<06212>>46630000
               END;                                            <<06212>>46635000
            END                                                <<06212>>46640000
         ELSE                                                  <<06212>>46645000
            BEGIN <<A SEGMENT IS IN THIS REGION>>              <<06212>>46650000
            IF OBJIDENT(ObjIDTypeField)=OBJIDDATATYPE          <<06660>>46655000
            THEN DESCSTINX:=OBJIDENT(ObjIDnumField)&LSL(2)     <<06660>>46660000
            ELSE DESCSTINX:=CONVSEGIDTOSTINX(OBJ);             <<06660>>46665000
            IF NOT LOGICAL(DST(DESCSTINX)).ABSENTFLAG THEN     <<06212>>46670000
               BEGIN <<SEG IS PRESENT>>                        <<06212>>46675000
               NEED'IT := IF                                   <<07320>>46680000
                   OBJIDENT(OBJIDTYPEFIELD) = OBJIDDATATYPE AND<<07320>>46685000
                   (OBJIDENT(OBJIDNUMFIELD) = CURRENTDBSEG OR  <<07320>>46690000
                    OBJIDENT(OBJIDNUMFIELD) = CURRENTSTK OR    <<07320>>46695000
                    OBJIDENT(OBJIDNUMFIELD)=CURRENTMAPSEG) THEN<<07320>>46700000
                       TRUE ELSE FALSE;                        <<07320>>46705000
                                                               <<*7564>>46710000
               << Check recent useage >>                       <<*7564>>46715000
               DST(DESCSTINX).REFERENCEDFLAG := 0;             <<*7564>>46720000
               IF = AND NOT NEED'IT THEN                       <<07320>>46725000
               <<CAN TOSS IF REF BIT OFF, NOT CURRENT PROC'S SE<<06945>>46730000
                MAKEOC(DESCSTINX,OBJ,REQSIZE,SCANPOINT);       <<06660>>46735000
               END                                             <<06212>>46740000
            ELSE IF DST(X:=X+1).FWIPFLAG <> 1                  <<06212>>46745000
            THEN SUDDENDEATH(619);                             <<06212>>46750000
            END;                                               <<06212>>46755000
         END;                                                  <<06212>>46760000
      ASMB(DDEL);                                                       46765000
      ENABLE;  <<OFFSET DISABLE>>                              <<01562>>46770000
      UPDATESCANPOINT;                                                  46775000
      END;                                                              46780000
   END;                                                                 46785000
IF AWAKETOSCHEDMSG < CURRACTPRI THEN MAKEROOM := MMPREEMPT     <<d7738>>46790000
ELSE IF REQSIZE <= MAXAVAILREG THEN MAKEROOM:=MMOK             <<01987>>46795000
ELSE MAKEROOM:=MMTHRASHDANGER;                                 <<01987>>46800000
END  <<MAKEROOM>>;                                                      46805000
                                                                        46810000
                                                                        46815000
$PAGE "MEMORY ALLOCATION PROCEDURES : CREATE LOCK SPACE "               46820000
DOUBLE PROCEDURE CREATELOCKSPACE(PAGESREQUIRED);                        46825000
VALUE PAGESREQUIRED;                                                    46830000
INTEGER PAGESREQUIRED;                                                  46835000
OPTION PRIVILEGED,UNCALLABLE;                                           46840000
                                                                        46845000
BEGIN                                                                   46850000
                                                                        46855000
DOUBLE SEARCHBASE,                                                      46860000
       OBJ,                                                    <<06660>>46865000
       SEARCHPOINTER;                                                   46870000
INTEGER DESCSTINX,                                                      46875000
        CDTENTRYNUMBER,                                        <<06212>>46880000
        THISREGIONSIZE,                                                 46885000
        CONDCODE:=CCE,                                                  46890000
        POTENTIALSIZE:=0;                                               46895000
LOGICAL MAPSEG;                                                <<*7766>>46900000
LOGICAL QUIT:=FALSE;                                                    46905000
LOGICAL IMI := FALSE;                                          <<06212>>46910000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>46915000
SUBROUTINE BUMPSEARCHBASE;                                              46920000
                                                                        46925000
BEGIN                                                                   46930000
POTENTIALSIZE:=0;                                                       46935000
TOS:=SEARCHPOINTER;                                                     46940000
TOS:=THISREGIONSIZE&LSL(PAGEPOWER);                                     46945000
ASMB(LADD);                                                             46950000
IF CARRY OR THISREGIONSIZE = MAXHOLESIZE THEN S1 := S1 + 1;    <<07320>>46955000
SEARCHBASE:=TOS;                                                        46960000
SEARCHPOINTER:=SEARCHBASE;                                              46965000
IF SEARCHBASE > LASTMEMORYADDRESS THEN                                  46970000
   BEGIN                                                                46975000
   QUIT:=TRUE;                                                          46980000
   CONDCODE:=CCG;                                                       46985000
   END;                                                                 46990000
END;                                                                    46995000
                                                                        47000000
SUBROUTINE BUMPSEARCHPOINTER;                                           47005000
                                                                        47010000
BEGIN                                                                   47015000
TOS:=SEARCHPOINTER;                                                     47020000
POTENTIALSIZE:=POTENTIALSIZE+THISREGIONSIZE;                            47025000
TOS:=THISREGIONSIZE&LSL(PAGEPOWER);                                     47030000
ASMB(LADD);                                                             47035000
IF CARRY OR THISREGIONSIZE = MAXHOLESIZE THEN                  <<07320>>47040000
   BEGIN <<WOOPS-WENT OFF THE END OF THE BANK>>                         47045000
   ASMB(DDEL);                                                          47050000
   BUMPSEARCHBASE ;                                                     47055000
   END                                                                  47060000
ELSE                                                                    47065000
   BEGIN <<BUMP TO NEXT REGION IN THE BANK>>                            47070000
   SEARCHPOINTER:=TOS;                                                  47075000
   IF SEARCHPOINTER > LASTMEMORYADDRESS THEN                            47080000
      BEGIN                                                             47085000
      QUIT:=TRUE;                                                       47090000
      CONDCODE:=CCG;                                                    47095000
      END;                                                              47100000
   END;                                                                 47105000
END;                                                                    47110000
                                                                        47115000
                                                                        47120000
SEARCHPOINTER:=SEARCHBASE:=FIRSTMEMADDR;                                47125000
WHILE POTENTIALSIZE < PAGESREQUIRED AND NOT QUIT DO                     47130000
   BEGIN                                                                47135000
   TOS:=SEARCHPOINTER;                                                  47140000
   TOS:=TOS+RBTORSDISP;                                                 47145000
   DISABLE;                                                             47150000
   ASMB(LSEA);                                                          47155000
   THISREGIONSIZE:=TOS;                                                 47160000
   TOS:=TOS+RSTORASDISP;                                                47165000
   ASMB(LSEA);                                                          47170000
   IF LS0.REGAVAILABLEFLAG THEN BUMPSEARCHPOINTER                       47175000
   ELSE IF LS0.REGLKDFLAG THEN BUMPSEARCHBASE                           47180000
   ELSE IF LS0.REGFZFLAG THEN BUMPSEARCHBASE                            47185000
   ELSE IF LS0.REGIOFZFLAG THEN                                         47190000
      BEGIN <<DELAY>>                                                   47195000
      <<CONDCODE:=CCL;>>                                                47200000
      <<QUIT:=TRUE;>>                                                   47205000
      BUMPSEARCHBASE ; <<DAMN LP DRIVER WON'T I/O UNFREEZE>>            47210000
      END                                                               47215000
   ELSE                                                                 47220000
      BEGIN <<try to throw this object out>>                   <<06212>>47225000
      IF LS0.REGMAPFLAG THEN MAPSEG:=TRUE ELSE MAPSEG:=FALSE;  <<*7766>>47230000
      ASMB(DEL);                                                        47235000
      TOS:=TOS+RASTOOBJIDENTDISP;                              <<06212>>47240000
      ASMB(LDEA);                                              <<06660>>47245000
      OBJ:=TOS;                                                <<06660>>47250000
                                                               <<06212>>47255000
      <<see if object is in motion in>>                        <<06212>>47260000
                                                               <<06212>>47265000
      IF objident(ObjIDTypeField)=OBJIDCDTYPE THEN             <<06660>>47270000
         BEGIN <<a cached disc domain sitting here>>           <<06212>>47275000
         cdtentrynumber := objident(ObjIDnumField);            <<06660>>47280000
         IF  <> THEN                                           <<06212>>47285000
            BEGIN <<mapped in>>                                <<06212>>47290000
            IF CDT'GET'BIT(cdtentrynumber,cdt'imi'bit,0) = 1   <<06212>>47295000
            THEN IMI := TRUE;                                  <<06212>>47300000
            END;                                               <<06212>>47305000
         END                                                   <<06212>>47310000
      ELSE                                                     <<06212>>47315000
         BEGIN << a segment>>                                  <<06212>>47320000
         IF OBJIDENT(ObjIDTypeField)=OBJIDDATATYPE             <<06660>>47325000
         THEN DESCSTINX:=OBJIDENT(ObjIDnumField)&LSL(2)<<DSEG>><<06660>>47330000
         ELSE DESCSTINX:=CONVSEGIDTOSTINX(OBJ);                <<06660>>47335000
         IF LOGICAL(DST(DESCSTINX+1)).IMIFLAG                  <<06212>>47340000
         THEN IMI := TRUE;                                     <<06212>>47345000
         END;                                                  <<06212>>47350000
                                                               <<06212>>47355000
      IF IMI THEN                                              <<06212>>47360000
         BEGIN <<DELAY TILL READ COMPLETES>>                            47365000
         CONDCODE:=CCL;                                                 47370000
         QUIT:=TRUE;                                                    47375000
         END                                                            47380000
      ELSE                                                              47385000
         BEGIN  <<THROW THE OBJ OUT>>                          <<06212>>47390000
         << If it's a mapseg then, let MAKEOC throw it out >>  <<*7766>>47395000
                                                               <<*7766>>47400000
         IF MAPSEG THEN                                        <<*7766>>47405000
            BEGIN                                              <<*7766>>47410000
            TOS := MEMPRESSURE'CELL;                           <<*7766>>47415000
            MEMPRESSURE'CELL := 1;                             <<*7766>>47420000
            END;                                               <<*7766>>47425000
                                                               <<*7766>>47430000
         MakeOC(descstinx,obj,0,searchpointer);                <<06660>>47435000
                                                               <<*7766>>47440000
         IF MAPSEG THEN MEMPRESSURE'CELL := TOS;               <<*7766>>47445000
         ENABLE;                                                        47450000
         BUMPSEARCHPOINTER;                                             47455000
         END;                                                           47460000
      END;                                                              47465000
   ENABLE;                                                              47470000
   END;                                                                 47475000
                                                                        47480000
IF NOT QUIT THEN CREATELOCKSPACE:=SEARCHBASE                            47485000
ELSE CREATELOCKSPACE:=0D;                                               47490000
CC:=CONDCODE;                                                           47495000
END  <<CREATELOCKSPACE>>;                                               47500000
                                                                        47505000
$PAGE "MEMORY ALLOCATION PROCEDURES : FETCH OBJECT "           <<06212>>47510000
INTEGER PROCEDURE FETCHOBJECT(OBJ,REQUESTORID,                 <<06660>>47515000
   SPECIALFLAGS,SPECIALINFO,HARDREQUEST);                               47520000
VALUE OBJ,REQUESTORID,SPECIALFLAGS,SPECIALINFO,                <<06660>>47525000
      HARDREQUEST;                                             <<06212>>47530000
INTEGER REQUESTORID;                                                    47535000
LOGICAL SPECIALFLAGS,SPECIALINFO,HARDREQUEST;                  <<06660>>47540000
DOUBLE OBJ;                                                    <<06660>>47545000
OPTION PRIVILEGED,UNCALLABLE;                                           47550000
                                                                        47555000
COMMENT                                                                 47560000
                                                                        47565000
FETCHOBJECT IS INVOKED BY THE DISPATCHER DIRECTLY FOR A SEGMENT<<06212>>47570000
REQUEST FROM THE I/O SYSTEM, AND FROM THE DISPATCHER'S SUBROUTINE       47575000
SWAPIN FOR OBJECTS REQUIRED BY A PROCESS BEING SWAPPED IN.     <<06212>>47580000
                                                               <<06212>>47585000
                                                                        47590000
FETCHOBJECT CHECKS THE OBJECT'S DESCRIPTOR TO SEE IF THE OBJECT<<06212>>47595000
IS ALREADY PRESENT OR ON ITS WAY IN ON BEHALF OF ANOTHER PROCES<<06212>>47600000
IF SUCH IS THE CASE, NO MAIN MEMORY ALLOCATION IS REQUIRED. IF          47605000
THE OBJECT IS PRESENT, CONTROL RETURNS IMMEDIATELY TO THE      <<06212>>47610000
CALLER.  IF THE SEGMENT IS ON ITS WAY IN, THE PROCESS' PCB              47615000
OR THE DEVICE'S LDEVNUM IS QUEUED FOR THE SEGMENT, AND WHEN             47620000
THE READ COMPLETES, THE PROCESS' COUNTER FOR READ COOMPLETIONS          47625000
UNTIL AWAKE IS DECREMENTED AND IF IT FALLS TO ZERO THE PROCESS          47630000
IS LAUNCHED, OR AWAKEIO IS CALLED AGAINST THE DEVICE FOR IO REQUESTS.   47635000
                                                                        47640000
IF THE OBJECT IS ABSENT,AN AVAILABLE MAIN MEMORY REGION IS     <<06212>>47645000
RESERVED FOR THE SEGMENT, OR, IF A LARGE ENOUGH REGION IS NOT           47650000
AVAILABLE, AN ATTEMPT IS MADE TO MAKEROOM.  IF A REGION IS              47655000
OBTAINED, A READ FOR THE SEGMENT IS FORMED.                    <<06212>>47660000
                                                               <<06212>>47665000
IF THE REQUEST IS BLOCKED, (IE NOT A PREFETCH REQUEST), THE PRO<<06212>>47670000
OR DEVICE IS QUEUED FOR THE OBJECT.                            <<06212>>47675000
                                                                        47680000
THE I/O SYSTEM FINISHES OFF THE FETCH ON THE ICS.  WHEN                 47685000
ONGOING I/O COMPLETES IN THE REGION RESERVED FOR THE                    47690000
OBJECT FETCH, THE READ REQUEST IS QUEUED.  WHEN THE READ       <<06212>>47695000
COMPLETES, THE WAITING PROCESSES AND DEVICES ARE AWAKENED.              47700000
OR A CACHE MOVE IS INITIATED IN THE CASE OF A FETCH OF A MAPPED<<06212>>47705000
DISC DOMAIN.                                                   <<06212>>47710000
                                                                        47715000
;                                                                       47720000
                                                                        47725000
BEGIN                                                                   47730000
                                                               <<*7606>>47735000
DEFINE                                                         <<*7606>>47740000
  A'DISC = LOGICAL(REQUESTORID).(1:1)#;                        <<*7606>>47745000
                                                               <<*7606>>47750000
INTEGER returnvalue=FETCHOBJECT;                               <<07320>>47755000
LOGICAL ARRAY OBJIDENTIFIER(*)=OBJ;                            <<06660>>47760000
<<DB ASSUMED TO BE AT SYSDB>>                                           47765000
                                                                        47770000
DOUBLE REGIONBASE,                                             <<06620>>47775000
       startsector,                                            <<06212>>47780000
       limitsector,                                            <<06212>>47785000
       MAPD'ABS'OFST,    << Abs addr of mapped entry >>        <<d7738>>47790000
       ocregionbase;                                           <<06212>>47795000
                                                                        47800000
LOGICAL REQSIZE;                                                        47805000
                                                                        47810000
INTEGER OBJSIZE,                                               <<06212>>47815000
        drq'entry'index,                                       <<06392>>47820000
        reqp,                                                  <<06392>>47825000
        IOSTATUS,                                              <<06212>>47830000
        XFERCNT,                                                        47835000
        PCBPT,                                                 <<06650>>47840000
        SEGDESCSTINX,                                                   47845000
        SEGDESCSYSBASEINX,                                              47850000
        HODA,                                                           47855000
        LODA,                                                           47860000
        DISCREQINX,                                                     47865000
        COUNT,                                                          47870000
        PROCPRI,                                                        47875000
        SLLINX,                                                <<06625>>47880000
        SPECREQINX,                                                     47885000
        MSTATPARM3,                                            <<06948>>47890000
        CDTENTRYNUMBER,                                        <<06212>>47895000
        READOFFSET:=0;                                                  47900000
                                                                        47905000
LOGICAL DATASEG' := FALSE,                                     <<06613>>47910000
        MAPPEDDOMAIN := FALSE,                                 <<06212>>47915000
        SWAPPINGIN:=FALSE,                                              47920000
        SEGMODPNDG:=FALSE,                                              47925000
        IOSYSREQ:=FALSE,                                                47930000
        IOFZREQ:=FALSE,                                                 47935000
        FZREQ:=FALSE,                                                   47940000
        LKREQ:=FALSE,                                                   47945000
        PREFETCHREQ := FALSE,                                  <<06212>>47950000
        PRESENT := FALSE,                                      <<06212>>47955000
        ROC := FALSE,                                          <<06212>>47960000
        IMI := FALSE,                                          <<06212>>47965000
        BKLKREQ:=FALSE,                                        <<06212>>47970000
        MAPD'FLAGS,      << Local copy of Mapped dom. flags >> <<d7738>>47975000
        REGASSIGNSTATE;                                        <<06212>>47980000
                                                               <<06212>>47985000
                                                               <<06212>>47990000
SUBROUTINE GetDA'PutRB;                                        <<06212>>47995000
                                                               <<06212>>48000000
<<looks up the object's disc address and stuffs into H/LODA>>  <<06212>>48005000
<<Puts the regionbase into the object's desc>>                 <<06212>>48010000
                                                               <<06212>>48015000
BEGIN                                                          <<06212>>48020000
IF mappeddomain THEN                                           <<06212>>48025000
   BEGIN                                                       <<06212>>48030000
   tos := MAPD'ABS'OFST;                                       <<d7738>>48035000
   << Put DB at mapped domain entry >>                         <<d7738>>48040000
   EXCHDB;                  << Put DB at entry >>              <<d7738>>48045000
   tos := CDT'DARRAY(CDT'MD'SECTOR & asr(1));                  <<d7738>>48050000
                                                               <<d7738>>48055000
   LODA := tos;                                                <<d7738>>48060000
   HODA := tos;                                                <<d7738>>48065000
   HODA.(0:8) := CDT'ARRAY(CDT'MD'LDEV);                       <<d7738>>48070000
   CDT'DARRAY(CDT'MD'MEM'ADDR & asr(1)) := REGIONBASE;         <<d7738>>48075000
   EXCHDB;   << Put DB back >>                                 <<d7738>>48080000
   ASMB(DDEL);  << Remove abs addr >>                          <<d7738>>48085000
   END                                                         <<06212>>48090000
                                                               <<06212>>48095000
ELSE                                                           <<06212>>48100000
   BEGIN <<a seg>>                                             <<06212>>48105000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>48110000
   HODA:=SEGDESCHODA;                                          <<06212>>48115000
   LODA:=SEGDESCLODA;                                          <<06212>>48120000
   TOS :=regionbase;                                           <<06212>>48125000
   SEGDESCADDR:=TOS;                                           <<06212>>48130000
   SEGDESCBANK:=TOS;                                           <<06212>>48135000
   END                                                         <<06212>>48140000
END;  <<Subroutine GetDA'PutRB>>                               <<06212>>48145000
                                                               <<06212>>48150000
SUBROUTINE InitRegionbaseVar;                                  <<06212>>48155000
                                                               <<06212>>48160000
<<fills in the region base local variable from the seg desc>>  <<06212>>48165000
<<or the cdt entry of the object(object must be present)>>     <<06212>>48170000
                                                               <<06212>>48175000
BEGIN                                                          <<06212>>48180000
if MAPPEDDOMAIN then                                           <<d7738>>48185000
   begin                                                       <<d7738>>48190000
   tos := MAPD'ABS'OFST;                                       <<d7738>>48195000
   tos := tos + CDT'MD'MEM'ADDR; << Point to mem cell >>       <<d7738>>48200000
   ASMB(LDEA;DXCH,DDEL);  << Load memory address >>            <<d7738>>48205000
   REGIONBASE := tos;                                          <<d7738>>48210000
   end                                                         <<d7738>>48215000
ELSE                                                           <<06212>>48220000
   BEGIN  <<a segment>>                                        <<06212>>48225000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>48230000
   TOS:=SEGDESCBANK;                                           <<06212>>48235000
   TOS:=SEGDESCADDR;                                           <<06212>>48240000
   REGIONBASE:=TOS;                                            <<06212>>48245000
   END;                                                        <<06212>>48250000
END;  <<Subroutine InitRegionbaseVar>>                         <<06212>>48255000
                                                               <<06212>>48260000
                                                               <<06212>>48265000
                                                               <<06212>>48270000
SUBROUTINE MarkObjectIMI;                                      <<06212>>48275000
                                                               <<06212>>48280000
<< flags object as on its way in >>                            <<06212>>48285000
                                                               <<06212>>48290000
BEGIN                                                          <<06212>>48295000
                                                               <<06212>>48300000
IF mappeddomain THEN                                           <<06212>>48305000
   BEGIN  <<a mapped domain>>                                  <<06212>>48310000
   tos := MAPD'ABS'OFST;                                       <<d7738>>48315000
   tos := tos + CDT'MD'FLAGS;                                  <<d7738>>48320000
   ASMB(LSEA);     << Load FLAGS word of mapped domain >>      <<d7738>>48325000
   tos.(CDT'IMI'BIT:1) := 1;  << Turn on IMI bit >>            <<d7738>>48330000
   if <> then SUDDENDEATH(SFKernCacheSyncBad);                 <<d7738>>48335000
   tos := MAPD'FLAGS := tos;  << Save flags value >>           <<d7738>>48340000
   ASMB(SSEA;DDEL);  << Store new FLAGS in CDT >>              <<d7738>>48345000
   END                                                         <<06212>>48350000
ELSE                                                           <<06212>>48355000
   BEGIN  <<a Seg>>                                            <<06212>>48360000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>48365000
   SEGDESCFLAGS.IMIFLAG:=1;                                    <<06212>>48370000
   END;                                                        <<06212>>48375000
                                                               <<06212>>48380000
END;  <<Subroutine MarkObjectIMI>>                             <<06212>>48385000
                                                               <<06212>>48390000
                                                               <<06212>>48395000
SUBROUTINE GetInObjectsQueue;                                  <<06212>>48400000
                                                                        48405000
COMMENT                                                                 48410000
GET IN SEG'S QUEUE INSERTS THE PROCESS' OR DEVICES' IDENTIFIER          48415000
INTO THE SEGMENT'S QUEUE.                                               48420000
;                                                                       48425000
BEGIN                                                                   48430000
                                                                        48435000
<<                                                                      48440000
QUEUE PROC/DEVICE FOR SEGMENT                                           48445000
>>                                                                      48450000
                                                                        48455000
                                                                        48460000
IF IOSYSREQ THEN PutDeviceOnObjectsMPQ(REQUESTORID,            <<06212>>48465000
REGIONBASE) ELSE                                                        48470000
   BEGIN                                                                48475000
   TOS := REQUESTORID/PCBSIZE; << PIN >>                       <<06650>>48480000
   TOS:=OBJ;                                                   <<06660>>48485000
   TOS:=REGIONBASE;                                                     48490000
   PCBPT := REQUESTORID;                                       <<06650>>48495000
   TOS:=SLLPTR;                                                         48500000
   TOS:=SPECIALINFO;  <<REQSLLENTRYINX>>                                48505000
   TOS:=FALSE;  <<NOT PREFETCH SO NOTIFY, DEC CNT>>            <<06945>>48510000
   PutProcOnObjectsMPQ(*,*,*,*,*,*);                           <<06411>>48515000
   END;                                                                 48520000
END <<SUBROUTINE GetInObjectsQueue>>;                          <<06212>>48525000
                                                               <<06212>>48530000
SUBROUTINE StartCacheMove;                                     <<06212>>48535000
                                                               <<06212>>48540000
BEGIN  <<get the cache move started>>                          <<06212>>48545000
TOS:=regionbase;                                               <<06212>>48550000
TOS:=TOS+RBTOSASDISP;                                          <<06212>>48555000
ASMB(LSEA;STAX,DDEL);                                          <<06212>>48560000
iostatus:=x.regfetchiostatus;                                  <<06212>>48565000
ProcessCDTLogReqQ(cdtentrynumber,iostatus,0);                  <<06212>>48570000
END; <<SUBROUTINE StartCacheMove>>                             <<06212>>48575000
                                                               <<06212>>48580000
                                                               <<06212>>48585000
SUBROUTINE HandlePresentObject;                                <<06212>>48590000
                                                               <<06212>>48595000
<<checks if object is present, and, if so, sets present,regionb<<06212>>48600000
                                                               <<06212>>48605000
BEGIN                                                          <<06212>>48610000
DISABLE;                                                       <<06212>>48615000
IF mappeddomain THEN                                           <<06212>>48620000
   BEGIN  <<mapped disc domain>>                               <<06212>>48625000
   tos := MAPD'ABS'OFST;                                       <<d7738>>48630000
   tos := tos + CDT'MD'FLAGS;                                  <<d7738>>48635000
   ASMB(LSEA;DELB,DELB);                                       <<d7738>>48640000
   tos := MAPD'FLAGS := tos;                                   <<d7738>>48645000
   if tos.(CDT'ABS'BIT:1)=0 then PRESENT := true;              <<d7738>>48650000
   END                                                         <<06212>>48655000
ELSE                                                           <<06212>>48660000
   BEGIN  <<a segment>>                                        <<06212>>48665000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>48670000
   IF NOT SEGDESCFIRMINFO.ABSENTFLAG THEN present:=TRUE;       <<06212>>48675000
   END;                                                        <<06212>>48680000
IF present THEN                                                <<06212>>48685000
   BEGIN  <<object is present>>                                <<06212>>48690000
   MMSTAT'(mmstatfetch,OBJIDENTIFIER(OBJIDDESCFIELD),          <<06948>>48695000
          OBJIDENTIFIER(OBJIDNUMFIELD),MSTATPARM3,MMSTATPRES,  <<06948>>48700000
          0,0);                                                <<06948>>48705000
   InitRegionbaseVar;                                          <<06212>>48710000
   IF mappeddomain AND prefetchreq THEN StartCacheMove;        <<06411>>48715000
   END;                                                        <<06212>>48720000
IF GCLASSENABLEDMASK.CLASS0 THEN                               <<06212>>48725000
   BEGIN  <<MEASURE MEMORY ALLOCATION EVENT>>                  <<06212>>48730000
   TOS:=MEASSTATXDSBANK;                                       <<06212>>48735000
   TOS:=MEASSTATXDSBASE;                                       <<06212>>48740000
   TOS:=TOS+C0SUB0'SEGRELOFF+C'MEMALLOC;                       <<06212>>48745000
   ASMB(LSEA);                                                 <<06212>>48750000
   TOS:=TOS+1;                                                 <<06212>>48755000
   ASMB(SSEA;DDEL);                                            <<06212>>48760000
   END;                                                        <<06212>>48765000
END;  <<Subroutine HandlePresentObject>>                       <<06212>>48770000
                                                               <<06212>>48775000
                                                               <<06212>>48780000
SUBROUTINE HandleROCObject;                                    <<06212>>48785000
                                                               <<06212>>48790000
<<Handles objects that are recoverable overlay candidates>>    <<06212>>48795000
                                                               <<06212>>48800000
BEGIN                                                          <<06212>>48805000
IF mappeddomain THEN                                           <<06212>>48810000
   BEGIN  <<mapped disc domain>>                               <<06212>>48815000
   if MAPD'FLAGS.(CDT'ROC'BIT:1) then                          <<d7738>>48820000
      BEGIN                                                    <<06212>>48825000
      roc:=TRUE;                                               <<06212>>48830000
      tos := MAPD'ABS'OFST;                                    <<d7738>>48835000
      tos := tos + CDT'MD'MEM'ADDR;                            <<d7738>>48840000
      ASMB(LDEA;DXCH,DDEL);   << Put mem addr on tos >>        <<d7738>>48845000
      OCREGIONBASE := tos;                                     <<d7738>>48850000
      END;                                                     <<06212>>48855000
   END                                                         <<06212>>48860000
ELSE                                                           <<06212>>48865000
   BEGIN  <<a segment>>                                        <<06212>>48870000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>48875000
   IF SEGDESCFIRMINFO=%100000 THEN SUDDENDEATH(617);           <<06212>>48880000
   IF LOGICAL(SEGDESCFLAGS).ROCFLAG THEN roc:= TRUE;           <<06212>>48885000
   END;                                                        <<06212>>48890000
IF roc THEN                                                    <<06212>>48895000
   BEGIN                                                       <<06212>>48900000
   IF GCLASSENABLEDMASK.CLASS0 THEN                            <<06212>>48905000
      BEGIN  <<MEASURE RECOVER EVENT DURING ALLOCATION>>       <<06212>>48910000
      TOS:=MEASSTATXDSBANK;                                    <<06212>>48915000
      TOS:=MEASSTATXDSBASE;                                    <<06212>>48920000
      TOS:=TOS+C0SUB0'SEGRELOFF+C'OLCANDRECOVERY;              <<06212>>48925000
      ASMB(LSEA);                                              <<06212>>48930000
      TOS:=TOS+1;                                              <<06212>>48935000
      ASMB(SSEA;DDEL);                                         <<06212>>48940000
      END;                                                     <<06212>>48945000
   ENABLE;                                                     <<06212>>48950000
   MMSTAT'(mmstatfetch,OBJIDENTIFIER(OBJIDDESCFIELD),          <<06948>>48955000
          OBJIDENTIFIER(OBJIDNUMFIELD),MSTATPARM3,MMSTATROC,   <<06948>>48960000
          0,0);                                                <<06948>>48965000
   RecoverOC(obj,segdescstinx,ocregionbase);                   <<06660>>48970000
   InitRegionbaseVar;                                          <<06212>>48975000
   IF mappeddomain AND prefetchreq THEN StartCacheMove;        <<06411>>48980000
   END;                                                        <<06212>>48985000
END;  <<Subroutine HandleROCObject>>                           <<06212>>48990000
                                                               <<06212>>48995000
SUBROUTINE BUMPREADPRI;                                        <<02825>>49000000
                                                               <<02825>>49005000
COMMENT                                                        <<02825>>49010000
                                                               <<02825>>49015000
BUMPS THE PRIORITY OF A PENDING READ REQUEST FOR AN OBJECT     <<06212>>49020000
ALREADY ON ITS WAY IN TO AT LEAST THE PRIORITY OF THE          <<02825>>49025000
REQUESTOR.                                                     <<02825>>49030000
                                                               <<02825>>49035000
;                                                              <<02825>>49040000
                                                               <<02825>>49045000
BEGIN                                                          <<02825>>49050000
                                                               <<02825>>49055000
<<DETERMINE THE STATE OF THE READ REQUEST>>                    <<02825>>49060000
                                                               <<02825>>49065000
DISABLE;                                                       <<02825>>49070000
TOS:=REGIONBASE;                                               <<02825>>49075000
TOS:=TOS+RBTOINITINFODISP;                                     <<02825>>49080000
ASMB(LSEA);                                                    <<02825>>49085000
drq'entry'index:=reqp:=TOS;  <<PUT READ REQ PTR INTO INDEX>>   <<06392>>49090000
ASMB(DDEL);  <<GET RID OF ADDR ON TOS>>                        <<02825>>49095000
TOS:=DRQ'FLAGS;                                                <<06392>>49100000
ASMB(TBC COMPLETEDFLAG);                                       <<02825>>49105000
IF = THEN                                                      <<02825>>49110000
   BEGIN  <<ITS NOT DONE YET>>                                 <<02825>>49115000
   IF DRQ'PREQ THEN                                            <<06627>>49120000
      BEGIN  <<THE REQUEST IS QUEUED>>                         <<02825>>49125000
      IF DRQ'URGCLAS > LOGICAL(PROCPRI) THEN                   <<06392>>49130000
         BEGIN <<GOT TO BUMP IT>>                              <<02825>>49135000
         DRQ'URGCLAS:=PROCPRI;                                 <<06392>>49140000
         DISCQMANAGER(reqp,QUEUEREQCODE);                      <<06392>>49145000
         IF < THEN SUDDENDEATH(618); <<ALREADY DONE>>          <<02825>>49150000
         END;                                                  <<02825>>49155000
      END                                                      <<02825>>49160000
      ELSE IF DRQ'URGCLAS > LOGICAL(PROCPRI)                   <<06392>>49165000
      THEN DRQ'URGCLAS:=PROCPRI;                               <<06392>>49170000
      END;                                                     <<02825>>49175000
ASMB(DEL); <<GET RID OF FLAGS>>;                               <<02825>>49180000
                                                               <<02825>>49185000
END <<BUMPREADPRI>> ;                                          <<02825>>49190000
                                                               <<02825>>49195000
                                                               <<06212>>49200000
SUBROUTINE HandleIMIObject;                                    <<06212>>49205000
                                                               <<06212>>49210000
<<Handles IMI objects>>                                        <<06212>>49215000
                                                               <<06212>>49220000
BEGIN                                                          <<06212>>49225000
IF mappeddomain THEN                                           <<06212>>49230000
   BEGIN  <<mapped disc domain>>                               <<06212>>49235000
   IF MAPD'FLAGS.(CDT'IMI'BIT:1)  THEN IMI := TRUE;            <<d7738>>49240000
   END                                                         <<06212>>49245000
ELSE                                                           <<06212>>49250000
   BEGIN  <<a segment>>                                        <<06212>>49255000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>49260000
   IF SEGDESCFIRMINFO=%100000 THEN SUDDENDEATH(617);           <<06212>>49265000
   IF LOGICAL(SEGDESCFLAGS).IMIFLAG                            <<06212>>49270000
   THEN imi:=TRUE;                                             <<06212>>49275000
   END;                                                        <<06212>>49280000
IF imi THEN                                                    <<06212>>49285000
   BEGIN                                                       <<06212>>49290000
   InitRegionbaseVar;                                          <<06212>>49295000
   specialflags.don'tnotifyflag := 0;                          <<06945>>49300000
   IF = THEN GETINOBJECTSQUEUE;                                <<06945>>49305000
   IF GCLASSENABLEDMASK.CLASS0 THEN                            <<06212>>49310000
      BEGIN  <<MEASURE IMI EVENT>>                             <<06212>>49315000
      TOS:=MEASSTATXDSBANK;                                    <<06212>>49320000
      TOS:=MEASSTATXDSBASE;                                    <<06212>>49325000
      TOS:=TOS+C0SUB0'SEGRELOFF+C'INMOTIONIN;                  <<06212>>49330000
      ASMB(LSEA);                                              <<06212>>49335000
      TOS:=TOS+1;                                              <<06212>>49340000
      ASMB(SSEA;DDEL);                                         <<06212>>49345000
      END;                                                     <<06212>>49350000
   BUMPREADPRI;                                                <<06212>>49355000
   MMSTAT'(mmstatfetch,OBJIDENTIFIER(OBJIDDESCFIELD),          <<06948>>49360000
          OBJIDENTIFIER(OBJIDNUMFIELD),MSTATPARM3,MMSTATIMI,   <<06948>>49365000
          0,0);                                                <<06948>>49370000
   END;                                                        <<06212>>49375000
END;  <<Subroutine HandleIMIObject>>                           <<06212>>49380000
                                                               <<06212>>49385000
                                                               <<06212>>49390000
                                                               <<06212>>49395000
<<LOG FETCH EVENT FOR DUMP ANALYSIS>>                          <<01987>>49400000
                                                               <<01987>>49405000
MSTATPARM3 := SPECIALFLAGS;                                    <<06948>>49410000
MSTATPARM3.(1:15) := IF SPECIALFLAGS.(0:1) = 1                 <<06948>>49415000
                      THEN REQUESTORID       << Ldev >>        <<06948>>49420000
                    ELSE REQUESTORID/PCBSIZE;  << Pin >>       <<06948>>49425000
                                                                        49430000
<<FILL IN LOCAL VARIABLES>>                                    <<06411>>49435000
                                                               <<06411>>49440000
TOS:=SPECIALFLAGS;                                                      49445000
IF = THEN ASMB(DEL) ELSE                                                49450000
   BEGIN <<SOME SPECIAL ASPECTS TO THIS SEGMENT REQUEST>>               49455000
   ASMB(TBC IOSYSREQBIT);                                               49460000
   IF <> THEN IOSYSREQ:=TRUE;                                           49465000
   ASMB(TBC IOFZREQBIT);                                                49470000
   IF <> THEN IOFZREQ:=TRUE;                                            49475000
   ASMB(TBC BKLKREQBIT);                                                49480000
   IF <> THEN BKLKREQ:=TRUE;                                            49485000
   ASMB(TBC LKREQBIT);                                                  49490000
   IF <> THEN LKREQ:=TRUE;                                              49495000
   ASMB(TBC FZREQBIT);                                                  49500000
   IF <> THEN FZREQ:=TRUE;                                              49505000
   ASMB(TBC PREFETCHREQBIT);                                   <<06212>>49510000
   IF <> THEN PREFETCHREQ := TRUE;                             <<06212>>49515000
   ASMB(DEL);                                                           49520000
   END;                                                                 49525000
                                                               <<06212>>49530000
PCBPT := REQUESTORID;                                          <<06650>>49535000
IF IOSYSREQ THEN PROCPRI:=FORCEDWRITEPRI                       <<06411>>49540000
ELSE PROCPRI:=QUEUEINGINFO.PRIFIELD;                           <<06411>>49545000
                                                                        49550000
                                                               <<06212>>49555000
<<DETERMINE OBJECT'S CURRENT STATE AND PROCEDE ACCORDINGLY>>   <<06212>>49560000
                                                               <<06212>>49565000
                                                                        49570000
FETCHOBJECT:=MMOK;  <<INITIATIALIZE RETURN STATUS TO SUCCESS>><<<06212>>49575000
                                                               <<06212>>49580000
IF OBJIDENTIFIER(OBJIDTYPEFIELD)=OBJIDCDTYPE THEN              <<06660>>49585000
   BEGIN <<FETCH OF A MAPPED DISC DOMAIN>>                     <<06212>>49590000
   CDTENTRYNUMBER := OBJIDENTIFIER(OBJIDNUMFIELD);             <<06660>>49595000
   IF BKLKREQ OR LKREQ THEN SUDDENDEATH(SFKERNNOTSUPPORTED);   <<06212>>49600000
   << Calculate & save mapped entry's absolute address >>      <<d7738>>49605000
   CDT'ABS'ON'TOS;                                             <<d7738>>49610000
   tos := tos + (CDTENTRYNUMBER * CDT'ENTRY'SIZE);             <<d7738>>49615000
   MAPD'ABS'OFST := tos;                                       <<d7738>>49620000
                                                               <<d7738>>49625000
   MAPPEDDOMAIN := TRUE;                                       <<06212>>49630000
   END                                                         <<06212>>49635000
ELSE                                                           <<06212>>49640000
   BEGIN <<FETCHING A SEGMENT>>                                <<06212>>49645000
   IF OBJIDENTIFIER(OBJIDTYPEFIELD)=OBJIDDATATYPE              <<06660>>49650000
   THEN SEGDESCSTINX:=OBJIDENTIFIER(ObjIDnumField)&LSL(2)      <<06660>>49655000
   ELSE SEGDESCSTINX:=CONVSEGIDTOSTINX(OBJ);                   <<06660>>49660000
   IF OBJIDENTIFIER(OBJIDTYPEFIELD)=OBJIDDATATYPE              <<06660>>49665000
   THEN DATASEG' := TRUE;                                      <<06613>>49670000
   X:=SEGDESCSYSBASEINX:=DSTSYSBASEINX+SEGDESCSTINX;           <<06212>>49675000
   IF BKLKREQ OR LKREQ THEN                                    <<06212>>49680000
   BEGIN  <<GET RID OF SEG IF IT'S NOT LOCKED>>                         49685000
   IF (SEGDESCFIRMINFO.ABSENTFLAG LAND SEGDESCFLAGS.IMIFLAG)            49690000
   LOR (SEGDESCFIRMINFO.ABSENTFLAG LAND SEGDESCFLAGS.ROCFLAG)           49695000
   LOR NOT SEGDESCFIRMINFO.ABSENTFLAG THEN                              49700000
      BEGIN  <<SEG AROUND OR IMI-CHECK IF LOCKED>>                      49705000
      TOS:=SEGDESCBANK;                                                 49710000
      TOS:=SEGDESCADDR;                                                 49715000
      TOS:=TOS+RBTORASDISP;                                             49720000
      ASMB(LSEA);                                                       49725000
       REGASSIGNSTATE:=S0;                                     <<03764>>49730000
                                                               <<06411>>49735000
                                                               <<01897>>49740000
       IF NOT REGASSIGNSTATE.REGLKDFLAG AND                    <<03764>>49745000
          NOT REGASSIGNSTATE.REGFZFLAG THEN                    <<03764>>49750000
         BEGIN  <<NOT LOCKED OR FROZEN - GET RID OF IT>>       <<01897>>49755000
         IF TOS.REGIOFZFLAG OR SEGDESCFLAGS.IMIFLAG THEN       <<02300>>49760000
            BEGIN  <<IN MOTION IN OR IOFRZN - WAIT A WHILE>>   <<01897>>49765000
            FETCHOBJECT:=MMSEGBUSY;                            <<06212>>49770000
            RETURN;                                                     49775000
            END;                                                        49780000
         IF NOT SEGDESCFLAGS.ROCFLAG THEN                      <<06212>>49785000
            BEGIN <<make into a roc>>                          <<06212>>49790000
            tos:=segdescbank;                                  <<06212>>49795000
            tos:=segdescaddr;                                  <<06212>>49800000
            regionbase:=tos;                                   <<06212>>49805000
            MAKEOC(SEGDESCSTINX,OBJ,0,regionbase);             <<06660>>49810000
            END;                                               <<06212>>49815000
         DISABLE;                                                       49820000
         SEGDESCFLAGS.ROCFLAG:=0;                                       49825000
         TOS:=TOS+RASTOHODADISP;                                        49830000
         ASMB(LDEA);                                                    49835000
         SEGDESCLODA:=TOS;  <<PUT DISC ADDRESS INTO DESCRIPTOR>>        49840000
         SEGDESCHODA:=TOS;                                              49845000
         TOS:=TOS+HODATOOBJIDENTDISP;                          <<06212>>49850000
         IF OBJIDENTIFIER(OBJIDTYPEFIELD)<> OBJIDDATATYPE      <<06660>>49855000
         OR DST(SEGDESCSTINX+1).DISCCOPYVALIDFLAG=1 THEN                49860000
            BEGIN <<WIPE OUT TRACE OF SEGMENT IN MEMEORY REGION>>       49865000
            TOS:=0D;                                           <<06660>>49870000
            ASMB(SDEA);                                        <<06660>>49875000
            END                                                         49880000
         ELSE DST(SEGDESCSTINX+1).FWIPFLAG:=1;<<SIGNAL COMP>>  <<01696>>49885000
         ASMB(DDEL);                                                    49890000
         ENABLE;                                                        49895000
         END                                                   <<01897>>49900000
      ELSE ASMB(DEL);  <<PITCH RAS>>                           <<01897>>49905000
      END;                                                              49910000
   END;                                                                 49915000
   END;                                                        <<06212>>49920000
                                                               <<06212>>49925000
<<Determine Object's State and Proceed Accordingly>>           <<06212>>49930000
                                                               <<06212>>49935000
HandlePresentObject;                                           <<06212>>49940000
                                                               <<06212>>49945000
IF NOT present THEN HandleROCObject;                           <<06212>>49950000
                                                               <<06212>>49955000
IF NOT present AND NOT roc THEN  HandleIMIObject;              <<06212>>49960000
                                                               <<06212>>49965000
IF MAPPEDDOMAIN                                                <<07320>>49970000
AND (MAPD'FLAGS.(CDT'IMO'BIT:1))                               <<d7738>>49975000
THEN returnvalue:=mmsegbusy;                                   <<07320>>49980000
                                                               <<07320>>49985000
IF NOT present AND NOT roc AND NOT imi                         <<07320>>49990000
AND returnvalue <> mmsegbusy THEN                              <<07320>>49995000
   BEGIN <<Object Must Be Fetched>>                            <<06212>>50000000
                                                               <<06212>>50005000
                                                               <<07320>>50010000
   <<see if enough disc request entries to complete fetch>>    <<06212>>50015000
                                                               <<06212>>50020000
      IF (DQH'TOT'ENT-DQH'CUR'NUSE) < 2 THEN                   <<06392>>50025000
         BEGIN <<NOT ENOUGH DISC REQUEST ENTRIES TO PROCEDE>>  <<01987>>50030000
         FETCHOBJECT:=MMOUTOFDISCREQ;                         <<<06212>>50035000
         RETURN;                                               <<01987>>50040000
         END;                                                  <<01987>>50045000
                                                               <<06212>>50050000
         ENABLE;                                                        50055000
                                                               <<06212>>50060000
    <<MUST GET SPACE AND INITIATE READ>>                       <<06212>>50065000
                                                               <<06212>>50070000
         MMSTAT'(mmstatfetch,OBJIDENTIFIER(OBJIDDESCFIELD),    <<06948>>50075000
                OBJIDENTIFIER(OBJIDNUMFIELD),MSTATPARM3,       <<06948>>50080000
                MMSTATFULLFETCH,0,0);                          <<06948>>50085000
         IF DATASEG' THEN                                      <<06613>>50090000
            BEGIN <<ADJUST FOR NEW SIZE IF SEG MOD PENDING>>            50095000
            IF LOGICAL(DST(SEGDESCSTINX+1)).SEGMODREQFLAG THEN          50100000
               BEGIN                                                    50105000
               SEGMODPNDG:=TRUE;                                        50110000
               <<FIND OUT NEW SIZE FOR SEGMENT>>                        50115000
               TOS := SPECQHEAD;                               <<06616>>50120000
               TOS := DST(SPECREQDST&LSL(2) + 2); << BANK >>   <<06616>>50125000
               TOS := DST(X + 1);                              <<06616>>50130000
               ASMB(XCHD);                                     <<06616>>50135000
               DDEL;                                           <<06616>>50140000
                                                               <<06620>>50145000
               X := TOS & LSR(1);     << Double index >>       <<06620>>50150000
               WHILE DENTRYWORD01 <> OBJ DO                    <<06660>>50155000
                  BEGIN                                        <<06620>>50160000
                  X := X & LSL(1);     << Single index >>      <<06620>>50165000
                  X := ENTRYWORD00;                            <<06620>>50170000
                  X := X & LSR(1);     << Double index >>      <<06620>>50175000
                  END;                                         <<06620>>50180000
               X := X & LSL(1);      << Single index >>        <<06620>>50185000
               SPECREQINX:=X;                                           50190000
               TOS:=ENTRYWORD03 & LSL(2);    << New DST size >><<06620>>50195000
               TOS := %1000D;                                  <<06616>>50200000
               ASMB(XCHD);                                     <<06616>>50205000
               DDEL;                                           <<06616>>50210000
               END                                                      50215000
            ELSE TOS:=DST(SEGDESCSTINX).DATASIZEFIELD&LSL(2);           50220000
            XFERCNT:=DST(SEGDESCSTINX).DATASIZEFIELD&LSL(2);            50225000
            END                                                         50230000
         ELSE IF mappeddomain THEN                             <<06212>>50235000
            BEGIN                                              <<06212>>50240000
            tos := MAPD'ABS'OFST;                              <<d7738>>50245000
                                                               <<d7738>>50250000
            EXCHDB;   << DB is pointing to entry >>            <<d7738>>50255000
            STARTSECTOR:=CDT'DARRAY(CDT'MD'SECTOR&asr(1));     <<d7738>>50260000
            LIMITSECTOR:=CDT'DARRAY(CDT'MD'END'SECTOR&asr(1)); <<d7738>>50265000
            EXCHDB;   << Back to original DB >>                <<d7738>>50270000
            ASMB(DDEL);  << Remove abs DB >>                   <<d7738>>50275000
            TOS:=limitsector-startsector; <<# of sector>>      <<06212>>50280000
            TOS := TOS*sectorsizeinwords;                      <<06212>>50285000
            XFERCNT:=S0;                                       <<06212>>50290000
            END                                                <<06212>>50295000
         ELSE                                                  <<06212>>50300000
            BEGIN <<code seg>>                                 <<06212>>50305000
            X:=SEGDESCSYSBASEINX;                                       50310000
            TOS:=SEGDESCFIRMINFO.CODESIZEFIELD&LSL(2);                  50315000
            XFERCNT:=S0;                                                50320000
            END;                                                        50325000
         OBJSIZE:=S0;                                          <<06212>>50330000
         IF = THEN SUDDENDEATH(619);                           <<01644>>50335000
         TOS:=(TOS+OVERHEAD-1)&LSR(PAGEPOWER)+1;                        50340000
         REQSIZE:=TOS;                                                  50345000
         IF LKREQ OR BKLKREQ THEN                                       50350000
            BEGIN                                                       50355000
            IF AWAKETOSCHEDMSG < CURRACTPRI THEN               <<d7738>>50360000
               BEGIN                                           <<d7738>>50365000
               RETURNVALUE := MMPREEMPT;                       <<d7738>>50370000
               RETURN;                                         <<d7738>>50375000
               END;                                            <<d7738>>50380000
                                                               <<d7738>>50385000
            REGIONBASE:=CREATELOCKSPACE(REQSIZE);                       50390000
            IF <> THEN                                                  50395000
               BEGIN  <<DIDN'T MAKE IT>>                                50400000
               IF < THEN FETCHOBJECT:=MMSEGBUSY               <<<06212>>50405000
               ELSE FETCHOBJECT:=MMNOLOCKSPACE;               <<<06212>>50410000
               RETURN;                                                  50415000
               END;                                                     50420000
            END;                                                        50425000
         IF REQSIZE > LOGICAL(MAXAVAILREG) THEN                         50430000
            BEGIN <<NOT A BIG ENOUGH REGION AVAILABLE>>                 50435000
            TOS:=MAKEROOM(REQUESTORID,REQSIZE,HARDREQUEST);             50440000
            FETCHOBJECT:=S0;                                  <<<06212>>50445000
            IF TOS <> MMOK THEN RETURN;                        <<01987>>50450000
               IF GCLASSENABLEDMASK.CLASS0 THEN                <<RAY.V>>50455000
                  BEGIN <<COUNT SUCCESSFUL MAKEROOM>>          <<RAY.V>>50460000
                  TOS:=MEASSTATXDSBANK;                        <<RAY.V>>50465000
                  TOS:=MEASSTATXDSBASE;                        <<RAY.V>>50470000
                  TOS:=TOS+C0SUB0'SEGRELOFF+C'MAKEROOMSUCCESS; <<RAY.V>>50475000
                  ASMB(LSEA;INCA;SSEA;DDEL);                   <<RAY.V>>50480000
                  END;                                         <<RAY.V>>50485000
               END                                             <<RAY.V>>50490000
            ELSE                                               <<RAY.V>>50495000
               IF GCLASSENABLEDMASK.CLASS0 THEN                <<RAY.V>>50500000
                  BEGIN <<COUNT FOUND FREE SPACE>>             <<RAY.V>>50505000
                  TOS:=MEASSTATXDSBANK;                        <<RAY.V>>50510000
                  TOS:=MEASSTATXDSBASE;                        <<RAY.V>>50515000
                  TOS:=TOS+C0SUB0'SEGRELOFF+C'FREESPACE;       <<RAY.V>>50520000
                  ASMB(LSEA);                                  <<RAY.V>>50525000
                  TOS:=TOS+1;                                  <<RAY.V>>50530000
                  ASMB(SSEA;DDEL);                             <<RAY.V>>50535000
                  END;                                         <<RAY.V>>50540000
         <<                                                             50545000
         SPACE IS AVAILABLE FOR REQUEST-RESERVE A REGION                50550000
                   AND INITIATE THE SEGMENT READ                        50555000
         >>                                                             50560000
                                                                        50565000
         IF LKREQ OR BKLKREQ                                            50570000
         THEN TOS:=RESERVEREGION(REQSIZE,MAXHOLESIZE,PROCPRI,           50575000
            LOCKCODE,REGIONBASE)                                        50580000
         ELSE TOS:=RESERVEREGION(REQSIZE,MAXHOLESIZE,PROCPRI,           50585000
            NOINFO,0D);                                                 50590000
                                                               <<06212>>50595000
         ASMB(DTST);  << Make sure Region Addr is non-zero >>  <<*7564>>50600000
         REGIONBASE:=TOS;                                               50605000
         IF = THEN SUDDENDEATH(619);                           <<01644>>50610000
                                                               <<06212>>50615000
         <<Get Disc Addr of Object, Put Object's Mem Addr>>    <<06212>>50620000
                                                               <<06212>>50625000
         GetDA'PutRB;                                          <<06212>>50630000
         <<CHECK FOR STACK EXPANSIONS REQUIRING A DISPLACED READ>>      50635000
                                                                        50640000
         IF DATASEG' THEN                                      <<06613>>50645000
            BEGIN                                                       50650000
            IF LOGICAL(DST(X:=OBJIDENTIFIER(ObjIDnumField)     <<06660>>50655000
                                           &LSL(2)+1)).STKFLAG <<06660>>50660000
            THEN                                               <<06212>>50665000
               BEGIN                                                    50670000
               IF LOGICAL(DST(X)).SEGMODREQFLAG THEN                    50675000
                  BEGIN <<LOOK UP READ OFFSET>>                         50680000
                  TOS := SPECREQINX;                           <<06616>>50685000
                  TOS := DST(SPECREQDST&LSL(2) + 2); << BANK >><<06616>>50690000
                  TOS := DST(X + 1);                           <<06616>>50695000
                  ASMB(XCHD);                                  <<06616>>50700000
                  DDEL;                                        <<06616>>50705000
                  X := TOS;                                    <<06616>>50710000
                  READOFFSET:=ENTRYWORD04;                     <<06620>>50715000
                  TOS := %1000D;                               <<06616>>50720000
                  ASMB(XCHD);                                  <<06616>>50725000
                  DDEL;                                        <<06616>>50730000
                  END;                                                  50735000
               END;                                                     50740000
            END;                                                        50745000
                                                                        50750000
                                                               <<06212>>50755000
         << BUILD OBJECT READ DISC REQUEST                     <<06212>>50760000
                                                               <<06212>>50765000
                                                                        50770000
         IF MAPPEDDOMAIN THEN                                  <<06411>>50775000
           BEGIN                                               <<06411>>50780000
           tos := MAPD'ABS'OFST;                               <<d7738>>50785000
           tos := tos + CDT'MD'DISCREQ;                        <<d7738>>50790000
           ASMB(LSEA;DELB;DELB);  << Load disc req >>          <<d7738>>50795000
           IF = THEN SUDDENDEATH(SFKERNCACHEINTBAD);           <<d7738>>50800000
         X := DISCREQINX := TOS;                               <<06948>>50805000
           END                                                 <<06411>>50810000
                                                               <<06411>>50815000
         ELSE X:=DISCREQINX:=GETDISCREQ(2); <<NO IMPEDE>>      <<06392>>50820000
         IF X=0 THEN SUDDENDEATH(601); <<DISCREQTAB TOO SMALL>><<01644>>50825000
         drq'entry'index:=x;                                   <<06392>>50830000
         DRQ'FLAGS:=0;                                         <<06392>>50835000
         DRQ'MMREQ:=1;                                         <<06392>>50840000
         TOS:=REGIONBASE;                                               50845000
         TOS:=READOFFSET;                                               50850000
         ASMB(DUP);                                                     50855000
         DRQ'SEGDISP:=TOS;                                     <<06392>>50860000
         ASMB(LADD);                                                    50865000
         DRQ'BUFADR:=TOS;                                      <<06392>>50870000
         DRQ'BUFDST:=TOS;                                      <<06392>>50875000
         DRQ'FUNC:=READREQ;                                    <<06392>>50880000
         TOS:=XFERCNT;                                                  50885000
         DRQ'COUNT:=TOS;                                       <<06392>>50890000
         DRQ'LDEV:=HODA.(0:8);                                 <<06392>>50895000
         DRQ'PARM1:=HODA.(8:8);                                <<06392>>50900000
         DRQ'STAT:=0;                                          <<06392>>50905000
                                                               <<08803>>50910000
         DRQ'PCB := 0;  <<NECESSARY FOR SIODM FUNCTION>>       <<08803>>50915000
                                                               <<08803>>50920000
         DRQ'QMISC := 0;                                       <<07320>>50925000
         DRQ'PARM2:=LODA;                                      <<06392>>50930000
         DRQ'SEGID1 := OBJIDENTIFIER(OBJIDDESCFIELD);          <<06941>>50935000
         DRQ'SEGID2 := OBJIDENTIFIER(OBJIDNUMFIELD);           <<06941>>50940000
         IF SWAPPINGIN THEN DRQ'URGCLAS:=BKGRNDREADPRI         <<06392>>50945000
         ELSE DRQ'URGCLAS:=PROCPRI;                            <<06392>>50950000
                                                               <<06212>>50955000
    <<IF SWAPPINGIN THEN AUXDISCREQFLAGS.SWAPINREADREQFLAG:=1>><<06212>>50960000
                                                                        50965000
                                                               <<06212>>50970000
         << PUT OBJIDENT, DISCREQP, DISC ADDRESS INTO HEADER>> <<06212>>50975000
                                                               <<06212>>50980000
                                                                        50985000
         TOS:=REGIONBASE;                                               50990000
         TOS:=TOS+RBTOOBJIDENTDISP;                            <<06212>>50995000
         TOS:=OBJ;                                             <<06660>>51000000
         ASMB(SDEA);                                           <<06660>>51005000
         TOS:=TOS+OBJIDENTTOINITINFODISP;                      <<06212>>51010000
         TOS:=drq'entry'index;                                 <<06392>>51015000
         ASMB(SSEA);  <<PUT DISCREQP INTO THE REGION HEADER>>           51020000
         TOS:=TOS+INITINFOTOHODADISP;                                   51025000
         TOS:=HODA;                                                     51030000
         TOS:=LODA;                                                     51035000
         ASMB(SDEA);                                                    51040000
                                                                        51045000
         <<                                                             51050000
         BUILD REQUEST COMPLETION MESSAGE, AND STORE INTO HEADER        51055000
         >>                                                             51060000
                                                                        51065000
         TOS:=TOS+HODATOCOMPMSGDISP;                                    51070000
         TOS:=0;                                                        51075000
         IF SEGMODPNDG THEN TOS.COMPMSGMODFLAG:=1;                      51080000
         IF BKLKREQ THEN TOS.COMPMSGBLKDLKFLAG:=1;                      51085000
         ASMB(SSEA);                                                    51090000
                                                                        51095000
                                                               <<06212>>51100000
         <<GET PROCESS/DEVICE IN LINE FOR THE SEGMENT>>        <<06212>>51105000
                                                               <<06212>>51110000
                                                                        51115000
         DISABLE;                                              <<07320>>51120000
                                                               <<06212>>51125000
         SPECIALFLAGS.DON'TNOTIFYFLAG := 0;                    <<06945>>51130000
         IF = THEN                                             <<06945>>51135000
            GETINOBJECTSQUEUE;                                 <<06945>>51140000
                                                                        51145000
         <<Mark Object In Motion IN>>                          <<06212>>51150000
                                                               <<06212>>51155000
         MarkObjectIMI;                                        <<06212>>51160000
                                                               <<06212>>51165000
         <<If a mapped disc domain, get region linked into>>   <<06212>>51170000
         <<list of cached disc domains>>                       <<06212>>51175000
                                                               <<06212>>51180000
         IF mappeddomain THEN                                  <<06212>>51185000
            BEGIN <<set cached region flag, link>>             <<06212>>51190000
            TOS:=regionbase;;                                  <<06212>>51195000
            TOS:=TOS + rbtosasdisp;                            <<06212>>51200000
            ASMB(LSEA);                                        <<06212>>51205000
            TOS.regcachedflag:=1;                              <<06212>>51210000
            TOS.regfetchiostatus:=iostatusok;<<for virgins>>   <<06212>>51215000
            ASMB(SSEA;DDEL);                                   <<06212>>51220000
             << Pass Subregion Size to LINK procedure >>       <<06411>>51225000
             TOS := REGIONBASE;                                <<06411>>51230000
             TOS := TOS + RBTOSSDISP;                          <<06411>>51235000
             ASMB(LSEA;STAX);  << Save old ss in X-register>>  <<06411>>51240000
             TOS := REQSIZE;   << Region Pages >>              <<06411>>51245000
             ASMB(SSEA);                                       <<06411>>51250000
             ENABLE;                                           <<*7564>>51255000
             LinkCachedRegion(regionbase);                     <<06411>>51260000
             DISABLE;                                          <<*7564>>51265000
             ASMB(LDXA;SSEA;DDEL); << Restore SS from X-reg>>  <<*7564>>51270000
            tos := MAPD'ABS'OFST;                              <<d7738>>51275000
            tos := tos + CDT'MD'FLAGS;                         <<d7738>>51280000
            ASMB(LSEA;DELB,DELB);  << Load FLAGS word on tos >><<d7738>>51285000
            MAPD'FLAGS := tos;     << Save flags for later   >><<d7738>>51290000
            END;                                               <<06212>>51295000
                                                                        51300000
         <<                                                             51305000
         BUILD INITIATION MESSAGE AND PUT IN REGION HEADER              51310000
         >>                                                             51315000
                                                                        51320000
         TOS:=TOS+COMPMSGTOINITMSGDISP;                                 51325000
         DISABLE;                                                       51330000
         ASMB(LSEA);                                                    51335000
         IF MAPPEDDOMAIN                                       <<06212>>51340000
         AND (MAPD'FLAGS.(CDT'VIRGIN'BIT:1))                   <<d7738>>51345000
         THEN TOS.INITMSGSTARTCOMPFLAG := 1                    <<06212>>51350000
         ELSE TOS.QUEUEREADREQFLAG:=1;                         <<06212>>51355000
         TOS.INITMSGTOGGLESWITCH:=0;                                    51360000
         IF MAPPEDDOMAIN                                       <<06212>>51365000
            AND (MAPD'FLAGS.(CDT'IMO'BIT:1))                   <<d7738>>51370000
         THEN TOS.MSGEXTDISABLEDFLAG:=1;                       <<06411>>51375000
         IF DATASEG' AND NOT LOGICAL(DST(X:=SEGDESCSTINX+1)).  <<06613>>51380000
            DISCCOPYVALIDFLAG THEN TOS.MSGEXTDISABLEDFLAG:=1;           51385000
         ASMB(SSEA);                                                    51390000
         TOS:=TOS+INITMSGTORBDISP;                                      51395000
         PROCESSINITMSG(*);                                             51400000
   END;                                                                 51405000
                                                               <<06212>>51410000
IF DATASEG' AND SPECIALFLAGS.SETMAPREQFLAG THEN                <<*7766>>51415000
   BEGIN                                                       <<*7766>>51420000
   TOS := REGIONBASE;                                          <<*7766>>51425000
   TOS := TOS + RBTORASDISP;                                   <<*7766>>51430000
   ASMB (LSEA);                                                <<*7766>>51435000
   LS0.REGMAPFLAG := 1;                                        <<*7766>>51440000
   ASMB (SSEA;DDEL);                                           <<*7766>>51445000
   END;                                                        <<*7766>>51450000
                                                               <<*7766>>51455000
<<Perform any Special processing>>                             <<06212>>51460000
                                                               <<06212>>51465000
TOS:=SPECIALFLAGS;                                                      51470000
IF <> AND RETURNVALUE = MMOK THEN                              <<07320>>51475000
   BEGIN <<UPDATE SPECIAL STATE COUNTERS IN THE REGION HEADER>>         51480000
   DISABLE;                                                             51485000
   TOS:=REGIONBASE;                                                     51490000
                                                               <<06212>>51495000
   IF IOFZREQ THEN                                                      51500000
      BEGIN                                                             51505000
      IF A'DISC THEN                                           <<*7606>>51510000
         BEGIN    << It's a disc request index >>              <<*7606>>51515000
         DRQ'ENTRY'INDEX := REQUESTORID.(2:14);                <<*7606>>51520000
         IF DRQ'DATAFRZN OR DRQ'DONE THEN RETURN;              <<*7606>>51525000
         DRQ'DATAFRZN := 1;                                    <<*7606>>51530000
         END;                                                  <<*7606>>51535000
                                                               <<*7606>>51540000
      TOS:=TOS+RBTOWDIOFZCNTDISP;                                       51545000
      ASMB(LSEA);                                                       51550000
      COUNT:=TOS;                                                       51555000
      COUNT.IOFZCNTFIELD:=COUNT.IOFZCNTFIELD+1;                         51560000
      TOS:=COUNT;                                                       51565000
      ASMB(SSEA);                                                       51570000
      TOS:=TOS+WDIOFZCNTTORASDISP;                                      51575000
      ASMB(LSEA);                                                       51580000
      TOS.REGIOFZFLAG:=1;                                               51585000
      ASMB(SSEA);                                                       51590000
      MMSTAT'(MMSTATSPECREQ,OBJIDENTIFIER(OBJIDDESCFIELD),     <<06948>>51595000
             OBJIDENTIFIER(OBJIDNUMFIELD),%100000,             <<06948>>51600000
             COUNT.IOFZCNTFIELD,0,0);                          <<06948>>51605000
      END                                                               51610000
   ELSE                                                                 51615000
      BEGIN                                                             51620000
      TOS:=TOS+RBTOLKFZCNTDISP;                                         51625000
      ASMB(LSEA);                                                       51630000
      COUNT:=TOS;                                                       51635000
      IF LKREQ OR BKLKREQ THEN COUNT.LKCNTFIELD:=COUNT.LKCNTFIELD+1     51640000
      ELSE IF FZREQ THEN COUNT.FZCNTFIELD:=COUNT.FZCNTFIELD+1;          51645000
      TOS:=COUNT;                                                       51650000
      ASMB(SSEA);                                                       51655000
      TOS:=TOS+LKFZCNTTORASDISP;                                        51660000
      ASMB(LSEA);                                                       51665000
      IF FZREQ THEN TOS.REGFZFLAG:=1                                    51670000
      ELSE IF LKREQ OR BKLKREQ THEN TOS.REGLKDFLAG:=1;                  51675000
      ASMB(SSEA);                                                       51680000
      IF LKREQ OR BKLKREQ THEN                                 <<01571>>51685000
         MMSTAT'(MMSTATSPECREQ,OBJIDENTIFIER(OBJIDDESCFIELD),  <<06948>>51690000
               OBJIDENTIFIER(OBJIDNUMFIELD),%100002,COUNT,0,0) <<06948>>51695000
      ELSE IF FZREQ THEN                                       <<01571>>51700000
         MMSTAT'(MMSTATSPECREQ,OBJIDENTIFIER(OBJIDDESCFIELD),  <<06948>>51705000
               OBJIDENTIFIER(OBJIDNUMFIELD),%100001,COUNT,0,0);<<06948>>51710000
      SLLINX := SPECIALINFO;                                   <<06625>>51715000
      IF FZREQ THEN SLL(SLL'FLAGS).SLLFZREQFLAG := 0           <<06625>>51720000
      ELSE IF LKREQ THEN SLL(SLL'FLAGS).SLLLKREQFLAG := 0      <<06625>>51725000
      ELSE IF BKLKREQ THEN SLL(SLL'FLAGS).SLLBLKLOCKREQFLAG:=0;<<06625>>51730000
      IF GCLASSENABLEDMASK.CLASS0 THEN                                  51735000
         BEGIN  <<MEASURE LOCK OR FREEZE REQUEST>>                      51740000
         TOS:=MEASSTATXDSBANK;                                          51745000
         TOS:=MEASSTATXDSBASE;                                          51750000
         IF FZREQ THEN TOS:=TOS+C0SUB0'SEGRELOFF+C'FREEZEREQ   <<RAY.V>>51755000
            ELSE TOS:=TOS+C0SUB0'SEGRELOFF+C'LOCKREQ;          <<RAY.V>>51760000
         ASMB(LSEA);                                                    51765000
         IF FZREQ AND COUNT.FZCNTFIELD=1 THEN TOS:=TOS+1                51770000
         ELSE IF COUNT.LKCNTFIELD=1 THEN TOS:=TOS+1;                    51775000
         ASMB(SSEA;DDEL);                                               51780000
         END;                                                           51785000
      END;                                                              51790000
   END;                                                                 51795000
END   <<PROCEDURE FETCHOBJECT>>;                               <<06212>>51800000
                                                                        51805000
$PAGE "MEMORY ALLOCATION PROCEDURES : SWAPIN"                           51810000
                                                               <<06411>>51815000
INTEGER PROCEDURE SwapIn(swapinprocinx,swapinstructions);      <<06411>>51820000
VALUE swapinprocinx,swapinstructions;                          <<06411>>51825000
INTEGER swapinprocinx;                                         <<06411>>51830000
LOGICAL swapinstructions;                                      <<06411>>51835000
OPTION PRIVILEGED,UNCALLABLE;                                           51840000
                                                                        51845000
COMMENT                                                                 51850000
                                                                        51855000
SWAPIN IS INVOKED BY A CPU'S DISPATCHER WHEN HE HAS DECIDED TO          51860000
DEVOTE HIS CPU TO WORKING ON SWAPPING IN THE LOCALITY OF                51865000
A PROCESS REQUIRING SCHEDULING ATTENTION.                      <<06212>>51870000
                                                                        51875000
SWAPIN MONITORS THE AWAKETOSCHEDMSG AND THE CURRACTPRI TO               51880000
SEE IF SOMETHING MORE URGENT IS PENDING, AND IF SO RETURNS TO           51885000
THE DISPATCHER (PARTIAL SWAPINS ARE OK).                                51890000
                                                                        51895000
THE LOCALITY LIST OF SWAPINPROCINX IS CHECKED TO FIND THE NEXT          51900000
SEGMENT REQUEST OF THE PROCESS.  IF THE SEGMENT IS NOT ALREADY          51905000
ALLOCATED TO THE PROCESS, FETCHOBJECT IS INVOKED TO FETCH      <<06212>>51910000
THE SEGMENT FOR THIS PROCESS.                                           51915000
                                                               <<06411>>51920000
THE SWAPINSTRUCTIONS PARAMETER INDICATE ANY SPECIAL SERVICING  <<06411>>51925000
REQUIRED FOR THIS SWAP REQUEST.  THESE SPECIAL INSTRUCTIOONS   <<06411>>51930000
INCLUDE A HARD SWAP REQUIRED (IE OVERRULE THE THRASH CONTROL   <<06411>>51935000
MECHANISM AND GET THIS GUY IN NO MATTER WHAT), AND A WAKE UP   <<06411>>51940000
CONTROL THAT CAUSES THE PROCESS TO BE AWAKENED OR NOT TO BE    <<06411>>51945000
AWAKENED WHEN ITS SWAP COMPLETES (DON'T WAKE UP IF SWAPIN IS   <<06411>>51950000
BEING CALLED DIRECTLY FROM THE PROCESS' STACK ON A PREFETCH    <<06411>>51955000
REQUEST).                                                      <<06411>>51960000
                                                               <<06411>>51965000
                                                                        51970000
SWAPIN RETURNS STATUS FROM FETCHSEGMENT OR ACCORDING TO THE    <<06411>>51975000
DEFINED CONSTANTS FOR MEMORY MANAGEMENT STATUS                 <<06411>>51980000
                                                               <<06411>>51985000
                                                               <<06411>>51990000
                                                               <<06411>>51995000
;                                                                       52000000
                                                                        52005000
BEGIN                                                                   52010000
                                                                        52015000
LOGICAL RETURNVALUE=SWAPIN;                                             52020000
                                                               <<06625>>52025000
INTEGER                                                        <<06660>>52030000
        SLLHEADINX, << Index to SLL header entry >>            <<06625>>52035000
        PCBPT,                                                 <<06650>>52040000
        NEXTREQINX,                                                     52045000
        MSTATPARM2,                                            <<01571>>52050000
        SLLINX;     << Index to SLL regular entry >>           <<06625>>52055000
                                                               <<06625>>52060000
DOUBLE OBJIDENTIFIER;                                          <<06660>>52065000
DOUBLE SAVETIME;                                                        52070000
                                                               <<06625>>52075000
                                                               <<06625>>52080000
LOGICAL SPECIALREQFLAGS,                                                52085000
        HARDREQUEST:=FALSE,                                    <<06945>>52090000
        GOTSOMEMEMORY:=FALSE,                                           52095000
        SWAPREQUIRED:=FALSE;                                            52100000
                                                                        52105000
                                                                        52110000
SWAPIN:=MMOK; <<ASSUME SUCCESS>>                               <<01987>>52115000
                                                                        52120000
<<                                                                      52125000
START RESERVING SPACE FOR THE PROCESS' LOCALITY                         52130000
>>                                                                      52135000
                                                                        52140000
IF GCLASSENABLEDMASK.CLASS0 THEN SAVETIME:=TIMER;                       52145000
PCBPT := SWAPINPROCINX;                                        <<06650>>52150000
SLLHEADINX := SLLPTR;                                          <<06625>>52155000
IF SWAPINSTRUCTIONS.SWAPHARDREQUEST THEN HARDREQUEST:=TRUE;    <<06411>>52160000
DISABLE;                                                                52165000
                                                               <<04484>>52170000
STARTSCANOVER:                                                 <<04484>>52175000
                                                                        52180000
IF SLL(SCHEDTOIOMSG).SLLSWAPREQFLAG THEN SWAPREQUIRED := TRUE; <<06625>>52185000
IF (NOT SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG LAND SWAPREQUIRED)     <<06625>>52190000
   LOR SLL(SCHEDTOIOMSG).SLLSTARTOVERFLAG                      <<06625>>52195000
   LOR (INTEGER(SLL(SEGCOUNT)) > SLLOBJLIMIT) THEN             <<06625>>52200000
   BEGIN  <<CHOP TO MIN LOCALITY AND START SWAP OVER>>         <<01913>>52205000
   TOS:=SWAPINPROCINX;                                                  52210000
   ASMB(DZRO,DZRO);                                            <<06660>>52215000
   TOS.INITLOCFLAG:=1;                                                  52220000
   ADJUSTLOCALITY(*,*,*,*);                                             52225000
   SWAPREQUIRED := TRUE;                                       <<*7564>>52230000
   SLL(MEMREQINX) := SLL(FIRSTINX);                            <<06625>>52235000
   SLL(SCHEDTOIOMSG).SLLSTARTOVERFLAG := 0;                    <<06625>>52240000
   END;                                                                 52245000
                                                               <<06625>>52250000
SLL(SCHEDTOIOMSG).SLLSWAPIPFLAG := 1;                          <<06625>>52255000
SLLINX := SLL(MEMREQINX);                                      <<06625>>52260000
                                                               <<06625>>52265000
WHILE SLLINX <> 0 DO                                           <<06625>>52270000
   BEGIN                                                                52275000
   TOS := SLL(SLL'OBJDESC);                                    <<06660>>52280000
   TOS := SLL(SLL'OBJNUM);                                     <<06660>>52285000
   OBJIDENTIFIER := TOS;                                       <<06660>>52290000
   SPECIALREQFLAGS:=0;                                                  52295000
   TOS := SLL(SLL'FLAGS);                                      <<06625>>52300000
   ASMB(TBC SLLFZREQBIT);                                               52305000
   IF <> THEN SPECIALREQFLAGS.FZREQFLAG:=1;                             52310000
   ASMB(TBC SLLLKREQBIT);                                               52315000
   IF <> THEN SPECIALREQFLAGS.LKREQFLAG:=1;                             52320000
   ASMB(TBC SLLBLKLOCKREQBIT);                                          52325000
   IF <> THEN SPECIALREQFLAGS.BKLKREQFLAG:=1;                           52330000
   IF S0.SLLPREFETCHCOUNT <> 0 THEN                            <<06945>>52335000
      BEGIN                                                    <<06945>>52340000
      specialreqflags.prefetchreqflag := 1;                    <<06945>>52345000
      IF S0.slldeccntflag = 0                                  <<06945>>52350000
      THEN SPECIALREQFLAGS.DON'TNOTIFYFLAG :=1;                <<06945>>52355000
      END;                                                     <<06945>>52360000
   << If called from PREFETCHOBJECT (i.e. on a user's stack) >><<07320>>52365000
   << then don't want to be queued for any object fetch.     >><<07320>>52370000
                                                               <<07320>>52375000
   IF CURPRC <> 0 THEN SPECIALREQFLAGS.DON'TNOTIFYFLAG := 1;   <<07320>>52380000
                                                               <<07320>>52385000
   ASMB(DEL);                                                  <<06945>>52390000
                                                               <<*7564>>52395000
   IF SLL(SLL'FLAGS).SLLMAPSEGFLAG THEN                        <<*7766>>52400000
      SPECIALREQFLAGS.SETMAPREQFLAG := 1;                      <<*7766>>52405000
                                                               <<*7766>>52410000
   << Save next SLL entry. Done before FETCHOBJECT in case  >> <<*7564>>52415000
   << an SLL entry gets removed on us.                      >> <<*7564>>52420000
                                                               <<*7564>>52425000
   NEXTREQINX := SLL(NEXTINX);                                 <<*7564>>52430000
                                                               <<*7564>>52435000
   ENABLE;                                                              52440000
   IF SLL(SLL'FLAGS).SLLIMIFLAG THEN SWAPIN := MMOK            <<*7564>>52445000
   ELSE SWAPIN := FETCHOBJECT(OBJIDENTIFIER,SWAPINPROCINX,     <<06212>>52450000
      SPECIALREQFLAGS,SLLINX,HARDREQUEST);                     <<06625>>52455000
   DISABLE;                                                             52460000
                                                               <<06212>>52465000
   IF RETURNVALUE <> MMOK THEN                                 <<06212>>52470000
      BEGIN  <<FETCH COULDN'T COMPLETE>>                                52475000
      NEXTREQINX:=0;                                                    52480000
      IF RETURNVALUE  = MMNOLOCKSPACE <<NO LOCK SPACE>>        <<06212>>52485000
      THEN SLL(SLL'FLAGS).SLLTOSSENTRYFLAG := 1;               <<06625>>52490000
      END                                                               52495000
   ELSE                                                                 52500000
      BEGIN  <<SEG ALLOCATED SUCCESSFULLY>>                             52505000
      GOTSOMEMEMORY:=TRUE;                                              52510000
      IF SLL(SCHEDTOIOMSG).SLLSTARTOVERFLAG THEN               <<06625>>52515000
         GO STARTSCANOVER;                                     <<04484>>52520000
      IF NOT SWAPREQUIRED THEN                                          52525000
         BEGIN <<ALL DONE WITH THIS GUY>>                               52530000
         SLL(MEMREQINX) := NEXTREQINX := 0;                    <<06625>>52535000
         END                                                            52540000
      ELSE                                                              52545000
         BEGIN  <<PUT NEXT REQUEST INTO MEMREQINX>>                     52550000
         SLL(MEMREQINX) := NEXTREQINX;                         <<06625>>52555000
         END;                                                           52560000
      END;                                                              52565000
   SLLINX := NEXTREQINX;                                       <<06625>>52570000
   END;                                                                 52575000
IF GOTSOMEMEMORY THEN SLL(SCHEDTOIOMSG).SLLHASMEMFLAG := 1;    <<06625>>52580000
IF RETURNVALUE = MMOK THEN                                     <<06212>>52585000
   BEGIN <<SWAP COMPLETE>>                                              52590000
   TOS := SLL(SCHEDTOIOMSG);                                   <<06625>>52595000
   TOS.SLLSWAPREQFLAG:=0;                                               52600000
   TOS.SLLSWAPIPFLAG:=0;                                                52605000
   SLL(SCHEDTOIOMSG) := S0;                                    <<06625>>52610000
   RESABORTINFO.SARFLAG := 0;                                  <<06650>>52615000
   RESABORTINFO.PCBSHORTWAITFLAG := 1;                         <<06650>>52620000
   IF TOS.SLLIOCOMPTOAWAKEMSG=0                                <<06411>>52625000
   AND SWAPINSTRUCTIONS.SWAPWAKEUP THEN                        <<06411>>52630000
      BEGIN <<PROCESS IS READY TO BE LAUNCHED>>                         52635000
      SWAPIN:=MMPREEMPT;<<signal disp to start over>>          <<06411>>52640000
      AWAKE(SWAPINPROCINX,MEMORYWAITCODE,NOWAIT);              <<06650>>52645000
      ENABLE;                                                  <<*8461>>52650000
      END;                                                              52655000
   END;                                                                 52660000
MSTATPARM2 := %100000;                                         <<01571>>52665000
MSTATPARM2.(1:1) := IF SWAPREQUIRED THEN 1 ELSE 0;             <<01571>>52670000
MSTATPARM2.(12:4):= RETURNVALUE;                               <<01571>>52675000
MMSTAT'(MMSTATSWAPIN,SWAPINPROCINX/PCBSIZE,MSTATPARM2,         <<06948>>52680000
        HARDREQUEST,0,0,0);                                    <<06948>>52685000
IF GCLASSENABLEDMASK.CLASS0 THEN                                        52690000
   BEGIN  <<MEASURE SWAP-IN EVENT AND DURATION>>                        52695000
   TOS:=MEASSTATXDSBANK;                                                52700000
   TOS:=MEASSTATXDSBASE;                                                52705000
   TOS:=TOS+C0SUB0'SEGRELOFF+C'SWAPIN;                         <<RAY.V>>52710000
   ASMB(LSEA);                                                          52715000
   TOS:=TOS+1;                                                          52720000
   ASMB(SSEA);                                                          52725000
   TOS:=TOS-C'SWAPIN+C'CPUMEMORYALLOC;                         <<RAY.V>>52730000
   ASMB(LDEA);                                                          52735000
   TOS:=TIMER-SAVETIME;                                                 52740000
   ASMB(DADD;SDEA;DDEL);                                                52745000
   END;                                                                 52750000
IF GCLASSENABLEDMASK.CLASS15 THEN                              <<01812>>52755000
   BEGIN <<PRCOESS LEVEL SWAPIN>>                              <<01812>>52760000
   TOS:=MEASPROCXDSBANK;                                       <<01812>>52765000
   TOS:=MEASPROCXDSBASE;                                       <<01812>>52770000
   TOS:=TOS+ICS(-ICS'CANDPINCELL)*                             <<01812>>52775000
        CLASS15'SUB0SIZE+CP'SWAPIN;                            <<01812>>52780000
   ASMB(LSEA);                                                 <<01812>>52785000
   TOS:=TOS+1;                                                 <<01812>>52790000
   ASMB(SSEA;DDEL);                                            <<01812>>52795000
   END;                                                        <<01812>>52800000
END  <<SWAPIN>>;                                                        52805000
                                                                        52810000
$PAGE "GARBAGE COLLECTION"                                              52815000
                                                                        52820000
PROCEDURE COLLECTGARBAGE(SINGLEHOLEBASE);                               52825000
VALUE SINGLEHOLEBASE;                                                   52830000
DOUBLE SINGLEHOLEBASE;                                                  52835000
OPTION PRIVILEGED,UNCALLABLE;                                           52840000
                                                                        52845000
COMMENT                                                                 52850000
                                                                        52855000
COLLECTGARBAGE COMBINES HOLES DURING OTHERWISE IDLE PERIODS.            52860000
SINCE GARBAGE COLLECTION IS A BACKGROUND ACTIVITY, THE                  52865000
AWAKETOSCHEDMSG IS SAMPLED AT CONVENIENT TIMES SO THAT MORE             52870000
URGENT PENDING ACTIVITY CAN BE RESPONDED TO.                            52875000
                                                                        52880000
THE SELECTED STRATEGY PROCEEDS FROM THE LARGEST TO THE SMALLEST         52885000
HOLE. IT IS FIRST ATTEMPTED TO COMBINE THE HOLE WITH THE PREVIOUS       52890000
HOLE IN THE BANK, THEN WITH THE FOLLOWING HOLE IN THE BANK.             52895000
THE COMBINATIONS ARE PERFORMED BY MOVING ALL SEGMENTS BETWEEN           52900000
THE LOWER AND UPPER HOLE TO THE BASE OF SOME OTHER SMALL HOLE.          52905000
THE COMBINATIONS WILL BE PERFORMED IF :                                 52910000
                                                                        52915000
   (I). THE MOVE OF THE INTERMEDIATE SEGMENTS DOES NOT EXCEED THE       52920000
        CONFIGURED MOVE THRESHOLD,                                      52925000
                                                                        52930000
  (II). NO INTERVENING SEGMENTS ARE LOCKED, FROZEN, OR I/O FROZEN,      52935000
                                                                        52940000
 (III). A SMALL DESTINATION HOLE WHICH IS CLEAN OF ONGOING INTERNAL     52945000
        I/O CAN BE OBTAINED.                                            52950000
                                                                        52955000
;                                                                       52960000
                                                                        52965000
BEGIN                                                                   52970000
                                                                        52975000
INTEGER MOVEPAGECNT:=0;                                                 52980000
                                                                        52985000
                                                                        52990000
DOUBLE NEXTCANDBASE:=0D,                                                52995000
       CURRENTHOLEBASE:=0D,                                             53000000
       FIRSTMEMORYADDRESS,                                              53005000
       CURRENTFLIPBASE,                                                 53010000
       UPPERBOUNDBASE,                                                  53015000
       NEXTFLIPBASE,                                                    53020000
       LOWERBOUNDBASE,                                                  53025000
       LOWERHOLEBASE,                                                   53030000
       UPPERHOLEBASE,                                                   53035000
       DESTHOLEBASE,                                                    53040000
       MOVESOURCE,                                                      53045000
       SAVETIME,                                                        53050000
       COMBINEDHOLEBASE;                                                53055000
                                                                        53060000
                                                                        53065000
INTEGER CURRENTHOLESIZE:=MAXHOLESIZE,                                   53070000
        THISREGIONSIZE,                                                 53075000
        SEGDESCSYSBASEINX,                                              53080000
        SEGDESCSTINX,                                                   53085000
        LOWERHOLESIZE,                                                  53090000
        UPPERHOLESIZE,                                                  53095000
        COMBINEDHOLESIZE;                                               53100000
                                                                        53105000
LOGICAL GOTONE,                                                         53110000
        CAN'TMOVE,                                                      53115000
        STARTOVER,                                                      53120000
        COMBINEBELOW,                                                   53125000
        COMBINEABOVE,                                                   53130000
        MOVED,                                                          53135000
        GETREADY,                                                       53140000
        READY,                                                          53145000
        GOONCE,                                                         53150000
        GOTNEXTHOLE,                                                    53155000
        GIVEUP;                                                         53160000
DOUBLE  OBJ;                                                   <<06660>>53165000
LOGICAL ARRAY OBJID(*)=OBJ;                                    <<06660>>53170000
                                                                        53175000
SUBROUTINE SELECTNEXTCAND;                                              53180000
                                                                        53185000
COMMENT                                                                 53190000
                                                                        53195000
Selects the available region about which garbage collection wil<<06945>>53200000
take place.  Collection proceeds from the largest hole         <<06945>>53205000
backwards through the available region list.                   <<06945>>53210000
                                                                        53215000
;                                                                       53220000
                                                                        53225000
BEGIN                                                                   53230000
IF STARTOVER THEN                                              <<06945>>53235000
   CURRENTHOLESIZE := MAXHOLESIZE;                             <<06945>>53240000
<< Select current hole base >>                                 <<06945>>53245000
IF SINGLEHOLEBASE <> 0D THEN                                            53250000
   BEGIN <<JUST A SINGLE SHOT>>                                         53255000
   IF CURRENTHOLEBASE <> 0D THEN CURRENTHOLEBASE:=0D <<DONE>>           53260000
   ELSE CURRENTHOLEBASE:=SINGLEHOLEBASE;                                53265000
   END                                                                  53270000
ELSE IF NEXTCANDBASE <> 0D AND NOT STARTOVER THEN              <<06945>>53275000
   CURRENTHOLEBASE := NEXTCANDBASE                             <<06945>>53280000
ELSE IF STARTOVER THEN                                         <<06945>>53285000
   BEGIN                                                       <<06945>>53290000
   TOS := HOLELISTTAIL;                                        <<06945>>53295000
   IF <> THEN TOS := TOS + NLTORBDISP;                         <<07320>>53300000
   CURRENTHOLEBASE := TOS;                                     <<06945>>53305000
   END                                                         <<06945>>53310000
ELSE CURRENTHOLEBASE := NEXTCANDBASE;                          <<06945>>53315000
                                                               <<06945>>53320000
<< Select next candidate base >>                               <<06945>>53325000
                                                               <<06945>>53330000
IF SINGLEHOLEBASE <> 0D THEN NEXTCANDBASE:=0D ELSE                      53335000
   BEGIN <<NOT JUST A SINGLE SHOT>>                                     53340000
   TOS:=CURRENTHOLEBASE;                                                53345000
   IF = THEN NEXTCANDBASE:=TOS ELSE                                     53350000
      BEGIN                                                             53355000
      TOS := TOS+RBTOPLDISP;    << prev in list >>             <<06945>>53360000
      ASMB(LDEA);                                                       53365000
      IF = THEN NEXTCANDBASE := TOS ELSE                       <<06945>>53370000
         BEGIN                                                 <<06945>>53375000
         TOS := TOS + PLTORBDISP;                              <<06945>>53380000
         NEXTCANDBASE := TOS;                                  <<06945>>53385000
         END;                                                  <<06945>>53390000
      ASMB(DDEL);                                                       53395000
      END;                                                              53400000
   END;                                                                 53405000
                                                               <<06945>>53410000
<< Determine current hole size >>                              <<06945>>53415000
                                                               <<06945>>53420000
TOS:=CURRENTHOLEBASE;                                                   53425000
IF = THEN                                                               53430000
   BEGIN <<SHOULD QUIT>>                                                53435000
   ASMB(DDEL);                                                          53440000
   CURRENTHOLESIZE:=0;                                                  53445000
   END                                                                  53450000
ELSE                                                                    53455000
   BEGIN                                                                53460000
   TOS:=TOS+RBTORSDISP;                                                 53465000
   ASMB(LSEA);                                                          53470000
   CURRENTHOLESIZE:=TOS;                                                53475000
   ASMB(DDEL);                                                          53480000
   END;                                                                 53485000
STARTOVER:=FALSE;                                                       53490000
                                                               <<06945>>53495000
<< Skip over holes that are already of max size. >>            <<06945>>53500000
                                                               <<06945>>53505000
IF CURRENTHOLESIZE=MAXHOLESIZE THEN SELECTNEXTCAND; <<RECURSIVE>>       53510000
END <<SUBROUTINE SELECTNEXTCAND>>;                                      53515000
                                                               <<06212>>53520000
                                                               <<06212>>53525000
SUBROUTINE MarkObjectAbsent;                                   <<06212>>53530000
                                                               <<06212>>53535000
<<sets the absent bit of the object identiifed by objid>>      <<06212>>53540000
                                                               <<06212>>53545000
BEGIN                                                          <<06212>>53550000
IF objid(ObjIDTypeField)=OBJIDCDTYPE THEN                      <<06660>>53555000
   BEGIN  <<a mapped domain>>                                  <<06212>>53560000
   IF objid(ObjIDnumField)<> 0 THEN                            <<06660>>53565000
      BEGIN  <<cached domain has a CDT entry>>                 <<06212>>53570000
      CDT'ABS'ON'TOS;                                          <<d7738>>53575000
      tos := tos + CDT'MD'FLAGS +                              <<d7738>>53580000
             (OBJID(ObjIDNumField) * CDT'ENTRY'SIZE);          <<d7738>>53585000
      ASMB(LSEA);                                              <<d7738>>53590000
      tos.(CDT'ABS'BIT:1) := 1;                                <<d7738>>53595000
      if <> then SUDDENDEATH(SFKernCacheSyncBad);              <<d7738>>53600000
      ASMB(SSEA;DDEL);                                         <<d7738>>53605000
      END;                                                     <<d7738>>53610000
   END                                                         <<06212>>53615000
ELSE                                                           <<06212>>53620000
   BEGIN  <<a Seg>>                                            <<06212>>53625000
   IF OBJID(OBJIDTYPEFIELD)=OBJIDDATATYPE                      <<06660>>53630000
   THEN SEGDESCSTINX:=OBJID(ObjIDnumField)&LSL(2) <<DATA SEG>> <<06660>>53635000
   ELSE SEGDESCSTINX:=CONVSEGIDTOSTINX(OBJ);                   <<06660>>53640000
   SEGDESCSYSBASEINX:=DSTSYSBASEINX+SEGDESCSTINX;              <<06212>>53645000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>53650000
   SEGDESCFIRMINFO.ABSENTFLAG:=1;                              <<06212>>53655000
   IF <> THEN SUDDENDEATH(614);                                <<06212>>53660000
   END;                                                        <<06212>>53665000
END;  <<SUBROUTINE MarkObjectAbsent>>                          <<06212>>53670000
                                                               <<06212>>53675000
                                                               <<06212>>53680000
                                                                        53685000
SUBROUTINE MarkObjectPresent;                                  <<06212>>53690000
                                                               <<06212>>53695000
<< flags object as present and puts currentflipbase as address><<06212>>53700000
                                                               <<06212>>53705000
BEGIN                                                          <<06212>>53710000
                                                               <<06212>>53715000
IF objid(ObjIDTypeField)=OBJIDCDTYPE THEN                      <<06660>>53720000
   BEGIN                                                       <<06212>>53725000
   IF objid(ObjIDnumField)<> 0 THEN                            <<06660>>53730000
      BEGIN  <<a mapped domain>>                               <<06212>>53735000
      CDT'ABS'ON'TOS;                                          <<d7738>>53740000
      tos := tos + (OBJID(ObjIDNumField) * CDT'ENTRY'SIZE);    <<d7738>>53745000
      EXCHDB;                                                  <<d7738>>53750000
      CDT'ARRAY(CDT'MD'FLAGS).(CDT'ABS'BIT:1) := 0;            <<d7738>>53755000
      if = then SUDDENDEATH(SFKernCacheSyncBad);               <<d7738>>53760000
      CDT'DARRAY(CDT'MD'MEM'ADDR&asr(1)) := currentflipbase;   <<d7738>>53765000
      EXCHDB;   << Back to original DB >>                      <<d7738>>53770000
      ASMB(DDEL);  << Get rid of abs MD address >>             <<d7738>>53775000
      END;                                                     <<06212>>53780000
   END                                                         <<06212>>53785000
ELSE                                                           <<06212>>53790000
   BEGIN  <<a Seg>>                                            <<06212>>53795000
                                                               <<06212>>53800000
   IF OBJID(ObjIDTypeField)=OBJIDDATATYPE                      <<06660>>53805000
   THEN SEGDESCSTINX:=OBJID(ObjIDnumField)&LSL(2) <<DATA SEG>> <<06660>>53810000
   ELSE SEGDESCSTINX:=CONVSEGIDTOSTINX(OBJ);                   <<06660>>53815000
   SEGDESCSYSBASEINX:=DSTSYSBASEINX+SEGDESCSTINX;              <<06212>>53820000
   X:=SEGDESCSYSBASEINX;                                       <<06212>>53825000
   SEGDESCFIRMINFO.ABSENTFLAG:=0;                              <<06212>>53830000
   IF = THEN SUDDENDEATH(614);                                 <<06212>>53835000
   TOS := CURRENTFLIPBASE;                                     <<06212>>53840000
   SEGDESCADDR:=TOS;                                           <<06212>>53845000
   SEGDESCBANK:=TOS;                                           <<06212>>53850000
   END;                                                        <<06212>>53855000
END;  <<Subroutine MarkObjectPresent>>                         <<06212>>53860000
                                                               <<06212>>53865000
                                                               <<06212>>53870000
SUBROUTINE UPDATEDESCRIPTORS;                                           53875000
                                                                        53880000
COMMENT                                                                 53885000
                                                                        53890000
FLIPS THROUGH THE REGIONS BEGINNING WITH LOWERBOUNDBASE                 53895000
AND TERMINATING AT UPPERBOUNDBASE.  AT EACH REGION,                     53900000
UPDATES THE CORRESPONDING OBJECT'S DESCRIPTOR ADDRESS,         <<06212>>53905000
AND MARKS THE OBJECT PRESENT.                                  <<06212>>53910000
                                                                        53915000
;                                                                       53920000
                                                                        53925000
BEGIN                                                                   53930000
                                                                        53935000
CURRENTFLIPBASE:=LOWERBOUNDBASE;                                        53940000
DISABLE;                                                                53945000
WHILE CURRENTFLIPBASE <> UPPERBOUNDBASE OR GOONCE DO                    53950000
   BEGIN                                                                53955000
   GOONCE:=FALSE; <<DEGENERATE CASE AT END OF BANK>>                    53960000
   TOS:=CURRENTFLIPBASE;                                                53965000
   TOS:=TOS+RBTORASDISP;                                                53970000
   ASMB(LSEA);                                                          53975000
   tos.regreservedflag:=0;                                              53980000
   IF <> THEN SUDDENDEATH(614);                                <<01644>>53985000
   tos.regavailableflag:=0;                                             53990000
   if <> then asmb(del) else                                            53995000
      BEGIN                                                             54000000
      TOS.REGASSIGNEDFLAG:=0;                                           54005000
                                                               <<06945>>54010000
      ASMB(DEL);                                                        54015000
      IF = THEN SUDDENDEATH(614);                              <<01644>>54020000
      TOS:=TOS+RASTOOBJIDENTDISP;                              <<06212>>54025000
      ASMB(LDEA);                                              <<06660>>54030000
      IF = THEN SUDDENDEATH(614);                              <<01644>>54035000
      OBJ:=TOS;                                                <<06660>>54040000
      ASMB(ddel);                                              <<06212>>54045000
                                                               <<06212>>54050000
      <<If a cached disc region, link into cached region list>><<06212>>54055000
                                                               <<06212>>54060000
      IF objid(ObjIDTypeField)= OBJIDCDTYPE                    <<06660>>54065000
      THEN LinkCachedRegion (currentflipbase);                 <<06212>>54070000
                                                               <<06212>>54075000
      << Mark Obj Pres, Put in New Addr>>                      <<06212>>54080000
                                                               <<06212>>54085000
      MarkObjectPresent;                                       <<06212>>54090000
                                                               <<06212>>54095000
      << requeue deferred requests if a data seg>>             <<06212>>54100000
                                                               <<06212>>54105000
      IF objid(ObjIDTypeField) = OBJIDDATATYPE                 <<07320>>54110000
      AND dqh'disahead <> 0                                    <<06392>>54115000
      THEN CheckForDeferredDiscreq(obj);                       <<06660>>54120000
                                                               <<06212>>54125000
      <<restore tos value for branch case>>                    <<06212>>54130000
                                                               <<06212>>54135000
                                                               <<06945>>54140000
      TOS:=CURRENTFLIPBASE;                                             54145000
      TOS:=TOS+RBTORASDISP;                                             54150000
      END;                                                              54155000
   TOS:=TOS+RASTORSDISP;                                                54160000
   ASMB(LSEA);                                                          54165000
   TOS:=TOS&LSL(PAGEPOWER);                                             54170000
   TOS:=TOS+RSTORBDISP;                                                 54175000
   ASMB(ADD);                                                           54180000
   CURRENTFLIPBASE:=TOS;                                                54185000
   END;                                                                 54190000
ENABLE;                                                                 54195000
END  <<UPDATEDESCRIPTORS>>;                                             54200000
                                                                        54205000
                                                                        54210000
                                                                        54215000
SUBROUTINE COMBINE;                                                     54220000
                                                                        54225000
COMMENT                                                                 54230000
                                                                        54235000
FLIP THROUGH THE REGIONS BELOW/ABOVE THE CURRENT                        54240000
HOLE UNTIL THE BEGINNING/END OF THE BANK OR THE PREV/NEXT AVAILABLE     54245000
REGION IS REACHED, OR UNTIL THE DISTANCE FLIPPED EXCEEDS THE            54250000
MOVE THRESHOLD.  ALONG THE WAY, ENCNTERED SEGMENTS ARE MARKED           54255000
ABSENT.  IF A LOCKED, FROZEN, OR IOFROZEN SEGMENT OR A RESERVED         54260000
REGION IS ENCNTERED, WE GIVEUP SINCE WE CAN'T MOVE OVER SUCH            54265000
MAIN MEMORY DOMAINS.  IF THE BASE OF THE BANK IS ENCNTERED,             54270000
WE GIVEUP SINCE WE CAN'T CROSS BANK BOUNDARIES.  IF WE EXCEEDED         54275000
THE MOVE THRESHOLD, THEN GIVEUP.  OTHERWISE, CLEAN THE                  54280000
PREV/NEXT HOLE.  IF THE PREV/NEXT HOLE HAS ONGOING I/O THEN GIVEUP.     54285000
                                                                        54290000
IF WE GAVEUP, THEN FLIP BACK DOWN FROM THE BEGINNING AND MARK           54295000
ALL THE INTERVENING SEGMENTS PRESENT AGAIN AND RETURN.  OTHERWISE,      54300000
WE WILL COMBINE THE TWO HOLES BY MOVING ALL INTERVENING ASSIGNED        54305000
REGIONS DOWN TO THE BASE OF THE PREVIOUS HOLE.  WHEN THE MOVE IS        54310000
COMPLETE, UPDATE THE NEW ADDRESS OF THE INTERVENING SEGMENTS AND        54315000
MARK THEM PRESENT.                                                      54320000
                                                                        54325000
;                                                                       54330000
                                                                        54335000
BEGIN                                                                   54340000
                                                                        54345000
MOVEPAGECNT:=0;                                                         54350000
MOVED:=GIVEUP:=READY:=GOONCE:=CAN'TMOVE:=GETREADY:=FALSE;               54355000
                                                                        54360000
<< FLIP DOWN/UP UNTIL LOWER/UPPER HOLE OR A GIVEUP CONDITION >>         54365000
                                                                        54370000
CURRENTFLIPBASE:=CURRENTHOLEBASE;                                       54375000
WHILE NOT GIVEUP AND NOT GETREADY DO                                    54380000
   BEGIN <<PREPARE PREVIOUS/NEXT REGION IN THE BANK>>                   54385000
   DISABLE;                                                             54390000
   TOS:=CURRENTFLIPBASE;                                                54395000
   IF COMBINEBELOW THEN                                                 54400000
      BEGIN                                                             54405000
      IF LS0 < PTRASTORBDISP OR FIRSTMEMORYADDRESS=CURRENTFLIPBASE THEN 54410000
         BEGIN  <<FIRST REGION IN BANK>>                                54415000
         LOWERBOUNDBASE:=TOS;                                           54420000
         GIVEUP:=TRUE;                                                  54425000
         END                                                            54430000
      ELSE                                                              54435000
         BEGIN <<DETERMINE NEXT FLIP BASE>>                             54440000
         TOS:=TOS+RBTOPTRSDISP;                                         54445000
         ASMB(LSEA);                                                    54450000
         TOS:=TOS&LSL(PAGEPOWER);                                       54455000
         ASMB(LSUB);                                                    54460000
         TOS:=TOS+PTRSTORBDISP;                                         54465000
         NEXTFLIPBASE:=TOS;                                             54470000
         END;                                                           54475000
      END                                                               54480000
   ELSE                                                                 54485000
      BEGIN  <<COMBINE ABOVE>>                                          54490000
      << DETERMINE IF THIS IS THE LAST REGION IN THE BANK>>             54495000
      TOS:=TOS+RBTORSDISP;                                              54500000
      ASMB(LSEA);                                                       54505000
      IF S0=MAXHOLESIZE THEN SUDDENDEATH(614);                 <<01788>>54510000
      TOS:=TOS&LSL(PAGEPOWER);                                          54515000
      TOS:=TOS+RSTORBDISP;                                              54520000
      ASMB(LADD);                                                       54525000
      IF CARRY THEN                                                     54530000
         BEGIN  <<LAST REGION IN BANK>>                                 54535000
         GIVEUP:=TRUE;                                                  54540000
         UPPERBOUNDBASE:=TOS;                                           54545000
         IF CURRENTFLIPBASE <> CURRENTHOLEBASE THEN GOONCE:=TRUE;       54550000
         END                                                            54555000
      ELSE NEXTFLIPBASE:=TOS;                                           54560000
      IF NEXTFLIPBASE >= LASTMEMORYADDRESS AND NOT GIVEUP THEN <<01616>>54565000
         BEGIN  <<PAST LAST HALF-BANK>>                                 54570000
         GIVEUP:=TRUE;                                                  54575000
         UPPERBOUNDBASE:=NEXTFLIPBASE;  <<FOR UPDATE DESC>>             54580000
         IF CURRENTFLIPBASE <> CURRENTHOLEBASE THEN GOONCE:=TRUE;       54585000
         END;                                                           54590000
      END;                                                              54595000
   IF NOT GIVEUP THEN                                                   54600000
      BEGIN                                                             54605000
      TOS:=NEXTFLIPBASE;                                                54610000
      TOS:=TOS+RBTORSDISP;                                              54615000
      ASMB(LSEA);                                                       54620000
      THISREGIONSIZE:=TOS;                                              54625000
      TOS:=TOS+RSTORASDISP;                                             54630000
      ASMB(LSEA);                                                       54635000
      IF LS0.REGAVAILABLEFLAG THEN                                      54640000
         BEGIN                                                          54645000
         ASMB(DEL,DDEL);                                                54650000
         IF COMBINEBELOW THEN                                           54655000
            BEGIN  <<GOT THE NEXT HOLE BELOW>>                          54660000
            LOWERHOLESIZE:=THISREGIONSIZE;                              54665000
            LOWERBOUNDBASE:=LOWERHOLEBASE:=NEXTFLIPBASE;                54670000
            END                                                         54675000
         ELSE                                                           54680000
            BEGIN  <<GOT THE NEXT HOLE ABOVE>>                          54685000
            UPPERHOLESIZE:=THISREGIONSIZE;                              54690000
            UPPERBOUNDBASE:=UPPERHOLEBASE:=NEXTFLIPBASE;                54695000
            END;                                                        54700000
         IF NEXTFLIPBASE = NEXTCANDBASE THEN                            54705000
            BEGIN <<GET A NEW NEXT CANDIDATE HOLE>>                     54710000
            TOS:=NEXTFLIPBASE;                                          54715000
            tos := tos + rbtopldisp;                           <<*7566>>54720000
            ASMB(LDEA);                                                 54725000
            IF = THEN NEXTCANDBASE := TOS ELSE                 <<06945>>54730000
               BEGIN                                           <<06945>>54735000
               tos := tos + pltorbdisp;                        <<*7566>>54740000
               NEXTCANDBASE := TOS;                            <<06945>>54745000
               END;                                            <<06945>>54750000
            ASMB(DDEL);                                                 54755000
            END;                                                        54760000
         GETREADY:=TRUE;                                                54765000
         IF COMBINEABOVE THEN                                           54770000
            BEGIN                                                       54775000
            TAKEOFFARL(UPPERHOLEBASE,UPPERHOLESIZE);                    54780000
            COMBINEDHOLEBASE:=CURRENTHOLEBASE;                          54785000
            COMBINEDHOLESIZE:=UPPERHOLESIZE+CURRENTHOLESIZE+MOVEPAGECNT;54790000
            END                                                         54795000
         ELSE                                                           54800000
            BEGIN <<COMBINEBELOW>>                                      54805000
            TAKEOFFARL(LOWERHOLEBASE,LOWERHOLESIZE);                    54810000
            COMBINEDHOLEBASE:=LOWERHOLEBASE;                            54815000
            COMBINEDHOLESIZE:=LOWERHOLESIZE+CURRENTHOLESIZE+MOVEPAGECNT;54820000
            END;                                                        54825000
         END                                                            54830000
      ELSE                                                              54835000
         BEGIN  <<RESERVED OR ASSIGNED>>                                54840000
         MOVEPAGECNT:=MOVEPAGECNT+THISREGIONSIZE;                       54845000
         TOS.REGRESERVEDFLAG:=0;                                        54850000
         IF <> THEN CAN'TMOVE:=TRUE;                                    54855000
         TOS:=TOS.REGNONMOVEFLAGS;                                      54860000
         ASMB(DEL);                                                     54865000
         IF <> THEN CAN'TMOVE:=TRUE;                                    54870000
                                                               <<06411>>54875000
         << If write pending on cache, don't move >>           <<06411>>54880000
         TOS := TOS + RASTOWREQPDISP;                          <<06411>>54885000
         ASMB(LSEA;DEL);                                       <<06411>>54890000
         IF <> THEN CAN'TMOVE := TRUE;                         <<06411>>54895000
         TOS := TOS + WREQPTORASDISP; << Restore pointer >>    <<06411>>54900000
                                                               <<06411>>54905000
         <<look up objid in region header>>                    <<06411>>54910000
         TOS := TOS+rastoobjidentdisp;                         <<06411>>54915000
         ASMB(LDEA);                                           <<06660>>54920000
         OBJ := TOS;                                           <<06660>>54925000
         ASMB(DDEL);  <<get rid of addr for sub exit>>         <<06411>>54930000
                                                               <<06411>>54935000
         << If object is current process' stk or xds, skip>>   <<06411>>54940000
         IF CURPRC <> 0                                        <<06650>>54945000
         AND (INTEGER(OBJID(OBJIDNUMFIELD)) =                  <<06660>>54950000
              ICS(-ICS'STKDSTCELL) OR OBJID(OBJIDNUMFIELD) =   <<06660>>54955000
         LPCB(CURPRC+DBXDSINFOWORDNUM).XDSDSTFIELD OR          <<07320>>54960000
         OBJID(OBJIDNUMFIELD) = LPCB(CURPRC+MAPDSTWORDNUM))    <<07320>>54965000
      THEN CAN'TMOVE := TRUE;                                  <<07320>>54970000
                                                               <<07320>>54975000
         IF LS0 < PTRASTORBDISP OR CAN'TMOVE                            54980000
         OR MOVEPAGECNT > MOVETHRESHOLD THEN                            54985000
            BEGIN <<CAN'T GO THROUGH THIS REGION>>                      54990000
            GIVEUP:=TRUE;                                               54995000
            IF COMBINEBELOW THEN LOWERBOUNDBASE:=CURRENTFLIPBASE        55000000
            ELSE UPPERBOUNDBASE:=NEXTFLIPBASE;                          55005000
            END                                                         55010000
         ELSE                                                           55015000
            BEGIN <<THIS GUY CAN BE MOVED>>                    <<06212>>55020000
            <<If a cached disc domain, take region off cached>><<06660>>55025000
            << domain list.                                  >><<06660>>55030000
                                                               <<06212>>55035000
            IF OBJID(ObjIDTypeField)= OBJIDCDTYPE              <<06660>>55040000
            THEN UnlinkCachedRegion (nextflipbase);            <<06212>>55045000
                                                               <<06212>>55050000
            <<flag object absent in object's descriptor>>      <<06212>>55055000
                                                               <<06212>>55060000
            MarkObjectAbsent;                                  <<06212>>55065000
            END;                                               <<06212>>55070000
                                                               <<06212>>55075000
                                                               <<06212>>55080000
                                                               <<06212>>55085000
         END;                                                           55090000
      END;                                                              55095000
   CURRENTFLIPBASE:=NEXTFLIPBASE;                                       55100000
   END;                                                                 55105000
IF GETREADY THEN                                                        55110000
   BEGIN <<SELECT A DESTINATION HOLE FOR SEGMENTS BETWEEN THE HOLES>>   55115000
   IF MOVEPAGECNT > MAXAVAILREG THEN TOS:=0D                            55120000
   ELSE TOS := RESERVEREGION(MOVEPAGECNT,COMBINEDHOLESIZE,     <<06945>>55125000
                 BKGRNDPRI-1,GARBCOLLCODE,CURRENTHOLEBASE);    <<06945>>55130000
   ASMB(DTST);                                                          55135000
   DESTHOLEBASE:=TOS;                                                   55140000
   IF = THEN READY:=FALSE ELSE                                          55145000
      BEGIN  <<GOT A DESTINATION HOLE>>                                 55150000
      TOS:=DESTHOLEBASE;                                                55155000
      TOS:=TOS+RBTOINITMSGDISP;                                         55160000
      ASMB(LSEA);                                                       55165000
      TOS.MSGONGOINGIODISABLEDFLAG:=0;                                  55170000
      ASMB(DEL,DDEL);                                                   55175000
      IF <> THEN READY:=FALSE ELSE READY:=TRUE;                         55180000
      END;                                                              55185000
   IF NOT READY THEN                                                    55190000
      BEGIN  <<RETURN HOLES>>                                           55195000
      IF DESTHOLEBASE<>0D THEN                                 <<06212>>55200000
         BEGIN <<RELEASE HOLE, ZERO OBJID IF NECESSARY>>       <<06212>>55205000
         DISABLE; <<FREEZE THE ACTION>>                        <<06212>>55210000
         TOS:=DESTHOLEBASE;                                    <<06212>>55215000
         TOS:=TOS+RBTOOBJIDENTDISP;                            <<06212>>55220000
         ASMB(LDEA;DTST);                                      <<06660>>55225000
         IF = THEN ASMB(DDEL,DDEL) ELSE                        <<06660>>55230000
            BEGIN<<A DATA OBJECT IN MOTION OUT>>               <<06212>>55235000
            IF S1.OBJIDTYPE <> OBJIDDATATYPE  AND              <<07320>>55240000
               S1.OBJIDTYPE <> OBJIDCDTYPE                     <<07320>>55245000
            THEN SUDDENDEATH(SFKERNCACHEINTBAD);               <<06212>>55250000
               ASMB(DDEL);                                     <<06748>>55255000
            TOS:=TOS+OBJIDENTTOWREQPDISP;                      <<06212>>55260000
            ASMB(LSEA;DEL);                                    <<06212>>55265000
            IF <> THEN ASMB(DDEL) <<OBJ STILL NEEDED>>ELSE     <<06212>>55270000
               BEGIN <<WRITE COMPLETED SO ZAP OBJIDENT>>       <<06212>>55275000
               TOS:=TOS+WREQPTOOBJIDENTDISP;                   <<06212>>55280000
               TOS:=0D;                                        <<06660>>55285000
               ASMB(SDEA;DDEL);                                <<06660>>55290000
               END;                                            <<06212>>55295000
            END;                                               <<06212>>55300000
         RELEASEREGION(DESTHOLEBASE,0);                        <<06212>>55305000
         END;                                                  <<06212>>55310000
      IF COMBINEABOVE THEN                                              55315000
         BEGIN                                                          55320000
         UPPERBOUNDBASE:=NEXTFLIPBASE;                                  55325000
         RELEASEREGION(UPPERHOLEBASE,0);                                55330000
         END                                                            55335000
      ELSE                                                              55340000
         BEGIN                                                          55345000
         LOWERBOUNDBASE:=NEXTFLIPBASE;                                  55350000
         RELEASEREGION(LOWERHOLEBASE,0);                                55355000
         END;                                                           55360000
      END                                                               55365000
   ELSE                                                                 55370000
      BEGIN <<DO THE MOVE>>                                             55375000
      STARTOVER:=TRUE;                                                  55380000
      TAKEOFFARL(CURRENTHOLEBASE,CURRENTHOLESIZE);             <<06945>>55385000
      MOVED:=TRUE;                                                      55390000
                                                                        55395000
      <<SET UP FOR THE MOVE>>                                           55400000
                                                                        55405000
      ENABLE;                                                           55410000
                                                                        55415000
<<BC>>TOS:=DESTHOLEBASE;                                                55420000
      TOS:=TOS+RBTORSDISP;                                              55425000
      ASMB(LSEA);                                                       55430000
      TOS:=MOVEPAGECNT;                                                 55435000
      ASMB(CMP);                                                        55440000
      IF <> THEN SUDDENDEATH(619);                             <<01644>>55445000
      ASMB(DDEL);                                                       55450000
                                                               <<01788>>55455000
      TOS:=DESTHOLEBASE;                                                55460000
      TOS:=TOS+RBTORASDISP; <<DESTINATION>>                             55465000
      IF COMBINEBELOW THEN                                              55470000
         BEGIN                                                          55475000
         IF LOWERHOLEBASE < SCANPOINT AND                               55480000
         SCANPOINT <=CURRENTHOLEBASE THEN SCANPOINT:=COMBINEDHOLEBASE;  55485000
         TOS:=LOWERHOLEBASE;                                            55490000
         TOS:=LOWERHOLESIZE&LSL(PAGEPOWER);                             55495000
         ASMB(LADD);                                                    55500000
         TOS:=TOS+RBTORASDISP;  <<SOURCE FOR MOVE>>                     55505000
         ASMB(DDUP);                                                    55510000
         MOVESOURCE:=TOS;                                               55515000
         END                                                            55520000
      ELSE                                                              55525000
         BEGIN <<COMBINEABOVE>>                                         55530000
         IF CURRENTHOLEBASE < SCANPOINT AND                             55535000
         SCANPOINT <= UPPERHOLEBASE THEN SCANPOINT:=COMBINEDHOLEBASE;   55540000
         TOS:=CURRENTHOLEBASE;                                          55545000
         TOS:=CURRENTHOLESIZE&LSL(PAGEPOWER);                           55550000
         ASMB(LADD);                                                    55555000
         TOS:=TOS+RBTORASDISP;                                          55560000
         ASMB(DDUP); <<SOURCE FOR MOVE>>                                55565000
         MOVESOURCE:=TOS;                                               55570000
         END;                                                           55575000
      TOS:=MOVEPAGECNT&LSL(PAGEPOWER);                                  55580000
      ASMB(MABS 5);  <<FIRE AWAY>>                             <<01788>>55585000
                                                               <<01788>>55590000
      <<MAKE AN MMSTAT RECORD>>                                <<01788>>55595000
                                                               <<01788>>55600000
      TOS:=mmstatcgarbage; <<EVENT NUMBER>>     <<***>>        <<06948>>55605000
      TOS:=MOVESOURCE; <<***>>                                 <<06948>>55610000
      TOS:=MOVEPAGECNT; <<***>>                                <<06948>>55615000
      MMSTAT'(*,*,*,*,0,0,0);                                  <<06948>>55620000
                                                                        55625000
<<bc>> TOS:=MOVESOURCE;                                                 55630000
       ASMB(LSEA);                                                      55635000
       TOS.REGASSIGNEDFLAG:=1;                                          55640000
       IF = THEN SUDDENDEATH(614);                             <<01644>>55645000
       ASMB(DEL,DDEL);                                                  55650000
                                                                        55655000
      <<FIX UP THE COMBINED HOLE>>                                      55660000
                                                                        55665000
      TOS:=MOVESOURCE;                                                  55670000
      TOS:=REGAVAILABLECODE;                                            55675000
      ASMB(SSEA);                                                       55680000
      TOS:=TOS+RASTORSDISP;                                             55685000
      TOS:=MOVEPAGECNT;                                                 55690000
      ASMB(SSEA);                                                       55695000
      TOS:=TOS+RSTOSSDISP;                                              55700000
      TOS:=MOVEPAGECNT;                                                 55705000
      ASMB(SSEA);                                                       55710000
      TOS:=TOS+SSTOOBJIDENTDISP;                               <<06212>>55715000
      TOS:=0D;                                                 <<06660>>55720000
      ASMB(SDEA);                                              <<06660>>55725000
      TOS:=TOS+OBJIDENTTOPTRASDISP;                            <<06212>>55730000
      TOS:=MOVEPAGECNT&LSL(PAGEPOWER);                                  55735000
      ASMB(LADD);                                                       55740000
      TOS:=REGAVAILABLECODE;                                            55745000
      ASMB(SSEA);                                                       55750000
      TOS:=TOS+TRASTOTRSDISP;                                           55755000
      TOS:=MOVEPAGECNT;                                                 55760000
      ASMB(SSEA);                                                       55765000
      TOS:=TOS+TRSTOTSSDISP;                                            55770000
      TOS:=MOVEPAGECNT;                                                 55775000
      ASMB(SSEA);                                                       55780000
      ASMB(DDEL);                                                       55785000
                                                                        55790000
      <<FILL IN THE PROPER HEADER INFORMATION>>                         55795000
                                                                        55800000
      TOS:=COMBINEDHOLEBASE;                                            55805000
      TOS:=TOS+RBTORSDISP;                                              55810000
      TOS:=COMBINEDHOLESIZE;                                            55815000
      ASMB(SSEA);                                                       55820000
                                                                        55825000
      <<NOW FIX UP THE TRAILER>>                                        55830000
                                                                        55835000
      TOS:=RSTOPTRSDISP+COMBINEDHOLESIZE&LSL(PAGEPOWER);                55840000
      ASMB(LADD);                                                       55845000
      TOS:=COMBINEDHOLESIZE;                                            55850000
      ASMB(SSEA);                                                       55855000
      ASMB(DDEL);                                                       55860000
                                                                        55865000
      <<NEW CURRENT HOLE>>                                              55870000
                                                                        55875000
      CURRENTHOLEBASE:=COMBINEDHOLEBASE;                                55880000
      CURRENTHOLESIZE:=COMBINEDHOLESIZE;                                55885000
      END;                                                              55890000
   END;                                                                 55895000
                                                                        55900000
<< UPDATE ADDRESSES OF MOVED SEGMENTS, MARK SEGMENTS PRESENT >>         55905000
                                                                        55910000
IF MOVED THEN                                                           55915000
   BEGIN                                                                55920000
   IF GCLASSENABLEDMASK.CLASS0 THEN                                     55925000
      BEGIN  <<MEASURE MOVE EVENT>>                                     55930000
      TOS:=MEASSTATXDSBANK;                                             55935000
      TOS:=MEASSTATXDSBASE;                                             55940000
      TOS:=TOS+C0SUB0'SEGRELOFF;                                        55945000
      IF SINGLEHOLEBASE=0D THEN TOS:=TOS+C'GARBMOVEBKRND       <<RAY.V>>55950000
         ELSE TOS:=TOS+C'GARBMOVEALLOCATE;                     <<RAY.V>>55955000
      ASMB(LSEA;INCA;SSEA;DDEL);                                        55960000
      END;                                                              55965000
   LOWERBOUNDBASE:=DESTHOLEBASE;                                        55970000
   TOS:=DESTHOLEBASE;                                                   55975000
   TOS:=MOVEPAGECNT&LSL(PAGEPOWER);                                     55980000
   ASMB(LADD);                                                          55985000
   UPPERBOUNDBASE:=TOS;                                                 55990000
   END                                                                  55995000
ELSE                                                                    56000000
   BEGIN                                                                56005000
   IF COMBINEBELOW THEN UPPERBOUNDBASE:=CURRENTHOLEBASE                 56010000
   ELSE LOWERBOUNDBASE:=CURRENTHOLEBASE;                                56015000
   END;                                                                 56020000
UPDATEDESCRIPTORS;                                                      56025000
ENABLE;                                                                 56030000
                                                                        56035000
END <<SUBROUTINE COMBINE>>;                                             56040000
                                                                        56045000
<<BEGIN OUTER BLOCK OF GARBAGE COLLECTION>>                             56050000
                                                                        56055000
IF GCLASSENABLEDMASK.CLASS0 THEN SAVETIME:=TIMER;                       56060000
STARTOVER:=TRUE;                                                        56065000
TOS:=FIRSTMEMBANK;                                                      56070000
TOS:=FIRSTMEMBASE;                                                      56075000
FIRSTMEMORYADDRESS:=TOS;                                                56080000
WHILE CURRACTPRI <= AWAKETOSCHEDMSG AND CURRENTHOLESIZE <> 0 DO         56085000
   BEGIN                                                                56090000
   SELECTNEXTCAND;                                                      56095000
   IF CURRENTHOLESIZE <> 0 THEN                                         56100000
      BEGIN  <<GOTONE>>                                                 56105000
      COMBINEBELOW:=TRUE;                                               56110000
      COMBINEABOVE:=FALSE;                                              56115000
      COMBINE;                                                          56120000
      IF MOVED THEN                                            <<06945>>56125000
         PUTONARL(CURRENTHOLEBASE,CURRENTHOLESIZE,PUTATEND);   <<06945>>56130000
      IF CURRACTPRI <= AWAKETOSCHEDMSG AND CURRENTHOLESIZE     <<01788>>56135000
      <> MAXHOLESIZE THEN                                      <<01788>>56140000
         BEGIN <<TIME TO COMBINE ABOVE>>                                56145000
         COMBINEBELOW:=FALSE;                                           56150000
         COMBINEABOVE:=TRUE;                                            56155000
         COMBINE;                                                       56160000
         IF MOVED THEN                                         <<06945>>56165000
            PUTONARL(CURRENTHOLEBASE,CURRENTHOLESIZE,PUTATEND);<<06945>>56170000
         END;                                                           56175000
      END;                                                              56180000
   END;                                                                 56185000
IF GCLASSENABLEDMASK.CLASS0  THEN                                       56190000
   BEGIN  <<MEASURE GARB COLL EVENT & DURATION>>                        56195000
   TOS:=MEASSTATXDSBANK;                                                56200000
   TOS:=MEASSTATXDSBASE;                                                56205000
   TOS:=TOS+C0SUB0'SEGRELOFF;                                           56210000
   IF SINGLEHOLEBASE=0D THEN TOS:=TOS+C'CPUGARBAGE             <<RAY.V>>56215000
      ELSE TOS:=TOS+C'CPUALLOCGARB;                            <<RAY.V>>56220000
   ASMB(LDEA);                                                          56225000
   TOS:=TIMER-SAVETIME;                                                 56230000
   ASMB(DADD;SDEA);                                                     56235000
   IF SINGLEHOLEBASE=0D THEN                                   <<RAY.V>>56240000
       BEGIN                                                   <<RAY.V>>56245000
       TOS:=TOS-C'CPUGARBAGE+C'GARBAGECNT;<<USE ADDR ON TOS>>  <<RAY.V>>56250000
       ASMB(LSEA);                                             <<RAY.V>>56255000
       TOS:=TOS+1;                                             <<RAY.V>>56260000
       ASMB(SSEA);                                             <<RAY.V>>56265000
       END;                                                    <<RAY.V>>56270000
   IF CURRACTPRI > AWAKETOSCHEDMSG THEN                                 56275000
      BEGIN <<PREEMPTED>>                                               56280000
      ASMB(DEL);                                                        56285000
      TOS:=MEASSTATXDSBASE;                                             56290000
      TOS:=TOS+C0SUB0'SEGRELOFF+C'GARBGIVEUPPREEMPT;           <<RAY.V>>56295000
      ASMB(LSEA;INCA;SSEA);                                   <<RAY.V>> 56300000
      END;                                                              56305000
   ASMB(DDEL);                                                 <<RAY.V>>56310000
   END;                                                                 56315000
END  <<COLLECTGARBAGE>>;                                                56320000
                                                                        56325000
$PAGE "PROCESS SCHEDULER MESSAGES"                                      56330000
PROCEDURE PROCESSSCHEDMSGS;                                             56335000
OPTION PRIVILEGED,UNCALLABLE;                                           56340000
                                                                        56345000
COMMENT                                                                 56350000
                                                                        56355000
PROCESSSCHEDMSGS IS CALLED BY A CPU'S DISPATCHER TO SERVICE             56360000
REQUESTS FOR RELEASING REGIONS, PERFORMING MOVES OR FETCHING            56365000
SEGMENTS FOR I/O DEVICE MONITORS.  THESE REQUESTS WERE GENERATED        56370000
ON THE ICS, BUT COULDN'T BE COMPLETED THERE.                            56375000
                                                                        56380000
PROCESSSCHEDMSGS RETURNS CONDCODE=CCE IF ALL MESSAGES WERE     <<01557>>56385000
SUCCESSFULLY PROCESSED, AND CONDCODE=CCL IF A FETCHOBJECT REQU<<<06212>>56390000
FOR THE I/O SYSTEM FAILED DUE TO LACK OF SPACE.                <<01557>>56395000
                                                               <<01557>>56400000
;                                                                       56405000
                                                                        56410000
BEGIN                                                                   56415000
INTEGER MOSTURGPORTNUM,                                                 56420000
        REQPROCINX,                                                     56425000
        PCBPT,                                                 <<06650>>56430000
        IOQINX,                                                <<06392>>56435000
        CDTENTRYNUMBER,                                        <<06212>>56440000
        XFERSTATUS,                                            <<06212>>56445000
        REQCODE,                                               <<06212>>56450000
        DESCSTINX;                                                      56455000
LOGICAL SPECIALFLAGS;                                                   56460000
DOUBLE  OBJ;                                                   <<06660>>56465000
LOGICAL ARRAY OBJIDENT(*)=OBJ;                                 <<06660>>56470000
DOUBLE REGIONBASE;                                                      56475000
INTEGER SPECREQINDEX,                                                   56480000
        PREV'SPECREQ,     << FOR SCANNING QUEUE >>             <<01559>>56485000
        NEWSIZE,                                                        56490000
        READDISP,                                                       56495000
        MOVELENGTH;                                                     56500000
INTEGER OLDSIZE;                                               <<01557>>56505000
INTEGER CONDCODE:=CCE;                                         <<01557>>56510000
DOUBLE                                                         <<06616>>56515000
   SAVEDB;                                                     <<06660>>56520000
                                                               <<06620>>56525000
INTEGER                                                        <<06616>>56530000
   SAVE'SPECQHEAD;                                             <<06616>>56535000
                                                                        56540000
                                                               <<06212>>56545000
SUBROUTINE HandleCacheMoveReq;                                 <<06212>>56550000
                                                               <<06212>>56555000
                                                               <<06212>>56560000
BEGIN                                                          <<06212>>56565000
ASMB(ADDS 3);                                                  <<06212>>56570000
RECEIVEMSG(X,3,0);                                             <<06212>>56575000
IF <> THEN SUDDENDEATH(620);                                   <<06212>>56580000
ENABLE;                                                        <<06212>>56585000
REQCODE:=TOS;                                                  <<06212>>56590000
XFERSTATUS:=TOS;                                               <<06212>>56595000
CDTENTRYNUMBER:=TOS;                                           <<06212>>56600000
IF REQCODE=CACHEMOVEREADYCODE                                  <<06212>>56605000
THEN ProcessCDTLogReqQ(CDTENTRYNUMBER,XFERSTATUS,0)            <<06212>>56610000
ELSE IF REQCODE = CACHEWRITEDONECODE                           <<06212>>56615000
THEN CACHEWRITECOMP(CDTENTRYNUMBER,XFERSTATUS)                 <<06212>>56620000
ELSE SUDDENDEATH(SFKERNCACHEINTBAD);                           <<06212>>56625000
END; <<SUBROUTINE HandleCacheMoveReq>>                         <<06212>>56630000
                                                               <<06212>>56635000
SUBROUTINE HandleIOSegReq;                                     <<06212>>56640000
                                                               <<06212>>56645000
BEGIN                                                          <<06212>>56650000
ASMB(ADDS 4);                                                  <<06660>>56655000
RECEIVEMSG(X,4,NONDESTRUCTREAD);                               <<06660>>56660000
IF <> THEN SUDDENDEATH(620);                                   <<06212>>56665000
ENABLE;                                                        <<06212>>56670000
TOS:=0;                                                        <<06212>>56675000
TOS.IOSYSREQFLAG:=1;                                           <<06212>>56680000
SPECIALFLAGS:=TOS;                                             <<06212>>56685000
TOS.MSGIOFZREQFLAG:=0;                                         <<06212>>56690000
IF <> THEN SPECIALFLAGS.IOFZREQFLAG:=1;                        <<06212>>56695000
ASMB(DEL);                                                     <<06212>>56700000
IOQINX:=TOS;                                                   <<06392>>56705000
OBJ:=TOS;                                                      <<06660>>56710000
TOS:=FETCHOBJECT(OBJ,IOQINX,SPECIALFLAGS,                      <<06660>>56715000
                 NOINFO,TRUE);                                 <<06212>>56720000
IF TOS<>MMOK THEN CONDCODE:=CCL <<WON'T FIT NOW>> ELSE         <<06212>>56725000
   BEGIN <<SUCCESS>>                                           <<06212>>56730000
   IF DST(X:=CONVSEGIDTOSTINX(OBJ)).ABSENTFLAG=0               <<06660>>56735000
   THEN AWAKEDEVICE(IOQINX,OBJ,IOSTATUSOK);                    <<06945>>56740000
   ASMB(ADDS 4); <<SOME ROOM FOR MESSAGE>>                     <<06660>>56745000
   RECEIVEMSG(IOSEGREQPORT,4,0);                               <<06660>>56750000
   IF <> THEN SUDDENDEATH(620);                                <<06212>>56755000
   ASMB(DDEL,DDEL); <<FINISHED IT OFF>>                        <<06660>>56760000
   END;                                                        <<06212>>56765000
END;  <<SUBROUTINE HandleIOSegReq>>                            <<06212>>56770000
                                                               <<06212>>56775000
                                                               <<06212>>56780000
DISABLE;                                                                56785000
MOSTURGPORTNUM:=PORTSTATUS(-1);                                         56790000
WHILE <> DO                                                             56795000
   BEGIN  <<GOT A MESSAGE>>                                             56800000
   X:=MOSTURGPORTNUM;                                                   56805000
   CASE *X OF    <<SWITCH TO THE SERVICE ROUTINE FOR THE PORT>><<06660>>56810000
      BEGIN                                                    <<06660>>56815000
        GO TO  MAKEABSENTPORTSERVICE;                          <<06660>>56820000
        GO TO  MOVEREQPORTSERVICE;                             <<06660>>56825000
        GO TO  RELREGREQPORTSERVICE;                           <<06660>>56830000
        GO TO  IOSEGREQPORTSERVICE;                            <<06660>>56835000
        GO TO  CACHEMOVEREQPORTSERVICE;                        <<06660>>56840000
      END;                                                     <<06660>>56845000
                                                                        56850000
   MAKEABSENTPORTSERVICE:                                               56855000
      ASMB(ADDS 3);                                            <<06660>>56860000
      RECEIVEMSG(X,3,0);                                       <<06660>>56865000
      IF <> THEN SUDDENDEATH(620);                                      56870000
      REQPROCINX:=TOS;                                                  56875000
      OBJ := TOS;                                              <<06660>>56880000
      IF OBJIDENT(OBJIDTYPEFIELD) <> OBJIDDATATYPE             <<06660>>56885000
         THEN SUDDENDEATH(619);                                <<06660>>56890000
      DESCSTINX := OBJIDENT(OBJIDNUMFIELD) & LSL(2);           <<06660>>56895000
      DST(DESCSTINX+1).SEGMODREQFLAG:=1;                                56900000
      DST(X).FWIPFLAG:=1;                                               56905000
      PCBPT := REQPROCINX;                                     <<06650>>56910000
      TOS:=SLLPTR;                                                      56915000
      TOS:=OBJ;                                                <<06660>>56920000
      TOS:=0;                                                           56925000
      IF STKINFO.STKDSTFIELD=OBJIDENT THEN TOS.PROCSSTKFLAG:=1;<<06212>>56930000
      TOS.SETMEMREQPTRFLAG:=1;                                          56935000
      ADDTOLOCALITY(*,*,*);                                             56940000
      X:=DSTSYSBASEINX+DESCSTINX;                                       56945000
      SEGDESCFIRMINFO.ABSENTFLAG:=1;                                    56950000
      TOS:=SEGDESCBANK;                                                 56955000
      TOS:=SEGDESCADDR;                                                 56960000
      REGIONBASE:=TOS;                                         <<06212>>56965000
      RELEASEREGION(REGIONBASE,0);                             <<06212>>56970000
      ENABLE;                                                           56975000
      <<GET WRITE GOING>>                                      <<01816>>56980000
      STARTOBJWRITE(OBJ,FORCEDWRITEPRI,REGIONBASE,0,0);        <<06660>>56985000
      <<REPLACE MEMORY ADDR WITH DISC ADDR IN DESCRIPTOR>>     <<01816>>56990000
      TOS:=SEGDESCBANK;                                        <<01816>>56995000
      TOS:=SEGDESCADDR;                                        <<01816>>57000000
      TOS:=TOS+RBTOHODADISP;                                   <<01816>>57005000
      ASMB(LDEA);                                              <<01816>>57010000
      SEGDESCLODA:=TOS;                                        <<01816>>57015000
      SEGDESCHODA:=TOS;                                        <<01816>>57020000
      ASMB(DDEL);                                              <<01816>>57025000
      GO CHECKFORMOREMSGS;                                              57030000
                                                                        57035000
   MOVEREQPORTSERVICE:                                                  57040000
      ASMB(ADDS 2);                                            <<06660>>57045000
      RECEIVEMSG(X,2,0);                                       <<06660>>57050000
      IF <> THEN SUDDENDEATH(620);                                      57055000
      ENABLE;                                                           57060000
      OBJ := TOS;                                              <<06660>>57065000
      IF OBJIDENT(OBJIDTYPEFIELD) <> OBJIDDATATYPE             <<06660>>57070000
         THEN SUDDENDEATH(619);                                <<06660>>57075000
      DESCSTINX := OBJIDENT(OBJIDNUMFIELD) & LSL(2);           <<06660>>57080000
      DST(X:=DESCSTINX+1).SEGMODREQFLAG:=0;                             57085000
      IF = THEN SUDDENDEATH(619);                              <<01644>>57090000
                                                                        57095000
      <<FIND OUT PARAMETERS FOR MOVE>>                                  57100000
                                                                        57105000
      TOS := SAVE'SPECQHEAD := SPECQHEAD;                      <<06616>>57110000
      TOS := DST(SPECREQDST&LSL(2) + 2); << BANK >>            <<06616>>57115000
      TOS := DST(X + 1);                                       <<06616>>57120000
      ASMB(XCHD);                                              <<06616>>57125000
      SAVEDB := TOS;                                           <<06616>>57130000
                                                               <<06620>>57135000
      X := TOS & LSR(1);     << Double index >>                <<06620>>57140000
      << SEARCH FOR NEEDED SPECIAL REQUEST ENTRY >>            <<01559>>57145000
      WHILE DENTRYWORD01 <> OBJ DO                             <<06660>>57150000
         BEGIN                                                 <<01559>>57155000
         PREV'SPECREQ := X := X & LSL(1);  << Single index >>  <<06620>>57160000
         X := ENTRYWORD00;      << PTR TO NEXT ENTRY >>        <<01559>>57165000
         X := X & LSR(1);           << Double index >>         <<06620>>57170000
         END;                                                  <<01559>>57175000
      << DELINK THE SPECIAL REQUEST ENTRY FROM THE QUEUE >>    <<01559>>57180000
      X := X & LSL(1);        << Single index >>               <<06620>>57185000
      SPECREQINDEX := X;                                       <<01559>>57190000
      IF X = SAVE'SPECQHEAD THEN                               <<06616>>57195000
         BEGIN                                                 <<06616>>57200000
         TOS := ENTRYWORD00;                                   <<06616>>57205000
         TOS := %1000D;                                        <<06616>>57210000
         ASMB(XCHD);                                           <<06616>>57215000
         SAVEDB := TOS;                                        <<06616>>57220000
         SPECQHEAD := TOS;                                     <<06616>>57225000
         TOS := SAVEDB;                                        <<06616>>57230000
         ASMB(XCHD);                                           <<06616>>57235000
         SAVEDB := TOS;                                        <<06616>>57240000
         END                                                   <<06616>>57245000
      ELSE                                                     <<01559>>57250000
         BEGIN                                                 <<01559>>57255000
         TOS := ENTRYWORD00;    << PTR TO NEXT ENTRY >>        <<01559>>57260000
         X := PREV'SPECREQ;     << POINT TO PREV ENTRY >>      <<01559>>57265000
         ENTRYWORD00 := TOS;    << DELINK - SET NEW NEXT PTR >><<01559>>57270000
         END;                                                  <<01559>>57275000
      X := SPECREQINDEX;        << POINT TO SPECIAL REQ >>     <<01559>>57280000
      NEWSIZE:=ENTRYWORD03;                                    <<06620>>57285000
      READDISP:=ENTRYWORD04;                                   <<06620>>57290000
      MOVELENGTH:=ENTRYWORD05;                                 <<06620>>57295000
      RELSYSTABENTRY(SPECREQDST,SPECREQINDEX);                 <<06616>>57300000
      OLDSIZE:=DST(DESCSTINX).DATASIZEFIELD;                   <<01557>>57305000
      DST(DESCSTINX).DATASIZEFIELD:=NEWSIZE;                            57310000
      TOS:=DST(X:=X+2);                                                 57315000
      TOS:=DST(X:=X+1);                                                 57320000
      REGIONBASE:=TOS;                                                  57325000
      IF LOGICAL(DST(X:=DESCSTINX+1)).STKFLAG THEN                      57330000
         BEGIN <<CHECK FOR INTERNAL MOVES REQUIRED>>                    57335000
         IF MOVELENGTH <> 0 THEN                                        57340000
            BEGIN <<PCBX MOVE REQUIRED>>                                57345000
            TOS:=REGIONBASE;                                            57350000
            ASMB(DDUP);                                                 57355000
            TOS:=TOS+READDISP; <<SOURCE ADDR>>                          57360000
            TOS:=MOVELENGTH; <<SIGNED MOVE COUNT>>                      57365000
            ASMB(MABS 5);                                               57370000
            <<ZERO OUT THE EXPANDED AREA>>                     <<01557>>57375000
            TOS:=REGIONBASE;                                   <<01557>>57380000
            TOS:=TOS+MOVELENGTH+1;     <<DEST. FOR ZEROING OUT><<01557>>57385000
            ASMB(DDUP,DECA);      <<SOURCE FOR ZEROING OUT>>   <<01557>>57390000
            TOS:=0;                                            <<01557>>57395000
            ASMB(SSEA);      <<ZERO FIRST WORD FOR TEMPLATE>>  <<01557>>57400000
            TOS:=READDISP-1; <<# WORDS TO ZERO OUT W/ MOVE>>   <<01557>>57405000
            ASMB(MABS 5);                                      <<01557>>57410000
            END;                                                        57415000
         END;                                                           57420000
      <<ZERO OUT EXPANDED AREA>>                               <<01557>>57425000
      IF MOVELENGTH = 0 THEN                                   <<01557>>57430000
         BEGIN <<EXPANDED SEGMENT ON THE END>>                 <<01557>>57435000
         TOS:=REGIONBASE;                                      <<01557>>57440000
         TOS:=TOS+OLDSIZE&LSL(2)+1; <<DESTINATION>>            <<01557>>57445000
         ASMB(DDUP,DECA); <<SOURCE>>                           <<01557>>57450000
         TOS:=0;                                               <<01557>>57455000
         ASMB(SSEA); <<TEMPLATE FOR MOVE>>                     <<01557>>57460000
         TOS:=(NEWSIZE&LSL(2)-OLDSIZE&LSL(2))-1; <<MOVECNT>>   <<01557>>57465000
         ASMB(MABS 5);                                         <<01557>>57470000
         END;                                                  <<01557>>57475000
      DISABLE;                                                          57480000
      TOS := SAVEDB;                                           <<06616>>57485000
      ASMB(XCHD);                                              <<06616>>57490000
      DDEL;                                                    <<06616>>57495000
     PROCESSCOMPMSG(REGIONBASE,OBJ,DESCSTINX,IOSTATUSOK);      <<06660>>57500000
      GO CHECKFORMOREMSGS;                                              57505000
                                                                        57510000
   RELREGREQPORTSERVICE:                                                57515000
      ASMB(ADDS 2); <<FOR REGION BASE>>                                 57520000
      RECEIVEMSG(X,2,0);                                                57525000
      IF <> THEN SUDDENDEATH(620);                             <<01644>>57530000
      ENABLE;                                                           57535000
      RELEASEREGION(*,0);                                               57540000
      GO CHECKFORMOREMSGS;                                              57545000
                                                                        57550000
   IOSEGREQPORTSERVICE:                                                 57555000
      HandleIOSegReq;                                          <<06212>>57560000
      GO CHECKFORMOREMSGS;                                              57565000
                                                                        57570000
   CACHEMOVEREQPORTSERVICE:                                    <<06212>>57575000
      HandleCacheMoveReq;                                      <<06212>>57580000
      GO CheckForMoreMsgs;                                     <<06212>>57585000
                                                               <<06212>>57590000
                                                               <<06212>>57595000
   CHECKFORMOREMSGS:                                                    57600000
      DISABLE;                                                          57605000
      MOSTURGPORTNUM:=PORTSTATUS(-1);                                   57610000
   END;                                                                 57615000
CC:=CONDCODE;                                                  <<01557>>57620000
END  <<PROCESSSCHEDMSGS>>;                                              57625000
                                                                        57630000
$PAGE "DISPATCHER"                                                      57635000
PROCEDURE DSP;                                                          57640000
OPTION PRIVILEGED,UNCALLABLE;                                           57645000
                                                                        57650000
                                                                        57655000
COMMENT                                                                 57660000
                                                                        57665000
THE DISPATCHER IS LAUNCHED VIA MICROCODE SOON AFTER THE                 57670000
EXECUTION OF A DISP INSTRUCTION (WHEN THE PDISABLE                      57675000
COUNT FALLS TO ZERO).  ALTHOUGH IMPLEMENTED AS A PROCE-                 57680000
DURE, DISPATCHER MAY NOT BE PCALED SINCE PROCESS                        57685000
SWITCHING MAY BE DISABLED LEVELS DEEP UNKNOWN TO THE                    57690000
CALLER, AND THE USER'S STK, THE ICS, AND THE DISPATCER                  57695000
DB AND ENTRY POINT MUST BE SET UP BY THE MICROCODE FOR                  57700000
THE DISPATCHER ENVIRONMENT TO BE PROPERLY INITIALIZED.                  57705000
                                                                        57710000
THE DISPATCHER HAS TWO FUNCTIONS: I). SAVING THE REGISTER               57715000
STATE, RESCHEDULING, AND UPDATING AND ACCOUNTING FOR THE                57720000
USAGE OF THE CPU, MAIN MEMORY AND DISC RESOURCES OF THE LAST            57725000
LAUNCHED PROCESS, AND II). SELECTING AND INITIATING THE NEXT            57730000
MOST URGENT CPU ACTIVITY (LAUNCHING A PROCESS IF THAT IS THE            57735000
MOST URGENT PENDING ACTIVITY, RESERVING MEMORY REGIONS                  57740000
FOR A PROCESS IF IT HAD TRAPPED OR IT'S DEEMED SAFE TO TRY              57745000
TO INCREASE THE MULTIPROGRAMMING LEVEL, FIX UP MEMORY                   57750000
THROUGH GARBAGE COLLECTION IF THAT'S DEEMED THE MOST WORTH-             57755000
WHILE THING TO DO FOR THE TIME BEING, OR PAUSE IF THERE'S               57760000
NOTHING WORTHWHILE TO DO).                                              57765000
                                                                        57770000
;                                                                       57775000
                                                                        57780000
                                                                        57785000
BEGIN                                                                   57790000
                                                                        57795000
                                                                        57800000
<<FIRMWARE ASSIGNMENTS IN Q-0 THRU Q-31>>                               57805000
                                                                        57810000
INTEGER ICS'PDISABLEDCNT=Q-ICS'PDISCNTCELL,                             57815000
        ICS'STKDST=Q-ICS'STKDSTCELL,                                    57820000
        ICS'PISTATUS=Q-ICS'PISTATUSCELL,                                57825000
        ICS'PIDELTAP=Q-ICS'PIDELTAPCELL,                                57830000
        ICS'CURPROCPCBPT=Q-ICS'CURPCBPTCELL,                            57835000
        ICS'STKBASE=Q-ICS'STKBASECELL,                                  57840000
        ICS'STKDBRELZ=Q-ICS'STKDBRELZCELL,                              57845000
        ICS'STKDBRELDL=Q-ICS'STKDBRELDLCELL,                            57850000
        ICS'STKDBRELS=Q-ICS'STKDBRELSCELL,                              57855000
        ICS'STKBANK=Q-ICS'STKBANKCELL,                                  57860000
        ICS'ABSSTKDB=Q-ICS'ABSSTKDBCELL;                                57865000
                                                                        57870000
<< SOFTWARE ASSIGNMENTS IN Q-32 THROUGH Q-63 >>                         57875000
                                                                        57880000
INTEGER WORSTCPRI=Q-ICS'WORSTCPRICELL, <<C,D,E SCHEDULING LIMITS>>      57885000
        WORSTDPRI=Q-ICS'WORSTDPRICELL,                                  57890000
        WORSTEPRI=Q-ICS'WORSTEPRICELL,                                  57895000
        CSCHEDBASE=Q-ICS'CSCHEDBASECELL, <<C,D,E SCHEDULING BASES>>     57900000
        DSCHEDBASE=Q-ICS'DSCHEDBASECELL,                                57905000
        ESCHEDBASE=Q-ICS'ESCHEDBASECELL;                                57910000
LOGICAL MINCFILTER=Q-ICS'MINCFILTERCELL, <<C,D,E SCHEDULING FILTERS>>   57915000
        MAXCFILTER=Q-ICS'MAXCFILTERCELL,                                57920000
        CURRENTCFILTER=Q-ICS'CURCFILTERCELL,                            57925000
        DENOM=Q-ICS'CWTDENOMCELL,                              <<01840>>57930000
        OLDFILTER'WT=Q-ICS'CWTOLDFILTWTCELL,                   <<01840>>57935000
        BACKGROUNDFILTER=Q-ICS'CURDFILTERCELL,                          57940000
        EFILTER=Q-ICS'CUREFILTERCELL,                                   57945000
        LISTSTATE=Q-ICS'LISTSTATECELL,<<MEASUREMENT CELLS>>    <<01812>>57950000
        CANDPIN=Q-ICS'CANDPINCELL;                             <<01812>>57955000
DOUBLE  SAVEPAUSETIME=Q-ICS'PAUSETIMECELL; <<DOUBLE>>                   57960000
LOGICAL LASTTRANS'WT=Q-ICS'CWTLASTTRANSWTCELL;                 <<01840>>57965000
                                                                        57970000
INTEGER LASTPROCINX=Q+4,                                                57975000
        LASTSTKSYSBASEINX=Q+5,                                          57980000
        LASTPROCNEWPRI=Q+6,                                             57985000
        INCOREPROTECTCNT=Q+7,                                           57990000
        LAUNCHPROCINX=Q+8,                                              57995000
        BPTINX=Q+9;                                                     58000000
                                                                        58005000
LOGICAL SWAPINPROCINX=Q+10,                                             58010000
        HARDREQUEST=Q+11;                                               58015000
                                                                        58020000
INTEGER MOREURGENTSWCNT=Q+12,                                           58025000
        LASTPROCNEWPRIOFFSET=Q+13;                                      58030000
                                                                        58035000
EQUATE  WORSTPRI=256;                                                   58040000
                                                                        58045000
LOGICAL QUANTUMOUT=Q+15,                                                58050000
        PIFLAG=Q+16;                                                    58055000
                                                                        58060000
DOUBLE  LASTSTKADDR=Q+17,                                               58065000
        LAUNCHSTKADDR=Q+19,                                             58070000
        LAUNCHDB=Q+21;                                                  58075000
                                                                        58080000
LOGICAL DONTDEALLOCATE=Q+23;                                            58085000
LOGICAL STKRELDB=Q+24;                                                  58090000
INTEGER CANDPROCINX=Q+25;                                               58095000
INTEGER PCBPT = Q + 48;                                        <<06650>>58100000
INTEGER SWAPFENCE=Q+27;                                                 58105000
LOGICAL SWAPDELAY=Q+28;                                                 58110000
LOGICAL MEMORYPRESSURE=Q+30;                                            58115000
DOUBLE CURRENTAPPROXTIME=Q+31;                                          58120000
DOUBLE LASTMAKEROOMAPPROXTIME=Q+33,                                     58125000
       MEMPRESSINTERVAL=Q+35;                                           58130000
INTEGER LASTPROCOLDPRI=Q+37;                                   <<01840>>58135000
DOUBLE LASTTRANS'TERM=Q+40,                                    <<01840>>58140000
       OLDFILTER'TERM=Q+42,                                    <<01840>>58145000
       TERM'SUM=Q+44;                                          <<01840>>58150000
INTEGER SWAPSTATUS=Q+46;                                       <<01987>>58155000
INTEGER MAPSEG=Q+47;                                           <<06104>>58160000
DOUBLE LASTREFSWAPSEG = Q + 49;                                <<06650>>58165000
DEFINE PROCIMIFLAG=(0:1)#,                                              58170000
       PROCDISCIOFLAG=(1:1)#;                                           58175000
LOGICAL TOSRELSTOPREASON = S-4;                                <<01812>>58180000
DOUBLE  TOSRELLASTSTOPTIME = S-5;                              <<01812>>58185000
INTEGER JCUTINDEX = Q + 51;                                    <<06650>>58190000
                                                                        58195000
    << THESE ARE PARAMETERS TO HELP DETECT WHEN POWERFAIL >>   <<02096>>58200000
    << HAS OCCURRED. THIS IS DONE SO WE WILL NOT LAUNCH   >>   <<02096>>58205000
    << ANY ONE ELSE UNTIL THE POWERFAIL PROCESS IS DONE.  >>   <<02096>>58210000
                                                               <<02096>>58215000
EQUATE   PFAILPIN    = % 144,      <<PFAIL PROCESS PIN>>       <<02096>>58220000
               QI    =    %5;      <<ICS INITIAL Q>>           <<02096>>58225000
                                                               <<02096>>58230000
DEFINE   PF    = ABS(ABS(QI)-12)#,                             <<02096>>58235000
         PPIN  = ABS(SYSBASE+PFAILPIN)#;                       <<02096>>58240000
                                                               <<02096>>58245000
$TITLE " DISPATCHER : SAVESTATE"                                        58250000
SUBROUTINE SAVESTATE;                                                   58255000
                                                                        58260000
<<                                                                      58265000
SUBROUTINE SAVESTATE GETS THE S REGISTER VALUE FROM                     58270000
THE LAST LAUNCHED PROCESS FROM THE ICS AND STICKS IT INTO               58275000
THE PROCESS' PCBX.                                                      58280000
IT IS ALSO CHECKED IF A STACK MODIFICATION IS REQUIRED.                 58285000
IF SO, THE STACK IS WRITTEN TO DISC AND THE PROCESS QUEUED ON IT.       58290000
>>                                                                      58295000
                                                                        58300000
BEGIN                                                                   58305000
                                                                        58310000
<<                                                                      58315000
                                                                        58320000
UPDATE S REGISTER VALUE FIRMWARE PLACED IN ICS                          58325000
>>                                                                      58330000
                                                                        58335000
TOS:=LASTSTKADDR;                                                       58340000
TOS:=TOS+SBTODBRELSDISP;                                                58345000
TOS:=ICS'STKDBRELS;                                                     58350000
ASMB(SSEA);                                                             58355000
ASMB(DDEL);                                                             58360000
                                                                        58365000
<<SAVE THE TIME THE PROCESS STOPPED IN PCBX FOR MEAS INTF>>    <<01812>>58370000
<<IF PROCESS STATISTICS ENABLED, ELSE STORE 0D>>               <<01925>>58375000
TOS:=LASTSTKADDR;                                              <<01812>>58380000
TOS:=TOS+SBTOMEASSTOPTIME;                                     <<01812>>58385000
TOS:=IF GCLASSENABLEDMASK.CLASS15 THEN TIMER ELSE 0D;          <<01925>>58390000
ASMB(SDEA;DDEL);                                               <<01812>>58395000
IF WAITTODISPMSG.PREEMPTEDFLAG THEN                            <<04774>>58400000
   BEGIN                                                       <<04774>>58405000
   TOS:=ICS(-ICS'STKBANKCELL);                                 <<04774>>58410000
   TOS:=ICS(-ICS'STKBASECELL);                                 <<04774>>58415000
   TOS:=TOS+SBTOMEASSTOPREASON;                                <<04774>>58420000
   TOS:=STOPACTIVE;                                            <<04774>>58425000
   ASMB(SSEA;DDEL);                                            <<04774>>58430000
   END;                                                        <<04774>>58435000
IF GCLASSENABLEDMASK.CLASS15 THEN                              <<01812>>58440000
   BEGIN <<COPY REASON STOPPED FROM PCBX TO PROCSTAT XDS>>     <<01812>>58445000
   TOS:=LASTSTKADDR;                                           <<01812>>58450000
   TOS:=TOS+SBTOMEASSTOPREASON;                                <<01812>>58455000
   ASMB(LSEA);                                                 <<01812>>58460000
   TOS:=MEASPROCXDSBANK;                                       <<01812>>58465000
   TOS:=MEASPROCXDSBASE;                                       <<01812>>58470000
   TOS := TOS + (LASTPROCINX/PCBSIZE)*                         <<06650>>58475000
        CLASS15'SUB0SIZE+CP'PROCQUESTOPWORD;                   <<01812>>58480000
   ASMB(LSEA);                                                 <<01812>>58485000
   TOS.STOPFLD:=S3;                                            <<01812>>58490000
   ASMB(SSEA;DDEL;DEL;DDEL); <<BANK,ADDR,REASON,BANK,ADDR>>    <<01812>>58495000
   END;                                                        <<01812>>58500000
<<                                                                      58505000
SET PCB FLAGS OF PROCESS                                                58510000
>>                                                                      58515000
                                                                        58520000
PCBPT := LASTPROCINX;                                          <<06650>>58525000
DISABLE;                                                                58530000
STKINFO.STOVRALLFLAG:=0; <<CLEAR STOVRFLOW SEMAPHORE SET IN ININ>>      58535000
IF <> THEN                                                     <<01941>>58540000
   BEGIN   <<PROCESS JUST HAD A STACK OVERFLOW>>               <<01941>>58545000
   DST(ICS'STKDST&LSL(2)).ABSENTFLAG:=1; <<MARK STK ABS>>      <<01941>>58550000
   END;                                                        <<01941>>58555000
IF WAITTODISPMSG.MEMTRAPFLAG THEN                                       58560000
   BEGIN <<SET WAIT ON MEMORY FLAGS>>                                   58565000
   RESABORTINFO.SARFLAG:=1;                                             58570000
   WAKEMASK.MEMORYWAITFLAG:=1;                                          58575000
   END;                                                                 58580000
IF WAITTODISPMSG.DISCWAITFLAG THEN RESABORTINFO.PCBSHORTWAITFLAG:=1     58585000
ELSE RESABORTINFO.PCBSHORTWAITFLAG:=0;                                  58590000
IF WAITTODISPMSG.TRANSCOMPFLAG THEN RESABORTINFO.PCBLONGWAITFLAG:=1     58595000
ELSE RESABORTINFO.PCBLONGWAITFLAG:=0;                                   58600000
IF WAITTODISPMSG.TERMREADFLAG THEN RESABORTINFO.PCBTERMREADFLAG:=1      58605000
ELSE RESABORTINFO.PCBTERMREADFLAG:=0;                                   58610000
CPUNUM;                   << GET CPU NUMBER >>                 <<04663>>58615000
IF TOS= SERIES64 THEN UPDATE'PCBXBNDS'FLAG;                    <<04663>>58620000
ENABLE;                                                                 58625000
                                                                        58630000
<<ADD LAST REF SWAP CODE SEG TO MIN LOCALITY IF MEMORY PRESSURE>>       58635000
                                                                        58640000
IF NOT MEMORYPRESSURE THEN                                     <<06650>>58645000
   BEGIN                                                       <<06650>>58650000
   LASTREFCODESEG0 := 0;                                       <<06650>>58655000
   LASTREFCODESEG1 := 0;                                       <<06650>>58660000
   END                                                         <<06650>>58665000
ELSE                                                           <<06650>>58670000
   BEGIN  <<ADD MOST RECENT SWAP SEG TO MIN LOCALITY>>                  58675000
   LASTREFSWAPSEG := 0D;                                       <<06650>>58680000
   TOS:=ICS'STKBANK;                                                    58685000
   TOS:=ICS'ABSSTKDB+ICS'STKDBRELS-4;<<LAST P ADDR>>           <<06104>>58690000
   IF MAPDST = 0  OR                                           <<07320>>58695000
      (MAPDST <> 0 LAND DST(MAPDST & LSL(2)) > 0) THEN         <<07320>>58700000
      BEGIN                                                    <<07320>>58705000
                                                               <<07320>>58710000
      DO                                                       <<07320>>58715000
      BEGIN                                                             58720000
      ASMB( LDEA );  << P,STATUS >>                            <<06104>>58725000
      TOS.(0:1) := S1.(1:1); << MOVE MAPFLAG TO SIGN >>        <<06104>>58730000
      ASMB(DELB);    << Get rid of P register >>               <<06660>>58735000
      ASMB(DZRO; CAB);  << Return value from MAPPEDCSTTOPHY>>  <<06660>>58740000
      TOS:=MAPPEDCSTTOPHYCST(*,LASTPROCINX);                   <<06104>>58745000
      IF < THEN SUDDENDEATH(999);                              <<s8542>>58750000
      IF S1.OBJIDTYPE = OBJIDPGMTYPE THEN                      <<06749>>58755000
         LASTREFSWAPSEG := TOS                                 <<06660>>58760000
      ELSE                                                     <<06104>>58765000
         IF NOT LOGICAL(SL(S0*4+1)).SEGRESIDENTFLAG THEN       <<06660>>58770000
            LASTREFSWAPSEG:=TOS                                <<06104>>58775000
         ELSE                                                           58780000
            BEGIN                                                       58785000
            ASMB( DDEL );                                      <<06660>>58790000
            TOS := TOS+2;  << ADR OF DELTA Q >>                <<06104>>58795000
            ASMB( LSEA );                                      <<06104>>58800000
            TOS := TOS+2;                                      <<06104>>58805000
            ASMB( LSUB );  << ADR OF DELTA P IN PREV MARKER >> <<06104>>58810000
            END;                                                        58815000
      END                                                               58820000
      UNTIL LASTREFSWAPSEG <> 0D;                              <<07320>>58825000
   TOS := LASTREFSWAPSEG;                                      <<06650>>58830000
   LASTREFCODESEG1 := TOS;                                     <<06749>>58835000
   LASTREFCODESEG0 := TOS;                                     <<06749>>58840000
   ADDTOLOCALITY(SLLPTR,LASTREFSWAPSEG,2);  << No impede >>    <<07320>>58845000
   END;                                                        <<07320>>58850000
   ASMB(DDEL); << address of marker >>                         <<*8159>>58855000
   IF DBXDSINFO.XDSDSTFIELD <> 0                               <<01913>>58860000
   THEN ADDTOLOCALITY(SLLPTR,DOUBLE(DBXDSINFO.XDSDSTFIELD),2); <<07320>>58865000
                                            << No impede >>    <<07320>>58870000
   END;                                                                 58875000
END  <<SUBROUTINE SAVESTATE>>;                                          58880000
                                                                        58885000
                                                                        58890000
$TITLE "DISPATCHER : RESCHEDULE"                                        58895000
SUBROUTINE RESCHEDULE;                                                  58900000
                                                                        58905000
<<                                                                      58910000
                                                                        58915000
RESCHEDULE IS CALLED BY THE SCHEDULER AFTER THE STATE OF THE            58920000
LAST LAUCHED PROCESS HAS BEEN SAVED IN ORDER TO ACCOUNT FOR             58925000
THE CPU TIME USED BY THE PROCESS, AND, BASED ON CPU TIME USED           58930000
TOGETHER WITH THE CAUSE OF THE PROCESSING BLOCKING AND ITS              58935000
SCHEDULING CLASS, TO CALCULATE THE PROCESSES NEW PRIORITY               58940000
AND MERGE IT INTO THE PROPER SCHEDULING QUEUE.                          58945000
                                                                        58950000
>>                                                                      58955000
                                                                        58960000
BEGIN                                                                   58965000
TOS:=LASTSTKADDR;                                                       58970000
PCBPT := LASTPROCINX;                                          <<06650>>58975000
<<UPDATE CPU TIME USED, CHECK FOR JOB CUTOFF>>                          58980000
                                                                        58985000
IF NOT PROCSTATE.SYSTEMPROCFLAG THEN                                    58990000
   BEGIN <<UPDATE PROCTIME, CHECK JOB CUTOFF OF USER PROCS>>            58995000
   <<UPDATE PROCESS' CUMULATIVE CPU TIME USED CELL IN PCBX>>            59000000
   TOS:=TOS+SBTOPROCTIMEDISP;                                           59005000
   ASMB(LDEA;ZERO;RCLK;DADD;SDEA);                                      59010000
   <<IF THESE'S A CUTOFF CPU TIME ON THE JOB, UPDATE TIME               59015000
     LEFT, AND IF THIS FALLS BELOW ZERO, KILL THE JOB>>                 59020000
   TOS:=TOS+PROCTIMETOJCIDISP;                                          59025000
   ASMB(LSEA);                                                          59030000
   JCUTINDEX:=TOS;        <<INDEX INTO JCUT>>                  <<06942>>59035000
   IF JCUTINDEX <> 0 THEN                                      <<07320>>59040000
      BEGIN                                                             59045000
         JCUTINDEX:=(JCUTINDEX-1)*JCUTENTSIZE+JCUTHEADSIZE;    <<07320>>59050000
      TOS:=TOS+JCITOJROLSDISP;                                          59055000
      ASMB(LSEA;RCLK;LADD);                                             59060000
      IF NOCARRY AND S0 < 1000 THEN ASMB(SSEA) ELSE                     59065000
         BEGIN <<TACK ON ANOTHER 1000 MS USED>>                         59070000
         ASMB(ZERO,XCH);<<MAKE A DOUBLE WORD>>                          59075000
         TOS:=JCUTCPUC1;   <<GET JOB CPU TIME>>                <<06942>>59080000
         TOS:=JCUTCPUC2;                                       <<06942>>59085000
         ASMB(DADD,DDUP);<<UPDATED CUMULATIVE TIME USED>>               59090000
         JCUTCPUC2:=TOS;                                       <<06942>>59095000
         JCUTCPUC1:=TOS;                                       <<06942>>59100000
         TOS:=0;                                                        59105000
         TOS:=JCUTCPUL;       <<JOB LIMIT IN MILLE-SECONDS>>   <<06942>>59110000
         TOS:=1000D;                                                    59115000
         ASMB(DMUL;DCMP);                                               59120000
         IF > THEN                                                      59125000
            BEGIN <<SET FATHER'S SOFTKILL PSEUDO-INTERRUPT FLAG>>       59130000
            WHILE PROCSTATE.PTYPEFIELD <> MAIN                          59135000
            DO PCBPT := FATHERINFO;                            <<06650>>59140000
            IF PROCSTATE.ALIVEFLAG                                      59145000
            THEN SET'PSIF(PCBPT,SOFTKILL);                     <<06650>>59150000
            END;                                                        59155000
         TOS:=0;                                                        59160000
         ASMB(SSEA);                                                    59165000
                                                               <<06411>>59170000
         END;                                                           59175000
      TOS:=TOS+FROLSTOJCIDISP;                                 <<02029>>59180000
      END;                                                              59185000
      TOS:=TOS+JCITOSBDISP;                                             59190000
   END;                                                                 59195000
PCBPT := LASTPROCINX;                                          <<06650>>59200000
TOS:=TOS+SBTOTSSWAPINDISP;                                              59205000
                                                                        59210000
<<UPDATE TIME SINCE SWAP-IN AND INCORE PROTECT FLAG>>                   59215000
                                                                        59220000
IF NOT QUEUEINGINFO.PROCRESIDENTFLAG THEN                               59225000
   BEGIN                                                                59230000
   ASMB(LSEA;RCLK;LADD);                                                59235000
   IF CARRY THEN S0:=-1;                                                59240000
   ASMB(SSEA);                                                          59245000
   END;                                                                 59250000
TOS:=TOS+TSLSWAPINTOTSLRDISP;                                           59255000
                                                                        59260000
<<UPDATE TIME SINCE LAST TRANSACTION BEGAN AND PCBXQCNT>>               59265000
                                                                        59270000
IF QUEUEINGINFO.LSCHEDFLAG THEN TOS:=TOS+TSLRTOQCNTDISP ELSE            59275000
   BEGIN                                                                59280000
   ASMB(LSEA;RCLK;LADD);                                                59285000
   IF CARRY THEN S0:=-1;                                                59290000
   IF LOGICAL(WAITTODISPMSG).TRANSCOMPFLAG THEN                         59295000
      BEGIN                                                             59300000
      S0:=0;                                                            59305000
      RESABORTINFO.USEDQUANTUMFLAG:=0;                                  59310000
      END                                                               59315000
   ELSE IF QUEUEINGINFO.CSCHEDFLAG AND LS0>CURRENTCFILTER THEN          59320000
      BEGIN  <<CONSUMED A QUANTUM SINCE LAST RESCHEDULED>>              59325000
      QUANTUMOUT:=TRUE;                                                 59330000
      RESABORTINFO.USEDQUANTUMFLAG:=1;                                  59335000
      S0:=0;                                                            59340000
      END                                                               59345000
   ELSE IF LS0 > BACKGROUNDFILTER THEN                                  59350000
      BEGIN  <<BATCH JOB CONSUMED A QUANTUM SINCE LAST RESCHEDULED>>    59355000
      QUANTUMOUT:=TRUE;                                                 59360000
      S0:=0;                                                            59365000
      END;                                                              59370000
   ASMB(SSEA);                                                          59375000
   TOS:=TOS+TSLRTOTSTBDISP;<<PCBX' TIME SINCE TRANSACTION BEGAN>>       59380000
   ASMB(LSEA;RCLK;LADD);                                                59385000
   IF CARRY THEN S0:=-1;                                                59390000
                                                                        59395000
   <<TUNE C FILTER IF TRANSACTION COMPLETED>>                           59400000
                                                                        59405000
   IF RESABORTINFO.PCBTERMREADFLAG THEN                                 59410000
      BEGIN                                                             59415000
      LASTTRANS'TERM:=DOUBLE(TOS);   << TRANSACTION TIME >>    <<01840>>59420000
      LASTTRANS'TERM:=DOUBLE(LASTTRANS'WT)*LASTTRANS'TERM;     <<01840>>59425000
      IF OVERFLOW THEN TOS := CURRENTCFILTER                   <<01840>>59430000
      ELSE                                                     <<01840>>59435000
         BEGIN  << FORM 2ND TERM >>                            <<01840>>59440000
         OLDFILTER'TERM:=                                      <<01840>>59445000
            DOUBLE(OLDFILTER'WT)*DOUBLE(CURRENTCFILTER);       <<01840>>59450000
         IF OVERFLOW THEN TOS:=CURRENTCFILTER                  <<01840>>59455000
         ELSE                                                  <<01840>>59460000
            BEGIN  << FORM SUM OF TERMS >>                     <<01840>>59465000
            TERM'SUM:=LASTTRANS'TERM+OLDFILTER'TERM;           <<01840>>59470000
            IF OVERFLOW THEN TOS:=CURRENTCFILTER               <<01840>>59475000
            ELSE                                               <<01840>>59480000
               BEGIN  << FORM QUOTIENT >>                      <<01840>>59485000
               TOS:=TERM'SUM/DOUBLE(DENOM);                    <<01840>>59490000
               IF S1 <> 0 THEN                                 <<01840>>59495000
                  BEGIN                                        <<01840>>59500000
                  DDEL;   << THE BAD DOUBLE WORD FILTER >>     <<01840>>59505000
                  TOS:=CURRENTCFILTER;                         <<01840>>59510000
                  END                                          <<01840>>59515000
               ELSE                                            <<01840>>59520000
                  << THE NEW CFILTER WAS COMPUTED OK >>        <<01840>>59525000
                  DELB;   << MAKE IT A SINGLE WORD >>          <<01840>>59530000
               END << FINAL DIVIDE >>;                         <<01840>>59535000
            END << FORM SUM >>;                                <<01840>>59540000
         END << FORM 2ND TERM >>;                              <<01840>>59545000
      IF LS0>=MAXCFILTER THEN                                           59550000
         BEGIN <<SHOULD CRASH'>>                                        59555000
         ASMB(DEL);                                                     59560000
         TOS:=MAXCFILTER;                                               59565000
         END                                                            59570000
      ELSE IF LS0<=MINCFILTER THEN                                      59575000
         BEGIN                                                          59580000
         ASMB(DEL);                                                     59585000
         TOS:=MINCFILTER;                                               59590000
         END;                                                           59595000
      CURRENTCFILTER:=TOS;                                              59600000
      TOS:=0; <<FOR NEW VALUE OF TIME SINCE TRANS BEGAN>>               59605000
      END;                                                              59610000
   ASMB(SSEA);                                                          59615000
   TOS:=TOS+TSTBTOQCNTDISP;                                             59620000
   ASMB(LSEA);                                                          59625000
   IF QUANTUMOUT THEN                                          <<01880>>59630000
      BEGIN                                                    <<01880>>59635000
      TOS := TOS + 1;                                          <<01880>>59640000
      IF CARRY THEN S0 := -1; << Hold at max, do not rollover>><<01880>>59645000
      END;                                                     <<01880>>59650000
   IF LOGICAL(WAITTODISPMSG).TRANSCOMPFLAG THEN ASMB(DEL,ZERO);         59655000
   LASTPROCNEWPRIOFFSET := IF 0<=S0<=127  THEN  S0*2           <<01880>>59660000
      ELSE 256;                                                <<01880>>59665000
   ASMB(SSEA);                                                 <<01944>>59670000
   END;                                                                 59675000
ASMB(DDEL);                                                    <<01944>>59680000
<<CALCULATE PROC'S NEW PRIORITY, AND MERGE INTO PROPER QUEUE>>          59685000
                                                                        59690000
PCBPT := LASTPROCINX;                                          <<06650>>59695000
IF QUEUEINGINFO.LSCHEDFLAG THEN                                         59700000
LASTPROCNEWPRI:=QUEUEINGINFO.PRIFIELD ELSE                              59705000
   BEGIN <<RECALCULATE PROCESS' SCHEDULING PRIORITY>>                   59710000
   LASTPROCOLDPRI:=QUEUEINGINFO.PRIFIELD;                               59715000
      IF QUEUEINGINFO.CSCHEDFLAG THEN                                   59720000
         BEGIN                                                          59725000
         IF RESABORTINFO.HOLDIMPPRIFLAG                        <<06411>>59730000
         OR RESABORTINFO.HOLDSIRPRIFLAG                        <<06411>>59735000
         THEN TOS:=LASTPROCOLDPRI ELSE                         <<06411>>59740000
         TOS:=CSCHEDBASE+LASTPROCNEWPRIOFFSET;                          59745000
         IF S0 > WORSTCPRI  THEN S0:= WORSTCPRI;                        59750000
         LASTPROCNEWPRI:=TOS;                                           59755000
         END                                                            59760000
      ELSE                                                              59765000
         BEGIN                                                          59770000
         IF QUEUEINGINFO.DSCHEDFLAG  THEN                               59775000
            BEGIN                                                       59780000
            IF RESABORTINFO.HOLDIMPPRIFLAG                     <<06411>>59785000
            OR RESABORTINFO.HOLDSIRPRIFLAG                     <<06411>>59790000
            THEN TOS:=LASTPROCOLDPRI ELSE                      <<06411>>59795000
            TOS:=DSCHEDBASE+LASTPROCNEWPRIOFFSET;                       59800000
            IF S0 > WORSTDPRI THEN S0:=WORSTDPRI;                       59805000
            LASTPROCNEWPRI:=TOS;                                        59810000
            END                                                         59815000
         ELSE                                                           59820000
            BEGIN                                                       59825000
            IF RESABORTINFO.HOLDIMPPRIFLAG                     <<06411>>59830000
            OR RESABORTINFO.HOLDSIRPRIFLAG                     <<06411>>59835000
            THEN TOS:=LASTPROCOLDPRI ELSE                      <<06411>>59840000
            TOS:=ESCHEDBASE+LASTPROCNEWPRIOFFSET;                       59845000
            IF S0 > WORSTEPRI THEN S0:=WORSTEPRI;                       59850000
            LASTPROCNEWPRI:=TOS;                                        59855000
            END;                                                        59860000
         END;                                                           59865000
   END;                                                                 59870000
DISABLE;                                                                59875000
QUEUEINGINFO.PRIFIELD:=LASTPROCNEWPRI;                                  59880000
IF WAITTODISPMSG.MEMTRAPFLAG  LOR                              <<06411>>59885000
   (RESABORTINFO.PCBSHORTWAITFLAG                              <<06411>>59890000
   LOR WAKEMASK=0) LAND (LASTPROCOLDPRI <> LASTPROCNEWPRI      <<01696>>59895000
   LOR QUANTUMOUT)  <<ONLY MOVE IN QUEUE IF NECESSARY>>        <<01696>>59900000
   THEN QUEUEPROC(LASTPROCINX,DISPATCHINGQ,ENDOFCLASS);                 59905000
ENABLE;                                                                 59910000
END;  <<SUBROUTINE RESCHEDULE>>                                         59915000
                                                                        59920000
$TITLE "DISPATCHER : LAUNCH"                                            59925000
SUBROUTINE LAUNCH;                                                      59930000
                                                                        59935000
<<                                                                      59940000
LAUNCH IS CALLED BY THE CPU'S DISPATCHER TO SET UP THE ENVIRONMENT      59945000
ON THE ICS FOR THE LAUNCH OF LAUNCHPROCINX.                             59950000
>>                                                                      59955000
                                                                        59960000
                                                                        59965000
BEGIN                                                                   59970000
                                                                        59975000
<<                                                                      59980000
FIX UP LOW CORE CELLS                                                   59985000
>>                                                                      59990000
                                                                        59995000
CURPRC := LAUNCHPROCINX;                                       <<06650>>60000000
PCBPT := LAUNCHPROCINX;                                        <<06650>>60005000
X := PBX;                                                      <<06650>>60010000
IF <> THEN                                                              60015000
   BEGIN <<FILL IN THE ST PROGRAM BLOCK BASE>>                          60020000
   TOS:=CSTXBLK(X);                                                     60025000
   TOS:=TOS+ABSOLUTE(DSTP);                                    <<06104>>60030000
   ABSOLUTE(SYSNRPGMSEGS) := ABSOLUTE(S0);                     <<06104>>60035000
   ABSOLUTE(CSTXP):=TOS;                                                60040000
   END                                                         <<*8593>>60045000
ELSE                                                           <<*8593>>60050000
   ABSOLUTE(SYSNRPGMSEGS) := 0;                                <<*8593>>60055000
                                                                        60060000
<<                                                                      60065000
STORE THE PROCESS' REGISTER VALUES INTO THE ICS                         60070000
>>                                                                      60075000
                                                                        60080000
                                                               <<02016>>60085000
ICS'CURPROCPCBPT := PCBPT;                                     <<06650>>60090000
                                                               <<01788>>60095000
<<MAKE SURE STK AND XDS AROUND>>                               <<01788>>60100000
                                                               <<01788>>60105000
ICS'STKDST:=STKINFO.STKDSTFIELD;                               <<01788>>60110000
STKRELDB:=DBXDSINFO.XDSDSTFIELD; <<SAVE :X REG PROB>>          <<01788>>60115000
MAPSEG := MAPDST;                                              <<06104>>60120000
IF (STKRELDB<>0 LAND DST(STKRELDB&LSL(2))<0)                   <<01788>>60125000
LOR ( MAPSEG<>0 LAND DST(MAPSEG&LSL(2))<0 )                    <<06104>>60130000
LOR (DST(ICS'STKDST&LSL(2))<0) THEN                            <<01788>>60135000
   BEGIN <<STK, DB XDS OR MAPPING SEG ABSENT>>                 <<06104>>60140000
   CURPRC := 0; <<CHANGED OUR MINDS>>                          <<06650>>60145000
   TOS:=ICS'CURPROCPCBPT/PCBSIZE;                              <<06411>>60150000
   TOS := DOUBLE(STKRELDB);                                    <<06660>>60155000
   TOS:=0;                                                     <<06411>>60160000
   TOS.CAUSEFULLSWAP:=1;                                       <<06411>>60165000
   IF STKRELDB <> 0 THEN TOS.FETCHSPECOBJ:=1;                  <<06411>>60170000
   FLAGPROCABSENT(*,*,*);                                      <<06411>>60175000
   ASMB(DEL); <<RETURN DELTAP FOR S EXIT>>                              60180000
   GO STARTSCANOVER;                                                    60185000
   END;                                                                 60190000
                                                               <<01788>>60195000
IF MAPDST <> 0 THEN                                            <<06104>>60200000
   BEGIN                                                       <<06104>>60205000
   MAPSEG := MAPDST;                                           <<06104>>60210000
   ABSOLUTE(SYSMAPSEGBANK) := DST(MAPSEG&LSL(2)+2);            <<06104>>60215000
   ABSOLUTE(SYSMAPSEGADR) := DST(MAPSEG&LSL(2)+3);             <<06104>>60220000
   END                                                         <<06104>>60225000
ELSE                                                           <<06104>>60230000
   BEGIN                                                       <<06104>>60235000
   ABSOLUTE(SYSMAPSEGBANK) := 0;                               <<06104>>60240000
   ABSOLUTE(SYSMAPSEGADR) := 0;                                <<06104>>60245000
   END;                                                        <<06104>>60250000
X:=ICS'STKDST&LSL(2)+DSTSYSBASEINX; <<SET X TO STK DESC>>      <<01788>>60255000
SEGDESCFIRMINFO.REFERENCEDFLAG:=1;<<FOR CLOCK ALG>>                     60260000
TOS:=SEGDESCBANK;                                                       60265000
ICS'STKBANK:=S0;                                                        60270000
TOS:=SEGDESCADDR;                                                       60275000
ICS'STKBASE:=S0;                                                        60280000
TOS:=TOS+SBTOSTKRELDBDISP;                                              60285000
ASMB(LSEA); <<DB OFFSET FROM STACK'S BASE>>                             60290000
STKRELDB:=S0; <<SAVE FOR DL REL DB CALCULATION>>                        60295000
ASMB(DDUP,LADD);                                                        60300000
ICS'ABSSTKDB:=TOS+STKRELDBTOSBDISP;                                     60305000
ASMB(DEL);                                                              60310000
TOS:=TOS+STKDBTOSTKDLDISP;                                              60315000
ASMB(LSEA);                                                             60320000
ICS'STKDBRELDL:=TOS-STKRELDB;                                           60325000
IF > THEN SUDDENDEATH(680);                                    <<01644>>60330000
TOS:=TOS+STKDLTODBRELZDISP;                                             60335000
ASMB(LSEA);                                                             60340000
ICS'STKDBRELZ:=TOS;                                                     60345000
TOS:=TOS+DBRELZTODBRELSDISP;                                            60350000
ASMB(LSEA);                                                             60355000
ICS'STKDBRELS:=TOS;                                                     60360000
                                                                        60365000
<<                                                                      60370000
FIX UP PROCESS' MARKER FOR LAUNCH                                       60375000
>>                                                                      60380000
                                                                        60385000
ASMB(DEL);                                                              60390000
TOS:=ICS'ABSSTKDB+ICS'STKDBRELS;<<ABS ADDR OF S>>                       60395000
CPUNUM;             << GET CPU NUMBER >>                       <<04663>>60400000
IF TOS= SERIES64 THEN GET'PCBXBNDS'FLAG;                       <<04663>>60405000
<<FIGURE OUT PROCESS' DB VALUE>>                                        60410000
TOS:=DBXDSINFO;                                                         60415000
IF < THEN                                                               60420000
   BEGIN <<DB AT AN ABS LOCATION, SO S0,S1 SHOULD BE VALID>>            60425000
   ASMB(DEL,DECA);                                                      60430000
   END                                                                  60435000
ELSE                                                                    60440000
   BEGIN                                                                60445000
   TOS:=TOS.XDSDSTFIELD&LSL(2);                                         60450000
   IF = THEN                                                            60455000
      BEGIN  <<DB AT THE STK>>                                          60460000
      ASMB(DEL);                                                        60465000
      TOS:=ICS'ABSSTKDB;                                                60470000
      ASMB(SSEA);                                                       60475000
      TOS:=TOS-1;                                                       60480000
      TOS:=ICS'STKBANK;                                                 60485000
      ASMB(SSEA);                                                       60490000
      END                                                               60495000
   ELSE                                                                 60500000
      BEGIN <<DB GOES TO BASE OF AN XDS>>                               60505000
      X:=TOS+DSTSYSBASEINX;                                             60510000
      IF SEGDESCFIRMINFO.ABSENTFLAG THEN                                60515000
      SUDDENDEATH(619);                                        <<01788>>60520000
      CPUNUM;           << GET CPU NUMBER >>                   <<04663>>60525000
      IF TOS= SERIES64 THEN GET'XDSEG'LIMITS;                  <<04663>>60530000
      SEGDESCFIRMINFO.REFERENCEDFLAG:=1;                                60535000
      TOS:=SEGDESCADDR;                                                 60540000
      ASMB(SSEA);                                                       60545000
      TOS:=TOS-1;                                                       60550000
      TOS:=SEGDESCBANK;                                                 60555000
      ASMB(SSEA);                                                       60560000
      END;                                                              60565000
   END;                                                                 60570000
IF GCLASSENABLEDMASK.CLASS15 THEN                              <<01812>>60575000
   BEGIN <<UPDATE REASON STOPTIME>>                            <<01812>>60580000
   TOS:=ICS'STKBANK;                                           <<01812>>60585000
   TOS:=ICS'STKBASE+SBTOMEASSTOPREASON;                        <<01812>>60590000
   ASMB(LSEA);                                                 <<01812>>60595000
   IF <> THEN                                                  <<01812>>60600000
      BEGIN <<PROCESS STOPPED FOR REASON INTF KNOWS ABOUT>>    <<01812>>60605000
      ASMB(CAB,CAB); <<PUT BANK & ADDR BACK ON TOS>>           <<01812>>60610000
      TOS:=TOS-SBTOMEASSTOPREASON+SBTOMEASSTOPTIME;            <<01812>>60615000
      ASMB(LDEA); <<TIME LAST STOPPED>>                        <<01812>>60620000
      IF = THEN <<PROCESS STOPPED BEFORE STATS ENABLED, USE>>  <<01925>>60625000
         BEGIN<<STARTTIME OF STATS GATHERING AS PROC STOPTIME>><<01925>>60630000
         ASMB(DDEL); <<GET RID OF 0D FOR A STOPTIME>>          <<01925>>60635000
         TOS:=MEASPROCXDSBANK;                                 <<01925>>60640000
         TOS:=MEASPROCXDSBASE+2;<<TIME STATS WAS ENABLED>>     <<01925>>60645000
         ASMB(LDEA);                                           <<01925>>60650000
         ASMB(DXCH;DDEL); << DEL BANK AND ADDR>>               <<01925>>60655000
         END;                                                  <<01925>>60660000
      TOS:=TIMER;                                              <<01812>>60665000
      ASMB(DXCH;DSUB); <<TOS ==> TOTAL TIME STOPPED>>          <<01812>>60670000
      ASMB(DXCH;DDEL); <<DEL STKBANK & STKBASE>>               <<01812>>60675000
      <<TOS NOW HAS THE REASON AND TOTAL TIME STOPPED>>        <<01812>>60680000
      <<NOW ADD TO APPROPIATE COUNTER IN MEAS XDS>>            <<01812>>60685000
      TOS:=MEASPROCXDSBANK;                                    <<01812>>60690000
      TOS:=MEASPROCXDSBASE;                                    <<01812>>60695000
      TOS := TOS + CURPRC/PCBSIZE *                            <<06749>>60700000
           CLASS15'SUB0SIZE;                                   <<01812>>60705000
      TOS:=TOS+CP'PAUSESWAPTIME-2+TOSRELSTOPREASON*2;          <<01812>>60710000
      ASMB(LDEA); <<OLD CUMMLATIVE TIME STOPPED>>              <<01812>>60715000
      TOS:=TOSRELLASTSTOPTIME;  <<FROM S-5, >>                 <<01812>>60720000
      ASMB(DADD;SDEA); <<STUFF AWAY NEW TIME>>                 <<01812>>60725000
      ASMB(DDEL;DDEL;DEL);<<REASON, TIME STOPPPED,BANK,ADDR>>  <<01812>>60730000
      END                                                      <<01812>>60735000
   ELSE                                                        <<01812>>60740000
      ASMB(DDEL;DEL); <<BANK, BASE, AND REASON>>               <<01812>>60745000
   END;                                                        <<01812>>60750000
<<UNCONDITIONALY ZERO OUT THE MEASSTOPREASON IN THE USERS>>    <<01812>>60755000
<<PCBX FOR HISTORY AND SYNCRONIZATION WHEN USING MEAS INTF>>   <<01812>>60760000
TOS:=ICS'STKBANK;                                              <<01812>>60765000
TOS:=ICS'STKBASE+SBTOMEASSTOPREASON;                           <<01812>>60770000
ASMB(ZERO;SSEA;DDEL);                                          <<01812>>60775000
<<                                                                      60780000
IF PROCESS HAS A PENDING PSEUDO-INTERRUPT, PUT A MARKER                 60785000
ONTO HIS STK SO HE'LL BE LAUNCHED INTO THE INTERRUPT HANDLER            60790000
>>                                                                      60795000
DISABLE;                                                                60800000
IF PROCSTATE.SIPIFLAGSFIELD <> 0 OR                            <<d7738>>60805000
   (LOGICAL(PROCSTATE).STOVFLAG LAND                           <<07320>>60810000
   NOT LOGICAL(RESABORTINFO).STOVABORTFLAG)                    <<07320>>60815000
    LAND NOT LOGICAL(STKINFO).INSYSTEMFLAG                     <<04483>>60820000
    LAND NOT LOGICAL(RESABORTINFO).HASSIRFLAG                  <<04483>>60825000
    LAND NOT LOGICAL(RESABORTINFO).CRITFLAG THEN               <<04483>>60830000
   BEGIN <<PROCESS HAS A PENDING PSEUDO OR SOFT INTERRUPT>>    <<03041>>60835000
   IF NOT RESABORTINFO.HASSIRFLAG AND NOT RESABORTINFO.CRITFLAG         60840000
   OR RESABORTINFO.RITBRKFLAG THEN                                      60845000
      BEGIN <<BUILD MARKER TO PSEUDOINT>>                               60850000
      PIFLAG:=TRUE;                                                     60855000
      RESABORTINFO.PIOVRFLAG:=0;                                        60860000
      <<ADD A MARKER TO PSEUDOINT>>                                     60865000
      ASMB(LDEA);                                                       60870000
      LAUNCHDB:=TOS;                                                    60875000
      TOS:=0;                                                           60880000
      ASMB(SSEA); <<DON'T CARE ABOUT X>>                                60885000
      TOS:=TOS+1;                                                       60890000
      TOS:=ICS'PIDELTAP;                                                60895000
      ASMB(SSEA);                                                       60900000
      TOS:=TOS+1;                                                       60905000
      TOS:=ICS'PISTATUS;                                                60910000
      ASMB(SSEA);                                                       60915000
      TOS:=TOS+1;                                                       60920000
      TOS:=4;                                                           60925000
      ASMB(SSEA);                                                       60930000
      TOS:=TOS+1;                                                       60935000
      TOS:=LAUNCHDB;                                                    60940000
      ASMB(SDEA);                                                       60945000
      ICS'STKDBRELS:=ICS'STKDBRELS+4;                                   60950000
      END;                                                              60955000
   END;                                                                 60960000
                                                                        60965000
<<                                                                      60970000
SET THE PROCESS' BREAKPOINTS                                            60975000
>>                                                                      60980000
                                                                        60985000
BPTINX := BPTLINK;                                             <<06650>>60990000
IF BPTINX<>0 THEN                                              <<MM.IV>>60995000
   BEGIN                                                       <<MM.IV>>61000000
   << EXCHDB TO BREAKPOINT TABLE  >>                           <<MM.IV>>61005000
   << TABLE HAD BETTER BE PRESENT >>                           <<MM.IV>>61010000
   IF NOT BPT'TAB'LOCKED THEN SUDDENDEATH (199);               <<MM.IV>>61015000
   TOS := DST(BPT'DST'IND+2);                                  <<MM.IV>>61020000
   TOS := DST(X+1);                                            <<MM.IV>>61025000
   ASMB(XCHD);                                                 <<MM.IV>>61030000
   BPTINX := BPT(BPTINX);          << INDEX OF 1ST ENTRY   >>  <<MM.IV>>61035000
                                                               <<MM.IV>>61040000
   WHILE BPTINX <> 0 DO                                        <<MM.IV>>61045000
      BEGIN                                                    <<MM.IV>>61050000
      << CONVERT OBJIDENT TO DST INX >>                        <<06212>>61055000
      TOS := 0;    << Return value from CONVSEGIDTOSTINX >>    <<06750>>61060000
      TOS := BPT(BPTINX + CLABELOFFSET);                       <<06750>>61065000
      TOS := BPT(BPTINX + CLABELOFFSET + 1);                   <<06750>>61070000
      TOS := CONVSEGIDTOSTINX(*);                              <<06750>>61075000
      X := TOS;                                                <<06750>>61080000
                                                               <<06750>>61085000
      IF DST(X) > 0 THEN                                       <<MM.IV>>61090000
         BEGIN                     << SET BREAK POINT      >>  <<MM.IV>>61095000
         TOS := DST(X:=X+2);       << GET INSTR.           >>  <<MM.IV>>61100000
         TOS := DST(X:=X+1);                                   <<MM.IV>>61105000
         TOS := TOS+BPT(BPTINX+PLOCOFFSET); <<PLOC OF INSTR.>> <<06104>>61110000
         ASMB(LSEA);                                           <<MM.IV>>61115000
         IF S0 = %36000 THEN                                   <<MM.IV>>61120000
            DEL                                                <<MM.IV>>61125000
         ELSE                                                  <<MM.IV>>61130000
            BEGIN                                              <<MM.IV>>61135000
            BPT(BPTINX+INSTROFFSET) := TOS;  << SAVE INSTR.>>  <<06104>>61140000
            TOS := %36000;                                     <<MM.IV>>61145000
            ASMB(SSEA);                                       <<<MM.IV>>61150000
            BPT(BPTINX).BKPT'VALID := 1;<< SET VALIDITY FLAG>> <<06104>>61155000
            END;                                               <<MM.IV>>61160000
         DDEL;                     << REMOVE ADDRESS       >>  <<MM.IV>>61165000
         END;                                                  <<MM.IV>>61170000
      BPTINX := BPT(BPTINX+LINKOFFSET);     << NEXT ENTRY  >>  <<06104>>61175000
      END;                                                     <<MM.IV>>61180000
                                                               <<MM.IV>>61185000
   ASMB(XCHD); DDEL;               << SET DB TO ORIG STATE >>  <<MM.IV>>61190000
   END;                                                        <<MM.IV>>61195000
                                                               <<MM.IV>>61200000
                                                                        61205000
DISABLE;                                                                61210000
                                                                        61215000
<<                                                                      61220000
FILL IN THE DISP, AWAKE, AND WAIT COMMUNICATION CELLS                   61225000
>>                                                                      61230000
                                                                        61235000
TOS:=0;                                                        <<02827>>61240000
TOS.CURPROCQUEUE:=QUEUEINGINFO.QUEUEFIELD;                     <<02827>>61245000
TOS.CURPROCPRI:=QUEUEINGINFO.PRIFIELD;                         <<02827>>61250000
<<Determine if process is preemptable by another process in>>  <<02827>>61255000
<<same queue.                                              >>  <<02827>>61260000
IF RESABORTINFO.USEDQUANTUMFLAG OR QUEUEINGINFO.LSCHEDFLAG     <<02827>>61265000
THEN TOS.PREEMPTOKFLAG:=1; <<ENABLE PREEMPTION>>                        61270000
DISPTOAWAKEMSG:=TOS;                                                    61275000
WAITTODISPMSG:=0;                                                       61280000
                                                                        61285000
IF PIFLAG THEN ICS'PDISABLEDCNT:=2; <<LAUNCH PDISABLED>>                61290000
PENABLE;  <<SERIES 33 REQUIRES>>                                        61295000
<<                                                                      61300000
ZERO OUT PROCESS CLOCK                                                  61305000
>>                                                                      61310000
                                                                        61315000
TOS:=0;                                                                 61320000
SETCLOCK;                                                               61325000
                                                                        61330000
<<                                                                      61335000
ARM CPU BOUND PROTECT INTERRUPT                                         61340000
>>                                                                      61345000
                                                                        61350000
IF PROCSTATE.SYSTEMPROCFLAG THEN TRLQTIME:=-1<<NO SYS TIMEOUT>><<06943>>61355000
ELSE TRLQTIME:=3; <<SET TIMEOUT FOR APPROX 300 MS>>            <<06943>>61360000
                                                                        61365000
<<                                                                      61370000
IXIT INTO THE PROCESS                                                   61375000
>>                                                                      61380000
                                                                        61385000
ASMB( IXIT );                                                           61390000
END;  <<SUBROUTINE LAUNCH>>                                             61395000
                                                                        61400000
                                                                        61405000
                                                                        61410000
$PAGE "DISPATCHER : DSP"                                                61415000
<<                                                                      61420000
MICROCODE LAUNCH POINT OF DISPATCHER-                                   61425000
EXTERNAL INTERRUPTS AND TRAPS ARE DISABLED,                             61430000
DB IS SET AT SYSDB                                                      61435000
>>                                                                      61440000
                                                                        61445000
PDISABLE;<<WE DON'T WANT THE DISPATCHER TO RESTART UNLESS               61450000
          HE HAS PAUSED.  THE DISPATCHER IS EXPLICITLY IN-              61455000
          FORMED OF MORE URGENT ACTIVITY THROUGH THE AWAKETO-           61460000
          DISP COMMUNICATIONS CELL. INSTEAD OF HAVING AWAKE             61465000
          DO A DISP TO RESTART THE DISPATCHER, DISPATCHER               61470000
          STAYS PDISABLED UNTIL LAUNCHING OR PAUSING, AND               61475000
          CHECKS AWAKE'S COMMUNICATIONS AT CONVENIENT TIMES             61480000
          TO SEE IF THERE'S SOMETHING MORE URGENT TO DO.>>              61485000
                                                                        61490000
<<                                                                      61495000
MAKE ROOM ON THE ICS FOR DISPATCHER'S LOCAL VARIABLES, INITIALIZE       61500000
>>                                                                      61505000
                                                                        61510000
ASMB(ADDS 51);  << FOR DISPATCHER LOCAL VARIABLES >>           <<06650>>61515000
                                                               <<01788>>61520000
<<FIGURE OUT IF THERE'S BEEN MEMORY PRESSURE LATELY>>          <<01788>>61525000
                                                               <<01788>>61530000
ASMB(RSW);  IF TOS = %100000 THEN HELP;                        <<07320>>61535000
TOS:=TRLDTIME1;                                                <<06943>>61540000
TOS:=TRLDTIME2;                                                <<06943>>61545000
CURRENTAPPROXTIME:=TOS;                                        <<01925>>61550000
TOS:=HOTIMELASTMAKEROOM;                                                61555000
TOS:=LOTIMELASTMAKEROOM;                                                61560000
LASTMAKEROOMAPPROXTIME:=TOS;                                            61565000
TOS:=0;                                                                 61570000
TOS:=MEMPRESSDUREXT;                                                    61575000
MEMPRESSINTERVAL:=TOS;                                                  61580000
IF CURRENTAPPROXTIME-LASTMAKEROOMAPPROXTIME < 0D               <<01788>>61585000
THEN MEMORYPRESSURE:=FALSE<<CLOCK ROLLOVER SINCE MAKEROOM>>    <<01788>>61590000
ELSE IF CURRENTAPPROXTIME-LASTMAKEROOMAPPROXTIME               <<01788>>61595000
< MEMPRESSINTERVAL THEN MEMORYPRESSURE:=TRUE <<RECENT MAKEROOM><<01788>>61600000
ELSE MEMORYPRESSURE:=FALSE;                                    <<01788>>61605000
IF CACHE'DST<>0 AND NBANKS >= 15                               <<06411>>61610000
THEN MEMORYPRESSURE:=FALSE;<<GO CHEAP IF CACHING ENABLED>>     <<06411>>61615000
                                                                        61620000
MEMPRESSURE'CELL := MEMORYPRESSURE;                            <<*7766>>61625000
ASMB(DZRO,DZRO);                                                        61630000
LASTPROCNEWPRIOFFSET:=TOS;                                              61635000
DONTDEALLOCATE:=TOS;                                                    61640000
PIFLAG:=TOS;                                                            61645000
QUANTUMOUT:=TOS;                                                        61650000
<<************************************>>                       <<06212>>61655000
                                                               <<06212>>61660000
<<************************************>>                       <<06212>>61665000
                                                               <<06212>>61670000
<<                                                                      61675000
INFORM SYSTEM THAT DISPATCHER IS RUNNING,NOT PAUSED                     61680000
>>                                                                      61685000
                                                                        61690000
TOS:=ABSOLUTE(CPCB);                                                    61695000
COMMENT : SETUP FOR CALL TO MMSTAT ( DONE HERE TO PRESERVE     <<04485>>61700000
 THE PIN OF THE LAST RUNNING PROCESS;                          <<04485>>61705000
                                                               <<04485>>61710000
ASMB(TEST);                                                    <<04485>>61715000
IF <> THEN                                                     <<04485>>61720000
   BEGIN                                                       <<04485>>61725000
   PCBPT := (CURPRC);                                          <<06650>>61730000
   MMSTAT'(MMSTATQUIESCE,RESABORTINFO,WAKEMASK,QUEUEINGINFO,   <<06948>>61735000
          0,0,0);                                              <<06948>>61740000
   END;                                                        <<04485>>61745000
                                                                        61750000
ASMB(ZERO,DZRO);                                                        61755000
TOS.DISPRUNNINGFLAG:=1;                                                 61760000
DISPTOAWAKEMSG:=TOS; <<==>DISPATCHER RUNNING,NOT PAUSED>>               61765000
CURPRC := TOS;                                                 <<06650>>61770000
TRLQTIME:=TOS; <<SET QTIME TO 0-DON'T WANT CLOCK INTERRUPTING>><<06943>>61775000
ENABLE;                                                                 61780000
                                                                        61785000
                                                                        61790000
<<                                                                      61795000
WHO WAS RUNNING LAST?                                                   61800000
>>                                                                      61805000
                                                                        61810000
ASMB(TEST);                                                             61815000
IF <> THEN                                                              61820000
   BEGIN <<A PROCESS WAS RUNNING>>                                      61825000
   IF S0=-1 THEN                                                        61830000
      BEGIN  <<SYSTEM JUST COMING UP>>                                  61835000
      ASMB(DEL);                                                        61840000
      LASTPROCINX := 0;                                        <<06650>>61845000
      INITIO(2); <<INITIALIZE SYSTEM DISC>>                             61850000
      STARTCLOCK(0,0D); <<GET CLOCK MOVING>>                   <<01770>>61855000
      END                                                               61860000
   ELSE                                                                 61865000
      BEGIN                                                             61870000
      LASTPROCINX := TOS;                                      <<06650>>61875000
      LASTSTKSYSBASEINX:=ICS'STKDST&LSL(2)+DSTSYSBASEINX;               61880000
      IF GCLASSENABLEDMASK.CLASS0 THEN                                  61885000
         BEGIN  <<MEASURE PROCESS BURST EVENT AND DURATION>>            61890000
         TOS:=MEASSTATXDSBANK;                                          61895000
         TOS:=MEASSTATXDSBASE;                                          61900000
         TOS:=TOS+C0SUB0'SEGRELOFF+C'LAUNCH;                   <<RAY.V>>61905000
         ASMB(LSEA);                                                    61910000
         TOS:=TOS+1;                                                    61915000
         ASMB(SSEA);  << CUM # OF LAUNCHES>>                            61920000
         TOS:=TOS-C'LAUNCH+C'CPUPROCESS;                       <<RAY.V>>61925000
         ASMB(LDEA);                                                    61930000
         ASMB(ZERO;RCLK);                                               61935000
         ASMB(DADD);                                                    61940000
         ASMB(SDEA;DDEL); <<CUM CPU TIME ON PROCESSES>>                 61945000
         END;                                                           61950000
      IF GCLASSENABLEDMASK.CLASS15 THEN                        <<01812>>61955000
         BEGIN <<CPU TIME & NUMBER OF LAUNCHES>>               <<01812>>61960000
         TOS:=MEASPROCXDSBANK;                                 <<01812>>61965000
         TOS:=MEASPROCXDSBASE;                                 <<01812>>61970000
         TOS:=TOS+(LASTPROCINX/PCBSIZE)*                       <<06650>>61975000
              CLASS15'SUB0SIZE+CP'LAUNCH;                      <<01812>>61980000
         ASMB(LSEA);                                           <<01812>>61985000
         TOS:=TOS+1;                                           <<01812>>61990000
         ASMB(SSEA);                                           <<01812>>61995000
         TOS:=TOS-CP'LAUNCH+CP'CPUTIME;                        <<01812>>62000000
         ASMB(LDEA);                                           <<01812>>62005000
         ASMB(ZERO;RCLK);                                      <<01812>>62010000
         ASMB(DADD;SDEA;DDEL);                                 <<01812>>62015000
         END;                                                  <<01812>>62020000
      END;                                                              62025000
   END                                                                  62030000
ELSE                                                                    62035000
   BEGIN <<SYSTEM WAS PAUSED>>                                          62040000
   LASTPROCINX:=TOS;                                                    62045000
   IF GCLASSENABLEDMASK.CLASS0 THEN                                     62050000
      BEGIN  <<MEASUREMENT ENABLED FOR THIS STATISTICS CLASS>>          62055000
      TOS:=MEASSTATXDSBANK;                                             62060000
      TOS:=MEASSTATXDSBASE;                                             62065000
      TOS:=TOS+C0SUB0'SEGRELOFF;                                        62070000
      IF LISTSTATE.PROCIMIFLAG AND LISTSTATE.PROCDISCIOFLAG             62075000
      THEN TOS:=TOS+C'PAUSEBOTHTIME <<PAUSE MM AND USER IO>>   <<RAY.V>>62080000
      ELSE IF LISTSTATE.PROCIMIFLAG THEN                       <<RAY.V>>62085000
           TOS:=TOS+C'PAUSESEGSWAPTIME                         <<06411>>62090000
      ELSE IF LISTSTATE.PROCDISCIOFLAG  THEN                   <<RAY.V>>62095000
           TOS:=TOS+C'PAUSEDISCTIME                            <<RAY.V>>62100000
      ELSE TOS:=TOS+C'PAUSEIDLETIME;                           <<RAY.V>>62105000
      ASMB(LDEA);                                                       62110000
      TOS:=TIMER-SAVEPAUSETIME;                                         62115000
      ASMB(DADD;SDEA;DDEL);  <<WHY ARE WE PAUSING>>                     62120000
      END;                                                              62125000
                                                                        62130000
   END;                                                                 62135000
                                                                        62140000
<<                                                                      62145000
IF A PROCESS WAS RUNNING, LOG ITS QUIESCE, SAVE ITS REGISTER            62150000
STATES, RESCHEDULE IT, ACCOUNT FOR AND UPDATE RESOURCE USAGE            62155000
>>                                                                      62160000
                                                                        62165000
PCBPT := LASTPROCINX;                                          <<06650>>62170000
IF <> THEN   <<IF = THEN DISPATCHER HAD BEEN PAUSED>>                   62175000
   BEGIN                                                                62180000
   TOS:=ICS'STKBANK;                                                    62185000
   TOS:=ICS'STKBASE;                                                    62190000
   LASTSTKADDR:=TOS;                                                    62195000
   SAVESTATE;                                                           62200000
   IF NOT PROCSTATE.SYSTEMPROCFLAG THEN RESCHEDULE ELSE        <<01913>>62205000
      BEGIN <<UPDATE CPU TIME USED FOR SYSTEM PROCESSES>>      <<01913>>62210000
      TOS:=LASTSTKADDR;                                        <<01913>>62215000
      TOS:=TOS+SBTOPROCTIMEDISP;                               <<01913>>62220000
      ASMB(LDEA;ZERO;RCLK;DADD;SDEA;DDEL);                     <<01913>>62225000
      END;                                                     <<01913>>62230000
   END;                                                                 62235000
                                                                        62240000
<<                                                                      62245000
DEVOTE THE CPU TO THE MOST URGENT PENDING ACTIVITY                      62250000
>>                                                                      62255000
                                                                        62260000
STARTSCANOVER:                                                          62265000
                                                                        62270000
ENABLE;                                                                 62275000
LISTSTATE:=MOREURGENTSWCNT:=0;                                          62280000
SWAPDELAY:=FALSE;                                                       62285000
SWAPFENCE:=WORSTPRI;                                                    62290000
CURRACTPRI:=0; <<MOST URGENT>>                                          62295000
                                                               <<01679>>62300000
<<CHECK FOR SCHEDULER MESSAGES>>                               <<01679>>62305000
                                                               <<01679>>62310000
CHECK'DISP'PORTSTATUS;                                         <<*7565>>62315000
IF <> THEN                                                     <<*7565>>62320000
BEGIN                                                          <<01679>>62325000
PROCESSSCHEDMSGS; <<PROCESS MSGS FROM ICS MONITORS>>                    62330000
IF <> THEN                                                     <<01557>>62335000
   BEGIN  <<COULDN'T FIT IN A SEG FOR THE I/O SYSTEM>>         <<01557>>62340000
   SWAPDELAY:=TRUE;  <<SET CLOCK TO CHECK LATER>>              <<01557>>62345000
   SWAPFENCE:=0;  <<DON'T SCHEDULE MEMORY FOR ANY PROCESSES>>  <<01557>>62350000
   END;                                                        <<01557>>62355000
END;                                                           <<01679>>62360000
                                                                        62365000
<<                                                                      62370000
SCAN THE DISPQ, WORK ON MOST URGENT PROCESS READY OR REQUIRING ATTENTION62375000
>>                                                                      62380000
                                                                        62385000
DISABLE;                                                                62390000
AWAKETOSCHEDMSG:=WORSTPRI;                                              62395000
CANDPROCINX:=DISPQHEAD;                                        <<01987>>62400000
WHILE CANDPROCINX <> 0 DO                                      <<01987>>62405000
   BEGIN <<LAUNCH OR SWAP-IN THE PROCESS>>                              62410000
   CANDPIN := CANDPROCINX/PCBSIZE;                             <<06650>>62415000
   IF PF <> 0 THEN       <<POWERFAIL RECOVERY IN PROGRESS>>    <<02096>>62420000
       IF CANDPIN <> (PPIN/PCBSIZE) THEN  <<NOT PFAIL PIN>>    <<02096>>62425000
          GO TO PFAIL;                                         <<02096>>62430000
                                                               <<02096>>62435000
   PCBPT :=  CANDPROCINX;                                      <<06650>>62440000
   TOS:=PROCSTATE.PIFLAGSFIELD;                                         62445000
   IF = THEN ASMB(DEL) ELSE                                             62450000
      BEGIN <<PENDING PSEUDO INTERRUPT>>                                62455000
      TOS:=TOS&LSL(9);                                                  62460000
      ASMB(SCAN 0;DEL);                                                 62465000
      IF X <> 4 AND X <> 3 THEN PCBPT:=CANDPROCINX ELSE        <<06650>>62470000
         BEGIN << 3==>STOP,4==> HYB >>                                  62475000
         PCBPT:=CANDPROCINX;                                   <<06650>>62480000
         IF NOT RESABORTINFO.CRITFLAG                                   62485000
         AND NOT RESABORTINFO.HASSIRFLAG THEN                           62490000
            BEGIN <<THROW HIM OUT>>                                     62495000
            QUEUEPROC(CANDPROCINX,NOQUEUE,NOINFO);                      62500000
            GO STARTSCANOVER;                                           62505000
            END;                                                        62510000
         END;                                                           62515000
      END;                                                              62520000
   IF NOT RESABORTINFO.PCBSHORTWAITFLAG AND WAKEMASK.(0:15)<>0 THEN     62525000
      BEGIN                                                             62530000
      QUEUEPROC(PCBPT,NOQUEUE,NOINFO);                         <<06650>>62535000
      GO STARTSCANOVER;                                                 62540000
      END;                                                              62545000
   IF WAKEMASK=0 THEN                                                   62550000
      BEGIN  <<PROCESS IS LAUNCHABLE>>                                  62555000
      LAUNCHPROCINX := PCBPT;                                  <<06650>>62560000
      ENABLE;                                                           62565000
      LAUNCH; <<NO RETURN>>                                             62570000
      END                                                               62575000
   ELSE                                                                 62580000
      BEGIN <<PROCESS NOT LAUNCHABLE>>                                  62585000
      IF NOT RESABORTINFO.SARFLAG THEN                                  62590000
         BEGIN  <<SOON LAUNCHABLE-DISC I/O OR SEGS ON WAY IN>>          62595000
         IF WAKEMASK.MEMORYWAKEFLAG THEN LISTSTATE.PROCIMIFLAG:=1       62600000
         ELSE LISTSTATE.PROCDISCIOFLAG:=1;                              62605000
         MOREURGENTSWCNT:=MOREURGENTSWCNT+1;                            62610000
         IF MEMORYPRESSURE THEN                                         62615000
            BEGIN                                                       62620000
            TOS := PCBPT;                                      <<06650>>62625000
            TOS:=0D;                                                    62630000
            TOS:=0D;                                           <<06660>>62635000
            ASMB(TSBC REFMINLOCBIT);                                    62640000
            ADJUSTLOCALITY(*,*,*,*);                                    62645000
            END;                                                        62650000
         CANDPROCINX:=NQPTR;  <<NEXT PROCESS TO CONSIDER>>     <<01987>>62655000
         END                                                            62660000
      ELSE                                                              62665000
         BEGIN  <<PROCESS NEEDS SOME MAIN MEMORY SCHEDULING>>           62670000
         IF(MEMORYPRESSURE LAND MOREURGENTSWCNT>=STATICMPLFENCE<<01913>>62675000
         LAND STATICMPLFENCE > 0)                              <<01987>>62680000
         LOR (INTEGER(QUEUEINGINFO).PRIFIELD >= SWAPFENCE) THEN<<01913>>62685000
            BEGIN <<NO ROOM FOR THIS PROCESS>>                          62690000
            CANDPROCINX:=NQPTR;<<NEXT PROC TO CONSIDER>>       <<01987>>62695000
            END                                                         62700000
         ELSE                                                           62705000
            BEGIN <<PROCESS REQUIRES SOME SEGMENTS>>                    62710000
            SWAPINPROCINX := PCBPT;                            <<06650>>62715000
            CURRACTPRI:=QUEUEINGINFO.PRIFIELD;                          62720000
            ENABLE;                                                     62725000
            TOS := 0;       << Return value from SWAPIN >>     <<06752>>62730000
            TOS:=SWAPINPROCINX;                                <<06411>>62735000
            TOS:=0;                                            <<06411>>62740000
            TOS.SWAPWAKEUP:=1;                                 <<06411>>62745000
            TOS.SWAPHARDREQUEST:=0;                            <<06411>>62750000
            TOS := SWAPIN(*,*);                                <<06752>>62755000
            SWAPSTATUS := TOS;                                 <<06752>>62760000
            IF SWAPSTATUS=MMOK THEN                            <<01987>>62765000
               BEGIN  <<SUCCESSFUL SWAP-IN>>                            62770000
               IF CURRACTPRI >= AWAKETOSCHEDMSG THEN           <<03766>>62775000
                  GO STARTSCANOVER;                            <<03766>>62780000
               MOREURGENTSWCNT:=MOREURGENTSWCNT+1; <<ON ITS WAY IN>>    62785000
               DISABLE; <<Q LINK INTEGRITY>>                            62790000
               CANDPROCINX:=NQPTR;<<NEXT  TO CONSIDER>>        <<01987>>62795000
               END                                                      62800000
            ELSE                                                        62805000
               BEGIN <<SWAPIN INCOMPLETE>>                              62810000
               IF SWAPSTATUS=MMIOERR THEN                      <<01987>>62815000
                  BEGIN <<DISC I/O ERROR-ABORT THE PROCESS>>            62820000
                  PCBPT := SWAPINPROCINX;                      <<06650>>62825000
                  ABORTPROCESS(SWAPINPROCINX,MAKEPRESIOERR);            62830000
                  GO STARTSCANOVER;                                     62835000
                  END                                                   62840000
               ELSE                                                     62845000
                  BEGIN                                                 62850000
                  IF AWAKETOSCHEDMSG < CURRACTPRI OR           <<06411>>62855000
                  SWAPSTATUS = MMPREEMPT THEN                  <<06411>>62860000
                     BEGIN <<MORE URGENT PENDING ACTIVITY>>             62865000
                     IF GCLASSENABLEDMASK.CLASS0 THEN                   62870000
                        BEGIN  <<MEASURE GIVEUP>>                       62875000
                        TOS:=MEASSTATXDSBANK;                           62880000
                        TOS:=MEASSTATXDSBASE;                           62885000
                        TOS:=TOS+C0SUB0'SEGRELOFF+C'GIVEUP;    <<RAY.V>>62890000
                        ASMB(LSEA;INCA;SSEA;DDEL);                      62895000
                        END;                                            62900000
                     GO STARTSCANOVER;                                  62905000
                     END                                                62910000
                  ELSE                                                  62915000
                     BEGIN  <<NO ROOM OR DELAY>>                        62920000
                     SWAPDELAY:=TRUE;                                   62925000
                     IF SWAPSTATUS<>MMSEGBUSY                  <<01987>>62930000
                     THEN SWAPFENCE:=QUEUEINGINFO.PRIFIELD;    <<01987>>62935000
                     IF MOREURGENTSWCNT <> 0                   <<01987>>62940000
                     OR SWAPSTATUS = MMSEGBUSY THEN            <<01987>>62945000
                        BEGIN <<CONTINUE ON>>                  <<01987>>62950000
                        IF GCLASSENABLEDMASK.CLASS0 THEN       <<02007>>62955000
                           BEGIN                               <<02007>>62960000
                           IF SWAPSTATUS=MMTHRASHDANGER THEN   <<02007>>62965000
                              BEGIN  <<MEAS SWAPIN DEFERRAL>>  <<02007>>62970000
                              TOS:=MEASSTATXDSBANK;            <<02007>>62975000
                              TOS:=MEASSTATXDSBASE;            <<02007>>62980000
                              TOS:=TOS+C0SUB0'SEGRELOFF+       <<02007>>62985000
                                   C'DEFERRAL;                 <<02007>>62990000
                              ASMB(LSEA);                      <<02007>>62995000
                              TOS:=TOS+1;                      <<02007>>63000000
                              ASMB(SSEA;DDEL);                 <<02007>>63005000
                              END;                             <<02007>>63010000
                           END;                                <<02007>>63015000
                        DISABLE;                                        63020000
                        PCBPT := CANDPROCINX;                  <<06650>>63025000
                        CANDPROCINX:=NQPTR;                    <<01987>>63030000
                        END                                             63035000
                     ELSE                                               63040000
                        BEGIN <<HAVE TO MAKE SPACE-NOONE ELSE WILL RUN>>63045000
                        SWAPSTATUS:=SWAPIN(SWAPINPROCINX,HARDSWAP);     63050000
                        IF SWAPSTATUS=MMOK                     <<01987>>63055000
                        OR AWAKETOSCHEDMSG < CURRACTPRI THEN   <<01987>>63060000
                           BEGIN                               <<RAY.V>>63065000
                           IF SWAPSTATUS=MMOK THEN             <<01987>>63070000
                              BEGIN                            <<RAY.V>>63075000
                              IF GCLASSENABLEDMASK.CLASS0 THEN <<RAY.V>>63080000
                                 BEGIN                         <<RAY.V>>63085000
                                 TOS:=MEASSTATXDSBANK;         <<RAY.V>>63090000
                                 TOS:=MEASSTATXDSBASE;         <<RAY.V>>63095000
                                 TOS:=TOS+C0SUB0'SEGRELOFF;    <<RAY.V>>63100000
                                 TOS:=TOS+C'HARDREQUEST;       <<RAY.V>>63105000
                                 ASMB(LSEA);                   <<RAY.V>>63110000
                                 TOS:=TOS+1;                   <<RAY.V>>63115000
                                 ASMB(SSEA;DDEL);              <<RAY.V>>63120000
                                 END;                          <<RAY.V>>63125000
                              END                              <<02007>>63130000
                           ELSE                                <<02007>>63135000
                              IF GCLASSENABLEDMASK.CLASS0 THEN <<02007>>63140000
                                 BEGIN <<MEASURE SWAPIN GIVEUP><<02007>>63145000
                                 TOS:=MEASSTATXDSBANK;         <<02007>>63150000
                                 TOS:=MEASSTATXDSBASE;         <<02007>>63155000
                                 TOS:=TOS+C0SUB0'SEGRELOFF+    <<02007>>63160000
                                      C'GIVEUP;                <<02007>>63165000
                                 ASMB(LSEA);                   <<02007>>63170000
                                 TOS:=TOS+1;                   <<02007>>63175000
                                 ASMB(SSEA;DDEL);              <<02007>>63180000
                                 END;                          <<02007>>63185000
                           GO STARTSCANOVER;                            63190000
                           END                                          63195000
                        ELSE                                   <<RAY.V>>63200000
                           BEGIN                               <<RAY.V>>63205000
                           CANDPROCINX:=0;                     <<01987>>63210000
                           SWAPDELAY:=TRUE;                    <<RAY.V>>63215000
                           END;                                <<RAY.V>>63220000
                        END;                                            63225000
                     END;                                               63230000
                  END;                                                  63235000
               END;                                                     63240000
            END;                                                        63245000
         END;                                                           63250000
      END;                                                              63255000
   END;                                                                 63260000
                                                                        63265000
                                                                        63270000
<<                                                                      63275000
NOBODY TO LAUNCH OR SWAP-IN, SO FIX UP MEMORY UNTIL A PROCESS           63280000
BECOMES ACTIVE OR SWAP DELAY EXPIRES                                    63285000
>>                                                                      63290000
                                                                        63295000
CURRACTPRI:=WORSTPRI;                                                   63300000
ENABLE;                                                                 63305000
IF LOGICAL(GARBCOLLENABLED) AND MEMORYPRESSURE THEN COLLECTGARBAGE(0D); 63310000
DISABLE;                                                                63315000
                                                               <<02096>>63320000
PFAIL:       <<ONLY SWAP IN AND LAUNCH POWERFAIL PROCESS>>     <<02096>>63325000
             <<DO NOT LAUNCH ANY ONE ELSE>>                    <<02096>>63330000
                                                               <<02096>>63335000
IF AWAKETOSCHEDMSG < CURRACTPRI THEN GO STARTSCANOVER ELSE     <<03766>>63340000
   BEGIN  <<NOTHING WORTHWHILE TO DO, SO PAUSE>>                        63345000
   IF SWAPDELAY THEN TRLQTIME:=1; <<ALARM CLOCK>>              <<06943>>63350000
   TOS:=0;                                                              63355000
   TOS.DISPRUNNINGFLAG:=1;                                              63360000
   TOS.PAUSEDFLAG:=1;                                                   63365000
   DISPTOAWAKEMSG:=TOS;                                                 63370000
   PENABLE;  <<WILL CAUSE DISPATCHER TO START OVER AFTER NEXT DISP>>    63375000
                                                                        63380000
   IF GCLASSENABLEDMASK.CLASS0 THEN                                     63385000
      BEGIN  <<MEASUREMENT ENABLED FOR THIS STATISTICS CLASS>>          63390000
      SAVEPAUSETIME:=TIMER;                                             63395000
      TOS:=MEASSTATXDSBANK;                                             63400000
      TOS:=MEASSTATXDSBASE;                                             63405000
      TOS:=TOS+C0SUB0'SEGRELOFF;                                        63410000
      IF DISPQHEAD=0 THEN TOS:=TOS+C'PAUSEIDLECNT              <<RAY.V>>63415000
      ELSE IF LISTSTATE.PROCIMIFLAG AND LISTSTATE.PROCDISCIOFLAG        63420000
      THEN TOS:=TOS+C'PAUSEBOTHCNT                             <<RAY.V>>63425000
      ELSE IF LISTSTATE.PROCIMIFLAG THEN                       <<RAY.V>>63430000
           TOS:=TOS+C'PAUSESEGSWAPCNT                          <<06411>>63435000
      ELSE IF LISTSTATE.PROCDISCIOFLAG THEN                    <<RAY.V>>63440000
           TOS:=TOS+C'PAUSEDISCCNT;                            <<RAY.V>>63445000
      ASMB(LSEA);                                                       63450000
      TOS:=TOS+1;                                                       63455000
      ASMB(SSEA;DDEL);  <<WHY ARE WE PAUSING>>                          63460000
      END;                                                              63465000
                                                                        63470000
   ENABLE;                                                              63475000
                                                               <<02091>>63480000
PAUSELOOP:                                                     <<02091>>63485000
IF ICS(-ICS'PDISCNTCELL) <> 0 THEN                             <<02091>>63490000
   COMMENT:  The purpose of the following code is to cover up  <<k7563>>63495000
             a pdisable problem in which an interrupt handler  <<k7563>>63500000
             appears to execute a pdisable without a           <<k7563>>63505000
             corresponding penable.  This strange problem      <<k7563>>63510000
             always appears to leave the pdisable count at 1.  <<k7563>>63515000
             If this condition is met, we shall execute a      <<k7563>>63520000
             penable on behalf of the defective software       <<k7563>>63525000
             [a small prayer is in order here] and continue    <<k7563>>63530000
             execution (SOFT'DEATH will log this event). ;     <<k7563>>63535000
                                                               <<k7563>>63540000
   IF ICS(-ICS'PDISCNTCELL) = 1 THEN                           <<k7563>>63545000
      BEGIN                                                    <<k7563>>63550000
      PENABLE;  <<It's a miracle>>                             <<k7563>>63555000
      SOFT'DEATH(634);                                         <<k7563>>63560000
      END                                                      <<k7563>>63565000
   ELSE                                                        <<k7563>>63570000
      SUDDENDEATH(634);     <<Leave the SF hook in>>           <<k7563>>63575000
                                                               <<*7565>>63580000
<< The following code has been inserted to catch a pending   >><<*7565>>63585000
<< dispatcher message (usually a cache move request) that we >><<*7565>>63590000
<< never see. This problem began with the newly rewritten    >><<*7565>>63595000
<< message facility. If the reason for the pending message is>><<*7565>>63600000
<< ever fixed, this code should be removed.                  >><<*7565>>63605000
                                                               <<*7565>>63610000
   CHECK'DISP'PORTSTATUS;                                      <<*7565>>63615000
   IF <> OR AWAKETOSCHEDMSG < CURRACTPRI THEN                  <<*7565>>63620000
      BEGIN                                                    <<*7565>>63625000
      DISABLE;                                                 <<*7565>>63630000
      PDISABLE;                                                <<*7565>>63635000
      DISPTOAWAKEMSG.PAUSEDFLAG := 0;                          <<*7565>>63640000
      GO STARTSCANOVER;                                        <<*7565>>63645000
      END                                                      <<*7565>>63650000
   ELSE                                                        <<*7565>>63655000
   ASSEMBLE(PAUS);                                             <<02091>>63660000
   GO TO PAUSELOOP;                                            <<02091>>63665000
                                                               <<02091>>63670000
   HELP;                                                                63675000
   END;                                                                 63680000
END  <<DSP>>;                                                           63685000
                                                                        63690000
                                                                        63695000
$CONTROL SEGMENT=MAIN                                                   63700000
END  <<KERNELC>>.                                                       63705000
