FrameImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Levin on September 20, 1983 11:05 am
Russ Atkinson (RRA) January 28, 1985 10:54:20 pm PST
DIRECTORY
MesaRuntimeInit USING [],
PrincOps USING [ControlLink, EPRange, GFT, GFTItem, GlobalFrameHandle, NullGlobalFrame, NullLink, SD, sGFTLength, UnboundLink],
PrincOpsUtils USING [],
RuntimeError USING [UnboundProcedure];
FrameImpl: PROGRAM
IMPORTS RuntimeError
EXPORTS MesaRuntimeInit, PrincOpsUtils
= BEGIN OPEN PrincOps;
Exported to PrincOpsUtils (Global Frame stuff)
GlobalFrame: PUBLIC SAFE PROC [link: ControlLink] RETURNS [GlobalFrameHandle] = TRUSTED {
DO
SELECT TRUE FROM
link = UnboundLink => link ← SIGNAL RuntimeError.UnboundProcedure[link];
link.proc =>
IF link.gfi IN [1..SD[sGFTLength])
THEN {
gftItem: GFTItem ← GFT[link.gfi];
gftItem.epbias ← 0;
RETURN[gftItem.framePtr]
}
ELSE RETURN[NullGlobalFrame];
link.indirect => link ← link.link^;
link = NullLink => RETURN[NullGlobalFrame];
ENDCASE => RETURN[link.frame.accesslink]
ENDLOOP;
};
GlobalFrameAndEntryPoint: PUBLIC SAFE PROC [link: ControlLink] RETURNS [gf: GlobalFrameHandle, ep: CARDINAL] = TRUSTED {
DO
SELECT TRUE FROM
link = UnboundLink => link ← SIGNAL RuntimeError.UnboundProcedure[link];
link.proc =>
IF link.gfi IN [1..SD[sGFTLength])
THEN {
gftItem: GFTItem ← GFT[link.gfi];
ep ← gftItem.epbias*EPRange+link.ep;
gftItem.epbias ← 0;
gf ← gftItem.framePtr;
RETURN
}
ELSE ERROR;
link.indirect => link ← link.link^;
ENDCASE => ERROR; -- not meaningful for type-0 control links
ENDLOOP;
};
END.