Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cbmvax!daveh From: daveh@cbmvax.commodore.com (Dave Haynie) Newsgroups: comp.sys.amiga.tech Subject: Re: 020 & 030 CACR Message-ID: <14891@cbmvax.commodore.com> Date: 4 Oct 90 20:32:09 GMT References: <4788@crash.cts.com> Reply-To: daveh@cbmvax.commodore.com (Dave Haynie) Organization: Commodore, West Chester, PA Lines: 34 In article <4788@crash.cts.com> lkoop@pnet01.cts.com (Lamonte Koop) writes: >Now that I finally have some working code for reading/setting the >68020..030...??? CACR, I have ONE question. I realize it would be a good >idea to disable task switching and such when SETTING the CACR, but how 'bout >reading it? You have no choice. In order to execute the MOVEC instruction, you must be in Supervisor mode. Tasks don't swap in Supervisor mode. As for directly using the MOVEC op-code, you're taking a bit of risk, it's non-portable. For example, if you use MOVEC to modify some cache parameters in 2.0, you will soon find them set back to their original state by the OS. The SetCPU V1.6 source code has SetCACR() and GetCACR() functions, which work under 1.3 and under 2.0. And once you move to a 68040 processor, the bit assignments in the CACR work differently. In general, if you think you need to modify the cache parameters yourself, you probably need to rethink what you're doing. Cache clearing is required by device drivers for DMA devices. Other than that, there are only a few real applications that should be using these calls -- they are a rather large speed penalty. Cache control is really an OS function, and should only be done by programs that are doing OS style things, like the aforementioned device drivers. And you have to be careful about switching things off. For example, if you simply switch off the I and/or D caches via CACR, you're safe for awhile. But when you turn them back on, the caches are still valid, though they can very easily be, in reality, stale. So it's always a good idea to clear any cache you turn on. >--LaMonte -- Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" {uunet|pyramid|rutgers}!cbmvax!daveh PLINK: hazy BIX: hazy Standing on the shoulders of giants leaves me cold -REM