-- SMLoad.Mesa -- last edit by Schmidt, May 13, 1983 3:17 pm -- last edit by Satterthwaite, August 15, 1983 11:36 am -- the new modeller loader interface DIRECTORY BcdDefs: TYPE USING [Link, NameRecord], BcdOps: TYPE USING [BcdBase, EXPHandle, MTHandle], File: TYPE USING [Capability], IO: TYPE USING [Handle], MiscAlpha: TYPE USING [alpha], Mopcodes: TYPE USING [zMISC], PilotLoaderOps: TYPE USING [FrameList], PilotLoadStateOps: TYPE USING [ConfigIndex, Map], PrincOps: TYPE USING [ ControlLink, ControlModule, GFTIndex, GlobalFrameHandle, MaxNGfi, NullControl, NullLink], Rope: TYPE USING [Text], TimeStamp: TYPE USING [Null, Stamp]; SMLoad: DEFINITIONS ~ { -- this is an Interface Record in the usual parlance -- for procedures, this ControlLink is [procedure[gfi: gfi, ep: ep, tag: TRUE] -- for exported variables this is the absolute address of the variable -- for PROGRAM modules this is a GlobalFramePointer IR: TYPE~REF InterfaceRecordRep; InterfaceRecordRep: TYPE~RECORD[ name: ATOM_NIL, -- the interface (module) name (note that Tree.Name = ATOM) stamp: TimeStamp.Stamp_TimeStamp.Null, -- func time stamp resolved: BOOL_FALSE, -- all links have been filled in body: SEQUENCE size: NAT OF RECORD[ link: PrincOps.ControlLink_PrincOps.NullLink] -- the actual link ]; LoadInfo: TYPE~REF LoadInfoRecord; LoadInfoRecord: TYPE~RECORD[ bcdBase: BcdOps.BcdBase_NIL, -- the in core bcd linksResolved: BOOL_FALSE, -- => all links for these frames are resolved rtStarted: BOOL_FALSE, -- => AcquireTypesAndLiterals has been called on this bcd cm: PrincOps.ControlModule_PrincOps.NullControl, -- the control module to start gfiMap: GfiMap_NIL, -- [0 to bcdbase.firstdummy+bcdbase.nDummies) imports: IRSeq_NIL, -- [0 to bcdbase.nImports) exports: IRSeq_NIL, -- export[0] is the global frame configGfi: PrincOps.GFTIndex_0, -- dummy gfi in resulting loaded config map: PilotLoadStateOps.Map_NIL, -- map for this bcd, not fake config frameList: PilotLoaderOps.FrameList_NIL, -- ptrs to frames body: SEQUENCE size: NAT OF LoadRecord]; -- (> 1 only for configs) LoadRecord: TYPE~RECORD[ frame: PrincOps.GlobalFrameHandle_NIL, -- the gfh for module frameSize: CARDINAL_0, -- shadows the mth.framesize nGfi: NAT_0]; -- shadows the mth.ngfi -- For gfiMap[0 .. bcdbase.firstdummy) this is the real gfi for the module. -- for gfiMap[bcdbase.firstdummy .. bcdbase.ndummies + bcdbase.firstdummy), -- this is the index into the ImportTable for the dummy gfi's GfiMap: TYPE~REF GfiMapSeq; GfiMapSeq: TYPE~RECORD[ size: NAT_0, body: SEQUENCE maxsize: NAT OF RECORD[ index: PrincOps.GFTIndex, whichOne: [0..PrincOps.MaxNGfi)] -- this ranges between 0 and 3 ]; -- The ith element of this is the interface record associated with the ith import (zero origin). -- Import #3 has been matched up with InterfaceRecord import[3], etc. IRSeq: TYPE~REF IRSeqRecord; IRSeqRecord: TYPE~RECORD[ body: SEQUENCE size: NAT OF IR]; ReplaceResult: TYPE ~ { ok, configNotReplaceable, frameTooBig, ngfiTooBig, cantCopyOldBcd, checkForMRFailed, compilerSaysNo}; InvalidFile: ERROR[File.Capability]; -- raised by LoadGlobalFrames and LoadIncremental LoadGlobalFrames: PROC[ cap: File.Capability, config: PilotLoadStateOps.ConfigIndex, oldConfigGfi: PrincOps.GFTIndex, out: IO.Handle] RETURNS[loadInfo: LoadInfo, newConfigGfi: PrincOps.GFTIndex]; -- will read in bcd header and map code segments LoadIncremental: PROC[bcdcap: File.Capability, loadInfo: LoadInfo, out: IO.Handle] RETURNS[replaceResult: ReplaceResult]; BuildInterface: PROC[loadInfo: LoadInfo, eth: BcdOps.EXPHandle] RETURNS[ir: IR]; BuildFramePtrInterface: PROC[bcdBase: BcdOps.BcdBase, frame: PrincOps.GlobalFrameHandle] RETURNS[ir: IR]; NSToRope: PROC[bcdBase: BcdOps.BcdBase, name: BcdDefs.NameRecord] RETURNS[Rope.Text]; ConvertLink: PROC [bl: BcdDefs.Link] RETURNS [cl: PrincOps.ControlLink]; aLongBlkZ: MiscAlpha.alpha = 102b; Zero: PROC[lp: LONG POINTER, nwords: CARDINAL] RETURNS[LONG POINTER] ~ MACHINE CODE {Mopcodes.zMISC, aLongBlkZ}; -- frame link space operations OpenLinkSpace: PROC [ frame: PrincOps.GlobalFrameHandle, mth: BcdOps.MTHandle, bcd: BcdOps.BcdBase_NIL] RETURNS[LONG POINTER]; ReadLink: PROC[offset: CARDINAL] RETURNS[link: PrincOps.ControlLink]; WriteLink: PROC[offset: CARDINAL, link: PrincOps.ControlLink]; CloseLinkSpace: PROC[frame: PrincOps.GlobalFrameHandle]; -- allocation/deallocation AllocateLoadInfo: PROC[bcdbase: BcdOps.BcdBase] RETURNS[LoadInfo]; FreeLoadInfo: PROC[loadInfo: LoadInfo] RETURNS[LoadInfo]; -- always gives NIL AllocateIR: PROC[name: ATOM, size: NAT] RETURNS[IR]; FreeIR: PROC[ir: IR] RETURNS[IR]; -- always gives NIL }.