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.
This commit is contained in:
Florian Weimer
2019-02-19 06:55:11 -05:00
committed by Anthony Green
parent 042ef8c314
commit 44a6c28545
3 changed files with 21 additions and 0 deletions
+4
View File
@@ -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;