diff options
author | ed <ed@FreeBSD.org> | 2010-11-11 15:13:11 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2010-11-11 15:13:11 +0000 |
commit | 870837e3e92f721a44db51308f2b900d928fb04f (patch) | |
tree | 9f851f7f6da4a4d9010d26bf17881d3bc5320f2b /contrib/compiler-rt/lib/clear_cache.c | |
parent | a1b6fa69a6f674978270e402b8bba6552e152066 (diff) | |
parent | 653bb6745595746d04ad4acacaaab66caaaeb69b (diff) | |
download | FreeBSD-src-870837e3e92f721a44db51308f2b900d928fb04f.zip FreeBSD-src-870837e3e92f721a44db51308f2b900d928fb04f.tar.gz |
Import libcompiler_rt into HEAD and add Makefiles.
Obtained from: user/ed/compiler-rt
Diffstat (limited to 'contrib/compiler-rt/lib/clear_cache.c')
-rw-r--r-- | contrib/compiler-rt/lib/clear_cache.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/compiler-rt/lib/clear_cache.c b/contrib/compiler-rt/lib/clear_cache.c new file mode 100644 index 0000000..43db37a --- /dev/null +++ b/contrib/compiler-rt/lib/clear_cache.c @@ -0,0 +1,41 @@ +/* ===-- clear_cache.c - Implement __clear_cache ---------------------------=== + * + * The LLVM Compiler Infrastructure + * + * This file is distributed under the University of Illinois Open Source + * License. See LICENSE.TXT for details. + * + * ===----------------------------------------------------------------------=== + */ + +#include "int_lib.h" +#include <stdlib.h> + +#if __APPLE__ + #include <libkern/OSCacheControl.h> +#endif + +/* + * The compiler generates calls to __clear_cache() when creating + * trampoline functions on the stack for use with nested functions. + * It is expected to invalidate the instruction cache for the + * specified range. + */ + +void __clear_cache(void* start, void* end) +{ +#if __i386__ || __x86_64__ +/* + * Intel processors have a unified instruction and data cache + * so there is nothing to do + */ +#else + #if __APPLE__ + /* On Darwin, sys_icache_invalidate() provides this functionality */ + sys_icache_invalidate(start, end-start); + #else + compilerrt_abort(); + #endif +#endif +} + |