From 44a6c28545186d78642487927952844156fc7ab5 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 19 Feb 2019 12:55:11 +0100 Subject: aarch64: Flush code mapping in addition to data mapping (#471) This needs a new function, ffi_data_to_code_pointer, to translate from data pointers to code pointers. Fixes issue #470. --- src/aarch64/ffi.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/aarch64') diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c index c48c549..188acf2 100644 --- a/src/aarch64/ffi.c +++ b/src/aarch64/ffi.c @@ -773,6 +773,10 @@ ffi_prep_closure_loc (ffi_closure *closure, *(UINT64 *)(tramp + 16) = (uintptr_t)start; ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE); + + /* Also flush the cache for code mapping. */ + unsigned char *tramp_code = ffi_data_to_code_pointer (tramp); + ffi_clear_cache (tramp_code, tramp_code + FFI_TRAMPOLINE_SIZE); #endif closure->cif = cif; -- cgit v1.2.1