/Modules/_ctypes/libffi/src/powerpc/ffitarget.h

http://unladen-swallow.googlecode.com/ · C++ Header · 118 lines · 68 code · 18 blank · 32 comment · 6 complexity · f9aa53a88d448b422cc7f279d1c64a02 MD5 · raw file

  1. /* -----------------------------------------------------------------*-C-*-
  2. ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
  3. Copyright (C) 2007 Free Software Foundation, Inc
  4. Target configuration macros for PowerPC.
  5. Permission is hereby granted, free of charge, to any person obtaining
  6. a copy of this software and associated documentation files (the
  7. ``Software''), to deal in the Software without restriction, including
  8. without limitation the rights to use, copy, modify, merge, publish,
  9. distribute, sublicense, and/or sell copies of the Software, and to
  10. permit persons to whom the Software is furnished to do so, subject to
  11. the following conditions:
  12. The above copyright notice and this permission notice shall be included
  13. in all copies or substantial portions of the Software.
  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
  17. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  18. HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  19. WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. DEALINGS IN THE SOFTWARE.
  22. ----------------------------------------------------------------------- */
  23. #ifndef LIBFFI_TARGET_H
  24. #define LIBFFI_TARGET_H
  25. /* ---- System specific configurations ----------------------------------- */
  26. #if defined (POWERPC) && defined (__powerpc64__)
  27. #define POWERPC64
  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. #ifdef POWERPC
  35. FFI_SYSV,
  36. FFI_GCC_SYSV,
  37. FFI_LINUX64,
  38. FFI_LINUX,
  39. FFI_LINUX_SOFT_FLOAT,
  40. # ifdef POWERPC64
  41. FFI_DEFAULT_ABI = FFI_LINUX64,
  42. # else
  43. # if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106))
  44. FFI_DEFAULT_ABI = FFI_LINUX,
  45. # else
  46. # ifdef __NO_FPRS__
  47. FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
  48. # else
  49. FFI_DEFAULT_ABI = FFI_GCC_SYSV,
  50. # endif
  51. # endif
  52. # endif
  53. #endif
  54. #ifdef POWERPC_AIX
  55. FFI_AIX,
  56. FFI_DARWIN,
  57. FFI_DEFAULT_ABI = FFI_AIX,
  58. #endif
  59. #ifdef POWERPC_DARWIN
  60. FFI_AIX,
  61. FFI_DARWIN,
  62. FFI_DEFAULT_ABI = FFI_DARWIN,
  63. #endif
  64. #ifdef POWERPC_FREEBSD
  65. FFI_SYSV,
  66. FFI_GCC_SYSV,
  67. FFI_LINUX64,
  68. FFI_DEFAULT_ABI = FFI_SYSV,
  69. #endif
  70. FFI_LAST_ABI
  71. } ffi_abi;
  72. #endif
  73. /* ---- Definitions for closures ----------------------------------------- */
  74. #define FFI_CLOSURES 1
  75. #define FFI_NATIVE_RAW_API 0
  76. /* For additional types like the below, take care about the order in
  77. ppc_closures.S. They must follow after the FFI_TYPE_LAST. */
  78. /* Needed for soft-float long-double-128 support. */
  79. #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
  80. /* Needed for FFI_SYSV small structure returns. */
  81. #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
  82. #if defined(POWERPC64) || defined(POWERPC_AIX)
  83. #define FFI_TRAMPOLINE_SIZE 24
  84. #else /* POWERPC || POWERPC_AIX */
  85. #define FFI_TRAMPOLINE_SIZE 40
  86. #endif
  87. #ifndef LIBFFI_ASM
  88. #if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
  89. struct ffi_aix_trampoline_struct {
  90. void * code_pointer; /* Pointer to ffi_closure_ASM */
  91. void * toc; /* TOC */
  92. void * static_chain; /* Pointer to closure */
  93. };
  94. #endif
  95. #endif
  96. #endif