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; Kludge: TYPE = ARRAY [0..5] OF LONG POINTER _ ALL[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 = { 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]; }; 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. ^StorageTrapsImpl.Mesa last edited October 19, 1983 10:38 am by Paul Rovner START HERE Κϊ– "cedar" style˜Iprocšœ™Kšœ4™4K˜šΟk ˜ KšœœŒ˜ Kšœ œœ˜Gšœœ˜ Kšœ³˜³—Kšœœ&˜?Kšœ œ(˜9šœ œ˜KšœΡ˜Ρ—Kšœ œ˜—K˜Kšœ˜Kšœ/˜6Kšœ˜!Kšœœœœ ˜9K˜Kšœœœœœœœœ˜7Kš œœœœœœ˜AK˜KšΟc˜Kšœœœœœœœœœ˜LK˜Kšž˜šΟnœœœ˜!Kšœ˜Kšœœ œ˜Kšœœž!˜2Kšœœœ ˜Kšœ˜Kšœ˜—K˜KšŸ œœœœœœœ˜2š œœœœœ˜!Kšœœ˜ Kšœœœœ˜BKšœ˜ Kšœ˜—K™K™šœ ™ Kšœœ˜@Kšœœ˜@K˜šœ˜Kšœœ˜'—šœ#˜#Kšœœ$˜.—šœ"˜"Kšœ-˜-—šœ+˜+Kšœœ,˜6—šœ!˜!Kšœœ˜&—šœ˜Kšœœ˜"—šœ!˜!Kšœœ"˜,—šœ˜Kšœœ ˜*—K˜Kšœœœœ˜%Kšœœœ˜DK˜Kšœœœœ˜(Kšœœœ˜GK˜Kšœœœœ˜!Kšœœ œ˜/K˜Kšœœœœ˜.Kšœœ&œ˜VK˜Kšœœœœ˜(Kšœœœ˜=K˜Kšœœœœ˜Kšœœœœ˜!Kšœœœ œœœœœœ ˜MK˜Kšœœ œœ˜0šœ˜Kšœœ'œ˜;—K˜Kšœœœœ˜'Kšœœ&œ˜OK˜Kšœœœœ˜*Kšœœ)œ˜UK˜Kšœœœœ˜!Kšœœœœ˜#šœœœœœœœœ˜>Kšœœœœ˜1—K˜—Kšœ˜K˜—…—P¨