Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!gem.mps.ohio-state.edu!mips!cprice From: cprice@mips.COM (Charlie Price) Newsgroups: comp.sys.mips Subject: Re: ls -A and the MIPS Message-ID: <31898@orac.mips.COM> Date: 21 Nov 89 22:25:31 GMT References: <14057@boulder.Colorado.EDU> <14101@boulder.Colorado.EDU> <14134@boulder.Colorado.EDU> Reply-To: cprice@mips.COM (Charlie Price) Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 41 In article <14134@boulder.Colorado.EDU> grunwald@foobar.colorado.edu writes: > >How do you force a cache flush? Will a simple O/S call do it as part >of the O/S overhead? RISC/os, the MIPS OS, has calls to let any user process invalidate (clean, flush) portions of the process' virtual space. The call is: cacheflush(start_addr, nbytes, which_caches) Say "man cacheflush" to receive greater enlightenment. The only cache flushing that you are likely to need from the user level is to get rid of "stale" entries in the instruction cache. The i-cache can contain out-of-date entries when the user has done either a store or a read(2) into locations used as instructions. The i-cache isn't updated automatically as a result of CPU store instructions or DMA. When you "flush" the address in the i-cache, it is marked invalid and the next i-fetch takes a cache miss and gets the (new) instruction from main memory. Caution. MIPS cpu's have a per-page bit in the memory mapping hardware that allows accesses mapped through the translation buffer to bypass the cache and always go to main memory. RISC/os offers a user-level service to make pages of the process' virtual space "uncached" by setting the no-cache bit in the page table entry. Utter "man cachectl" to find out about this service. You might be tempted to avoid the hassles of invalidating the i-cache in the right places by making the entire region you use uncached. If you do any loops at all executing from uncached locations is going to be VERY SLOW. The overhead of invalidating the cache entries is probably less. -- Charlie Price cprice@mips.mips.com (408) 720-1700 MIPS Computer Systems / 928 Arques Ave. / Sunnyvale, CA 94086