File: cache-flush.h

package info (click to toggle)
smlnj-runtime 110.44-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,968 kB
  • ctags: 5,368
  • sloc: ansic: 24,674; asm: 4,195; makefile: 1,353; sh: 91
file content (51 lines) | stat: -rw-r--r-- 1,348 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* cache-flush.h
 *
 * COPYRIGHT (c) 1994 AT&T Bell Laboratories
 *
 * System dependent includes and macros for flushing the cache.
 */

#ifndef _CACHE_FLUSH_
#define _CACHE_FLUSH_

#ifdef TARGET_MIPS
#  ifdef OPSYS_MACH
#    define INCLUDE_CACHECTL_H	<mips/cachectl.h>
#  else
#    define INCLUDE_CACHECTL_H	<sys/cachectl.h>
#  endif
#endif

#if defined(TARGET_MIPS)
#  include INCLUDE_CACHECTL_H
#  ifdef OPSYS_MACH
#    include <sys/syscall.h>
#    define MIPS_CACHEFLUSH 0x104
#    define FlushICache(addr, size)	\
	(syscall(SYS_sysmips, MIPS_CACHEFLUSH, (addr), (size), BCACHE, 0))
#  else
#    define  FlushICache(addr, size)	\
	(cacheflush((addr), (size), BCACHE))
#  endif

#elif defined(TARGET_X86)
/* 386 & 486 have unified caches and the pentium has hardware consistency */
#  define FlushICache(addr, size)

#elif ((defined(TARGET_RS6000) || defined(TARGET_PPC))&& defined(OPSYS_AIX))
#  include <sys/cache.h>
#  define FlushICache(addr, size)	_sync_cache_range((addr), (size))

#elif (defined(TARGET_SPARC) || defined(TARGET_ALPHA32) || defined(TARGET_HPPA) || defined(OPSYS_MKLINUX))
extern FlushICache (void *addr, int nbytes);


#elif (defined(TARGET_PPC) && (defined(OPSYS_LINUX) || defined(OPSYS_DARWIN) ))
extern FlushICache (void *addr, int nbytes);

#else
#  define FlushICache(addr, size)
#endif

#endif /* !_CACHE_FLUSH_ */