Subject: Re: memsync() proposal (Was: Re: cacheflush() proposal)
To: None <tech-userlevel@netbsd.org>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: tech-userlevel
Date: 02/07/1999 13:32:10
On Sun, Feb 07, 1999 at 12:49:03AM +0100, Ignatios Souvatzis wrote:
> Another point: we didn't yet define how to do all addresses, 
> instead of the given range.
> I propose to use the NULL address for this.
> 
> $Id: cacheflush.txt,v 1.4 1999/02/06 23:48:02 is Exp is $
> 
> RATIONALE (by eeh)
> 
> The primary stated purpose of this was to assist the implementation of
> things like JIT compilers.  That's quite reasonable.
> 
> ....
> 
> There are several higher-level operations that I could see an application
> might legitimately want to do.  
> 
> 	o It might want to synchronize the data and instruction caches
> 	  because it just finished generating some code that it will want
> 	  to execute.
> 
> 	o It might want to force a memory barrier to make sure any data it
> 	  has stored is now globally visible to other processors.
> 
> 	o It might want to force read synchronization while spinning on a
> 	  lock.
> 
> I think it would be better to think in terms of these operations rather
> than explicit operations on the caches.  Flushing a cache can have quite
> different results on different cache implementations, and some caches are
> simply not meant to be flushed.
> 
> DEFINITION (taken from eeh, enhanced by myself)
> 
> 	#include <sys/memsync.h>
> 
> 	void memsync(start, size, what), weakly aliased to
> 	void _memsync(start, size, what)
> 	void* start;
> 	size_t size;
> 	int what;

Should it really be void memsync(...)?

	-is