Back to index

plt-scheme  4.2.1
ffitarget.h
Go to the documentation of this file.
00001 /* -----------------------------------------------------------------*-C-*-
00002    ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
00003    Copyright (C) 2007, 2008 Free Software Foundation, Inc
00004    Target configuration macros for PowerPC.
00005 
00006    Permission is hereby granted, free of charge, to any person obtaining
00007    a copy of this software and associated documentation files (the
00008    ``Software''), to deal in the Software without restriction, including
00009    without limitation the rights to use, copy, modify, merge, publish,
00010    distribute, sublicense, and/or sell copies of the Software, and to
00011    permit persons to whom the Software is furnished to do so, subject to
00012    the following conditions:
00013 
00014    The above copyright notice and this permission notice shall be included
00015    in all copies or substantial portions of the Software.
00016 
00017    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00019    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00020    IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00021    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00022    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00023    OTHER DEALINGS IN THE SOFTWARE.
00024 
00025    ----------------------------------------------------------------------- */
00026 
00027 #ifndef LIBFFI_TARGET_H
00028 #define LIBFFI_TARGET_H
00029 
00030 /* ---- System specific configurations ----------------------------------- */
00031 
00032 #if defined (POWERPC) && defined (__powerpc64__)
00033 #define POWERPC64
00034 #endif
00035 
00036 #ifndef LIBFFI_ASM
00037 typedef unsigned long          ffi_arg;
00038 typedef signed long            ffi_sarg;
00039 
00040 typedef enum ffi_abi {
00041   FFI_FIRST_ABI = 0,
00042 
00043 #ifdef POWERPC
00044   FFI_SYSV,
00045   FFI_GCC_SYSV,
00046   FFI_LINUX64,
00047   FFI_LINUX,
00048   FFI_LINUX_SOFT_FLOAT,
00049 # ifdef POWERPC64
00050   FFI_DEFAULT_ABI = FFI_LINUX64,
00051 # else
00052 #  if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106))
00053   FFI_DEFAULT_ABI = FFI_LINUX,
00054 #  else
00055 #   ifdef __NO_FPRS__
00056   FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
00057 #   else
00058   FFI_DEFAULT_ABI = FFI_GCC_SYSV,
00059 #   endif
00060 #  endif
00061 # endif
00062 #endif
00063 
00064 #ifdef POWERPC_AIX
00065   FFI_AIX,
00066   FFI_DARWIN,
00067   FFI_DEFAULT_ABI = FFI_AIX,
00068 #endif
00069 
00070 #ifdef POWERPC_DARWIN
00071   FFI_AIX,
00072   FFI_DARWIN,
00073   FFI_DEFAULT_ABI = FFI_DARWIN,
00074 #endif
00075 
00076 #ifdef POWERPC_FREEBSD
00077   FFI_SYSV,
00078   FFI_GCC_SYSV,
00079   FFI_LINUX64,
00080   FFI_LINUX,
00081   FFI_LINUX_SOFT_FLOAT,
00082   FFI_DEFAULT_ABI = FFI_SYSV,
00083 #endif
00084 
00085   FFI_LAST_ABI
00086 } ffi_abi;
00087 #endif
00088 
00089 /* ---- Definitions for closures ----------------------------------------- */
00090 
00091 #define FFI_CLOSURES 1
00092 #define FFI_NATIVE_RAW_API 0
00093 
00094 /* For additional types like the below, take care about the order in
00095    ppc_closures.S. They must follow after the FFI_TYPE_LAST.  */
00096 
00097 /* Needed for soft-float long-double-128 support.  */
00098 #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
00099 
00100 /* Needed for FFI_SYSV small structure returns.
00101    We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are
00102    defined in ffi.c, to determine the exact return type and its size.  */
00103 #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
00104 
00105 #if defined(POWERPC64) || defined(POWERPC_AIX)
00106 #define FFI_TRAMPOLINE_SIZE 24
00107 #else /* POWERPC || POWERPC_AIX */
00108 #define FFI_TRAMPOLINE_SIZE 40
00109 #endif
00110 
00111 #ifndef LIBFFI_ASM
00112 #if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
00113 struct ffi_aix_trampoline_struct {
00114     void * code_pointer;    /* Pointer to ffi_closure_ASM */
00115     void * toc;                    /* TOC */
00116     void * static_chain;    /* Pointer to closure */
00117 };
00118 #endif
00119 #endif
00120 
00121 #endif