• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* -----------------------------------------------------------------*-C-*-
2    ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
3    Copyright (C) 2008  Free Software Foundation, Inc.
4 
5    Target configuration macros for x86 and x86-64.
6 
7    Permission is hereby granted, free of charge, to any person obtaining
8    a copy of this software and associated documentation files (the
9    ``Software''), to deal in the Software without restriction, including
10    without limitation the rights to use, copy, modify, merge, publish,
11    distribute, sublicense, and/or sell copies of the Software, and to
12    permit persons to whom the Software is furnished to do so, subject to
13    the following conditions:
14 
15    The above copyright notice and this permission notice shall be included
16    in all copies or substantial portions of the Software.
17 
18    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
19    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21    NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25    DEALINGS IN THE SOFTWARE.
26 
27    ----------------------------------------------------------------------- */
28 
29 #ifndef LIBFFI_TARGET_H
30 #define LIBFFI_TARGET_H
31 
32 /* ---- System specific configurations ----------------------------------- */
33 
34 #if defined (X86_64) && defined (__i386__)
35 #undef X86_64
36 #define X86
37 #endif
38 
39 /* ---- Generic type definitions ----------------------------------------- */
40 
41 #ifndef LIBFFI_ASM
42 typedef unsigned long          ffi_arg;
43 typedef signed long            ffi_sarg;
44 
45 typedef enum ffi_abi {
46   FFI_FIRST_ABI = 0,
47 
48   /* ---- Intel x86 Win32 ---------- */
49 #ifdef X86_WIN32
50   FFI_SYSV,
51   FFI_STDCALL,
52   /* TODO: Add fastcall support for the sake of completeness */
53   FFI_DEFAULT_ABI = FFI_SYSV,
54 #endif
55 
56   /* ---- Intel x86 and AMD x86-64 - */
57 #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__))
58   FFI_SYSV,
59   FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
60 #ifdef __i386__
61   FFI_DEFAULT_ABI = FFI_SYSV,
62 #else
63   FFI_DEFAULT_ABI = FFI_UNIX64,
64 #endif
65 #endif
66 
67   FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
68 } ffi_abi;
69 #endif
70 
71 /* ---- Definitions for closures ----------------------------------------- */
72 
73 #define FFI_CLOSURES 1
74 #define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
75 #define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
76 
77 #if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
78 #define FFI_TRAMPOLINE_SIZE 24
79 #define FFI_NATIVE_RAW_API 0
80 #else
81 #ifdef X86_WIN32
82 #define FFI_TRAMPOLINE_SIZE 13
83 #else
84 #define FFI_TRAMPOLINE_SIZE 10
85 #endif
86 #define FFI_NATIVE_RAW_API 1	/* x86 has native raw api support */
87 #endif
88 
89 #endif
90 
91