OSDN Git Service

a39a62671661cdbf2b5a3772bb7023876b90cc85
[pf3gnuchains/gcc-fork.git] / libffi / src / powerpc / ffitarget.h
1 /* -----------------------------------------------------------------*-C-*-
2    ffitarget.h - Copyright (c) 1996-2003  Red Hat, Inc.
3    Copyright (C) 2007, 2008 Free Software Foundation, Inc
4    Target configuration macros for PowerPC.
5
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
14    The above copyright notice and this permission notice shall be included
15    in all copies or substantial portions of the Software.
16
17    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
18    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20    IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23    OTHER DEALINGS IN THE SOFTWARE.
24
25    ----------------------------------------------------------------------- */
26
27 #ifndef LIBFFI_TARGET_H
28 #define LIBFFI_TARGET_H
29
30 /* ---- System specific configurations ----------------------------------- */
31
32 #if defined (POWERPC) && defined (__powerpc64__)
33 #define POWERPC64
34 #endif
35
36 #ifndef LIBFFI_ASM
37 typedef unsigned long          ffi_arg;
38 typedef signed long            ffi_sarg;
39
40 typedef enum ffi_abi {
41   FFI_FIRST_ABI = 0,
42
43 #ifdef POWERPC
44   FFI_SYSV,
45   FFI_GCC_SYSV,
46   FFI_LINUX64,
47   FFI_LINUX,
48   FFI_LINUX_SOFT_FLOAT,
49 # ifdef POWERPC64
50   FFI_DEFAULT_ABI = FFI_LINUX64,
51 # else
52 #  if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106))
53   FFI_DEFAULT_ABI = FFI_LINUX,
54 #  else
55 #   ifdef __NO_FPRS__
56   FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT,
57 #   else
58   FFI_DEFAULT_ABI = FFI_GCC_SYSV,
59 #   endif
60 #  endif
61 # endif
62 #endif
63
64 #ifdef POWERPC_AIX
65   FFI_AIX,
66   FFI_DARWIN,
67   FFI_DEFAULT_ABI = FFI_AIX,
68 #endif
69
70 #ifdef POWERPC_DARWIN
71   FFI_AIX,
72   FFI_DARWIN,
73   FFI_DEFAULT_ABI = FFI_DARWIN,
74 #endif
75
76 #ifdef POWERPC_FREEBSD
77   FFI_SYSV,
78   FFI_GCC_SYSV,
79   FFI_LINUX64,
80   FFI_LINUX,
81   FFI_LINUX_SOFT_FLOAT,
82   FFI_DEFAULT_ABI = FFI_SYSV,
83 #endif
84
85   FFI_LAST_ABI
86 } ffi_abi;
87 #endif
88
89 /* ---- Definitions for closures ----------------------------------------- */
90
91 #define FFI_CLOSURES 1
92 #define FFI_NATIVE_RAW_API 0
93
94 /* For additional types like the below, take care about the order in
95    ppc_closures.S. They must follow after the FFI_TYPE_LAST.  */
96
97 /* Needed for soft-float long-double-128 support.  */
98 #define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1)
99
100 /* Needed for FFI_SYSV small structure returns.
101    We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are
102    defined in ffi.c, to determine the exact return type and its size.  */
103 #define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2)
104
105 #if defined(POWERPC64) || defined(POWERPC_AIX)
106 #define FFI_TRAMPOLINE_SIZE 24
107 #else /* POWERPC || POWERPC_AIX */
108 #define FFI_TRAMPOLINE_SIZE 40
109 #endif
110
111 #ifndef LIBFFI_ASM
112 #if defined(POWERPC_DARWIN) || defined(POWERPC_AIX)
113 struct ffi_aix_trampoline_struct {
114     void * code_pointer;        /* Pointer to ffi_closure_ASM */
115     void * toc;                 /* TOC */
116     void * static_chain;        /* Pointer to closure */
117 };
118 #endif
119 #endif
120
121 #endif