DIRECTORY DragOpsCross USING [TrapIndex, Word], SparseMemory USING [Base]; LizardCache: CEDAR DEFINITIONS = BEGIN TrapIndex: TYPE = DragOpsCross.TrapIndex; Word: TYPE = DragOpsCross.Word; CacheBase: TYPE = REF CacheBaseRep; CacheBaseRep: TYPE = RECORD [ sharedBase: SharedBase _ NIL, -- shared base data private: REF _ NIL, -- private data to the cache implementation fetch: CacheFetchProc _ NIL, -- this hook allows the user to intercept cache accesses store: CacheStoreProc _ NIL, -- this hook allows the user to intercept cache accesses data: REF _ NIL, -- private data for clients intercepting fetch & store stats: CacheStats _ [] -- maintained by the default fetch and store routines ]; SharedBase: TYPE = REF SharedBaseRep; SharedBaseRep: TYPE = RECORD [ mem: SparseMemory.Base _ NIL, busyUntil: INT _ 0 ]; CacheFetchProc: TYPE = PROC [base: CacheBase, addr: Word, cycle: INT, userMode: BOOL, noEffect: BOOL _ FALSE] RETURNS [data: Word, status: TrapIndex, rejectCycles: INT]; CacheStoreProc: TYPE = PROC [base: CacheBase, addr: Word, data: Word, cycle: INT, userMode: BOOL] RETURNS [old: Word, status: TrapIndex, rejectCycles: INT]; CacheStats: TYPE = RECORD [ probes: INT _ 0, misses: INT _ 0, mapMisses: INT _ 0, dirtyWrites: INT _ 0, rejectCycles: INT _ 0 ]; NewBase: PROC [mem: SparseMemory.Base] RETURNS [SharedBase]; NewCache: PROC [shared: SharedBase, lines: [0..4096) _ 0] RETURNS [CacheBase]; ResetCache: PROC [cache: CacheBase]; FlushCache: PROC [cache: CacheBase]; Fetch: PROC [base: CacheBase, addr: Word, cycle: INT, userMode: BOOL, noEffect: BOOL _ FALSE] RETURNS [data: Word, status: TrapIndex, rejectCycles: INT] = INLINE { [data, status, rejectCycles] _ base.fetch[base, addr, cycle, userMode, noEffect] }; Store: PROC [base: CacheBase, addr: Word, data: Word, cycle: INT, userMode: BOOL] RETURNS [old: Word, status: TrapIndex, rejectCycles: INT] = INLINE { [old, status, rejectCycles] _ base.store[base, addr, data, cycle, userMode] }; END. .LizardCache.mesa Copyright c 1984, 1985, 1986 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) September 11, 1986 2:01:28 am PDT This is the type of routine that is used to fetch words from the cache. If noEffect, then no change will be made to the cache state or statistics (useful for dumping memory). This is the type of routine that is used to store words into the cache. The old word is returned to facilitate memory tracing. Creates a new cache on the specified sparse memory. Creates a new cache on the specified shared memory. If lines = 0, then the default # of lines is used. Resets the given cache to its initial state. Makes sure that the memory behind the cache is up to date. This operation does not affect the statistics. It should not be used for instruction emulation. Κf˜codešœ™Kšœ Οmœ=™HK™5—K˜šΟk ˜ Kšœ žœ˜%Kšœ žœ˜K˜—KšΟn œžœž œž˜&K˜Kšœ žœ˜)Kšœžœ˜K˜Kšœ žœžœ˜#–36 sp tabStopsšœžœžœ˜K–36 sp tabStopsšœžœΟc˜1K–36 sp tabStopsšœ žœžœ +˜?K–36 sp tabStopsšœžœ 8˜UK–36 sp tabStopsšœžœ 8˜UK–36 sp tabStopsšœžœžœ 6˜GK–36 sp tabStopsšœ 5˜LK–36 sp tabStops˜K–36 sp tabStops˜—Kšœ žœžœ˜%šœžœžœ˜Kšœžœ˜Kšœ žœ˜K˜K˜—šΟbœžœžœ&žœ žœ žœžœžœ/žœ˜©Kšœ―™―K˜—š‘œžœžœ2žœ žœžœ.žœ˜œKšœ™K˜—šœ žœžœ˜Kšœžœ˜Kšœžœ˜Kšœ žœ˜Kšœ žœ˜Kšœžœ˜K˜—K˜šŸœžœžœ˜