         << LINES .001/.009 ARE RESERVED FOR SYSTEMS INTEGRATION >>     00000001
                                                               <<09412>>00090010
<< PVPROC started after SYSUP set.  Allows AVRing of SDISCs  >><<09412>>00090020
<< which were on line when system came up.                   >><<09412>>00090030
                                                               <<09412>>00090040
INTEGER ECHOSTATE;                                             << 9331>>01386000
DEFINE   CPUNUM   = ASSEMBLE(PCN)#,      << Get CPU number >>  <<*9383>>01545000
         PMBCFIRMWARE = ABSOLUTE(%1220).(14:1)#;               <<*9383>>01546000
        No'Records           = 1015, << No records in file.  >><<s9115>>01850000
        Nothing'to'do        = 1016  << No block for startup >><<s9115>>01855000
                                     << or this startup type.>><<s9115>>01857500
        ;                                                      <<s9115>>01860000
                                                               <<s9115>>01862500
    INTEGER ARRAY Filenums ( 0:1 );                            <<s9115>>01940500
    << Used for storing file numbers in Fopen'Kludge.        >><<s9115>>01941000
                                                               <<s9115>>01941500
$EDIT VOID=07950000                                            <<s9115>>07950000
$EDIT VOID=10090000                                            <<s9115>>10015000
$Page "System Startup Processor - Fopen'kludge"                <<s9115>>10016000
$Control Segment=Called'once                                   <<s9115>>10017000
                                                               <<s9115>>10018000
PROCEDURE Fopen'kludge ( Fnums );                              <<s9115>>10019000
INTEGER ARRAY Fnums;                                           <<s9115>>10020000
BEGIN                                                          <<s9115>>10021000
                                                               <<s9115>>10022000
<< This procedure and its companion Fclose'kludge            >><<s9115>>10023000
<< exist because of a problem in the file system.            >><<s9115>>10024000
<< Normal user and CI processes have $Stdin and              >><<s9115>>10025000
<< $Stdlist as file numbers 1 and 2.                         >><<s9115>>10026000
<< But system processes do not have real $Stdin's            >><<s9115>>10027000
<< and $Stdlists. This mostly is hidden away                 >><<s9115>>10028000
<< from the user because the Read and Print                  >><<s9115>>10029000
<< intrinsics have a horrible kludge inside them             >><<s9115>>10030000
<< to make them appear as if system processes                >><<s9115>>10031000
<< really do have these files. Now when a system             >><<s9115>>10032000
<< process opens its first file it gets file                 >><<s9115>>10033000
<< number 1 which is generally reserved for $Stdin.          >><<s9115>>10034000
<< As long as the system process stays in                    >><<s9115>>10035000
<< priviledge mode, the file system will not                 >><<s9115>>10036000
<< interfere. As soon as the user switches                   >><<s9115>>10037000
<< to user mode, the file system will not let the            >><<s9115>>10038000
<< user access the file even though he obtained              >><<s9115>>10039000
<< the file number through legitimate means.                 >><<s9115>>10040000
<< Unfortunately, the file system doesn't check              >><<s9115>>10041000
<< to see how the file number was obtained in the            >><<s9115>>10042000
<< first place. The chief offender is the procedure          >><<s9115>>10043000
<< Loc'Acb.                                                  >><<s9115>>10044000
                                                               <<s9115>>10045000
<< In order to get around this mess for now,                 >><<s9115>>10046000
<< this procedure sucks up two file numbers,                 >><<s9115>>10047000
<< to ensure that system startup state will                  >><<s9115>>10048000
<< work with file numbers greater than 2.                    >><<s9115>>10049000
<< When system startup is all done, the procedure            >><<s9115>>10050000
<< Fclose'kludge is called to give the file                  >><<s9115>>10051000
<< numbers back.                                             >><<s9115>>10052000
                                                               <<s9115>>10053000
  INTEGER Index, Num;                                          <<s9115>>10054000
                                                               <<s9115>>10055000
  FOR Index := 0 UNTIL 1 DO                                    <<s9115>>10056000
  BEGIN                                                        <<s9115>>10057000
                                                               <<s9115>>10058000
    << Get two file numbers (hopefully 1 and 2               >><<s9115>>10059000
    << by Fopening $null.                                    >><<s9115>>10060000
                                                               <<s9115>>10061000
    Fnums ( Index ) := 0;                                      <<s9115>>10062000
    Num := Fopen ( , %60 ); << No-name, $Null >>               <<s9115>>10063000
    IF = THEN                                                  <<s9115>>10064000
      Fnums ( Index ) := Num;                                  <<s9115>>10065000
                                                               <<s9115>>10066000
  END;                                                         <<s9115>>10067000
END;                                                           <<s9115>>10068000
                                                               <<s9115>>10069000
$Control Segment=Called'once                                   <<s9115>>10070000
PROCEDURE Fclose'kludge ( Fnums );                             <<s9115>>10071000
INTEGER ARRAY Fnums;                                           <<s9115>>10072000
BEGIN                                                          <<s9115>>10073000
                                                               <<s9115>>10074000
  << Fclose the $Null files opened earlier.                  >><<s9115>>10075000
                                                               <<s9115>>10076000
  INTEGER Index;                                               <<s9115>>10077000
                                                               <<s9115>>10078000
  FOR Index := 0 UNTIL 1 DO                                    <<s9115>>10079000
    IF Fnums ( Index ) <> 0 THEN                               <<s9115>>10080000
      Fclose ( Fnums ( Index ) , 0, 0);                        <<s9115>>10081000
                                                               <<s9115>>10082000
END;                                                           <<s9115>>10083000
                                                               <<s9115>>10085000
$Page "System Startup Processor - Process'Startup"             <<s9115>>10085500
                                                               <<s9115>>10086000
<< ========================================================= >><<s9115>>10086500
<< ======          Procedure Process'Startup          ====== >><<s9115>>10087000
<< ========================================================= >><<s9115>>10087500
                                                               <<s9115>>10088000
PROCEDURE Process'Startup;                                     <<s9115>>10088500
                                                               <<s9115>>10089000
Comment                                                                 10089500
                                                                        10090000
This is the main procedure (i.e. that one which is called from          10090500
PROGEN's main program) of those set of procedures which process         10091000
the System Startup Configurator file.  This file, SYSSTART.PUB.SYS      10091500
contains commands which are executed before a session is                10092000
logged onto the console. Note that due to the programmatic              10092500
    Fopen'kludge ( Filenums );                                 <<s9115>>10260500
                                                               <<s9115>>10261000
      Find'keywords( Start'File'No, Start'Up'Option,           <<s9115>>10286000
                     Startup'Record, Type'Record );            <<s9115>>10287000
$EDIT VOID=10295000                                            <<s9115>>10290000
                                                               <<s9115>>10291000
      IF Startup'Record = -1D AND Type'Record = -1D            <<s9115>>10292000
      THEN                                                     <<s9115>>10293000
                                                               <<s9115>>10294000
        << On this particular startup there is no startup    >><<s9115>>10295000
        << block and no block for this startup type. But     >><<s9115>>10296000
        << the file exists and is valid. So we have already  >><<s9115>>10297000
        << printed the message indicating we have started    >><<s9115>>10298000
        << processing. This message explains that nothing    >><<s9115>>10299000
        << will happen this time.                            >><<s9115>>10300000
                                                               <<s9115>>10301000
        Genmsg ( Sysset, Nothing'to'do)                        <<s9115>>10302000
                                                               <<s9115>>10303000
      ELSE                                                     <<s9115>>10304000
      BEGIN                                                    <<s9115>>10305000
$EDIT VOID=10310000                                            <<s9115>>10310000
        IF Startup'Record <> -1d  THEN                         <<s9115>>10311000
        BEGIN                                                  <<s9115>>10312000
          Print'Block'Type ( T'Startup );                      <<s9115>>10313000
          Process'Block ( Start'File'No, Startup'Record );     <<s9115>>10315000
        END;                                                   <<s9115>>10320000
        IF Type'Record <> -1d   THEN                           <<s9115>>10330000
        BEGIN                                                  <<s9115>>10335000
          Print'Block'Type ( Start'Up'Option );                <<s9115>>10340000
          Process'Block ( Start'File'No, Type'Record );        <<s9115>>10345000
        END;                                                   <<s9115>>10350000
                                                               <<s9115>>10352500
      END;                                                     <<s9115>>10353000
                                                               <<s9115>>10411000
    Fclose'kludge ( Filenums );                                <<s9115>>10412000
$EDIT VOID=21105000                                            <<p9114>>20930000
M'Mouse := THISCPU = CPU'MM; << Is it a Mouse ?              >><<p9114>>21237500
IF PMBCFIRMWARE                                                <<*9383>>21260000
   THEN INIT'PMBCREGS;                                         <<*9383>>21265000
$EDIT VOID=21320000                                            <<09412>>21320000
$EDIT VOID=21340000                                            <<09412>>21340000
          AWAKE(ABSYS'PVPROC,1,2);                             <<09412>>21365010
          INITRECLOG;                                          <<09412>>21365020
                                                               <<p9114>>21365050
<< The following fix was requested by the Mighty Mouse       >><<p9114>>21365100
<< Microcode Team. We execute the OSSIG instruction to       >><<p9114>>21365150
<< signal the Mighty Mouse micro machine that MPE            >><<p9114>>21365200
<< is fully up and all is right with the world.              >><<p9114>>21365250
<< How this instruction is used depends on the version       >><<p9114>>21365300
<< of microcode and who last modified OSSIG.                 >><<p9114>>21365350
<< The last time I talked to the microcoders, this           >><<p9114>>21365400
<< instruction did only one thing. Over the last year        >><<p9114>>21365450
<< this instruction has been responsible for other stuff     >><<p9114>>21365500
<< too. At the time of writing, OSSIG 3 is MPE's signal      >><<p9114>>21365550
<< to microcode that MPE is up far enough to do a            >><<p9114>>21365600
<< power failure recovery. If a power failure occurs         >><<p9114>>21365650
<< the firmware will never return to MPE but go straight     >><<p9114>>21365700
<< to the console with the H for Help dialogue.              >><<p9114>>21365750
<< If the OSSIG has been done, microcode will present        >><<p9114>>21365800
<< a powerfail trap through ININ and MPE gets a chance to    >><<p9114>>21365850
<< leave things in a nicely recoverable fashion.             >><<p9114>>21365900
<< The absolute source of what OSSIG does is the             >><<p9114>>21365950
<< microcode listing. OSSIG operation is not documented      >><<p9114>>21366000
<< elsewhere.                                                >><<p9114>>21366050
                                                               <<p9114>>21366100
IF M'Mouse THEN                                                <<p9114>>21366150
BEGIN                                                          <<p9114>>21366200
                                                               <<p9114>>21366250
   TOS := 3; << Parameter to OS-SIGNAL                       >><<p9114>>21366300
                                                               <<p9114>>21366350
   ASSEMBLE ( CON %20104;                                      <<p9114>>21366400
              CON %   23 );                                    <<p9114>>21366450
   << This is the OS-SIGNAL instruction.                     >><<p9114>>21366500
   << Power failure recovery is now enabled.                 >><<p9114>>21366550
END;                                                           <<p9114>>21366600
        << Get the LPDT entry for the console and turn the  >> << 9117>>21695000
        << LOGGING on bit off and the device owned state to >> << 9117>>21695100
        << free (both values set in CHECK'TERM'ATTRIBUTES)  >> << 9117>>21695200
        LPDT'INDEX := INTEGER( CONSOLELDEV ) *                 << 9117>>21695300
                      INTEGER( LPDT'ENTRY'SIZE );              << 9117>>21695400
        LPDT'LOGGING'ON := 0;                                  << 9117>>21695500
        LPDT'DEV'OWN'STATE := LPDT'NOT'OWNED;                  << 9117>>21695600
        << The console must be DCLOSE'd to free the device  >> << 9117>>21696000
         << TURN ON ECHO INCASE WE HAVE A PROGRAMMATICALLY   >><< 9331>>21810100
         << CREATED SESSION THAT HAS TURNED IT OFF.          >><< 9331>>21810200
           TOS := ATTACHIO(CONSOLELDEV,0,0,0,%10,0,0,0,1);     << 9331>>21811000
           ECHOSTATE := TOS;                                   << 9331>>21812000
           ASSEMBLE(DEL);                                      << 9331>>21813000
         IF ECHOSTATE = 1 << ECHO WAS OFF >>                   << 9331>>21821000
            THEN ATTACHIO(CONSOLELDEV,0,0,0,%11,0,0,0,1);      << 9331>>21822000
