From: David Mosberger <davidm@hpl.hp.com>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] libffi patch
Date: Tue, 15 May 2001 07:41:57 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590693005575@msgid-missing> (raw)
In-Reply-To: <marc-linux-ia64-105590693005574@msgid-missing>
Below is a completely unofficial libffi patch. It is relative to the
libffi that comes with the CVS tree of gcc3.0. I'm not sure whether
this patch will be acceptable to the libffi maintainer, but for now,
it is what's needed to get mozilla/ia64 working...
--david
Index: include/ffi.h.in
=================================RCS file: /cvs/gcc/gcc/libffi/include/ffi.h.in,v
retrieving revision 1.7.2.2
diff -u -r1.7.2.2 ffi.h.in
--- include/ffi.h.in 2001/03/27 00:58:23 1.7.2.2
+++ include/ffi.h.in 2001/05/15 06:25:31
@@ -380,6 +380,30 @@
};
#define FFI_NATIVE_RAW_API 0
+#define FFI_STATIC_CLOSURE(name, cif, interp, user_data) \
+ __asm__ (" .data\n" \
+ " .align 8\n" \
+ "1: data8 @fptr(ffi_closure_UNIX)\n" \
+ " data8 1b\n" \
+ " data8 0\n" \
+ " data8 "#cif"\n" \
+ " data8 @fptr("#interp")\n" \
+ " data8 "#user_data"\n" \
+ " .text\n" \
+ " .global "#name"\n" \
+ " .proc "#name"\n" \
+ #name":\n" \
+ " addl r16 = @ltoff(1b), gp;;\n" \
+ " ld8 gp = [r16];;\n" /* fake gp = &closure */ \
+ " ld8 r17 = [gp];;\n" /* r17 = @fptr(...) */ \
+ " ld8 r19 = [r17],8;\n" /* r19 = code addr */ \
+ " adds r18 = 16,gp;;\n" \
+ " ld8 r20 = [r17];;\n" /* r20 = real gp */ \
+ " st8 [r18]=r20;\n" \
+ " mov b6 = r19\n" \
+ " br.cond.sptk.many b6\n" \
+ " .endp\n");
+
#elif defined(ALPHA)
#define FFI_CLOSURES 1
@@ -406,15 +430,17 @@
typedef struct {
char tramp[FFI_TRAMPOLINE_SIZE];
ffi_cif *cif;
- void (*fun)(ffi_cif*,void*,void**,void*);
+ void (*fun)(ffi_cif*,void*,void**,void*,void*);
void *user_data;
} ffi_closure;
ffi_status
ffi_prep_closure (ffi_closure*,
ffi_cif *,
- void (*fun)(ffi_cif*,void*,void**,void*),
+ void (*fun)(ffi_cif*,void*,void**,void*,void*),
void *user_data);
+
+extern void ffi_prep_incoming_args (ffi_cif *, void *, void **);
#if !FFI_NO_RAW_API
Index: src/ia64/ffi.c
=================================RCS file: /cvs/gcc/gcc/libffi/src/ia64/ffi.c,v
retrieving revision 1.1
diff -u -r1.1 ffi.c
--- src/ia64/ffi.c 2000/02/25 19:13:44 1.1
+++ src/ia64/ffi.c 2001/05/15 06:25:31
@@ -497,7 +499,7 @@
ffi_prep_incoming_args_UNIX(args, (void**)&resp, arg_area, cif);
- (closure->fun) (cif, resp, arg_area, closure->user_data);
+ (closure->fun) (cif, resp, arg_area, closure->user_data, args);
rtype = cif->flags;
@@ -633,6 +636,13 @@
return;
}
+void
+ffi_prep_incoming_args (ffi_cif *cif, void *raw_args, void **args)
+{
+ void *dummy_resp;
+
+ ffi_prep_incoming_args_UNIX(raw_args, &dummy_resp, args, cif);
+}
/* Fill in a closure to refer to the specified fun and user_data. */
/* cif specifies the argument and result types for fun. */
@@ -648,7 +658,7 @@
ffi_status
ffi_prep_closure (ffi_closure* closure,
ffi_cif* cif,
- void (*fun)(ffi_cif*,void*,void**,void*),
+ void (*fun)(ffi_cif*,void*,void**,void*,void*),
void *user_data)
{
struct ffi_ia64_trampoline_struct *tramp
prev parent reply other threads:[~2001-05-15 7:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-15 7:36 [Linux-ia64] libffi patch David Mosberger
2001-05-15 7:41 ` David Mosberger [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-ia64-105590693005575@msgid-missing \
--to=davidm@hpl.hp.com \
--cc=linux-ia64@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox