-- RTMicrocode.Mesa
-- Definitions for the intertface between the Cedar runtime software and
--   its microcode support
-- last edited 2-Feb-82 11:38:48 by Willie-Sue
-- last edited May 20, 1982 10:16 am by Paul Rovner


DIRECTORY
  Mopcodes USING[zMISC, op],
  MiscAlpha USING[alpha],
  RTRefCounts USING[ProbeIndex, rcoState, uCodeDirection],
  RTZones USING[PQuantizedZone, PZone],
  RTBasic USING[Type];

RTMicrocode: DEFINITIONS
= BEGIN

-- microcode version number which corresponds to this CedarRunTime system
  microcodeVersion: CARDINAL = 13B;

--  stuff that will(?) be in MiscAlpha
   aRECLAIMEDREF: MiscAlpha.alpha = 60B;
   aALTERCOUNT: MiscAlpha.alpha = 61B;
   aRSTKBits: MiscAlpha.alpha = 62B;
   aRTMOVESTATUS: MiscAlpha.alpha = 63B;
   aRCFINALIZECOUNT: MiscAlpha.alpha = 64B;
   aISPIRECLAIMABLE: MiscAlpha.alpha = 65B;
--   aRCERECLAIM: MiscAlpha.alpha = 66B;
-- NOTE see RTRefCounts   aCREATEREF: MiscAlpha.alpha = 67B;   
   aGetReferentType: MiscAlpha.alpha = 71B;
   aGetCanonicalReferentType: MiscAlpha.alpha = 72B;
   aAllocateQuantizedNode: MiscAlpha.alpha = 73B;
   aAllocateHeapNode: MiscAlpha.alpha = 74B;
   aFreeObject: MiscAlpha.alpha = 75B;
   aFreeQuantizedNode: MiscAlpha.alpha = 76B;
   aFreePrefixedNode: MiscAlpha.alpha = 77B;
   aLocalBlkZ: MiscAlpha.alpha = 100B;
   aLongBlkZ: MiscAlpha.alpha = 102B;

   opASSIGNREF: Mopcodes.op = 76B;
   opASSIGNREFNEW: Mopcodes.op = 77B;

-- MACHINE CODE Procedures

  LONGZERO: PROC[ptr: LONG POINTER, size: CARDINAL] RETURNS[LONG POINTER] =
    MACHINE CODE { Mopcodes.zMISC, aLongBlkZ };

  RECLAIMEDREF: PROC[ref: REF] RETURNS[REF] =
    MACHINE CODE { Mopcodes.zMISC, aRECLAIMEDREF };

  RTMOVESTATUS: PROC[direction: RTRefCounts.uCodeDirection, gcStateBank: CARDINAL]
        RETURNS[CARDINAL]= 
   MACHINE CODE { Mopcodes.zMISC, aRTMOVESTATUS };

  ALTERCOUNT: PROC[rcv: RTRefCounts.rcoState, ref: REF] = 
   MACHINE CODE { Mopcodes.zMISC, aALTERCOUNT };

  PPALTERCOUNT: PROC[rcv: RTRefCounts.rcoState, ref: REF] = 
   MACHINE CODE { Mopcodes.zMISC, aALTERCOUNT};

  RESETSTKBITS: PROC[pi: RTRefCounts.ProbeIndex] =
   MACHINE CODE { Mopcodes.zMISC, aRSTKBits };

  ASSIGNREF: PROC[refNew: REF, refPtr: LONG POINTER TO REF] = 
   MACHINE CODE { opASSIGNREF, 0 };

  ASSIGNREFNEW: PROC[refNew: REF, refPtr: LONG POINTER TO REF] = 
   MACHINE CODE { opASSIGNREFNEW, 0 };

  RCFINALIZECOUNT: PROC RETURNS [CARDINAL] =
   MACHINE CODE { Mopcodes.zMISC, aRCFINALIZECOUNT };

  ISPIRECLAIMABLE: PROC[pi: RTRefCounts.ProbeIndex]
      RETURNS[fpi: RTRefCounts.ProbeIndex, npi: CARDINAL] = 
   MACHINE CODE { Mopcodes.zMISC, aISPIRECLAIMABLE };

  GETCANONICALREFERENTTYPE: PROC[ref: REF] RETURNS[RTBasic.Type] =
   MACHINE CODE { Mopcodes.zMISC, aGetCanonicalReferentType };

  GETREFERENTTYPE: PROC[ref: REF] RETURNS[RTBasic.Type] =
   MACHINE CODE { Mopcodes.zMISC, aGetReferentType };

  ALLOCATEQUANTIZEDNODE:
   PROC[zn: RTZones.PQuantizedZone, size: CARDINAL, type: RTBasic.Type]
      RETURNS[LONG POINTER] =
   MACHINE CODE { Mopcodes.zMISC, aAllocateQuantizedNode };

  ALLOCATEHEAPNODE:
     PROC[zn: RTZones.PZone, size: CARDINAL, type: RTBasic.Type] RETURNS[LONG POINTER] =
   MACHINE CODE { Mopcodes.zMISC, aAllocateHeapNode };

  FREEOBJECT:
   PROC[ptr: LONG POINTER] = MACHINE CODE { Mopcodes.zMISC, aFreeObject };

  FREEQUANTIZEDNODE:
     PROC[ptr: LONG POINTER, zn: RTZones.PZone] =
   MACHINE CODE { Mopcodes.zMISC, aFreeQuantizedNode };

  FREEPREFIXEDNODE:
     PROC[ptr: LONG POINTER, zn: RTZones.PZone] =
   MACHINE CODE { Mopcodes.zMISC, aFreePrefixedNode };

END.