summaryrefslogtreecommitdiffstats
path: root/meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch')
-rw-r--r--meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch b/meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch
new file mode 100644
index 0000000..afd090b
--- /dev/null
+++ b/meta-bigendian/recipes-devtools/python/python/python_ffi_armeb_be8.patch
@@ -0,0 +1,34 @@
1Index: Python-2.7.3/Modules/_ctypes/libffi/src/arm/ffi.c
2===================================================================
3--- Python-2.7.3.orig/Modules/_ctypes/libffi/src/arm/ffi.c
4+++ Python-2.7.3/Modules/_ctypes/libffi/src/arm/ffi.c
5@@ -272,7 +272,7 @@ ffi_prep_incoming_args_SYSV(char *stack,
6 }
7
8 /* How to make a trampoline. */
9-
10+#if !(defined(__ARMEB__) && defined(__ARM_ARCH_7A__))
11 #define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
12 ({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
13 unsigned int __fun = (unsigned int)(FUN); \
14@@ -284,7 +284,19 @@ ffi_prep_incoming_args_SYSV(char *stack,
15 *(unsigned int*) &__tramp[16] = __fun; \
16 __clear_cache((&__tramp[0]), (&__tramp[19])); \
17 })
18-
19+#else /* armv7 big endian: be8 instructions are still little endian */
20+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \
21+({ unsigned char *__tramp = (unsigned char*)(TRAMP); \
22+ unsigned int __fun = (unsigned int)(FUN); \
23+ unsigned int __ctx = (unsigned int)(CTX); \
24+ *(unsigned int*) &__tramp[0] = 0x0f002de9; /* swab(0xe92d000f, 4) - stmfd sp!, {r0-r3} */ \
25+ *(unsigned int*) &__tramp[4] = 0x00009fe5; /* swab(0xe59f0000, 4) - ldr r0, [pc] */ \
26+ *(unsigned int*) &__tramp[8] = 0x00f09fe5; /* swab(0xe59ff000, 4) - ldr pc, [pc] */ \
27+ *(unsigned int*) &__tramp[12] = __ctx; \
28+ *(unsigned int*) &__tramp[16] = __fun; \
29+ __clear_cache((&__tramp[0]), (&__tramp[19])); \
30+ })
31+#endif
32
33 /* the cif must already be prep'ed */
34