/Modules/_ctypes/libffi_osx/include/ppc-ffitarget.h

http://unladen-swallow.googlecode.com/ · C++ Header · 104 lines · 60 code · 18 blank · 26 comment · 4 complexity · f972c99d01bda1b96f93ba879bde35e6 MD5 · raw file

  1. /* -----------------------------------------------------------------*-C-*-
  2. ppc-ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc.
  3. Target configuration macros for PowerPC.
  4. Permission is hereby granted, free of charge, to any person obtaining
  5. a copy of this software and associated documentation files (the
  6. ``Software''), to deal in the Software without restriction, including
  7. without limitation the rights to use, copy, modify, merge, publish,
  8. distribute, sublicense, and/or sell copies of the Software, and to
  9. permit persons to whom the Software is furnished to do so, subject to
  10. the following conditions:
  11. The above copyright notice and this permission notice shall be included
  12. in all copies or substantial portions of the Software.
  13. THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
  14. OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  16. IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  17. OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  18. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  19. OTHER DEALINGS IN THE SOFTWARE.
  20. ----------------------------------------------------------------------- */
  21. #ifndef LIBFFI_TARGET_H
  22. #define LIBFFI_TARGET_H
  23. /* ---- System specific configurations ----------------------------------- */
  24. #if (defined(POWERPC) && defined(__powerpc64__)) || \
  25. (defined(POWERPC_DARWIN) && defined(__ppc64__))
  26. #define POWERPC64
  27. #endif
  28. #ifndef LIBFFI_ASM
  29. typedef unsigned long ffi_arg;
  30. typedef signed long ffi_sarg;
  31. typedef enum ffi_abi {
  32. FFI_FIRST_ABI = 0,
  33. #ifdef POWERPC
  34. FFI_SYSV,
  35. FFI_GCC_SYSV,
  36. FFI_LINUX64,
  37. # ifdef POWERPC64
  38. FFI_DEFAULT_ABI = FFI_LINUX64,
  39. # else
  40. FFI_DEFAULT_ABI = FFI_GCC_SYSV,
  41. # endif
  42. #endif
  43. #ifdef POWERPC_AIX
  44. FFI_AIX,
  45. FFI_DARWIN,
  46. FFI_DEFAULT_ABI = FFI_AIX,
  47. #endif
  48. #ifdef POWERPC_DARWIN
  49. FFI_AIX,
  50. FFI_DARWIN,
  51. FFI_DEFAULT_ABI = FFI_DARWIN,
  52. #endif
  53. #ifdef POWERPC_FREEBSD
  54. FFI_SYSV,
  55. FFI_GCC_SYSV,
  56. FFI_LINUX64,
  57. FFI_DEFAULT_ABI = FFI_SYSV,
  58. #endif
  59. FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
  60. } ffi_abi;
  61. #endif // #ifndef LIBFFI_ASM
  62. /* ---- Definitions for closures ----------------------------------------- */
  63. #define FFI_CLOSURES 1
  64. #define FFI_NATIVE_RAW_API 0
  65. /* Needed for FFI_SYSV small structure returns. */
  66. #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST)
  67. #if defined(POWERPC64) /*|| defined(POWERPC_AIX)*/
  68. # define FFI_TRAMPOLINE_SIZE 48
  69. #elif defined(POWERPC_AIX)
  70. # define FFI_TRAMPOLINE_SIZE 24
  71. #else
  72. # define FFI_TRAMPOLINE_SIZE 40
  73. #endif
  74. #ifndef LIBFFI_ASM
  75. # if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
  76. typedef struct ffi_aix_trampoline_struct {
  77. void* code_pointer; /* Pointer to ffi_closure_ASM */
  78. void* toc; /* TOC */
  79. void* static_chain; /* Pointer to closure */
  80. } ffi_aix_trampoline_struct;
  81. # endif
  82. #endif // #ifndef LIBFFI_ASM
  83. #endif // #ifndef LIBFFI_TARGET_H