From 086a4bd7ddda8e5ac0faeee217f6ff5564bb1b4f Mon Sep 17 00:00:00 2001 From: Andreas Tobler Date: Tue, 9 Sep 2003 19:37:53 +0200 Subject: [PATCH] 2003-09-09 Andreas Tobler * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct passing correctly. From-SVN: r71238 --- libffi/ChangeLog | 5 +++++ libffi/src/powerpc/ffi.c | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/libffi/ChangeLog b/libffi/ChangeLog index 19493bb2eed5..bc9f28a62a63 100644 --- a/libffi/ChangeLog +++ b/libffi/ChangeLog @@ -1,3 +1,8 @@ +2003-09-09 Andreas Tobler + + * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct + passing correctly. + 2003-09-09 Alan Modra * configure: Regenerate. diff --git a/libffi/src/powerpc/ffi.c b/libffi/src/powerpc/ffi.c index 30ab7efb0c60..010050f91ba2 100644 --- a/libffi/src/powerpc/ffi.c +++ b/libffi/src/powerpc/ffi.c @@ -853,8 +853,7 @@ ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue, case FFI_TYPE_SINT32: case FFI_TYPE_UINT32: case FFI_TYPE_POINTER: - case FFI_TYPE_STRUCT: - /* there are 8 gpr registers used to pass values */ + /* there are 8 gpr registers used to pass values */ if (ng < 8) { avalue[i] = pgr; ng++; @@ -864,6 +863,19 @@ ffi_closure_helper_SYSV (ffi_closure* closure, void * rvalue, pst++; } break; + + case FFI_TYPE_STRUCT: + /* Structs are passed by reference. The address will appear in a + gpr if it is one of the first 8 arguments. */ + if (ng < 8) { + avalue[i] = (void *) *pgr; + ng++; + pgr++; + } else { + avalue[i] = (void *) *pst; + pst++; + } + break; case FFI_TYPE_SINT64: case FFI_TYPE_UINT64: