tsan: more defensive file descriptor verification
[blocksruntime.git] / lib / clear_cache.c
blobb934fd4bdf6942cdfc6fd238b337fd5d482f1fbe
1 /* ===-- clear_cache.c - Implement __clear_cache ---------------------------===
3 * The LLVM Compiler Infrastructure
5 * This file is dual licensed under the MIT and the University of Illinois Open
6 * Source Licenses. See LICENSE.TXT for details.
8 * ===----------------------------------------------------------------------===
9 */
11 #include "int_lib.h"
13 #if __APPLE__
14 #include <libkern/OSCacheControl.h>
15 #endif
18 * The compiler generates calls to __clear_cache() when creating
19 * trampoline functions on the stack for use with nested functions.
20 * It is expected to invalidate the instruction cache for the
21 * specified range.
24 void __clear_cache(void* start, void* end)
26 #if __i386__ || __x86_64__
28 * Intel processors have a unified instruction and data cache
29 * so there is nothing to do
31 #else
32 #if __APPLE__
33 /* On Darwin, sys_icache_invalidate() provides this functionality */
34 sys_icache_invalidate(start, end-start);
35 #else
36 compilerrt_abort();
37 #endif
38 #endif