-- VMMgrPack.pack

-- Last edited by:

-- September 15, 1982 6:18 pm   Levin   Removed AddressFaultProcess.

--  4-Feb-82 10:41:54   Levin   Added GetMappingSpaceDesc to SpaceStatusOps.

-- 23-Nov-81 17:37:21   Levin   Added ResetGrain to SpaceMapLogging.

-- Yokota  March 23, 1981  11:13 AM  ValidSpaceOrSwapUnit in HierarchyImpl and LongPointer, LongPointerFromPage in SpaceImplA are moved from SpaceMisc to SpaceOpsCommon.

-- Yokota  March 6, 1981  1:31 PM  Move Code from SpaceCodeHacking PACK to SpaceStatusOps PACK.

-- Yokota  March 4, 1981  5:22 PM  Add Activate(Deactivate)Proc, Activate(Deactivate)SwapUnit to SpaceStatusOps PACK.

-- Knutsen  February 25, 1981  3:16 PM  Add AddressFaultProcess to SpaceMisc pack.

-- Knutsen  February 18, 1981  12:39 PM  EnterSpace moved into new code pack VMMgrResident.

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

-- January 28, 1981   Knutsen   Renamed: WriteFaultProcess ← WriteProtectFaultProcess, CreateAny ← CreateInternal, DeleteAny ← DeleteInternal, VMHelperProcess ← VMMHelperProcess.  Moved: VMHelperProcess to SpaceImplB, EnterSpace to SpaceImplA.

-- January 23, 1981   Knutsen   Deleted *WriteProtectTrap, JoinTransaction, SpaceForCode, MaxIntervalForCode, ReleaseDefaultWindow.  Added WriteProtectFaultProcess, MakeCodeResident, MakeCodeSwappable, Code.  Moved CreateForCode to SpaceCreate pack.

-- January 13, 1981  3:43 PM   Gobbel   Created SpaceMapLogging pack.

-- December 4, 1980  12:59 PM   Luniewski   Moved JoinTransaction, ReleaseDefaultWindow to SpaceOpsCommon.

VMMgr: SEGMENT =
BEGIN

VMMHelperProcess: CODE PACK =
   BEGIN
   HierarchyImpl [Touch, LoadDesc];
   ProjectionImpl [Touch, Get];
   SpaceImplB [VMHelperProcess];
   STLeafImpl [Close, Open];
   STreeImpl [Get, KeyFromPDesc, SearchLeaf, SearchRoot, Update, UpdateRoot];
   END;

SpaceOpsCommon: CODE PACK =
   BEGIN
   -- we include the operations needed to get space handles from long pointers here as
   -- most clients will keep pointers to spaces instead of space handles, thus
   -- necessitating a translation before calling into the Space operations.  GetAttribute
   -- is included here: 1) it fits, and 2) in the development environment, it is frequently
   -- called from HeapImpl.SpaceFromLongPointer which is called from HeapImpl.PruneMDS
   -- which is frequently called.  The presence of GetAttributes here => FindFirstWIthin
   -- must also be here.
   HierarchyImpl [GetDescriptor, FindFirstWithin, GetInterval, Update,
      ValidSpaceOrSwapUnit];
   ProjectionImpl [ForceOut, TranslateLevel];
   SpaceImplA [ApplyToInterval, ForAllRegions, GetAttributes, GetHandle,
      LongPointer, LongPointerFromPage, PageFromLongPointer];
   SpaceImplB [GetSpaceDesc, ProcessWindow];
   END;

SpaceStatusOps: CODE PACK =
   { SpaceImplA [Activate, ActivateProc, ActivateSwapUnit, ApplyToSpace, Code,
         Deactivate, DeactivateProc, DeactivateSwapUnit, ForceOut, Kill];
     SpaceImplB [MakeReadOnly, MakeWritable, GetMappingSpaceDesc] };

SpaceMap: CODE PACK =
   { SpaceImplB [Map];
     STLeafImpl [AllocateWindow] };

SpaceUnmap: CODE PACK =
   { SpaceImplB [Unmap, UnmapInternal];
     STLeafImpl [DeallocateWindow] }; -- Also used by Space.Remap

SpaceCreate: CODE PACK =
   BEGIN
   HierarchyImpl [Insert];
   ProjectionImpl [Split];
   SpaceImplA [
       Create, CreateAligned, CreateForCode, CreateUniformSwapUnits, CreateAny];
   STLeafImpl [Create];
   STreeImpl [AllocateRoot, ExpandRoot, Insert];
   END;

SpaceDelete: CODE PACK =
   BEGIN
   HierarchyImpl [Delete];
   ProjectionImpl [DeleteSwapUnits, Merge];
   SpaceImplA [Delete, DeleteSwapUnits, DeleteAny];
   STLeafImpl [Delete];
   STreeImpl [Delete];
   END;

SpaceCopying: CODE PACK =
   { SpaceImplB [CopyIn, CopyOut, GetCopyInfo] };

SpaceTransactions: CODE PACK =
   { SpaceImplB [ReleaseFromTransaction, WriteFaultProcess] };

SpaceRemap: CODE PACK = { SpaceImplB [Remap] };

SpaceCodeHacking: CODE PACK =
   { SpaceImplA [MakeCodeResident, MakeCodeSwappable,
        MakeGlobalFrameResident, MakeGlobalFrameSwappable,
        MakeProcedureResident, MakeProcedureSwappable, MakeResident,
        MakeSwappable] };

SpaceMapLogging: CODE PACK = { MapLogImpl [ResetGrain, WriteLog1] };

SpaceMisc: CODE PACK =
   { SpaceImplA
        [GetWindow, Pointer, VMPageNumber] };

VMMgrInitialization: CODE PACK =
   BEGIN
   HierarchyImpl [MAIN];
   MapLogImpl [Initialize, MAIN];
   ProjectionImpl [MAIN];
   SpaceImplA [InitializeInternal, InitializeSpace, MAIN];
   SpaceImplB [InitializeSpaceImplB, MAIN];
   STLeafImpl [AllocateMapLogFile, InitVMMgrStore, InitSTLeaf, MAIN];
   STreeImpl [Initialize, MAIN];
   VMMControl [CreateSpace, FillHierarchyAndProjection, InitializeVMMgr,
                    IsDiagnosticPilot, MAIN];
   END;

VMMgrResident: CODE PACK = { SpaceImplA [EnterSpace] };
  -- Contrary to usual practice, this resident code pack is placed *last*.  This is because it is not required and not desired to pin the entry vector of SpaceImplA.  The only stuff that *must* be resident is the code starting from when EnterSpace releases the monitor lock and ending when it resets its priority to the caller's level.  (See notes in SpaceImplA.EnterSpace.)

END; --VMMgrPack.pack--