Commit 10099d6cad8418a10c1508235d1f458993ac51fe

Anthony Green 2017-09-27T20:54:09

Merge pull request #271 from frida/fix/qnx-cache-flushing arm: Fix cache flushing on QNX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index 8102ee6..e7ee5e5 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -566,8 +566,13 @@ ffi_prep_closure_loc (ffi_closure * closure,
   config[1] = closure_func;
 #else
   memcpy (closure->tramp, ffi_arm_trampoline, 8);
+#if defined (__QNX__)
+  msync(closure->tramp, 8, 0x1000000);	/* clear data map */
+  msync(codeloc, 8, 0x1000000);	/* clear insn map */
+#else
   __clear_cache(closure->tramp, closure->tramp + 8);	/* clear data map */
   __clear_cache(codeloc, codeloc + 8);			/* clear insn map */
+#endif
   *(void (**)(void))(closure->tramp + 8) = closure_func;
 #endif