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) 2008  Free Software Foundation, Inc.
00004 
00005    Target configuration macros for x86 and x86-64.
00006 
00007    Permission is hereby granted, free of charge, to any person obtaining
00008    a copy of this software and associated documentation files (the
00009    ``Software''), to deal in the Software without restriction, including
00010    without limitation the rights to use, copy, modify, merge, publish,
00011    distribute, sublicense, and/or sell copies of the Software, and to
00012    permit persons to whom the Software is furnished to do so, subject to
00013    the following conditions:
00014 
00015    The above copyright notice and this permission notice shall be included
00016    in all copies or substantial portions of the Software.
00017 
00018    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
00019    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00020    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00021    IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
00022    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
00023    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00024    OTHER DEALINGS IN THE SOFTWARE.
00025 
00026    ----------------------------------------------------------------------- */
00027 
00028 #ifndef LIBFFI_TARGET_H
00029 #define LIBFFI_TARGET_H
00030 
00031 /* ---- System specific configurations ----------------------------------- */
00032 
00033 #if defined (X86_64) && defined (__i386__)
00034 #undef X86_64
00035 #define X86
00036 #endif
00037 
00038 /* ---- Generic type definitions ----------------------------------------- */
00039 
00040 #ifndef LIBFFI_ASM
00041 typedef unsigned long          ffi_arg;
00042 typedef signed long            ffi_sarg;
00043 
00044 typedef enum ffi_abi {
00045   FFI_FIRST_ABI = 0,
00046 
00047   /* ---- Intel x86 Win32 ---------- */
00048 #ifdef X86_WIN32
00049   FFI_SYSV,
00050   FFI_STDCALL,
00051   /* TODO: Add fastcall support for the sake of completeness */
00052   FFI_DEFAULT_ABI = FFI_SYSV,
00053 #endif
00054 
00055   /* ---- Intel x86 and AMD x86-64 - */
00056 #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
00057   FFI_SYSV,
00058   FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
00059 #ifdef __i386__
00060   FFI_DEFAULT_ABI = FFI_SYSV,
00061 #else
00062   FFI_DEFAULT_ABI = FFI_UNIX64,
00063 #endif
00064 #endif
00065 
00066   FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
00067 } ffi_abi;
00068 #endif
00069 
00070 /* ---- Definitions for closures ----------------------------------------- */
00071 
00072 #define FFI_CLOSURES 1
00073 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
00074 #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
00075 
00076 #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
00077 #define FFI_TRAMPOLINE_SIZE 24
00078 #define FFI_NATIVE_RAW_API 0
00079 #else
00080 #define FFI_TRAMPOLINE_SIZE 10
00081 #define FFI_NATIVE_RAW_API 1       /* x86 has native raw api support */
00082 #endif
00083 
00084 #endif
00085