summaryrefslogtreecommitdiffstats
path: root/libffi
diff options
context:
space:
mode:
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-23 21:02:27 +0000
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>2012-02-23 21:02:27 +0000
commita5de0b3b45611a1cabe609720b2dc789ed9639ae (patch)
treea63608c539b89be3aacdd9570b46b31195388095 /libffi
parent97e18ae269d3f835415ee47ba59b36596f982e97 (diff)
downloadppe42-gcc-a5de0b3b45611a1cabe609720b2dc789ed9639ae.tar.gz
ppe42-gcc-a5de0b3b45611a1cabe609720b2dc789ed9639ae.zip
PR libffi/52221
* src/x86/ffi.c (ffi_closure_raw_THISCALL): New prototype. (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for thiscall-convention. (ffi_raw_call): Use ffi_prep_args_raw. * src/x86/win32.S (ffi_closure_raw_THISCALL): Add implementation for stub. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@184526 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libffi')
-rw-r--r--libffi/ChangeLog11
-rw-r--r--libffi/src/x86/ffi.c8
-rw-r--r--libffi/src/x86/win32.S30
3 files changed, 45 insertions, 4 deletions
diff --git a/libffi/ChangeLog b/libffi/ChangeLog
index 3b3167ae77b..5b553f341fa 100644
--- a/libffi/ChangeLog
+++ b/libffi/ChangeLog
@@ -1,3 +1,14 @@
+2012-02-22 Kai Tietz <ktietz@redhat.com>
+
+ PR libffi/52221
+ * src/x86/ffi.c (ffi_closure_raw_THISCALL): New
+ prototype.
+ (ffi_prep_raw_closure_loc): Use ffi_closure_raw_THISCALL for
+ thiscall-convention.
+ (ffi_raw_call): Use ffi_prep_args_raw.
+ * src/x86/win32.S (ffi_closure_raw_THISCALL): Add
+ implementation for stub.
+
2012-02-13 Kai Tietz <ktietz@redhat.com>
PR libffi/52221
diff --git a/libffi/src/x86/ffi.c b/libffi/src/x86/ffi.c
index 88edbc102f9..469578ea504 100644
--- a/libffi/src/x86/ffi.c
+++ b/libffi/src/x86/ffi.c
@@ -447,6 +447,8 @@ unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *)
void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *)
__attribute__ ((regparm(1)));
#ifdef X86_WIN32
+void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *)
+ __attribute__ ((regparm(1)));
void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *)
__attribute__ ((regparm(1)));
void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *)
@@ -747,7 +749,7 @@ ffi_prep_raw_closure_loc (ffi_raw_closure* closure,
}
else if (cif->abi == FFI_THISCALL)
{
- FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_SYSV,
+ FFI_INIT_TRAMPOLINE_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL,
codeloc, cif->bytes);
}
#endif
@@ -795,7 +797,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
#ifdef X86_WIN32
case FFI_SYSV:
case FFI_STDCALL:
- ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags,
+ ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags,
ecif.rvalue, fn);
break;
case FFI_THISCALL:
@@ -823,7 +825,7 @@ ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue)
cif->abi = abi = FFI_THISCALL;
if (passed_regs < 1 && abi == FFI_THISCALL)
cif->abi = abi = FFI_STDCALL;
- ffi_call_win32(ffi_prep_args, &ecif, abi, cif->bytes, cif->flags,
+ ffi_call_win32(ffi_prep_args_raw, &ecif, abi, cif->bytes, cif->flags,
ecif.rvalue, fn);
}
break;
diff --git a/libffi/src/x86/win32.S b/libffi/src/x86/win32.S
index e5c93ecf7b9..deb4a0394d8 100644
--- a/libffi/src/x86/win32.S
+++ b/libffi/src/x86/win32.S
@@ -264,6 +264,18 @@ ffi_closure_SYSV ENDP
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20
+ffi_closure_raw_THISCALL PROC NEAR
+ push ebp
+ mov ebp, esp
+ push esi
+ sub esp, 36
+ mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif
+ mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
+ mov [esp + 12], edx
+ lea edx, [ebp + 12], edx
+ jmp stubraw
+ffi_closure_raw_SYSV ENDP
+
ffi_closure_raw_SYSV PROC NEAR USES esi
;; the ffi_closure ctx is passed in eax by the trampoline.
@@ -272,6 +284,7 @@ ffi_closure_raw_SYSV PROC NEAR USES esi
mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data
mov [esp + 12], edx ;; user_data
lea edx, [ebp + 8]
+stubraw:
mov [esp + 8], edx ;; raw_args
lea edx, [ebp - 24]
mov [esp + 4], edx ;; &res
@@ -722,7 +735,21 @@ _ffi_closure_SYSV:
#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4)
#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4)
#define CIF_FLAGS_OFFSET 20
-
+ .balign 16
+ .globl _ffi_closure_raw_THISCALL
+#ifndef __OS2__
+ .def _ffi_closure_raw_THISCALL; .scl 2; .type 32; .endef
+#endif
+_ffi_closure_raw_THISCALL:
+ pushl %ebp
+ movl %esp, %ebp
+ pushl %esi
+ subl $36, %esp
+ movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */
+ movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
+ movl %edx, 12(%esp) /* user_data */
+ leal 12(%ebp), %edx /* __builtin_dwarf_cfa () */
+ jmp .stubraw
# This assumes we are using gas.
.balign 16
.globl _ffi_closure_raw_SYSV
@@ -742,6 +769,7 @@ _ffi_closure_raw_SYSV:
movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */
movl %edx, 12(%esp) /* user_data */
leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */
+.stubraw:
movl %edx, 8(%esp) /* raw_args */
leal -24(%ebp), %edx
movl %edx, 4(%esp) /* &res */
OpenPOWER on IntegriCloud