Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!aunro!ukma!rex!spool.mu.edu!mips!pacbell.com!ucsd!ucbvax!hplabs!pyramid!cbmvax!mks From: mks@cbmvax.commodore.com (Michael Sinz) Newsgroups: comp.sys.amiga.programmer Subject: Re: Correct code for turning off 020/030 caches? Message-ID: <22294@cbmvax.commodore.com> Date: 10 Jun 91 12:39:31 GMT References: <1991Jun5.033401.27422@en.ecn.purdue.edu> <1991Jun8.132157.8194@starnet.uucp> Reply-To: mks@cbmvax.commodore.com (Michael Sinz) Organization: Commodore, West Chester, PA Lines: 58 In article <1991Jun8.132157.8194@starnet.uucp> sschaem@starnet.uucp (Stephan Schaem) writes: > > > Just a qucky to turn cache off: >Check the CPU with exec (Execbase, attflags) >if 2.x or greater use the exec function: CacheControl >Otherwise try the following... > > move.w #$4000,($dff09a).l > lea NoCache(pc),a0 > lea ($80).w,a1 > move.l (a1),-(sp) > move.l a0,(a1) > trap #0 > move.l (sp)+,(a1) > moveq #0,d0 > rts > >NoCache: > movec CACR,d0 > and.b #$fe,d0 > movec d0,CACR > rte > Do *NOT* do this! It will not work correctly. Under 2.0 there is a function call for cache control. But, if you need to do it under pre-2.0 systems, use the Supervisor call! The above method will *NOT* work correctly in all machines and/or all software running. Example: . . . lea NoCache(pc),a5 move.l _AbsExecBase,a6 jsr _LVOSupervisor(a6) ; D0 now has the CACR register in it too... . . . NoCache: movec CACR,d0 and.b #$fe,d0 ; This is only right for 68020/030! move.c d0,CACR rte /----------------------------------------------------------------------\ | /// Michael Sinz - Amiga Software Engineer | | /// Operating System Development Group | | /// BIX: msinz UUNET: rutgers!cbmvax!mks | |\\\/// Programming is like sex: | | \XX/ One mistake and you have to support it for life. | \----------------------------------------------------------------------/