-- ControlPack.pack

-- Yokota  March 23, 1981  10:37 AM  GetGreenwichMeanTime is moved from SwappableSystem to ResidentCool.
-- McJones  February 4, 1981  6:44 PM  Eliminate control-z's
-- Gobbel  January 31, 1981  11:18 AM  Add ResidentCool pack (reserved memory handle); add SystemImpl.InitializeLocalTimeParameters to Initialization; delete frames

Control: SEGMENT =
  BEGIN

  ResidentSystem: CODE PACK =
    {SystemImpl  [InitializeUIDCleanup]}; -- A cleanup procedure

  ResidentCool: CODE PACK = -- reserved memory handle only
    -- GetGreenwichMeanTime is moved here since Star uses it often
    {PilotControl [ReservedMemoryHandle]; SystemImpl [GetGreenwichMeanTime]};

  SwappableSystem: CODE PACK =
    {SystemImpl EXCEPT Initialization, ResidentCool, ResidentSystem};

  Initialization: CODE PACK =
    BEGIN
    PilotControl EXCEPT ResidentCool;
    SystemImpl [InitializeLocalTimeParameters];
    SystemImpl [MAIN];
    END;

END;
-- FileMgrPack.pack

-- Yokota  March 23, 1981  11:38 AM  GetLabelString is moved from FileHelperProcess to Volume, and GetSavedLocalTimeParameters is moved from FileAttributes to PhysicalVolume.
-- McJones  January 31, 1981  11:19 AM  {Get, Set}LocalTimeParameters; diddle Scavenger; delete frames
-- Gobbel  January 13, 1981  3:36 PM  (previous edit)
-- Levin	August 26, 1982 3:42 pm	ReplicateImmutable now separate from Move.

FileMgr: SEGMENT =
BEGIN

FileHelperProcess: CODE PACK =
  BEGIN
  FileImpl [FileHelperProcess, GetFileDescriptorSignals, GetFileDescriptor];
  VolAllocMapImpl [Close];
  VolFileMapImpl [Close, ContextSet, Find, Get, GetPageGroup, Lower,
    ReadNext];
    -- We include GetAttributes, GetLabelString, GetLogicalRootPage and
    -- GetStatus here as they fit and are (or are presumed to be) called
    -- frequently in the development environment
  VolumeImpl [Activate, Deactivate, GetAttributes, GetLogicalRootPage, GetNext,
    GetStatus, LogicalVolumeFind, LVGetEntryPointer, LVGetStatus, VolumeAccess];
   END;

VMMHelperProcs: CODE PACK =
  {FileImpl [GetFileAttributes]};

VFMChangingSize: CODE PACK =
  BEGIN
  VolAllocMapImpl [AccessVAM, AllocPageGroup, FreePageGroup];
  VolFileMapImpl [CreateVPage, Delete, DeletePageGroup, FreeVPage, Insert,
      InsertPageGroup, Merge, PutNext, Split, Xtra];
  END;

FileCreate: CODE PACK =
  {FileImpl [Create, CreateWithID, CreateWithIDExternal, CreateWithIDInternal,
      TmpsEnter, TmpsGet, TmpsGrow]};

FileDelete: CODE PACK =
  {FileImpl [Delete, DeleteCommon, DeleteFileOnVolumeInternal,
    DeleteImmutable, TmpsRemove]};

FileSetSize: CODE PACK =
  {FileImpl [SetSize, SetSizeInternal]};

FileAttributes: CODE PACK =
  BEGIN
  FileImpl [ChangeAttributes, ChangeAttributesInternal, GetAttributes,
    GetSize, MakeImmutable, MakePermanent];
  -- The following should be in a small cold PhysicalVolume pack (it is used once/boot), but it fits here:
  END;

FileMapLogging: CODE PACK =
  {FileImpl [GetBootLocation, GetFilePoint, GetVIDAndGroup]};

OtherFileStuff: CODE PACK =
  {FileImpl [IsOnVolume, MakeBootable,
    MakeBootableOrUnbootable, MakeUnbootable, SetDebuggerFiles]};

TransactionRelatedRunning: CODE PACK =
  {FileImpl [LogContents, TxSetSize]};

TransactionRelatedAborting: CODE PACK =
  {FileImpl [MakeMutable, MakeTemporary, TxCreate, TxMakePerm]};

Scavenger: CODE PACK =
  BEGIN
  ScavengeImpl EXCEPT [Initialize, MAIN];
  VolFileMapImpl [InitMap];
  VolumeImpl [BeginScavenging, EndScavenging];
  END;

Volume: CODE PACK =
  BEGIN
  FileImpl [CloseVolumeAndFlushFiles, DeleteTempsInternal,
    DeleteTmpsInternalNew, DeleteTmpsInternalOld, OpenVolumeAndDeleteTemps];
  VolFileMapImpl [GetNextFile];
  VolumeImpl [Close, CloseLogicalVolume, GetLabelString, GetRootFile, IsOnServer, Open,
    OpenLogicalVolume, OpenLogicalVolumeInternal, OpenVolume, PutRootFile,
    SetRootFile, SignalVolumeAccess];
  END;

PhysicalVolume: CODE PACK =
  BEGIN
  MarkerPageImpl [Enter, EnterMarkerID, Find, FindInternal, Flush];
  PhysicalVolumeImpl [AssertNotAPilotVolume, AssertPilotVolume,
    AwaitStateChange, CheckPhysicalRootLabel, DriveSize,
    FinishWithNonPilotVolume, GetAttributes, GetDrive, GetHandle, GetHints,
    GetNext, GetNextDrive, GetNextLogicalVolume, GetPVDrive,
    GetSavedLocalTimeParameters, InterpretHandle,
    IsReady, Offline, PhysicalRootPageAccess, PhysicalRootPageAccessInternal,
    PhysicalRootPageCheck, PhysicalRootPageMap, PhysicalRootPageUnmap,
    PhysicalVolumeOffLineInternal, PhysicalVolumeOnLineInternal,
    RegisterPvInfo, RegisterSubvolumeMarker, SetSavedLocalTimeParameters, ValidateDrive];
  VolumeImpl [CheckLogicalVolume, EnterLV, FindLogicalVolume, GetLVStatus,
    LogicalVolumeCheck, LogicalVolumeDebuggerCheck, LogicalVolumeLike,
    LogicalVolumeOffLine, LVDecrementPieceCount, PinnedFileEnter,
    PinnedFileFlush, ReadAndCheckLogicalRootLabel, RegisterLogicalSubvolume,
    RegisterVFiles, SubvolumeOffline, SubvolumeOnline, UnregisterVFiles,
    VFileEnter];
  END;

Othello: CODE PACK =
  BEGIN
  MarkerPageImpl [CreateMarkerPage, GetNextPhysicalVolume, MarkerPageMap,
    MarkerPageUnmap, UpdateLogicalMarkerPages, UpdatePhysicalMarkerPages];
  PhysicalVolumeImpl [AccessPhysicalVolumeRootPage, CreateLogicalVolume,
    CreatePhysicalVolume, EraseLogicalVolume, GetContainingPhysicalVolume,
    GetNextBadPage, GetNextSubVolume, GetPhysicalVolumeAttributes,
    GetPhysicalVolumeBootFiles, GetSubVolumeAttributes, MarkPageBad,
    SetPhysicalVolumeBootFiles];
  VolumeImpl [DriveSize, GetContainingPhysicalVolume,
    GetLogicalVolumeBootFiles, GetType, LogicalVolumeCreate,
    LogicalVolumeErase, SetLogicalVolumeBootFiles];
  END;

FileMgrInitialization: CODE PACK =
  BEGIN
  -- Pin is only called by PilotControl. Move and ReplicateImmutable are
  -- here only since they are unimplemented.
  FileImpl [InitializeFileMgr, MAIN, Move, Pin, ReplicateImmutable];
  MarkerPageImpl [MAIN];
  PhysicalVolumeImpl [InitDisks, MAIN];
  ScavengeImpl [Initialize, MAIN];
  VolAllocMapImpl [MAIN];
  VolFileMapImpl [MAIN];
  VolumeImpl [OpenInitialVolumes, MAIN];
  END;
END;
-- FilerPack.pack
-- Last edit by:
-- Yokota  March 23, 1981  9:55 AM  FCacheCleanUp, RemoveCacheEntry, SetFile, SetCacheEntry, SetPageGroup, Await, Report, Log and HandleError are moved from Resident to ResidentCool.

-- Gobbel  January 31, 1981  11:30 AM  Moved frame packs into PilotKernelFrames.pack.

-- Knutsen  January 21, 1981  3:45 PM  Added InitalizeSubVolume.

-- Gobbel  January 19, 1981  4:17 PM  Create ResidentCool code pack.

Filer: SEGMENT =
BEGIN

-- Resident code - by definition!

Resident: CODE PACK =
  BEGIN
  FileCacheImpl EXCEPT Initialization, ResidentCool;
  FilerTransferImpl EXCEPT Initialization, LabelHacking, ResidentCool;
  FileTaskImpl EXCEPT Initialization, ResidentCool;
  SubVolumeImpl EXCEPT Initialization, ResidentCool;
  END;

ResidentCool: CODE PACK = -- goes in display memory on Dandelion
  BEGIN
  FileCacheImpl [FlushFile, FlushFilesOnVolume, FCacheCleanUp, RemoveCacheEntry, SetFile,
    SetCacheEntry, SetPageGroup];
  FilerExceptionImpl EXCEPT Initialization;
  FilerTransferImpl [Log];
  FileTaskImpl [ErrorHalt, HandleError, LabelWait];
  SubVolumeImpl [GetPageAddress, ErrorHalt, GetNext, OnLine, OffLine];
  END;

-- Swappable code (resident descriptor)

LabelHacking: CODE PACK =
  {FilerTransferImpl [ReadLabel, Perform, ReadRootLabel, WriteLabels,
    VerifyLabels, ReadLabelAndData, WriteLabelAndData]};

-- Initialization code:

Initialization: CODE PACK = -- initially resident
  BEGIN
  FileCacheImpl [Initialize, MAIN];
  FilerControl;
  FilerExceptionImpl [MAIN];
  FilerTransferImpl [MAIN];
  FileTaskImpl [MAIN];
  SubVolumeImpl [MAIN, InitializeSubVolume];
  END;
END;
-- SwapperPack.pack

-- Last edited by:
-- Yokota  March 23, 1981  10:22 AM  Delete in CachedSpaceImpl is moved from Resident to ResidentCool. ResidentMemoryImpl and SwapperExceptionImpl in Resident are moved into ResidentCool. Some other procedures in Resident are moved into ResidentCool.

-- Knutsen  February 18, 1981  12:35 PM  Deleted MStoreImpl.Initialize.

-- McJones  February 3, 1981  4:37 PM  Add MStoreImpl.CheckRealPageMax

-- Gobbel  January 31, 1981  11:33 AM  Moved frame packs into PilotKernelFrames.pack.

-- Gobbel  January 19, 1981  6:34 PM  Create ResidentCool code pack

Swapper: SEGMENT =
BEGIN

Resident: CODE PACK =
  BEGIN
  CachedRegionImplA EXCEPT Initialization, ResidentCool;
  CachedRegionImplB EXCEPT Initialization;
  CachedSpaceImpl EXCEPT Initialization, ResidentCool;
  MStoreImpl EXCEPT Initialization, ResidentCool;
  PageFaultImpl EXCEPT Initialization;
  SwapBufferImpl EXCEPT Initialization, ResidentCool;
  SwapTaskImpl EXCEPT Initialization;
  END;

SwappableSwapperHot: CODE PACK =
  {SimpleSpaceImpl [ApplyToSpace, ForceOut, Map, Unmap]};

SwappableSwapperWarm: CODE PACK =
  {SimpleSpaceImpl [CopyIn, CopyOut, Kill]};

ResidentCool: CODE PACK =
  BEGIN
  CachedRegionImplA [AgingProcess, AwaitNotCheckedOut, FindUnreferenced, Insert,
    InitializeAllocateMStoreRuthlessly, InitializeDeallocateClean, InitializeInsertIfRoom];
  CachedSpaceImpl [Delete, Get, Insert, Update];
  MStoreImpl [AwaitBelowThreshold, CheckRealPageMax, DonateDedicatedRealMemory,
    Promise,
    -- CAUTION: RecoverMStore must be run BEFORE
    -- DeviceCleanup.Perform[disconnect] has run
    RecoverMStore];
  ResidentMemoryImpl EXCEPT Initialization;
  SwapBufferImpl [Error];
  SwapperControl EXCEPT Initialization;
  SwapperExceptionImpl EXCEPT Initialization;
  END;

Initialization: CODE PACK =
  BEGIN
  CachedRegionImplA [InitializeInternal, InitializeRegionCacheA,
    InitializeRegionCacheB, MAIN];
  CachedRegionImplB [Initialize, MAIN];
  CachedSpaceImpl [MAIN];
  MStoreImpl [InitializeMStore, MAIN, SetThreshold];
  PageFaultImpl [MAIN];
  ResidentMemoryImpl [InitializeResidentMemoryA, InitializeResidentMemoryB,
    MAIN];
  SimpleSpaceImpl [AllocateVM, Create, DescribeSpace, DescribeSpaceInternal,
    DisableInitialization, HandleFromPage, InitializeSimpleSpace, MAIN,
    SuperFromPage];
  SwapBufferImpl [InitializeSwapBuffer, MAIN];
  SwapperControl [InitializeSwapper, MAIN];
  SwapperExceptionImpl [MAIN];
  SwapTaskImpl [MAIN];
  END;

END; --SwapperPack.pack--


-- MesaRuntimePack.pack
-- Last edit by:
-- Yokota  March 23, 1981  10:00 AM  FrameImpl in Resident pack is moved into ResidentCool. All the procedures in Instructions are moved from Resident to ResidentCool. Several procedures are interchanged between ProcessesHot and ProcessesCold. Processes in Resident is moved to ResidentCool. GetCaller is moved from FrameImplHot to ResidentCool.

-- Gobbel  March 1, 1981  2:04 PM  Moved Process.SetTimeout, MsecToTicks, and EnableAborts into ResidentCool (for SoundGenerator on DLion).

-- Gobbel  February 23, 1981  11:53 AM  Moved Process.Pause into ResidentCool (for SoundGenerator on DLion).

-- Gobbel  January 31, 1981  11:33 AM  Moved frame packs into PilotKernelFrames.pack.

-- Gobbel January 26, 1981  5:02 PM  Put PilotNub.InitializeDeviceCleanup in Resident code pack.

-- January 20, 1981  10:55 AM   Knutsen   Deleted duplicate frame of Signals - it's now Cold.  Rearraged Processes code pack, deleted CheckProcess.  FrameImpl's frame and fault handler must be resident.  Procedures moved from Traps to FrameImpl.  Misc procedures appearing and disappearing.  Traps now swappable.  InLoadFromBootLocation no longer resident, InitializeInLoadFromBootLoc is.  GetPriority, SetPriority now resident.

-- Gobbel January 19, 1981  4:19 PM  Created ResidentCool code pack

MesaRuntime: SEGMENT =
BEGIN

Resident: CODE PACK =
  BEGIN
  BootSwapCross EXCEPT Initialization;
  PilotNub [InitializeDeviceCleanup];
  -- InitializeInLoadFromBootLoc is vanilla resident so that it won't be mapped
  --  with non-PrincOps memory.
  SnapshotImpl [InitializeInLoadFromBootLoc];
  END;

ResidentCool: CODE PACK = -- goes into display memory on Dandelion
  BEGIN
  -- GetCaller is moved from FrameHotImpl since Star often uses it
  FrameImpl [Codebase, FrameFaultProcess, FrameSize, GetCaller];
  Instructions EXCEPT Initialization;
  PilotNub EXCEPT Initialization, Resident;
  -- BootButton is resident so it is always available.
  -- Process stuff is here because it gets used by SoundGenerator.Beep
  -- GetPriority, SetPriority are used by the Swapper
  Processes [EnableAborts, MsecToTicks, Pause, SetTimeout, GetPriority, SetPriority];
  SnapshotImpl [BootButton];
  END;
  
FrameImplHot: CODE PACK =
  -- The following have been chosen basically at random only under
  -- the constraint that this pack take up only one page.
  -- GetCaller is here explicitly as it makes the working set
  -- for owner checking (in HeapImpl) smaller.
  {FrameImpl [InGFT, IsBound, ValidateFrame, ValidateGlobalFrame]};
  
FrameImplCold: CODE PACK =
  {FrameImpl [AllocGlobalFrame, Copy, DeletedFrame, EntGlobalFrame, EnterGlobalFrame,
    GetBcdTime, GetBuildTime, GetNextGlobalFrame, GetNxGlobalFrame, GlobalFrame, MakeFsi,
    RemoveGlobalFrame, RemvGlobalFrame, SelfDestruct, zUnNew]};
  
ProcessesHot: CODE PACK =
  {Processes [DisableAborts, DisableTimeout, GetCurrent, InitializeCondition,
    InitializeMonitor, SecondsToTicks, TicksToMsec, ValidateProcess, Yield]};
  
ProcessesCold: CODE PACK =
  {Processes [Abort, AllocateNakedCondition, DeallocateNakedCondition,
   Detach, End, Fork, Join, ProcessTrap]};
  
InLoadOutLoad: CODE PACK =
  {SnapshotImpl [BootFromFile, BootFromVolume, BootFromPhysicalVolume,
   GetBootFileSize, GetDevice, InLoad, InLoadFromBootLocation, OutLoad]};
  
Signals: CODE PACK =
  {Signals EXCEPT Initialization};
  
SnapshotMisc: CODE PACK =
  {SnapshotImpl [InstallPhysicalVolumeBootFile,
   InstallVolumeBootFile, MakeBootable, MakeUnbootable]};
  
Traps: CODE PACK =
  {Traps [BoundsFaultTrap, CodeTrap, ControlFaultTrap, DivideCheckTrap, HardwareErrorTrap,
   PointerFaultTrap, Restart, StackErrorTrap, Start, StartCM, StartWithState,
   UnboundProcedureTrap, WakeupErrorTrap, ZeroDivisorTrap] };
  
Initialization: CODE PACK =
  BEGIN
  BootSwapCross [MAIN];
  FrameImpl [InitializeFrameImpl, MAIN];
  Instructions [InitializeInstructions, MAIN];
  PilotNub [InitializeInterrupt, InitializePilotNub, Install, MAIN];
  Processes [InitializeProcesses, MAIN];
  Signals [InitializeSignals, MAIN];
  SnapshotImpl [InitializeSnapshot, MAIN];
  Traps [Initialize, MAIN];
  END;
END;
-- MiscPack.pack
-- Last edit by:
-- Yokota  March 23, 1981  10:11 AM  All the procedures in Resident are moved into ResidentCool. FreeSpace, SpaceFromLongPointer and CheckOwner in HeapImpl are moved into Nodes.

-- Gobbel  January 31, 1981  11:33 AM  Moved frame packs into PilotKernelFrames.pack.

-- Jose  January 27, 1981  2:10 PM  Deleted LargeNode, NodeSize, RelativePointerToPointer from ResidentHeapImplt
-- Gobbel  January 19, 1981  4:27 PM  Created ResidentCool code pack

Misc: SEGMENT =
BEGIN

ByteBlt: CODE PACK =
  {StreamImpl [ByteBlt]};

ResidentCool: CODE PACK = -- goes in display memory on Dandelion
  BEGIN
  ResidentHeapImpl [FreeNode, MakeNode, SplitNode, WordsToPages];
  UtilitiesImpl EXCEPT Initialization;
  ZoneImpl [AddSegment, MakeNode, FreeNode, Split, SplitNode, ValidateZone];
  END;

Streams: CODE PACK =
   {StreamImpl EXCEPT Initialization, ByteBlt};

-- The following code packs are non-resident and depend upon the resident
-- heap only creating, deleting, splitting nodes and adding segments.

Nodes: CODE PACK =
  BEGIN
  HeapImpl [CheckOwner, Expand, ExpandHeap, ExpandMDS, FreeLargeOrRegularNode,
    FreeMDSNode, FreeNode, FreeSpace, MakeLargeNode, MakeMDSNode, MakeNode,
    MakeSpace, Narrow, PagesForNewSegment, SpaceFromLongPointer];
  END;

HeapPruning: CODE PACK =
   BEGIN
   HeapImpl [EnumerateSpaces, Prune, PruneHeap, PruneMDS];
   ZoneImpl [GetAttributes, GetSegmentAttributes, RemoveSegment];
   END;

Attributes: CODE PACK =
   BEGIN
   HeapImpl [GetAttributes, GetAttributesHeap, GetAttributesMDS];
   ZoneImpl [NodeSize];
   END;

CreateDelete: CODE PACK =
   BEGIN
   HeapImpl [Create, CreateHeap, CreateMDS, Delete, DeleteHeap, DeleteMDS,
   MakeResident, MakeResidentHeap, MakeResidentMDS, MakeSwappable,
   MakeSwappableHeap, MakeSwappableMDS];
   ZoneImpl [Create];
   END;

Recreating: CODE PACK =
   {ZoneImpl [GetRootNode, Recreate, SetRootNode]};

Checking: CODE PACK =
   BEGIN
   HeapImpl [SetChecking, SetCheckingHeap, SetCheckingMDS];
   ZoneImpl [CheckNode, CheckZone, SetChecking];
   END;

Initialization: CODE PACK =
   BEGIN
   HeapImpl [InitializeHeap, MAIN];
   ResidentHeapImpl [InitializeResidentHeap, MAIN];
   StreamImpl [InitializeStream, MAIN];
   UtilitiesImpl [InitializeUtilities, MAIN];
   ZoneImpl [InitializeZone, MAIN];
   END;
END;
-- UserTerminalDriverPack.pack
-- Last edit by:
-- Yokota  March 23, 1981  10:29 AM  GetBitBltTable, SetCursorPattern, SetMousePosition
--    are moved from Resident to ResidentCool (new CODE PACK).
-- Gobbel  January 31, 1981  11:33 AM  Moved frame packs into PilotKernelFrames.pack.
-- Levin   22-Mar-82 13:04:50  Add ColorDisplayImpl.
-- Levin   June 10, 1982 9:32 am  Add ColorCursorImpl.

UserTerminalDriver: SEGMENT =
BEGIN

Resident: CODE PACK =
  BEGIN
  UserTerminalImpl [WaitForScanLine, WaitForVerticalRetrace];
  END;

ResidentCool: CODE PACK = {
  UserTerminalImpl [GetBitBltTable, SetCursorPattern, SetMousePosition];
  ColorCursorImpl [SetCursorPattern, Setup]};

UserTerminalDriverSwappable: CODE PACK = {
  UserTerminalImpl EXCEPT Initialization, Resident, ResidentCool;
  ColorDisplayImpl EXCEPT Initialization, Resident, ResidentCool;
  ColorCursorImpl EXCEPT Initialization, Resident, ResidentCool};

Initialization: CODE PACK =
  BEGIN
  -- Explicit qualification is needed below  to avoid ambiguous references
  -- when all of Pilot is packaged via a merged segment.
  UserTerminalDriver.StartChainPlug [MAIN, Start];
  UserTerminalImpl [MAIN, Start];
  ColorDisplayImpl [MAIN, Start, StartHead];
  ColorCursorImpl [MAIN, Start, Init];
  END;

END;
-- DiskDriversPack.pack
-- Last edit by:
-- Yokota  March 20, 1981  10:20 AM  MakeLP & MakeRP are moved from Resident to ResidentCool.
-- Gobbel  January 31, 1981  11:33 AM  Moved frame packs into PilotKernelFrames.pack.
-- Gobbel  January 19, 1981  3:41 PM  Discard AltoFileInterlock, move SA4000Impl.Start to initialization
-- Levin  28-Apr-82 11:54:30  Flush AltoFileInterlock; move its contents to ResidentCool.

DiskDrivers: SEGMENT =
BEGIN

Resident: CODE PACK =
  BEGIN
  -- The only resident driver code is that for the system volume (to prevent
  -- monitor deadlocks caused by a page fault while in that monitor lock) and
  -- the code is callable from the page fault path (i.e., the Filer) - the
  -- driver procs getPageAddress, requestIO.  WARNING: this packaging ASSUMES
  -- that the SA4000 is the system volume!
  DiskChannelImpl EXCEPT Initialization, ResidentCool;
  DiskDriverSharedImpl EXCEPT Initialization;
  SA4000Impl EXCEPT Initialization, ResidentCool;
  END;

ResidentCool: CODE PACK = -- goes in display memory on Dandelion
  BEGIN
  DiskChannelImpl [ErrorHalt, AwaitStateChange, GetDriveAttributes,
    GetDriveTag, GetNextDrive, GetPageNumber, SetDriveState, SetDriveTag,
    Create, Delete, GetAttributes, GetPageAddress, CreateCompletionObject,
    RegisterDrive, MakeLP, MakeRP, Idle, Restart, Suspend];
  SA4000Impl [ErrorHalt, GetPageNumber, ChangeState];
  SA800Impl [GetNextRequest, GetPageAddress, RequestIO];
  END;

SwappableDiskDrivers: CODE PACK =
  BEGIN
  FloppyChannelImpl EXCEPT Initialization;
  SA800Impl EXCEPT Initialization, ResidentCool;
  END;

Initialization: CODE PACK =
  BEGIN
  DiskChannelImpl [MAIN];
  DiskDriverSharedImpl [MAIN];
  FloppyChannelImpl [MAIN, RegisterDrives];
  SA4000Impl [InitGlobals, MAIN, RegisterDrives, Start];
  SA800Impl [MAIN, RegisterDriverProcs];
  DiskDrivers.StartChainPlug;
  END;

END;
-- UtilityPilotKernelPack.pack

-- Code pack merging for all of UtilityPilotKernel

-- Yokota  March 25, 1981  5:35 PM  Misc.Resident is commented out and UserTerminalDriver.ResidentCool is added to KernelResidentCool
-- Gobbel  February 3, 1981  11:38 AM  Created from PilotKernelPack.pack
-- Levin  28-Apr-82 12:00:29  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.  (UtilityPilotKernelFrames.pack must be last.)

UtilityPilotVM: SEGMENT =
BEGIN

UtilityPilotVMImpl: CODE PACK =
  BEGIN
  UtilitySpaceImpl EXCEPT UtilityPilotVMInitialization;
  UtilityVMMControl EXCEPT UtilityPilotVMInitialization;
  END;

UtilityPilotVMInitialization: CODE PACK =
  BEGIN
  UtilitySpaceImpl [MAIN, Create, InitializeSpace, CreateForCode];
  UtilityVMMControl [MAIN, InitializePilotCounter, InitializePilotPerfMonitor,
    InitializePilotLoadState, InitializeTransactionData, InitializeVMMgr,
    RecoverTransactions, Log];
  END;
END;

UtilityPilotKernel: SEGMENT
  MERGES Control, DiskDrivers, Filer, MesaRuntime, Misc,
             Swapper, UserTerminalDriver =
BEGIN

KernelResident: CODE PACK =  -- must be first!
  -- This pack merges all of the resident code which goes in PrincOps real
  -- memory:
  BEGIN
  Control.ResidentSystem;
  DiskDrivers.Resident;
  Filer.Resident;
  MesaRuntime.Resident;
  -- Misc.Resident; Misc.Resident does not exist anymore
  Swapper.Resident;
  UserTerminalDriver.Resident;
  Control.SwappableSystem;
  DiskDrivers.SwappableDiskDrivers;
  Filer.LabelHacking;
  MesaRuntime.FrameImplHot;
  MesaRuntime.FrameImplCold;
  MesaRuntime.ProcessesHot;
  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;
  END;
  
KernelResidentCool: CODE PACK =  -- must be second!
   -- This pack merges all of the resident code which goes in
   --    non-PrincOps real memory:
  BEGIN
  Control.ResidentCool;
  DiskDrivers.ResidentCool;
  Filer.ResidentCool;
  MesaRuntime.ResidentCool;
  Misc.ResidentCool;
  Swapper.ResidentCool;
  UserTerminalDriver.ResidentCool;
  END;


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

UtilityPilotFileMgrAndVM: SEGMENT
  MERGES FileMgr, UtilityPilotVM =
BEGIN

VMResident: CODE PACK =  -- must be first!
  -- This pack merges all of the resident code which goes in PrincOps real
  -- memory:
  BEGIN
  FileMgr.FileHelperProcess;  -- should be first!
  FileMgr.VMMHelperProcs;
  FileMgr.FileAttributes;
  FileMgr.FileSetSize;
  FileMgr.VFMChangingSize;
  FileMgr.FileCreate;
  FileMgr.FileDelete;
  FileMgr.FileMapLogging;
  FileMgr.OtherFileStuff;
  FileMgr.Volume;
  FileMgr.PhysicalVolume;
  FileMgr.Othello;
  FileMgr.Scavenger;
  UtilityPilotVMImpl;
  END;

VMInitialization: CODE PACK =
  BEGIN
  FileMgr.FileMgrInitialization;
  UtilityPilotVMInitialization;
  END;

Discard: DISCARD CODE PACK =
  BEGIN
  TransactionRelatedRunning;
  TransactionRelatedAborting;
  END;
END;
-- UtilityPilotKernelFrames.pack

-- Frame packs for all of PilotKernel

-- February 2, 1981  5:55 PM   Gobbel   Created from old PilotKernelFrames.pack and frame packs for individual configs.
-- 23-Mar-82 16:28:42  	       Levin   Add ColorDisplayImpl.
-- June 10, 1982 9:41 am       Levin   Add ColorCursorImpl.

UtilityPilotKernelFrames: FRAME PACK =
   BEGIN
   -- Control
   SystemImpl;  -- contains cleanup procedure
   PilotControl;  -- must be resident due to its exported variables
   -- DiskDrivers
   DiskChannelImpl;
   DiskDriverSharedImpl;
   FloppyChannelImpl;
   SA4000Impl;
   SA800Impl; -- Must be resident until Pilot knows how to dynamically make it
                 -- resident
   -- Filer
   FileCacheImpl;
   FilerExceptionImpl;
   FilerTransferImpl;
   FileTaskImpl;
   SubVolumeImpl;
   -- MesaRuntime
   BootSwapCross;
   Instructions;
   FrameImpl;  -- resident since contains frame fault handler.
   PilotNub;
   Processes;  -- used by the Swapper.
   Signals;
   SnapshotImpl;
   Traps;
   -- Misc
   HeapImpl;
   ResidentHeapImpl;
   StreamImpl;
   UtilitiesImpl;
   ZoneImpl;
   -- Swapper
   CachedRegionImplA;
   CachedRegionImplB;
   CachedSpaceImpl;
   MStoreImpl;
   PageFaultImpl;
   ResidentMemoryImpl;
   SimpleSpaceImpl;
   SwapBufferImpl;
   SwapperControl;
   SwapperExceptionImpl;
   SwapTaskImpl;
   -- UserTerminalDriver
   UserTerminalImpl;
   ColorDisplayImpl;
   ColorCursorImpl;
   -- FileMgr
   FileImpl;
   MarkerPageImpl;
   PhysicalVolumeImpl;
   ScavengeImpl;
   VolAllocMapImpl;
   VolFileMapImpl;
   VolumeImpl;
   -- VMMgr
   UtilityVMMControl;
   UtilitySpaceImpl;

   -- The following are initialization only frames.  They are included here
   -- since they do not increase the size of this swap unit, thus saving one
   -- page of MDS
   DiskDrivers.StartChainPlug;
   FilerControl;
   UserTerminalDriver.StartChainPlug;

   END --of frame pack UtilityPilotKernelFrames--;