Path: utzoo!attcan!uunet!cbmvax!daveh From: daveh@cbmvax.commodore.com (Dave Haynie) Newsgroups: comp.sys.m68k Subject: Re: mc68040 I/D coherency Message-ID: <12558@cbmvax.commodore.com> Date: 11 Jun 90 21:29:27 GMT References: <41463@brunix.UUCP> <12055@cbmvax.commodore.com> <12131@cbmvax.commodore.com> Reply-To: daveh@cbmvax (Dave Haynie) Organization: Commodore, West Chester, PA Lines: 34 In article <12131@cbmvax.commodore.com> bryce@cbmvax (Bryce Nesbitt) writes: >In article <> valentin@cbmvax (Valentin Pepelea) writes: >>'They' chose not to support this practice at all. Writing self modifying >>code (Ahem - self distructing code) is not just difficult, it's darn well >>impossible on most systems. >Darn well common. Consider loading code from disk. Or worse >yet, a relocating loader. The case is identical. That's not self-modifying code. The code, as loaded, is of course data-space information. The loader performs the modifications, and then at some point this data-space magically is converted to instruction-space. The only thing such a transform can affect is a copyback data cache. The problem with self modifying code, or something similar, is going from I-space to D-space and then immediately back to I-space. It's quite easy for such a case to wind up with stale I-space code. This problem isn't only seen with self-modifying code, but it's most likely to occur with self modifying code, since the I->D->I transform must take place without flushing the I cache for a problem to occur. Some system simplify the problem by flushing caches when they change from Supervisor to User space. That will, for example, solve the copyback problem mentioned in the first case automatically for systems like UNIX in which the loader is always a Kernel routine. Other systems may have to explicitly flush the data cache or possibly use only write-through caching. >{X o} . Bryce Nesbitt, Commodore-Amiga, Inc. -- Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" {uunet|pyramid|rutgers}!cbmvax!daveh PLINK: hazy BIX: hazy "I have been given the freedom to do as I see fit" -REM