PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/js/src/ctypes/libffi/src/x86/ffitarget.h

http://github.com/zpao/v8monkey
C Header | 121 lines | 71 code | 16 blank | 34 comment | 4 complexity | 14c1f7aebbfc39f17a9b79f9a421478e MD5 | raw file
  1/* -----------------------------------------------------------------*-C-*-
  2   ffitarget.h - Copyright (c) 1996-2003, 2010  Red Hat, Inc.
  3   Copyright (C) 2008  Free Software Foundation, Inc.
  4
  5   Target configuration macros for x86 and x86-64.
  6
  7   Permission is hereby granted, free of charge, to any person obtaining
  8   a copy of this software and associated documentation files (the
  9   ``Software''), to deal in the Software without restriction, including
 10   without limitation the rights to use, copy, modify, merge, publish,
 11   distribute, sublicense, and/or sell copies of the Software, and to
 12   permit persons to whom the Software is furnished to do so, subject to
 13   the following conditions:
 14
 15   The above copyright notice and this permission notice shall be included
 16   in all copies or substantial portions of the Software.
 17
 18   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
 19   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 20   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 21   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 23   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 24   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 25   DEALINGS IN THE SOFTWARE.
 26
 27   ----------------------------------------------------------------------- */
 28
 29#ifndef LIBFFI_TARGET_H
 30#define LIBFFI_TARGET_H
 31
 32/* ---- System specific configurations ----------------------------------- */
 33
 34/* For code common to all platforms on x86 and x86_64. */
 35#define X86_ANY
 36
 37#if defined (X86_64) && defined (__i386__)
 38#undef X86_64
 39#define X86
 40#endif
 41
 42#ifdef X86_WIN64
 43#define FFI_SIZEOF_ARG 8
 44#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */
 45#endif
 46
 47/* ---- Generic type definitions ----------------------------------------- */
 48
 49#ifndef LIBFFI_ASM
 50#ifdef X86_WIN64
 51#ifdef _MSC_VER
 52typedef unsigned __int64       ffi_arg;
 53typedef __int64                ffi_sarg;
 54#else
 55typedef unsigned long long     ffi_arg;
 56typedef long long              ffi_sarg;
 57#endif
 58#else
 59typedef unsigned long          ffi_arg;
 60typedef signed long            ffi_sarg;
 61#endif
 62
 63typedef enum ffi_abi {
 64  FFI_FIRST_ABI = 0,
 65
 66  /* ---- Intel x86 Win32 ---------- */
 67#ifdef X86_WIN32
 68  FFI_SYSV,
 69  FFI_STDCALL,
 70  FFI_LAST_ABI,
 71  /* TODO: Add fastcall support for the sake of completeness */
 72  FFI_DEFAULT_ABI = FFI_SYSV
 73
 74#elif defined(X86_WIN64)
 75  FFI_WIN64,
 76  FFI_LAST_ABI,
 77  FFI_DEFAULT_ABI = FFI_WIN64
 78
 79#else
 80  /* ---- Intel x86 and AMD x86-64 - */
 81  FFI_SYSV,
 82  FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
 83  FFI_LAST_ABI,
 84#if defined(__i386__) || defined(__i386)
 85  FFI_DEFAULT_ABI = FFI_SYSV
 86#else
 87  FFI_DEFAULT_ABI = FFI_UNIX64
 88#endif
 89#endif
 90} ffi_abi;
 91#endif
 92
 93/* ---- Definitions for closures ----------------------------------------- */
 94
 95#define FFI_CLOSURES 1
 96#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)
 97#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)
 98#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)
 99
100#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))
101#define FFI_TRAMPOLINE_SIZE 24
102#define FFI_NATIVE_RAW_API 0
103#else
104#ifdef X86_WIN32
105#define FFI_TRAMPOLINE_SIZE 13
106#else
107#ifdef X86_WIN64
108#define FFI_TRAMPOLINE_SIZE 29
109#define FFI_NATIVE_RAW_API 0
110#define FFI_NO_RAW_API 1
111#else
112#define FFI_TRAMPOLINE_SIZE 10
113#endif
114#endif
115#ifndef X86_WIN64
116#define FFI_NATIVE_RAW_API 1	/* x86 has native raw api support */
117#endif
118#endif
119
120#endif
121