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, noEffect: BOOL _ FALSE] RETURNS [data: Word, status: TrapIndex, rejectCycles: INT]; CacheStoreProc: TYPE = PROC [base: CacheBase, addr: Word, data: Word, cycle: INT] 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, noEffect: BOOL _ FALSE] RETURNS [data: Word, status: TrapIndex, rejectCycles: INT] = INLINE { [data, status, rejectCycles] _ base.fetch[base, addr, cycle, noEffect] }; Store: PROC [base: CacheBase, addr: Word, data: Word, cycle: INT] RETURNS [old: Word, status: TrapIndex, rejectCycles: INT] = INLINE { [old, status, rejectCycles] _ base.store[base, addr, data, cycle] }; END. $LizardCache.mesa Copyright c 1984, 1985 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) July 15, 1985 10:30:18 pm 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. ΚS˜codešœ™Kšœ Οmœ7™BK™1—K˜šΟk ˜ Kšœ žœ˜%Kšœ žœ˜K˜—Kšœ žœž œž˜&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˜—šΟnœžœžœ&žœ žœžœžœ/žœ˜™Kšœ―™―K˜—š  œžœžœ2žœžœ.žœ˜ŒKšœ™K˜—šœ žœžœ˜Kšœžœ˜Kšœžœ˜Kšœ žœ˜Kšœ žœ˜Kšœžœ˜K˜—K˜š œžœžœ˜