-- PilotKernelPack.pack

-- This file specifies the code pack merging for all of PilotKernel.

-- Yokota March 23, 1981  6:07 PM  DiskDrivers.AltoFileInterlock is put into DISCARD CODE PACK (DiscardAltoFileInterlock). VMMgr.SpaceCreate and SpaceDelete are put into a separate code pack (SpaceCreateDelete). MesaRuntime.ProcessesHot is moved to ResidentCool. UserTerminalDriver.ResidentCool is added to ResidentCool. Packs in ResidentCool are rearranged.
-- Knutsen  February 18, 1981  12:50 PM  Added new code pack HighStoreResident.  Renamed code segments.
-- Gobbel  January 31, 1981  11:04 AM  Created from old TestPilotPack.pack
-- Knutsen  January 22, 1981  7:01 AM  New pack MesaRuntime.Traps.  Renamed code packs Frame* to FrameImpl*.  FrameImpl GFrame now resident.  Moved ResidentCool to be second.  Sorted swappable non-Store code packs by config name (only) [careful here!].  Improved documentation.
-- Gobbel  January 19, 1981  4:28 PM  Created ResidentCool code pack.  Deleted VMMgrCommon code pack.  Added MapLogging code pack.
-- Levin  28-Apr-82 11:58:25  Flush DiskDrivers.AltoFileInterlock

-- THE ORDER OF THE CODE PACKS BELOW IS CRUCIAL.
-- DO NOT REARRANGE THE ORDER OF ANYTHING UNLESS YOU
-- ARE SURE OF THE CONSEQUENCES.  In general, new packs will probably be
-- be placed later in the sequence, rather than earlier.

-- This file is used to merge all of the other CODE packaging specifications
-- so as minimize breakage.  This file is used as the next to the last .pack
-- file in the collection of files concatenated into the final packaging
-- specification.  (PilotKernelFrames.pack must be last.)

ResidentAndLowStore: SEGMENT
  MERGES Control, DiskDrivers, Filer, MesaRuntime, Misc,
             Swapper, UserTerminalDriver =
-- All resident code must go in this segment.  Swappable code from the rest
-- of Pilot (excluding FileMgr, Transactions, and VMMgr) goes here too.
BEGIN

Resident: CODE PACK =  -- must be first!
  -- This pack merges all of the resident code of the modules in this segment which goes in PrincOps real memory:
  BEGIN
  Control.ResidentSystem;
  DiskDrivers.Resident;
  Filer.Resident;
  MesaRuntime.Resident;
  -- Misc.Resident; Misc.Resident is moved to ResidentCool
  Swapper.Resident;
  UserTerminalDriver.Resident;
  END;

ResidentCool: CODE PACK =  -- must be second!
   -- This pack merges all of the resident code of the modules in this segment which goes in non-PrincOps real memory:
  BEGIN
  -- The order has been chosen to ensure that the COLDEST procedures end up in
  -- regular memory in case the display bank overflows.  This permits "easy"
  -- detection of performance problems related to executing out of the display bank.
  Swapper.ResidentCool;
  Misc.ResidentCool;
  MesaRuntime.ResidentCool;
  Filer.ResidentCool;
  MesaRuntime.ProcessesHot;  -- Since Star often uses these procedures
  UserTerminalDriver.ResidentCool;
  Control.ResidentCool;
  DiskDrivers.ResidentCool;
  END;


-- Swappable code packs for everything but FileMgr, Transactions, and VMMgr:

-- FOR A GIVEN CONFIG, THE ORDER IN WHICH THE PACKS ARE
--    MENTIONED IS IMPORTANT!
-- Place new packs together with the other packs of the same
--    config.  (If there are cross-config code packs, this rule will be violated.)
Control.SwappableSystem;
DiskDrivers.SwappableDiskDrivers;
Filer.LabelHacking;
MesaRuntime.FrameImplHot;
MesaRuntime.FrameImplCold;
-- MesaRuntime.ProcessesHot; ProcessesHot is put into ResidentCool
MesaRuntime.ProcessesCold;
MesaRuntime.InLoadOutLoad;
MesaRuntime.Signals;
MesaRuntime.SnapshotMisc;
MesaRuntime.Traps;
Misc.Nodes;
Misc.ByteBlt;
Misc.HeapPruning;
Misc.Attributes;
Misc.CreateDelete;
Misc.Recreating;
Misc.Checking;
Misc.Streams;
Swapper.SwappableSwapperHot;
Swapper.SwappableSwapperWarm;
UserTerminalDriver.UserTerminalDriverSwappable;

ResidentInitialization: CODE PACK =
  BEGIN
  Control.Initialization;
  DiskDrivers.Initialization;
  Filer.Initialization;
  MesaRuntime.Initialization;
  Misc.Initialization;
  Swapper.Initialization;
  UserTerminalDriver.Initialization
  END;

END; --of segment ResidentAndLowStore--

HighStore: SEGMENT
        MERGES FileMgr, Transactions, VMMgr =
-- This segment merges all of the code in the FileMgr, Transactions, and VMMgr configs.
BEGIN
  
FileMgr.FileHelperProcess;  -- should be first!

VMMHelperProcess: CODE PACK =  -- should be second!
  { VMMgr.VMMHelperProcess;
    FileMgr.VMMHelperProcs };

FileMgr.FileAttributes;
FileMgr.FileSetSize;
FileMgr.VFMChangingSize;
FileMgr.FileCreate;
FileMgr.FileDelete;
FileMgr.OtherFileStuff;
FileMgr.Volume;
FileMgr.PhysicalVolume;
FileMgr.Othello;
FileMgr.Scavenger;
VMMgr.SpaceOpsCommon;
VMMgr.SpaceMap;
VMMgr.SpaceUnmap;
VMMgr.SpaceCopying;
VMMgr.SpaceRemap;
VMMgr.SpaceStatusOps;
VMMgr.SpaceCodeHacking;
VMMgr.SpaceMisc;

SpaceCreateDelete: CODE PACK =  -- Star uses space Create & Delete in a short time.
  { VMMgr.SpaceCreate; VMMgr.SpaceDelete; };

TransactionsRunning: CODE PACK =
  { FileMgr.TransactionRelatedRunning;
    Transactions.RunningTransaction;
    VMMgr.SpaceTransactions };

TransactionsCommon: CODE PACK =
-- Merged from AbortBeginCommitCommon, BegTransaction, Commit,
-- VMMgr.SpaceTransactions.  This assumes that commiting a transacion is the
-- normal mode of operation and that aborting is "rare".
  { Transactions.AbortBeginCommitCommon;
    Transactions.BeginTransaction;
    Transactions.Commit };

TransactionsAborting: CODE PACK =
  { FileMgr.TransactionRelatedAborting;
    Transactions.Abort };

MapLogging: CODE PACK =
  { FileMgr.FileMapLogging;
    VMMgr.SpaceMapLogging };

FileMgr.FileMgrInitialization;
Transactions.TransactionsInitialization;
VMMgr.VMMgrInitialization;

HighStoreResident: CODE PACK =
  -- Contrary to usual practice, this resident code pack is placed *last* so as not to pin the entry vectors of their procedures.  (See notes in e.g. VMMgrPack.pack.)
  { --FileMgr.FileMgrResident;
    VMMgr.VMMgrResident };

END; --of segment HighStore--