• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd.
2 
3 Permission is hereby granted, free of charge, to any person obtaining
4 a copy of this software and associated documentation files (the
5 ``Software''), to deal in the Software without restriction, including
6 without limitation the rights to use, copy, modify, merge, publish,
7 distribute, sublicense, and/or sell copies of the Software, and to
8 permit persons to whom the Software is furnished to do so, subject to
9 the following conditions:
10 
11 The above copyright notice and this permission notice shall be
12 included in all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
21 
22 #ifndef LIBFFI_TARGET_H
23 #define LIBFFI_TARGET_H
24 
25 #ifndef LIBFFI_H
26 #error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."
27 #endif
28 
29 #ifndef LIBFFI_ASM
30 #ifdef __ILP32__
31 #define FFI_SIZEOF_ARG 8
32 #define FFI_SIZEOF_JAVA_RAW  4
33 typedef unsigned long long ffi_arg;
34 typedef signed long long ffi_sarg;
35 #elif defined(_M_ARM64)
36 #define FFI_SIZEOF_ARG 8
37 typedef unsigned long long ffi_arg;
38 typedef signed long long ffi_sarg;
39 #else
40 typedef unsigned long ffi_arg;
41 typedef signed long ffi_sarg;
42 #endif
43 
44 typedef enum ffi_abi
45   {
46     FFI_FIRST_ABI = 0,
47     FFI_SYSV,
48     FFI_LAST_ABI,
49     FFI_DEFAULT_ABI = FFI_SYSV
50   } ffi_abi;
51 #endif
52 
53 /* ---- Definitions for closures ----------------------------------------- */
54 
55 #define FFI_CLOSURES 1
56 #define FFI_NATIVE_RAW_API 0
57 
58 #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
59 
60 #ifdef __MACH__
61 #define FFI_TRAMPOLINE_SIZE 16
62 #define FFI_TRAMPOLINE_CLOSURE_OFFSET 16
63 #else
64 #error "No trampoline table implementation"
65 #endif
66 
67 #else
68 #define FFI_TRAMPOLINE_SIZE 24
69 #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
70 #endif
71 
72 #ifdef _M_ARM64
73 #define FFI_EXTRA_CIF_FIELDS unsigned is_variadic
74 #endif
75 
76 /* ---- Internal ---- */
77 
78 #if defined (__APPLE__)
79 #define FFI_TARGET_SPECIFIC_VARIADIC
80 #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs
81 #elif !defined(_M_ARM64)
82 /* iOS and Windows reserve x18 for the system.  Disable Go closures until
83    a new static chain is chosen.  */
84 #define FFI_GO_CLOSURES 1
85 #endif
86 
87 #ifndef _M_ARM64
88 /* No complex type on Windows */
89 #define FFI_TARGET_HAS_COMPLEX_TYPE
90 #endif
91 
92 #endif
93