Fix IRIX support
This commit is contained in:
@@ -16,3 +16,4 @@ ios
|
|||||||
fix-xfails
|
fix-xfails
|
||||||
interix
|
interix
|
||||||
ppc64-darwin
|
ppc64-darwin
|
||||||
|
irix
|
||||||
|
|||||||
0
.pc/irix/.timestamp
Normal file
0
.pc/irix/.timestamp
Normal file
4498
.pc/irix/ChangeLog
Normal file
4498
.pc/irix/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
417
.pc/irix/include/ffi.h.in
Normal file
417
.pc/irix/include/ffi.h.in
Normal file
@@ -0,0 +1,417 @@
|
|||||||
|
/* -----------------------------------------------------------------*-C-*-
|
||||||
|
libffi @VERSION@ - Copyright (c) 2011 Anthony Green
|
||||||
|
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person
|
||||||
|
obtaining a copy of this software and associated documentation
|
||||||
|
files (the ``Software''), to deal in the Software without
|
||||||
|
restriction, including without limitation the rights to use, copy,
|
||||||
|
modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* -------------------------------------------------------------------
|
||||||
|
The basic API is described in the README file.
|
||||||
|
|
||||||
|
The raw API is designed to bypass some of the argument packing
|
||||||
|
and unpacking on architectures for which it can be avoided.
|
||||||
|
|
||||||
|
The closure API allows interpreted functions to be packaged up
|
||||||
|
inside a C function pointer, so that they can be called as C functions,
|
||||||
|
with no understanding on the client side that they are interpreted.
|
||||||
|
It can also be used in other cases in which it is necessary to package
|
||||||
|
up a user specified parameter and a function pointer as a single
|
||||||
|
function pointer.
|
||||||
|
|
||||||
|
The closure API must be implemented in order to get its functionality,
|
||||||
|
e.g. for use by gij. Routines are provided to emulate the raw API
|
||||||
|
if the underlying platform doesn't allow faster implementation.
|
||||||
|
|
||||||
|
More details on the raw and cloure API can be found in:
|
||||||
|
|
||||||
|
http://gcc.gnu.org/ml/java/1999-q3/msg00138.html
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
http://gcc.gnu.org/ml/java/1999-q3/msg00174.html
|
||||||
|
-------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LIBFFI_H
|
||||||
|
#define LIBFFI_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Specify which architecture libffi is configured for. */
|
||||||
|
#ifndef @TARGET@
|
||||||
|
#define @TARGET@
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* ---- System configuration information --------------------------------- */
|
||||||
|
|
||||||
|
#include <ffitarget.h>
|
||||||
|
|
||||||
|
#ifndef LIBFFI_ASM
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define __attribute__(X)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
|
/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example).
|
||||||
|
But we can find it either under the correct ANSI name, or under GNU
|
||||||
|
C's internal name. */
|
||||||
|
|
||||||
|
#define FFI_64_BIT_MAX 9223372036854775807
|
||||||
|
|
||||||
|
#ifdef LONG_LONG_MAX
|
||||||
|
# define FFI_LONG_LONG_MAX LONG_LONG_MAX
|
||||||
|
#else
|
||||||
|
# ifdef LLONG_MAX
|
||||||
|
# define FFI_LONG_LONG_MAX LLONG_MAX
|
||||||
|
# else
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__
|
||||||
|
# endif
|
||||||
|
# ifdef _AIX
|
||||||
|
# ifndef __PPC64__
|
||||||
|
# if defined (__IBMC__) || defined (__IBMCPP__)
|
||||||
|
# define FFI_LONG_LONG_MAX LONGLONG_MAX
|
||||||
|
# endif
|
||||||
|
# endif /* __PPC64__ */
|
||||||
|
# undef FFI_64_BIT_MAX
|
||||||
|
# define FFI_64_BIT_MAX 9223372036854775807LL
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* The closure code assumes that this works on pointers, i.e. a size_t */
|
||||||
|
/* can hold a pointer. */
|
||||||
|
|
||||||
|
typedef struct _ffi_type
|
||||||
|
{
|
||||||
|
size_t size;
|
||||||
|
unsigned short alignment;
|
||||||
|
unsigned short type;
|
||||||
|
struct _ffi_type **elements;
|
||||||
|
} ffi_type;
|
||||||
|
|
||||||
|
#ifndef LIBFFI_HIDE_BASIC_TYPES
|
||||||
|
#if SCHAR_MAX == 127
|
||||||
|
# define ffi_type_uchar ffi_type_uint8
|
||||||
|
# define ffi_type_schar ffi_type_sint8
|
||||||
|
#else
|
||||||
|
#error "char size not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SHRT_MAX == 32767
|
||||||
|
# define ffi_type_ushort ffi_type_uint16
|
||||||
|
# define ffi_type_sshort ffi_type_sint16
|
||||||
|
#elif SHRT_MAX == 2147483647
|
||||||
|
# define ffi_type_ushort ffi_type_uint32
|
||||||
|
# define ffi_type_sshort ffi_type_sint32
|
||||||
|
#else
|
||||||
|
#error "short size not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INT_MAX == 32767
|
||||||
|
# define ffi_type_uint ffi_type_uint16
|
||||||
|
# define ffi_type_sint ffi_type_sint16
|
||||||
|
#elif INT_MAX == 2147483647
|
||||||
|
# define ffi_type_uint ffi_type_uint32
|
||||||
|
# define ffi_type_sint ffi_type_sint32
|
||||||
|
#elif INT_MAX == 9223372036854775807
|
||||||
|
# define ffi_type_uint ffi_type_uint64
|
||||||
|
# define ffi_type_sint ffi_type_sint64
|
||||||
|
#else
|
||||||
|
#error "int size not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LONG_MAX == 2147483647
|
||||||
|
# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX
|
||||||
|
#error "no 64-bit data type supported"
|
||||||
|
# endif
|
||||||
|
#elif LONG_MAX != FFI_64_BIT_MAX
|
||||||
|
#error "long size not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LONG_MAX == 2147483647
|
||||||
|
# define ffi_type_ulong ffi_type_uint32
|
||||||
|
# define ffi_type_slong ffi_type_sint32
|
||||||
|
#elif LONG_MAX == FFI_64_BIT_MAX
|
||||||
|
# define ffi_type_ulong ffi_type_uint64
|
||||||
|
# define ffi_type_slong ffi_type_sint64
|
||||||
|
#else
|
||||||
|
#error "long size not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* These are defined in types.c */
|
||||||
|
extern ffi_type ffi_type_void;
|
||||||
|
extern ffi_type ffi_type_uint8;
|
||||||
|
extern ffi_type ffi_type_sint8;
|
||||||
|
extern ffi_type ffi_type_uint16;
|
||||||
|
extern ffi_type ffi_type_sint16;
|
||||||
|
extern ffi_type ffi_type_uint32;
|
||||||
|
extern ffi_type ffi_type_sint32;
|
||||||
|
extern ffi_type ffi_type_uint64;
|
||||||
|
extern ffi_type ffi_type_sint64;
|
||||||
|
extern ffi_type ffi_type_float;
|
||||||
|
extern ffi_type ffi_type_double;
|
||||||
|
extern ffi_type ffi_type_pointer;
|
||||||
|
|
||||||
|
#if @HAVE_LONG_DOUBLE@
|
||||||
|
extern ffi_type ffi_type_longdouble;
|
||||||
|
#else
|
||||||
|
#define ffi_type_longdouble ffi_type_double
|
||||||
|
#endif
|
||||||
|
#endif /* LIBFFI_HIDE_BASIC_TYPES */
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
FFI_OK = 0,
|
||||||
|
FFI_BAD_TYPEDEF,
|
||||||
|
FFI_BAD_ABI
|
||||||
|
} ffi_status;
|
||||||
|
|
||||||
|
typedef unsigned FFI_TYPE;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ffi_abi abi;
|
||||||
|
unsigned nargs;
|
||||||
|
ffi_type **arg_types;
|
||||||
|
ffi_type *rtype;
|
||||||
|
unsigned bytes;
|
||||||
|
unsigned flags;
|
||||||
|
#ifdef FFI_EXTRA_CIF_FIELDS
|
||||||
|
FFI_EXTRA_CIF_FIELDS;
|
||||||
|
#endif
|
||||||
|
} ffi_cif;
|
||||||
|
|
||||||
|
/* ---- Definitions for the raw API -------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef FFI_SIZEOF_ARG
|
||||||
|
# if LONG_MAX == 2147483647
|
||||||
|
# define FFI_SIZEOF_ARG 4
|
||||||
|
# elif LONG_MAX == FFI_64_BIT_MAX
|
||||||
|
# define FFI_SIZEOF_ARG 8
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FFI_SIZEOF_JAVA_RAW
|
||||||
|
# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
ffi_sarg sint;
|
||||||
|
ffi_arg uint;
|
||||||
|
float flt;
|
||||||
|
char data[FFI_SIZEOF_ARG];
|
||||||
|
void* ptr;
|
||||||
|
} ffi_raw;
|
||||||
|
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8
|
||||||
|
/* This is a special case for mips64/n32 ABI (and perhaps others) where
|
||||||
|
sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */
|
||||||
|
typedef union {
|
||||||
|
signed int sint;
|
||||||
|
unsigned int uint;
|
||||||
|
float flt;
|
||||||
|
char data[FFI_SIZEOF_JAVA_RAW];
|
||||||
|
void* ptr;
|
||||||
|
} ffi_java_raw;
|
||||||
|
#else
|
||||||
|
typedef ffi_raw ffi_java_raw;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void ffi_raw_call (ffi_cif *cif,
|
||||||
|
void (*fn)(void),
|
||||||
|
void *rvalue,
|
||||||
|
ffi_raw *avalue);
|
||||||
|
|
||||||
|
void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw);
|
||||||
|
void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args);
|
||||||
|
size_t ffi_raw_size (ffi_cif *cif);
|
||||||
|
|
||||||
|
/* This is analogous to the raw API, except it uses Java parameter */
|
||||||
|
/* packing, even on 64-bit machines. I.e. on 64-bit machines */
|
||||||
|
/* longs and doubles are followed by an empty 64-bit word. */
|
||||||
|
|
||||||
|
void ffi_java_raw_call (ffi_cif *cif,
|
||||||
|
void (*fn)(void),
|
||||||
|
void *rvalue,
|
||||||
|
ffi_java_raw *avalue);
|
||||||
|
|
||||||
|
void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw);
|
||||||
|
void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args);
|
||||||
|
size_t ffi_java_raw_size (ffi_cif *cif);
|
||||||
|
|
||||||
|
/* ---- Definitions for closures ----------------------------------------- */
|
||||||
|
|
||||||
|
#if FFI_CLOSURES
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__declspec(align(8))
|
||||||
|
#endif
|
||||||
|
typedef struct {
|
||||||
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||||
|
ffi_cif *cif;
|
||||||
|
void (*fun)(ffi_cif*,void*,void**,void*);
|
||||||
|
void *user_data;
|
||||||
|
#ifdef __GNUC__
|
||||||
|
} ffi_closure __attribute__((aligned (8)));
|
||||||
|
#else
|
||||||
|
} ffi_closure;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *ffi_closure_alloc (size_t size, void **code);
|
||||||
|
void ffi_closure_free (void *);
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_closure (ffi_closure*,
|
||||||
|
ffi_cif *,
|
||||||
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_closure_loc (ffi_closure*,
|
||||||
|
ffi_cif *,
|
||||||
|
void (*fun)(ffi_cif*,void*,void**,void*),
|
||||||
|
void *user_data,
|
||||||
|
void*codeloc);
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||||
|
|
||||||
|
ffi_cif *cif;
|
||||||
|
|
||||||
|
#if !FFI_NATIVE_RAW_API
|
||||||
|
|
||||||
|
/* if this is enabled, then a raw closure has the same layout
|
||||||
|
as a regular closure. We use this to install an intermediate
|
||||||
|
handler to do the transaltion, void** -> ffi_raw*. */
|
||||||
|
|
||||||
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||||
|
void *this_closure;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*);
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
|
} ffi_raw_closure;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||||
|
|
||||||
|
ffi_cif *cif;
|
||||||
|
|
||||||
|
#if !FFI_NATIVE_RAW_API
|
||||||
|
|
||||||
|
/* if this is enabled, then a raw closure has the same layout
|
||||||
|
as a regular closure. We use this to install an intermediate
|
||||||
|
handler to do the transaltion, void** -> ffi_raw*. */
|
||||||
|
|
||||||
|
void (*translate_args)(ffi_cif*,void*,void**,void*);
|
||||||
|
void *this_closure;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*);
|
||||||
|
void *user_data;
|
||||||
|
|
||||||
|
} ffi_java_raw_closure;
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_raw_closure (ffi_raw_closure*,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_raw_closure_loc (ffi_raw_closure*,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_raw*,void*),
|
||||||
|
void *user_data,
|
||||||
|
void *codeloc);
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_java_raw_closure (ffi_java_raw_closure*,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||||
|
void *user_data);
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||||
|
void *user_data,
|
||||||
|
void *codeloc);
|
||||||
|
|
||||||
|
#endif /* FFI_CLOSURES */
|
||||||
|
|
||||||
|
/* ---- Public interface definition -------------------------------------- */
|
||||||
|
|
||||||
|
ffi_status ffi_prep_cif(ffi_cif *cif,
|
||||||
|
ffi_abi abi,
|
||||||
|
unsigned int nargs,
|
||||||
|
ffi_type *rtype,
|
||||||
|
ffi_type **atypes);
|
||||||
|
|
||||||
|
void ffi_call(ffi_cif *cif,
|
||||||
|
void (*fn)(void),
|
||||||
|
void *rvalue,
|
||||||
|
void **avalue);
|
||||||
|
|
||||||
|
/* Useful for eliminating compiler warnings */
|
||||||
|
#define FFI_FN(f) ((void (*)(void))f)
|
||||||
|
|
||||||
|
/* ---- Definitions shared with assembly code ---------------------------- */
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* If these change, update src/mips/ffitarget.h. */
|
||||||
|
#define FFI_TYPE_VOID 0
|
||||||
|
#define FFI_TYPE_INT 1
|
||||||
|
#define FFI_TYPE_FLOAT 2
|
||||||
|
#define FFI_TYPE_DOUBLE 3
|
||||||
|
#if @HAVE_LONG_DOUBLE@
|
||||||
|
#define FFI_TYPE_LONGDOUBLE 4
|
||||||
|
#else
|
||||||
|
#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE
|
||||||
|
#endif
|
||||||
|
#define FFI_TYPE_UINT8 5
|
||||||
|
#define FFI_TYPE_SINT8 6
|
||||||
|
#define FFI_TYPE_UINT16 7
|
||||||
|
#define FFI_TYPE_SINT16 8
|
||||||
|
#define FFI_TYPE_UINT32 9
|
||||||
|
#define FFI_TYPE_SINT32 10
|
||||||
|
#define FFI_TYPE_UINT64 11
|
||||||
|
#define FFI_TYPE_SINT64 12
|
||||||
|
#define FFI_TYPE_STRUCT 13
|
||||||
|
#define FFI_TYPE_POINTER 14
|
||||||
|
|
||||||
|
/* This should always refer to the last type code (for sanity checks) */
|
||||||
|
#define FFI_TYPE_LAST FFI_TYPE_POINTER
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
356
.pc/irix/src/java_raw_api.c
Normal file
356
.pc/irix/src/java_raw_api.c
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
/* -----------------------------------------------------------------------
|
||||||
|
java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc.
|
||||||
|
|
||||||
|
Cloned from raw_api.c
|
||||||
|
|
||||||
|
Raw_api.c author: Kresten Krab Thorup <krab@gnu.org>
|
||||||
|
Java_raw_api.c author: Hans-J. Boehm <hboehm@hpl.hp.com>
|
||||||
|
|
||||||
|
$Id $
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
``Software''), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* This defines a Java- and 64-bit specific variant of the raw API. */
|
||||||
|
/* It assumes that "raw" argument blocks look like Java stacks on a */
|
||||||
|
/* 64-bit machine. Arguments that can be stored in a single stack */
|
||||||
|
/* stack slots (longs, doubles) occupy 128 bits, but only the first */
|
||||||
|
/* 64 bits are actually used. */
|
||||||
|
|
||||||
|
#include <ffi.h>
|
||||||
|
#include <ffi_common.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#if !defined(NO_JAVA_RAW_API) && !defined(FFI_NO_RAW_API)
|
||||||
|
|
||||||
|
size_t
|
||||||
|
ffi_java_raw_size (ffi_cif *cif)
|
||||||
|
{
|
||||||
|
size_t result = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
ffi_type **at = cif->arg_types;
|
||||||
|
|
||||||
|
for (i = cif->nargs-1; i >= 0; i--, at++)
|
||||||
|
{
|
||||||
|
switch((*at) -> type) {
|
||||||
|
case FFI_TYPE_UINT64:
|
||||||
|
case FFI_TYPE_SINT64:
|
||||||
|
case FFI_TYPE_DOUBLE:
|
||||||
|
result += 2 * FFI_SIZEOF_JAVA_RAW;
|
||||||
|
break;
|
||||||
|
case FFI_TYPE_STRUCT:
|
||||||
|
/* No structure parameters in Java. */
|
||||||
|
abort();
|
||||||
|
default:
|
||||||
|
result += FFI_SIZEOF_JAVA_RAW;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
ffi_type **tp = cif->arg_types;
|
||||||
|
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
for (i = 0; i < cif->nargs; i++, tp++, args++)
|
||||||
|
{
|
||||||
|
switch ((*tp)->type)
|
||||||
|
{
|
||||||
|
case FFI_TYPE_UINT8:
|
||||||
|
case FFI_TYPE_SINT8:
|
||||||
|
*args = (void*) ((char*)(raw++) + 3);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_UINT16:
|
||||||
|
case FFI_TYPE_SINT16:
|
||||||
|
*args = (void*) ((char*)(raw++) + 2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 8
|
||||||
|
case FFI_TYPE_UINT64:
|
||||||
|
case FFI_TYPE_SINT64:
|
||||||
|
case FFI_TYPE_DOUBLE:
|
||||||
|
*args = (void *)raw;
|
||||||
|
raw += 2;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case FFI_TYPE_POINTER:
|
||||||
|
*args = (void*) &(raw++)->ptr;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
*args = raw;
|
||||||
|
raw +=
|
||||||
|
ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* WORDS_BIGENDIAN */
|
||||||
|
|
||||||
|
#if !PDP
|
||||||
|
|
||||||
|
/* then assume little endian */
|
||||||
|
for (i = 0; i < cif->nargs; i++, tp++, args++)
|
||||||
|
{
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 8
|
||||||
|
switch((*tp)->type) {
|
||||||
|
case FFI_TYPE_UINT64:
|
||||||
|
case FFI_TYPE_SINT64:
|
||||||
|
case FFI_TYPE_DOUBLE:
|
||||||
|
*args = (void*) raw;
|
||||||
|
raw += 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
*args = (void*) raw++;
|
||||||
|
}
|
||||||
|
#else /* FFI_SIZEOF_JAVA_RAW != 8 */
|
||||||
|
*args = (void*) raw;
|
||||||
|
raw +=
|
||||||
|
ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
|
||||||
|
#endif /* FFI_SIZEOF_JAVA_RAW == 8 */
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "pdp endian not supported"
|
||||||
|
#endif /* ! PDP */
|
||||||
|
|
||||||
|
#endif /* WORDS_BIGENDIAN */
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
ffi_type **tp = cif->arg_types;
|
||||||
|
|
||||||
|
for (i = 0; i < cif->nargs; i++, tp++, args++)
|
||||||
|
{
|
||||||
|
switch ((*tp)->type)
|
||||||
|
{
|
||||||
|
case FFI_TYPE_UINT8:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(UINT32*)(raw++) = *(UINT8*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->uint = *(UINT8*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT8:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(SINT32*)(raw++) = *(SINT8*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->sint = *(SINT8*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_UINT16:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(UINT32*)(raw++) = *(UINT16*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->uint = *(UINT16*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT16:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(SINT32*)(raw++) = *(SINT16*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->sint = *(SINT16*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_UINT32:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(UINT32*)(raw++) = *(UINT32*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->uint = *(UINT32*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT32:
|
||||||
|
#if WORDS_BIGENDIAN
|
||||||
|
*(SINT32*)(raw++) = *(SINT32*) (*args);
|
||||||
|
#else
|
||||||
|
(raw++)->sint = *(SINT32*) (*args);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_FLOAT:
|
||||||
|
(raw++)->flt = *(FLOAT32*) (*args);
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 8
|
||||||
|
case FFI_TYPE_UINT64:
|
||||||
|
case FFI_TYPE_SINT64:
|
||||||
|
case FFI_TYPE_DOUBLE:
|
||||||
|
raw->uint = *(UINT64*) (*args);
|
||||||
|
raw += 2;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
case FFI_TYPE_POINTER:
|
||||||
|
(raw++)->ptr = **(void***) args;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 8
|
||||||
|
FFI_ASSERT(0); /* Should have covered all cases */
|
||||||
|
#else
|
||||||
|
memcpy ((void*) raw->data, (void*)*args, (*tp)->size);
|
||||||
|
raw +=
|
||||||
|
ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !FFI_NATIVE_RAW_API
|
||||||
|
|
||||||
|
static void
|
||||||
|
ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue)
|
||||||
|
{
|
||||||
|
#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8
|
||||||
|
switch (cif->rtype->type)
|
||||||
|
{
|
||||||
|
case FFI_TYPE_UINT8:
|
||||||
|
case FFI_TYPE_UINT16:
|
||||||
|
case FFI_TYPE_UINT32:
|
||||||
|
*(UINT64 *)rvalue <<= 32;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT8:
|
||||||
|
case FFI_TYPE_SINT16:
|
||||||
|
case FFI_TYPE_SINT32:
|
||||||
|
case FFI_TYPE_INT:
|
||||||
|
#if FFI_SIZEOF_JAVA_RAW == 4
|
||||||
|
case FFI_TYPE_POINTER:
|
||||||
|
#endif
|
||||||
|
*(SINT64 *)rvalue <<= 32;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue)
|
||||||
|
{
|
||||||
|
#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8
|
||||||
|
switch (cif->rtype->type)
|
||||||
|
{
|
||||||
|
case FFI_TYPE_UINT8:
|
||||||
|
case FFI_TYPE_UINT16:
|
||||||
|
case FFI_TYPE_UINT32:
|
||||||
|
*(UINT64 *)rvalue >>= 32;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case FFI_TYPE_SINT8:
|
||||||
|
case FFI_TYPE_SINT16:
|
||||||
|
case FFI_TYPE_SINT32:
|
||||||
|
case FFI_TYPE_INT:
|
||||||
|
*(SINT64 *)rvalue >>= 32;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is a generic definition of ffi_raw_call, to be used if the
|
||||||
|
* native system does not provide a machine-specific implementation.
|
||||||
|
* Having this, allows code to be written for the raw API, without
|
||||||
|
* the need for system-specific code to handle input in that format;
|
||||||
|
* these following couple of functions will handle the translation forth
|
||||||
|
* and back automatically. */
|
||||||
|
|
||||||
|
void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue,
|
||||||
|
ffi_java_raw *raw)
|
||||||
|
{
|
||||||
|
void **avalue = (void**) alloca (cif->nargs * sizeof (void*));
|
||||||
|
ffi_java_raw_to_ptrarray (cif, raw, avalue);
|
||||||
|
ffi_call (cif, fn, rvalue, avalue);
|
||||||
|
ffi_java_rvalue_to_raw (cif, rvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if FFI_CLOSURES /* base system provides closures */
|
||||||
|
|
||||||
|
static void
|
||||||
|
ffi_java_translate_args (ffi_cif *cif, void *rvalue,
|
||||||
|
void **avalue, void *user_data)
|
||||||
|
{
|
||||||
|
ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif));
|
||||||
|
ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
|
||||||
|
|
||||||
|
ffi_java_ptrarray_to_raw (cif, avalue, raw);
|
||||||
|
(*cl->fun) (cif, rvalue, raw, cl->user_data);
|
||||||
|
ffi_java_raw_to_rvalue (cif, rvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||||
|
void *user_data,
|
||||||
|
void *codeloc)
|
||||||
|
{
|
||||||
|
ffi_status status;
|
||||||
|
|
||||||
|
status = ffi_prep_closure_loc ((ffi_closure*) cl,
|
||||||
|
cif,
|
||||||
|
&ffi_java_translate_args,
|
||||||
|
codeloc,
|
||||||
|
codeloc);
|
||||||
|
if (status == FFI_OK)
|
||||||
|
{
|
||||||
|
cl->fun = fun;
|
||||||
|
cl->user_data = user_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Again, here is the generic version of ffi_prep_raw_closure, which
|
||||||
|
* will install an intermediate "hub" for translation of arguments from
|
||||||
|
* the pointer-array format, to the raw format */
|
||||||
|
|
||||||
|
ffi_status
|
||||||
|
ffi_prep_java_raw_closure (ffi_java_raw_closure* cl,
|
||||||
|
ffi_cif *cif,
|
||||||
|
void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*),
|
||||||
|
void *user_data)
|
||||||
|
{
|
||||||
|
return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* FFI_CLOSURES */
|
||||||
|
#endif /* !FFI_NATIVE_RAW_API */
|
||||||
|
#endif /* !FFI_NO_RAW_API */
|
||||||
242
.pc/irix/src/mips/ffitarget.h
Normal file
242
.pc/irix/src/mips/ffitarget.h
Normal file
@@ -0,0 +1,242 @@
|
|||||||
|
/* -----------------------------------------------------------------*-C-*-
|
||||||
|
ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
|
||||||
|
Target configuration macros for MIPS.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
``Software''), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifndef LIBFFI_TARGET_H
|
||||||
|
#define LIBFFI_TARGET_H
|
||||||
|
|
||||||
|
#ifdef linux
|
||||||
|
# include <asm/sgidefs.h>
|
||||||
|
#elif defined(__rtems__)
|
||||||
|
/*
|
||||||
|
* Subprogram calling convention - copied from sgidefs.h
|
||||||
|
*/
|
||||||
|
#define _MIPS_SIM_ABI32 1
|
||||||
|
#define _MIPS_SIM_NABI32 2
|
||||||
|
#define _MIPS_SIM_ABI64 3
|
||||||
|
#else
|
||||||
|
# include <sgidefs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
# ifndef _ABIN32
|
||||||
|
# define _ABIN32 _MIPS_SIM_NABI32
|
||||||
|
# endif
|
||||||
|
# ifndef _ABI64
|
||||||
|
# define _ABI64 _MIPS_SIM_ABI64
|
||||||
|
# endif
|
||||||
|
# ifndef _ABIO32
|
||||||
|
# define _ABIO32 _MIPS_SIM_ABI32
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#if !defined(_MIPS_SIM)
|
||||||
|
-- something is very wrong --
|
||||||
|
#else
|
||||||
|
# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
|
||||||
|
# define FFI_MIPS_N32
|
||||||
|
# else
|
||||||
|
# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
|
||||||
|
# define FFI_MIPS_O32
|
||||||
|
# else
|
||||||
|
-- this is an unsupported platform --
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef FFI_MIPS_O32
|
||||||
|
/* O32 stack frames have 32bit integer args */
|
||||||
|
# define FFI_SIZEOF_ARG 4
|
||||||
|
#else
|
||||||
|
/* N32 and N64 frames have 64bit integer args */
|
||||||
|
# define FFI_SIZEOF_ARG 8
|
||||||
|
# if _MIPS_SIM == _ABIN32
|
||||||
|
# define FFI_SIZEOF_JAVA_RAW 4
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define FFI_FLAG_BITS 2
|
||||||
|
|
||||||
|
/* SGI's strange assembler requires that we multiply by 4 rather
|
||||||
|
than shift left by FFI_FLAG_BITS */
|
||||||
|
|
||||||
|
#define FFI_ARGS_D FFI_TYPE_DOUBLE
|
||||||
|
#define FFI_ARGS_F FFI_TYPE_FLOAT
|
||||||
|
#define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE
|
||||||
|
#define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT
|
||||||
|
#define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT
|
||||||
|
#define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE
|
||||||
|
|
||||||
|
/* Needed for N32 structure returns */
|
||||||
|
#define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8
|
||||||
|
#define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* The SGI assembler can't handle this.. */
|
||||||
|
#define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT
|
||||||
|
/* (and so on) */
|
||||||
|
#else
|
||||||
|
/* ...so we calculate these by hand! */
|
||||||
|
#define FFI_TYPE_STRUCT_D 61
|
||||||
|
#define FFI_TYPE_STRUCT_F 45
|
||||||
|
#define FFI_TYPE_STRUCT_DD 253
|
||||||
|
#define FFI_TYPE_STRUCT_FF 173
|
||||||
|
#define FFI_TYPE_STRUCT_FD 237
|
||||||
|
#define FFI_TYPE_STRUCT_DF 189
|
||||||
|
#define FFI_TYPE_STRUCT_SMALL 93
|
||||||
|
#define FFI_TYPE_STRUCT_SMALL2 109
|
||||||
|
|
||||||
|
/* and for n32 soft float, add 16 * 2^4 */
|
||||||
|
#define FFI_TYPE_STRUCT_D_SOFT 317
|
||||||
|
#define FFI_TYPE_STRUCT_F_SOFT 301
|
||||||
|
#define FFI_TYPE_STRUCT_DD_SOFT 509
|
||||||
|
#define FFI_TYPE_STRUCT_FF_SOFT 429
|
||||||
|
#define FFI_TYPE_STRUCT_FD_SOFT 493
|
||||||
|
#define FFI_TYPE_STRUCT_DF_SOFT 445
|
||||||
|
#define FFI_TYPE_STRUCT_SOFT 16
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef LIBFFI_ASM
|
||||||
|
#define v0 $2
|
||||||
|
#define v1 $3
|
||||||
|
#define a0 $4
|
||||||
|
#define a1 $5
|
||||||
|
#define a2 $6
|
||||||
|
#define a3 $7
|
||||||
|
#define a4 $8
|
||||||
|
#define a5 $9
|
||||||
|
#define a6 $10
|
||||||
|
#define a7 $11
|
||||||
|
#define t0 $8
|
||||||
|
#define t1 $9
|
||||||
|
#define t2 $10
|
||||||
|
#define t3 $11
|
||||||
|
#define t4 $12
|
||||||
|
#define t5 $13
|
||||||
|
#define t6 $14
|
||||||
|
#define t7 $15
|
||||||
|
#define t8 $24
|
||||||
|
#define t9 $25
|
||||||
|
#define ra $31
|
||||||
|
|
||||||
|
#ifdef FFI_MIPS_O32
|
||||||
|
# define REG_L lw
|
||||||
|
# define REG_S sw
|
||||||
|
# define SUBU subu
|
||||||
|
# define ADDU addu
|
||||||
|
# define SRL srl
|
||||||
|
# define LI li
|
||||||
|
#else /* !FFI_MIPS_O32 */
|
||||||
|
# define REG_L ld
|
||||||
|
# define REG_S sd
|
||||||
|
# define SUBU dsubu
|
||||||
|
# define ADDU daddu
|
||||||
|
# define SRL dsrl
|
||||||
|
# define LI dli
|
||||||
|
# if (_MIPS_SIM==_ABI64)
|
||||||
|
# define LA dla
|
||||||
|
# define EH_FRAME_ALIGN 3
|
||||||
|
# define FDE_ADDR_BYTES .8byte
|
||||||
|
# else
|
||||||
|
# define LA la
|
||||||
|
# define EH_FRAME_ALIGN 2
|
||||||
|
# define FDE_ADDR_BYTES .4byte
|
||||||
|
# endif /* _MIPS_SIM==_ABI64 */
|
||||||
|
#endif /* !FFI_MIPS_O32 */
|
||||||
|
#else /* !LIBFFI_ASM */
|
||||||
|
# ifdef __GNUC__
|
||||||
|
# ifdef FFI_MIPS_O32
|
||||||
|
/* O32 stack frames have 32bit integer args */
|
||||||
|
typedef unsigned int ffi_arg __attribute__((__mode__(__SI__)));
|
||||||
|
typedef signed int ffi_sarg __attribute__((__mode__(__SI__)));
|
||||||
|
#else
|
||||||
|
/* N32 and N64 frames have 64bit integer args */
|
||||||
|
typedef unsigned int ffi_arg __attribute__((__mode__(__DI__)));
|
||||||
|
typedef signed int ffi_sarg __attribute__((__mode__(__DI__)));
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef FFI_MIPS_O32
|
||||||
|
/* O32 stack frames have 32bit integer args */
|
||||||
|
typedef __uint32_t ffi_arg;
|
||||||
|
typedef __int32_t ffi_sarg;
|
||||||
|
# else
|
||||||
|
/* N32 and N64 frames have 64bit integer args */
|
||||||
|
typedef __uint64_t ffi_arg;
|
||||||
|
typedef __int64_t ffi_sarg;
|
||||||
|
# endif
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
|
||||||
|
typedef enum ffi_abi {
|
||||||
|
FFI_FIRST_ABI = 0,
|
||||||
|
FFI_O32,
|
||||||
|
FFI_N32,
|
||||||
|
FFI_N64,
|
||||||
|
FFI_O32_SOFT_FLOAT,
|
||||||
|
FFI_N32_SOFT_FLOAT,
|
||||||
|
FFI_N64_SOFT_FLOAT,
|
||||||
|
FFI_LAST_ABI,
|
||||||
|
|
||||||
|
#ifdef FFI_MIPS_O32
|
||||||
|
#ifdef __mips_soft_float
|
||||||
|
FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT
|
||||||
|
#else
|
||||||
|
FFI_DEFAULT_ABI = FFI_O32
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
# if _MIPS_SIM==_ABI64
|
||||||
|
# ifdef __mips_soft_float
|
||||||
|
FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT
|
||||||
|
# else
|
||||||
|
FFI_DEFAULT_ABI = FFI_N64
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# ifdef __mips_soft_float
|
||||||
|
FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT
|
||||||
|
# else
|
||||||
|
FFI_DEFAULT_ABI = FFI_N32
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
} ffi_abi;
|
||||||
|
|
||||||
|
#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag
|
||||||
|
#endif /* !LIBFFI_ASM */
|
||||||
|
|
||||||
|
/* ---- Definitions for closures ----------------------------------------- */
|
||||||
|
|
||||||
|
#if defined(FFI_MIPS_O32)
|
||||||
|
#define FFI_CLOSURES 1
|
||||||
|
#define FFI_TRAMPOLINE_SIZE 20
|
||||||
|
#else
|
||||||
|
/* N32/N64. */
|
||||||
|
# define FFI_CLOSURES 1
|
||||||
|
#if _MIPS_SIM==_ABI64
|
||||||
|
#define FFI_TRAMPOLINE_SIZE 52
|
||||||
|
#else
|
||||||
|
#define FFI_TRAMPOLINE_SIZE 20
|
||||||
|
#endif
|
||||||
|
#endif /* FFI_MIPS_O32 */
|
||||||
|
#define FFI_NATIVE_RAW_API 0
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
2011-02-09 Stuart Shelton <srcshelton@gmail.com>
|
||||||
|
|
||||||
|
http://bugs.gentoo.org/show_bug.cgi?id=286911
|
||||||
|
* src/mips/ffitarget.h: Clean up error messages.
|
||||||
|
* src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to
|
||||||
|
ffi_raw*.
|
||||||
|
* include/ffi.h.in: Add pragma for SGI compiler.
|
||||||
|
|
||||||
2011-02-09 Anthony Green <green@moxielogic.com>
|
2011-02-09 Anthony Green <green@moxielogic.com>
|
||||||
|
|
||||||
* configure.ac: Add powerpc64-*-darwin* support.
|
* configure.ac: Add powerpc64-*-darwin* support.
|
||||||
|
|||||||
@@ -278,6 +278,9 @@ typedef struct {
|
|||||||
} ffi_closure __attribute__((aligned (8)));
|
} ffi_closure __attribute__((aligned (8)));
|
||||||
#else
|
#else
|
||||||
} ffi_closure;
|
} ffi_closure;
|
||||||
|
# ifdef __sgi
|
||||||
|
# pragma pack 0
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void *ffi_closure_alloc (size_t size, void **code);
|
void *ffi_closure_alloc (size_t size, void **code);
|
||||||
@@ -296,6 +299,9 @@ ffi_prep_closure_loc (ffi_closure*,
|
|||||||
void *user_data,
|
void *user_data,
|
||||||
void*codeloc);
|
void*codeloc);
|
||||||
|
|
||||||
|
#ifdef __sgi
|
||||||
|
# pragma pack 8
|
||||||
|
#endif
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char tramp[FFI_TRAMPOLINE_SIZE];
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||||
|
|
||||||
|
|||||||
75
patches/irix
Normal file
75
patches/irix
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
Index: libffi/ChangeLog
|
||||||
|
===================================================================
|
||||||
|
--- libffi.orig/ChangeLog
|
||||||
|
+++ libffi/ChangeLog
|
||||||
|
@@ -1,3 +1,11 @@
|
||||||
|
+2011-02-09 Stuart Shelton <srcshelton@gmail.com>
|
||||||
|
+
|
||||||
|
+ http://bugs.gentoo.org/show_bug.cgi?id=286911
|
||||||
|
+ * src/mips/ffitarget.h: Clean up error messages.
|
||||||
|
+ * src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to
|
||||||
|
+ ffi_raw*.
|
||||||
|
+ * include/ffi.h.in: Add pragma for SGI compiler.
|
||||||
|
+
|
||||||
|
2011-02-09 Anthony Green <green@moxielogic.com>
|
||||||
|
|
||||||
|
* configure.ac: Add powerpc64-*-darwin* support.
|
||||||
|
Index: libffi/include/ffi.h.in
|
||||||
|
===================================================================
|
||||||
|
--- libffi.orig/include/ffi.h.in
|
||||||
|
+++ libffi/include/ffi.h.in
|
||||||
|
@@ -278,6 +278,9 @@ typedef struct {
|
||||||
|
} ffi_closure __attribute__((aligned (8)));
|
||||||
|
#else
|
||||||
|
} ffi_closure;
|
||||||
|
+# ifdef __sgi
|
||||||
|
+# pragma pack 0
|
||||||
|
+# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *ffi_closure_alloc (size_t size, void **code);
|
||||||
|
@@ -296,6 +299,9 @@ ffi_prep_closure_loc (ffi_closure*,
|
||||||
|
void *user_data,
|
||||||
|
void*codeloc);
|
||||||
|
|
||||||
|
+#ifdef __sgi
|
||||||
|
+# pragma pack 8
|
||||||
|
+#endif
|
||||||
|
typedef struct {
|
||||||
|
char tramp[FFI_TRAMPOLINE_SIZE];
|
||||||
|
|
||||||
|
Index: libffi/src/java_raw_api.c
|
||||||
|
===================================================================
|
||||||
|
--- libffi.orig/src/java_raw_api.c
|
||||||
|
+++ libffi/src/java_raw_api.c
|
||||||
|
@@ -311,7 +311,7 @@ ffi_java_translate_args (ffi_cif *cif, v
|
||||||
|
ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
|
||||||
|
|
||||||
|
ffi_java_ptrarray_to_raw (cif, avalue, raw);
|
||||||
|
- (*cl->fun) (cif, rvalue, raw, cl->user_data);
|
||||||
|
+ (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data);
|
||||||
|
ffi_java_raw_to_rvalue (cif, rvalue);
|
||||||
|
}
|
||||||
|
|
||||||
|
Index: libffi/src/mips/ffitarget.h
|
||||||
|
===================================================================
|
||||||
|
--- libffi.orig/src/mips/ffitarget.h
|
||||||
|
+++ libffi/src/mips/ffitarget.h
|
||||||
|
@@ -51,7 +51,7 @@
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#if !defined(_MIPS_SIM)
|
||||||
|
--- something is very wrong --
|
||||||
|
+# error -- something is very wrong --
|
||||||
|
#else
|
||||||
|
# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
|
||||||
|
# define FFI_MIPS_N32
|
||||||
|
@@ -59,7 +59,7 @@
|
||||||
|
# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
|
||||||
|
# define FFI_MIPS_O32
|
||||||
|
# else
|
||||||
|
--- this is an unsupported platform --
|
||||||
|
+# error -- this is an unsupported platform --
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
@@ -16,3 +16,4 @@ ios
|
|||||||
fix-xfails
|
fix-xfails
|
||||||
interix
|
interix
|
||||||
ppc64-darwin
|
ppc64-darwin
|
||||||
|
irix
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ ffi_java_translate_args (ffi_cif *cif, void *rvalue,
|
|||||||
ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
|
ffi_raw_closure *cl = (ffi_raw_closure*)user_data;
|
||||||
|
|
||||||
ffi_java_ptrarray_to_raw (cif, avalue, raw);
|
ffi_java_ptrarray_to_raw (cif, avalue, raw);
|
||||||
(*cl->fun) (cif, rvalue, raw, cl->user_data);
|
(*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data);
|
||||||
ffi_java_raw_to_rvalue (cif, rvalue);
|
ffi_java_raw_to_rvalue (cif, rvalue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
#if !defined(_MIPS_SIM)
|
#if !defined(_MIPS_SIM)
|
||||||
-- something is very wrong --
|
# error -- something is very wrong --
|
||||||
#else
|
#else
|
||||||
# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
|
# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64))
|
||||||
# define FFI_MIPS_N32
|
# define FFI_MIPS_N32
|
||||||
@@ -59,7 +59,7 @@
|
|||||||
# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
|
# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32))
|
||||||
# define FFI_MIPS_O32
|
# define FFI_MIPS_O32
|
||||||
# else
|
# else
|
||||||
-- this is an unsupported platform --
|
# error -- this is an unsupported platform --
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user