This is the mail archive of the
libffi-discuss@sources.redhat.com
mailing list for the libffi project.
x86-64 port started (and a small patch)
- From: Bo Thorsen <bo at sonofthor dot dk>
- To: libffi-discuss at sources dot redhat dot com
- Date: Thu, 23 May 2002 16:51:44 +0200
- Subject: x86-64 port started (and a small patch)
I thought I'd let you know that I have started a port for x86-64. I assume the
right tree to work in is the sources.redhat.com cvs tree, not the one in gcc.
Correct me if I'm wrong here, please.
And just a small patch for you to chew on. In x86/ffi.c, there was an unused
variable avn - or more precisely it is unnecessary, as the number in avn is
exactly equal to i at the time of use.
Unfortunately diff insists on obfuscating the patch, but basically what I did
was only to remove the avn declaration and the lines working on it.
2002-05-23 Bo Thorsen <bo@suse.de>
* x86/ffi.c (ffi_prep_args): Remove unused variable avn.
Index: x86/ffi.c
===================================================================
RCS file: /cvs/libffi/libffi/x86/ffi.c,v
retrieving revision 1.2
diff -u -p -r1.2 ffi.c
--- x86/ffi.c 21 Oct 2001 19:18:42 -0000 1.2
+++ x86/ffi.c 23 May 2002 14:27:32 -0000
@@ -35,7 +35,6 @@ void ffi_prep_args(char *stack, extended
{
register unsigned int i;
register int tmp;
- register unsigned int avn;
register void **p_argv;
register char *argp;
register ffi_type **p_arg;
@@ -48,7 +47,6 @@ void ffi_prep_args(char *stack, extended
argp += 4;
}
- avn = ecif->cif->nargs;
p_argv = ecif->avalue;
for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types;
@@ -62,54 +60,50 @@ void ffi_prep_args(char *stack, extended
argp = (char *) ALIGN(argp, (*p_arg)->alignment);
}
- if (avn != 0)
- {
- avn--;
- z = (*p_arg)->size;
- if (z < sizeof(int))
- {
- z = sizeof(int);
- switch ((*p_arg)->type)
- {
- case FFI_TYPE_SINT8:
- *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT8:
- *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
- break;
-
- case FFI_TYPE_SINT16:
- *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT16:
- *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
- break;
-
- case FFI_TYPE_SINT32:
- *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
- break;
-
- case FFI_TYPE_UINT32:
- *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
- break;
-
- case FFI_TYPE_STRUCT:
- *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
- break;
-
- default:
- FFI_ASSERT(0);
- }
- }
- else
+ z = (*p_arg)->size;
+ if (z < sizeof(int))
+ {
+ z = sizeof(int);
+ switch ((*p_arg)->type)
{
- memcpy(argp, *p_argv, z);
+ case FFI_TYPE_SINT8:
+ *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT8:
+ *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT16:
+ *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT16:
+ *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_SINT32:
+ *(signed int *) argp = (signed int)*(SINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_UINT32:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ case FFI_TYPE_STRUCT:
+ *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv);
+ break;
+
+ default:
+ FFI_ASSERT(0);
}
- p_argv++;
- argp += z;
}
+ else
+ {
+ memcpy(argp, *p_argv, z);
+ }
+ p_argv++;
+ argp += z;
}
return;
--
Bo Thorsen | Praestevejen 4
Free software developer | 5290 Marslev
SuSE Labs | Denmark