-- SSTrapsImpl.Mesa
-- last edited June 17, 1983 12:56 pm by Paul Rovner
DIRECTORY
PrincOps USING[SD, StateVector, ControlLink, NullLink, zWCDBL, zICDBL, alpha],
PrincOpsUtils USING[MyLocalFrame],
RTMicrocode USING
[aALLOCATEHEAPNODE, aALTERCOUNT, aCREATEREF, aDUMPINDEX,
aFREEOBJECT, aFREEPREFIXEDNODE, aGETCANONICALREFERENTTYPE,
aRECLAIMEDREF, aRTMOVESTATUS, aREADREGS],
RTRefCounts USING[ProbeIndex],
RTSD USING [sAllocateHeapNodeTrap, sAssignComposite, sAssignCompositeNew,
sAssignRefNewTrap, sAssignRefTrap, sCheckForNarrowRefFault,
sClobberedOverflowTable, sGetCanonicalReferentType, sProcCheck,
sRaiseNarrowFault, sGCState, sMapStiStd],
RTTypesBasicPrivate USING[AssignComposite, AssignCompositeNew],
SafeStorage USING[NarrowFault],
SSTraps USING[AllocateHeapNodeSDTrap, ALTERCOUNTOutOfOverflowTable, AssignRef,
AssignRefNew, AssignRefNewTrap,
AssignRefTrap, CheckForNarrowRefFault, ClobberedOverflowTable,
CREATEOutOfOverflowTable, CreatePrefixedObjectTrap, FreeObjectTrap,
FreePrefixedNodeTrap, GetCanonicalReferentTypeSDTrap,
GetCanonicalReferentTypeTrap, ReadUCodeRegsTrap,
ReclaimedRefOutOfOverflowTable, RTMOVESTATUSTrap, MapStiStd, GCState],
TrapSupport USING[BumpPC, opTrapTable];
SSTrapsImpl: PROGRAM
IMPORTS PrincOpsUtils, RTTypesBasicPrivate, SafeStorage, SSTraps, TrapSupport
EXPORTS SafeStorage, SSTraps
= BEGIN OPEN PrincOps, RTMicrocode, RTSD, TrapSupport;
-- PUBLIC SIGNALS --
UnsafeProcAssignment: PUBLIC SAFE SIGNAL[proc: PROC ANY RETURNS ANY] = CODE;
-- PUBLIC PROCEDURES --
RaiseNarrowFault: PUBLIC PROC =
{ state: StateVector;
kludge: LONG UNSPECIFIED;
state ← STATE; -- incantation to clear the stack
IF FALSE THEN kludge ← 0;
ERROR SafeStorage.NarrowFault};
ProcCheck: PUBLIC PROC[proc: PROC ANY RETURNS ANY]
RETURNS[PROC ANY RETURNS ANY] = {
p: ControlLink = LOOPHOLE[proc];
IF p # NullLink AND ~p.tag THEN SIGNAL UnsafeProcAssignment[proc];
RETURN[proc]};
DumpIndexTrap: PUBLIC PROC[pi: RTRefCounts.ProbeIndex] RETURNS[count: CARDINAL] =
{ state: StateVector;
state ← STATE; -- incantation
count ← 0; -- means no microcode
BumpPC[2]; -- length of opcode
state.dest ← LOOPHOLE[PrincOpsUtils.MyLocalFrame[]];
TRANSFER WITH state; -- incantation
};
-- START HERE
opTrapTable.main[zWCDBL] ← LOOPHOLE[SSTraps.AssignRefTrap];
opTrapTable.main[zICDBL] ← LOOPHOLE[SSTraps.AssignRefNewTrap];
opTrapTable.misc[aRECLAIMEDREF] ← LOOPHOLE[SSTraps.ReclaimedRefOutOfOverflowTable];
opTrapTable.misc[aALTERCOUNT] ← LOOPHOLE[SSTraps.ALTERCOUNTOutOfOverflowTable];
opTrapTable.misc[aRTMOVESTATUS] ← LOOPHOLE[SSTraps.RTMOVESTATUSTrap];
opTrapTable.misc[aREADREGS]← LOOPHOLE[SSTraps.ReadUCodeRegsTrap];
opTrapTable.misc[aCREATEREF] ← LOOPHOLE[SSTraps.CREATEOutOfOverflowTable];
opTrapTable.misc[aDUMPINDEX]← LOOPHOLE[DumpIndexTrap];
opTrapTable.misc[aGETCANONICALREFERENTTYPE]
← LOOPHOLE[SSTraps.GetCanonicalReferentTypeTrap];
opTrapTable.misc[aALLOCATEHEAPNODE] ← LOOPHOLE[SSTraps.CreatePrefixedObjectTrap];
opTrapTable.misc[aFREEOBJECT] ← LOOPHOLE[SSTraps.FreeObjectTrap];
opTrapTable.misc[aFREEPREFIXEDNODE] ← LOOPHOLE[SSTraps.FreePrefixedNodeTrap];
IF SD[sAssignRefTrap] # 0 THEN ERROR;
SD[sAssignRefTrap] ← LOOPHOLE[SSTraps.AssignRef, CARDINAL];
IF SD[sAssignRefNewTrap] # 0 THEN ERROR;
SD[sAssignRefNewTrap] ← LOOPHOLE[SSTraps.AssignRefNew, CARDINAL];
IF SD[sProcCheck] # 0 THEN ERROR;
SD[sProcCheck] ← LOOPHOLE[ProcCheck, CARDINAL];
IF SD[sCheckForNarrowRefFault] # 0 THEN ERROR;
SD[sCheckForNarrowRefFault] ← LOOPHOLE[SSTraps.CheckForNarrowRefFault, CARDINAL];
IF SD[sRaiseNarrowFault] # 0 THEN ERROR;
SD[sRaiseNarrowFault] ← LOOPHOLE[RaiseNarrowFault, CARDINAL];
IF SD[sGCState] # 0 THEN ERROR;
IF SD[sGCState+1] # 0 THEN ERROR;
LOOPHOLE[LONG[@SD[sGCState]],
LONG POINTER TO LONG POINTER]^ ← SSTraps.GCState;
IF SD[sGetCanonicalReferentType] # 0 THEN ERROR;
SD[sGetCanonicalReferentType] ← LOOPHOLE[SSTraps.GetCanonicalReferentTypeSDTrap, CARDINAL];
IF SD[sAssignComposite] # 0 THEN ERROR;
SD[sAssignComposite] ← LOOPHOLE[RTTypesBasicPrivate.AssignComposite, CARDINAL];
IF SD[sAssignCompositeNew] # 0 THEN ERROR;
SD[sAssignCompositeNew] ← LOOPHOLE[RTTypesBasicPrivate.AssignCompositeNew, CARDINAL];
IF SD[sClobberedOverflowTable] # 0 THEN ERROR;
SD[sClobberedOverflowTable] ← LOOPHOLE[SSTraps.ClobberedOverflowTable, CARDINAL];
IF SD[sAllocateHeapNodeTrap] # 0 THEN ERROR;
SD[sAllocateHeapNodeTrap] ← LOOPHOLE[SSTraps.AllocateHeapNodeSDTrap, CARDINAL];
IF SD[sMapStiStd] # 0 THEN ERROR;
IF SD[sMapStiStd+1] # 0 THEN ERROR;
LOOPHOLE[LONG[@SD[sMapStiStd]],
LONG POINTER TO LONG POINTER]^ ← LOOPHOLE[SSTraps.MapStiStd, LONG POINTER];
END.