'cacheflush' in FreeBSD ?

Yuri yuri at rawbw.com
Mon Jan 26 01:41:24 UTC 2015


LLVM has the function llvm::sys::Memory::InvalidateInstructionCache, 
that invalidates instruction cache after they allocate memory for the 
binary code, and before they run it.
On Linux this function calls cachflush(2). And on FreeBSD this function 
is a noop (besides some related valgrind cache call).

FreeBSD doesn't have 'cacheflush' system call. So how is instruction 
cache flushed on FreeBSD? I suspect this is a bug in LLVM that this 
function is a noop.

libexec/rtld-elf also loads binary code in similar way, and it isn't 
clear from its source code how instruction cache flushing is handled there.

Can somebody clarify what is the equivalent of linux cachflush(2), and 
is this a bug that llvm::sys::Memory::InvalidateInstructionCache is a noop?


Yuri


More information about the freebsd-hackers mailing list