| 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(_WIN32) |
| 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_WIN64, |
| 49 |
FFI_LAST_ABI, |
| 50 |
#if defined(_WIN32) |
| 51 |
FFI_DEFAULT_ABI = FFI_WIN64 |
| 52 |
#else |
| 53 |
FFI_DEFAULT_ABI = FFI_SYSV |
| 54 |
#endif |
| 55 |
} ffi_abi; |
| 56 |
#endif |
| 57 |
|
| 58 |
/* ---- Definitions for closures ----------------------------------------- */ |
| 59 |
|
| 60 |
#define FFI_CLOSURES 1 |
| 61 |
#define FFI_NATIVE_RAW_API 0 |
| 62 |
|
| 63 |
#if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE |
| 64 |
|
| 65 |
#ifdef __MACH__ |
| 66 |
#define FFI_TRAMPOLINE_SIZE 16 |
| 67 |
#define FFI_TRAMPOLINE_CLOSURE_OFFSET 16 |
| 68 |
#else |
| 69 |
#error "No trampoline table implementation" |
| 70 |
#endif |
| 71 |
|
| 72 |
#else |
| 73 |
#define FFI_TRAMPOLINE_SIZE 24 |
| 74 |
#define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE |
| 75 |
#endif |
| 76 |
|
| 77 |
#ifdef _WIN32 |
| 78 |
#define FFI_EXTRA_CIF_FIELDS unsigned is_variadic |
| 79 |
#endif |
| 80 |
#define FFI_TARGET_SPECIFIC_VARIADIC |
| 81 |
|
| 82 |
/* ---- Internal ---- */ |
| 83 |
|
| 84 |
#if defined (__APPLE__) |
| 85 |
#define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs |
| 86 |
#elif !defined(_WIN32) && !defined(__ANDROID__) |
| 87 |
/* iOS, Windows and Android reserve x18 for the system. Disable Go closures until |
| 88 |
a new static chain is chosen. */ |
| 89 |
#define FFI_GO_CLOSURES 1 |
| 90 |
#endif |
| 91 |
|
| 92 |
#ifndef _WIN32 |
| 93 |
/* No complex type on Windows */ |
| 94 |
#define FFI_TARGET_HAS_COMPLEX_TYPE |
| 95 |
#endif |
| 96 |
|
| 97 |
#endif |