ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.
authorAndrew Haley <aph@redhat.com>
Mon, 11 Jul 2011 17:50:04 +0000 (17:50 +0000)
committerAndrew Haley <aph@gcc.gnu.org>
Mon, 11 Jul 2011 17:50:04 +0000 (17:50 +0000)
2011-07-11  Andrew Haley  <aph@redhat.com>

        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.

From-SVN: r176172

libffi/ChangeLog
libffi/src/arm/ffi.c

index 12afae61ee610c49ad552dfc415f5da49dc863d6..1bbcf9e47f4a42f383a49ee8d2942d987752fe59 100644 (file)
@@ -1,3 +1,7 @@
+2011-07-11  Andrew Haley  <aph@redhat.com>
+
+        * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache.
+
 2011-06-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * testsuite/libffi.call/cls_double_va.c: Move PR number to comment.
index 9a0a53c83a9206e78f38c771640d3de6dbff37b1..4e72c3bcd7a62ee9b4b5f9000b851ae00c529d85 100644 (file)
@@ -341,12 +341,16 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
 ({ unsigned char *__tramp = (unsigned char*)(TRAMP);                   \
    unsigned int  __fun = (unsigned int)(FUN);                          \
    unsigned int  __ctx = (unsigned int)(CTX);                          \
+   unsigned char *insns = (unsigned char *)(CTX);                       \
    *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \
    *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */       \
    *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */       \
    *(unsigned int*) &__tramp[12] = __ctx;                              \
    *(unsigned int*) &__tramp[16] = __fun;                              \
-   __clear_cache((&__tramp[0]), (&__tramp[19]));                       \
+   __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping.  */ \
+   __clear_cache(insns, insns + 3 * sizeof (unsigned int));             \
+                                                 /* Clear instruction   \
+                                                    mapping.  */        \
  })