ffitarget.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* -----------------------------------------------------------------*-C-*-
  2. ffitarget.h - Copyright (c) 2012 Anthony Green
  3. Copyright (c) 2010 CodeSourcery
  4. Copyright (c) 1996-2003 Red Hat, Inc.
  5. Target configuration macros for ARM.
  6. Permission is hereby granted, free of charge, to any person obtaining
  7. a copy of this software and associated documentation files (the
  8. ``Software''), to deal in the Software without restriction, including
  9. without limitation the rights to use, copy, modify, merge, publish,
  10. distribute, sublicense, and/or sell copies of the Software, and to
  11. permit persons to whom the Software is furnished to do so, subject to
  12. the following conditions:
  13. The above copyright notice and this permission notice shall be included
  14. in all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
  16. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  17. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  18. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  19. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  20. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  21. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  22. DEALINGS IN THE SOFTWARE.
  23. ----------------------------------------------------------------------- */
  24. #ifndef LIBFFI_TARGET_H
  25. #define LIBFFI_TARGET_H
  26. #ifndef LIBFFI_H
  27. #error "Please do not include ffitarget.h directly into your source. Use ffi.h instead."
  28. #endif
  29. #ifndef LIBFFI_ASM
  30. typedef unsigned long ffi_arg;
  31. typedef signed long ffi_sarg;
  32. typedef enum ffi_abi {
  33. FFI_FIRST_ABI = 0,
  34. FFI_SYSV,
  35. FFI_VFP,
  36. FFI_LAST_ABI,
  37. #if defined(__ARM_PCS_VFP) || defined(_M_ARM)
  38. FFI_DEFAULT_ABI = FFI_VFP,
  39. #else
  40. FFI_DEFAULT_ABI = FFI_SYSV,
  41. #endif
  42. } ffi_abi;
  43. #endif
  44. #define FFI_EXTRA_CIF_FIELDS \
  45. int vfp_used; \
  46. unsigned short vfp_reg_free, vfp_nargs; \
  47. signed char vfp_args[16] \
  48. #define FFI_TARGET_SPECIFIC_VARIADIC
  49. #ifndef _M_ARM
  50. #define FFI_TARGET_HAS_COMPLEX_TYPE
  51. #endif
  52. /* ---- Definitions for closures ----------------------------------------- */
  53. #define FFI_CLOSURES 1
  54. #define FFI_GO_CLOSURES 1
  55. #define FFI_NATIVE_RAW_API 0
  56. #if defined (FFI_EXEC_TRAMPOLINE_TABLE) && FFI_EXEC_TRAMPOLINE_TABLE
  57. #ifdef __MACH__
  58. #define FFI_TRAMPOLINE_SIZE 12
  59. #define FFI_TRAMPOLINE_CLOSURE_OFFSET 8
  60. #else
  61. #error "No trampoline table implementation"
  62. #endif
  63. #else
  64. #ifdef _MSC_VER
  65. #define FFI_TRAMPOLINE_SIZE 16
  66. #define FFI_TRAMPOLINE_CLOSURE_FUNCTION 12
  67. #else
  68. #define FFI_TRAMPOLINE_SIZE 12
  69. #endif
  70. #define FFI_TRAMPOLINE_CLOSURE_OFFSET FFI_TRAMPOLINE_SIZE
  71. #endif
  72. #endif