mirror of
https://github.com/danog/ir.git
synced 2024-11-30 04:39:43 +01:00
Flush CPU cache
This commit is contained in:
parent
fbedabc5d8
commit
03bb1d1c4d
10
ir.c
10
ir.c
@ -6,6 +6,10 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_VALGRIND
|
||||
# include <valgrind/valgrind.h>
|
||||
#endif
|
||||
|
||||
#define IR_TYPE_FLAGS(name, type, field, flags) ((flags)|sizeof(type)),
|
||||
#define IR_TYPE_NAME(name, type, field, flags) #name,
|
||||
#define IR_TYPE_CNAME(name, type, field, flags) #type,
|
||||
@ -880,5 +884,11 @@ int ir_mem_unprotect(void *ptr, size_t size)
|
||||
|
||||
int ir_mem_flush(void *ptr, size_t size)
|
||||
{
|
||||
#if ((defined(__GNUC__) && ZEND_GCC_VERSION >= 4003) || __has_builtin(__builtin___clear_cache))
|
||||
__builtin___clear_cache((char*)(ptr), (char*)(ptr) + size);
|
||||
#endif
|
||||
#ifdef HAVE_VALGRIND
|
||||
VALGRIND_DISCARD_TRANSLATIONS(ptr, size);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user