🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #4298

Re: Self Modifying Code!

#4298
From: Randell Jesup
Date: Tue, 10 Jul 1990 02:06
29 lines
1935 bytes
In article <293@smosjc.UUCP> brett@smosjc.UUCP (Brett Coon) writes:
>Is there an acceptable means to write self-modifying code on the Amiga?
>
>Assuming for the sake of argument that I have a good reason to do such
>a thing (and there's a good chance I don't), can I do it without risking
>future compatibility?  My current plan is to select one of a few possible
>versions of the code at the beginning, and then patch the code to use the
>appropriate version.  It would be done once, during initialization, so 
>performance at this point is entirely unimportant.  What I envision is an
>operating system call to clear the instruction cache, or do nothing if there
>is no cache.  Surely something like this is done by the loader, right?

	Well, if you _must_....

	First, check the cpu type.  If on an '030 or greater, check the OS
version.  If less than 36, use an '030 cache clear instruction.  If greater
or equal to 36, use CacheClearU (or CacheClearS from supervisor mode).  Check
the Autodocs on how to use it.

	Using CacheClearU/S means that if you are running on a post-030
processor or with external cache, the right things will happen.

	Under 2.0, LoadSeg uses this after patching relocation information,
as does the scsi disk driver after doing dma.

-- 
Randell Jesup, Keeper of AmigaDos, Commodore Engineering.
{uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
Common phrase heard at Amiga Devcon '89: "It's in there!"
Technical Details
Message-ID: <13121@cbmvax.commodore.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!usc!rutgers!cbmvax!jesup
References: <293@smosjc.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!usc!rutgers!cbmvax!jesup
From: jesup@cbmvax.commodore.com (Randell Jesup)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Self Modifying Code!
Keywords: help, danger, cache, no flames
Message-ID: <13121@cbmvax.commodore.com>
Date: 10 Jul 90 02:06:30 GMT
References: <293@smosjc.UUCP>
Reply-To: jesup@cbmvax (Randell Jesup)
Organization: Commodore, West Chester, PA
Lines: 29