diff options
author | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 10:37:36 +0000 |
---|---|---|
committer | aph <aph@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-25 10:37:36 +0000 |
commit | d278060f6a8a5ef8df54b5e4d0046b27697dec32 (patch) | |
tree | b94d74e200da52f400405bf493925fd59196459d /libffi | |
parent | 8043d8fb720282aa372cd34fd98cdec677838028 (diff) | |
download | gcc-d278060f6a8a5ef8df54b5e4d0046b27697dec32.tar.gz |
2011-08-25 Andrew Haley <aph@redhat.com>
* src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly
instructions.
* src/arm/sysv.S (ffi_arm_trampoline): Put them here instead.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178060 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r-- | libffi/ChangeLog | 6 | ||||
-rw-r--r-- | libffi/src/arm/ffi.c | 6 | ||||
-rw-r--r-- | libffi/src/arm/sysv.S | 5 |
3 files changed, 14 insertions, 3 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 1bbcf9e47f4..b5905fac96f 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,9 @@ +2011-08-25 Andrew Haley <aph@redhat.com> + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Remove hard-coded assembly + instructions. + * src/arm/sysv.S (ffi_arm_trampoline): Put them here instead. + 2011-07-11 Andrew Haley <aph@redhat.com> * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache. diff --git a/libffi/src/arm/ffi.c b/libffi/src/arm/ffi.c index 4e72c3bcd7a..d5260333637 100644 --- a/libffi/src/arm/ffi.c +++ b/libffi/src/arm/ffi.c @@ -337,14 +337,14 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, /* How to make a trampoline. */ +extern unsigned int ffi_arm_trampoline[3]; + #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ ({ 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] */ \ + memcpy (__tramp, ffi_arm_trampoline, sizeof ffi_arm_trampoline); \ *(unsigned int*) &__tramp[12] = __ctx; \ *(unsigned int*) &__tramp[16] = __fun; \ __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping. */ \ diff --git a/libffi/src/arm/sysv.S b/libffi/src/arm/sysv.S index 72f0ee0ca0c..be6493a25b1 100644 --- a/libffi/src/arm/sysv.S +++ b/libffi/src/arm/sysv.S @@ -461,6 +461,11 @@ ARM_FUNC_START ffi_closure_VFP UNWIND .fnend .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) +ENTRY(ffi_arm_trampoline) + stmfd sp!, {r0-r3} + ldr r0, [pc] + ldr pc, [pc] + #if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",%progbits #endif |