StorageTrapsImpl.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Paul Rovner, October 19, 1983 10:38 am
Russ Atkinson (RRA) February 1, 1985 1:43:35 pm PST
DIRECTORY
CedarMicrocode USING [aCREATEREF, aDISABLEMICROCODE, aENABLEMICROCODE, aGETCANONICALREFERENTTYPE, aRECLAIMABLEREF, aRECLAIMEDREF, aALLOCATEOBJECT, aFREEOBJECT],
PrincOps USING[ControlLink, NullLink, SD, StateVector, zICDBL, zWCDBL],
RTSD USING [sAssignComposite, sAssignCompositeNew, sAssignRefNewTrap, sAssignRefTrap, sCheckForNarrowRefFault, sGCState, sGetCanonicalReferentType, sMapStiStd, sProcCheck, sRaiseNarrowFault],
RTTypesBasicPrivate USING[AssignComposite, AssignCompositeNew],
SafeStorage USING[NarrowFault, GetCanonicalReferentType],
StorageTraps USING[AssignRefTrap, CheckForNarrowRefFault, GetCanonicalReferentTypeTrap, MapStiStd, MapTiTd, CreateRefTrap, DisableMicrocodeTrap, EnableMicrocodeTrap, ReclaimableRefTrap, ReclaimedRefTrap, AllocateTrap, FreeTrap],
TrapSupport USING[opTrapTable];
StorageTrapsImpl: PROGRAM
IMPORTS RTTypesBasicPrivate, SafeStorage, StorageTraps
EXPORTS SafeStorage, StorageTraps
= BEGIN OPEN CedarMicrocode, PrincOps, RTSD, TrapSupport;
RRA: why is this here?
Kludge: TYPE = ARRAY [0..5] OF LONG POINTERALL[NIL];
kludge: Kludge ← [NIL, NIL, NIL, NIL, NIL, StorageTraps.MapTiTd];
PUBLIC SIGNALS --
UnsafeProcAssignment: PUBLIC SAFE SIGNAL[proc: PROC ANY RETURNS ANY] = CODE;
PUBLIC PROCEDURES --
RaiseNarrowFault: PUBLIC PROC = {
kludge: LONG CARDINAL;
state: StateVector;
state ← STATE; -- incantation to clear the stack
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];
};
START HERE
{
opTrapTable.main[zWCDBL] ← LOOPHOLE[StorageTraps.AssignRefTrap];
opTrapTable.main[zICDBL] ← LOOPHOLE[StorageTraps.AssignRefTrap];
opTrapTable.misc[aCREATEREF]
LOOPHOLE[StorageTraps.CreateRefTrap];
opTrapTable.misc[aDISABLEMICROCODE]
LOOPHOLE[StorageTraps.DisableMicrocodeTrap];
opTrapTable.misc[aENABLEMICROCODE]
← LOOPHOLE[StorageTraps.EnableMicrocodeTrap];
opTrapTable.misc[aGETCANONICALREFERENTTYPE]
LOOPHOLE[StorageTraps.GetCanonicalReferentTypeTrap];
opTrapTable.misc[aALLOCATEOBJECT]
LOOPHOLE[StorageTraps.AllocateTrap];
opTrapTable.misc[aFREEOBJECT]
LOOPHOLE[StorageTraps.FreeTrap];
opTrapTable.misc[aRECLAIMABLEREF]
LOOPHOLE[StorageTraps.ReclaimableRefTrap];
opTrapTable.misc[aRECLAIMEDREF]
LOOPHOLE[StorageTraps.ReclaimedRefTrap];
IF SD[sAssignRefTrap] # 0 THEN ERROR;
SD[sAssignRefTrap] ← LOOPHOLE[StorageTraps.AssignRefTrap, CARDINAL];
IF SD[sAssignRefNewTrap] # 0 THEN ERROR;
SD[sAssignRefNewTrap] ← LOOPHOLE[StorageTraps.AssignRefTrap, CARDINAL];
IF SD[sProcCheck] # 0 THEN ERROR;
SD[sProcCheck] ← LOOPHOLE[ProcCheck, CARDINAL];
IF SD[sCheckForNarrowRefFault] # 0 THEN ERROR;
SD[sCheckForNarrowRefFault] ← LOOPHOLE[StorageTraps.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]^ ← LONG[@kludge];
IF SD[sGetCanonicalReferentType] # 0 THEN ERROR;
SD[sGetCanonicalReferentType]
LOOPHOLE[SafeStorage.GetCanonicalReferentType, 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[sMapStiStd] # 0 THEN ERROR;
IF SD[sMapStiStd+1] # 0 THEN ERROR;
LOOPHOLE[LONG[@SD[sMapStiStd]], LONG POINTER TO LONG POINTER]^
LOOPHOLE[StorageTraps.MapStiStd, LONG POINTER];
};
END.