Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
ffitarget.h165 linesDownload Raw Back to include
1/* -----------------------------------------------------------------*-C-*-2   ffitarget.h - Copyright (c) 2012, 2014, 2018  Anthony Green3                 Copyright (c) 1996-2003, 2010  Red Hat, Inc.4                 Copyright (C) 2008  Free Software Foundation, Inc.5 6   Target configuration macros for x86 and x86-64.7 8   Permission is hereby granted, free of charge, to any person obtaining9   a copy of this software and associated documentation files (the10   ``Software''), to deal in the Software without restriction, including11   without limitation the rights to use, copy, modify, merge, publish,12   distribute, sublicense, and/or sell copies of the Software, and to13   permit persons to whom the Software is furnished to do so, subject to14   the following conditions:15 16   The above copyright notice and this permission notice shall be included17   in all copies or substantial portions of the Software.18 19   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,20   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF21   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND22   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT23   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,24   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,25   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER26   DEALINGS IN THE SOFTWARE.27 28   ----------------------------------------------------------------------- */29 30#ifndef LIBFFI_TARGET_H31#define LIBFFI_TARGET_H32 33#ifndef LIBFFI_H34#error "Please do not include ffitarget.h directly into your source.  Use ffi.h instead."35#endif36 37/* ---- System specific configurations ----------------------------------- */38 39/* For code common to all platforms on x86 and x86_64. */40#define X86_ANY41 42#if defined (X86_64) && defined (__i386__)43#undef X86_6444#warning ******************************************************45#warning ********** X86 IS DEFINED ****************************46#warning ******************************************************47#define X8648#endif49 50#ifdef X86_WIN6451#define FFI_SIZEOF_ARG 852#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */53#endif54 55#define FFI_TARGET_SPECIFIC_STACK_SPACE_ALLOCATION56#ifndef _MSC_VER57#define FFI_TARGET_HAS_COMPLEX_TYPE58#endif59 60/* ---- Generic type definitions ----------------------------------------- */61 62#ifndef LIBFFI_ASM63#ifdef X86_WIN6464#ifdef _MSC_VER65typedef unsigned __int64       ffi_arg;66typedef __int64                ffi_sarg;67#else68typedef unsigned long long     ffi_arg;69typedef long long              ffi_sarg;70#endif71#else72#if defined __x86_64__ && defined __ILP32__73#define FFI_SIZEOF_ARG 874#define FFI_SIZEOF_JAVA_RAW  475typedef unsigned long long     ffi_arg;76typedef long long              ffi_sarg;77#else78typedef unsigned long          ffi_arg;79typedef signed long            ffi_sarg;80#endif81#endif82 83typedef enum ffi_abi {84#if defined(X86_WIN64)85  FFI_FIRST_ABI = 0,86  FFI_WIN64,            /* sizeof(long double) == 8  - microsoft compilers */87  FFI_GNUW64,           /* sizeof(long double) == 16 - GNU compilers */88  FFI_LAST_ABI,89#ifdef __GNUC__90  FFI_DEFAULT_ABI = FFI_GNUW6491#else92  FFI_DEFAULT_ABI = FFI_WIN6493#endif94 95#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN))96  FFI_FIRST_ABI = 1,97  FFI_UNIX64,98  FFI_WIN64,99  FFI_EFI64 = FFI_WIN64,100  FFI_GNUW64,101  FFI_LAST_ABI,102  FFI_DEFAULT_ABI = FFI_UNIX64103 104#elif defined(X86_WIN32)105  FFI_FIRST_ABI = 0,106  FFI_SYSV      = 1,107  FFI_STDCALL   = 2,108  FFI_THISCALL  = 3,109  FFI_FASTCALL  = 4,110  FFI_MS_CDECL  = 5,111  FFI_PASCAL    = 6,112  FFI_REGISTER  = 7,113  FFI_LAST_ABI,114  FFI_DEFAULT_ABI = FFI_MS_CDECL115#else116  FFI_FIRST_ABI = 0,117  FFI_SYSV      = 1,118  FFI_THISCALL  = 3,119  FFI_FASTCALL  = 4,120  FFI_STDCALL   = 5,121  FFI_PASCAL    = 6,122  FFI_REGISTER  = 7,123  FFI_MS_CDECL  = 8,124  FFI_LAST_ABI,125  FFI_DEFAULT_ABI = FFI_SYSV126#endif127} ffi_abi;128#endif129 130/* ---- Definitions for closures ----------------------------------------- */131 132#define FFI_CLOSURES 1133#define FFI_GO_CLOSURES 1134 135#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1)136#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2)137#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3)138#define FFI_TYPE_MS_STRUCT       (FFI_TYPE_LAST + 4)139 140#if defined (X86_64) || defined(X86_WIN64) \141    || (defined (__x86_64__) && defined (X86_DARWIN))142/* 4 bytes of ENDBR64 + 7 bytes of LEA + 6 bytes of JMP + 7 bytes of NOP143   + 8 bytes of pointer.  */144# define FFI_TRAMPOLINE_SIZE 32145# define FFI_NATIVE_RAW_API 0146#else147/* 4 bytes of ENDBR32 + 5 bytes of MOV + 5 bytes of JMP + 2 unused148   bytes.  */149# define FFI_TRAMPOLINE_SIZE 16150# define FFI_NATIVE_RAW_API 1  /* x86 has native raw api support */151#endif152 153#if !defined(GENERATE_LIBFFI_MAP) && defined(__CET__)154# include <cet.h>155# if (__CET__ & 1) != 0156#   define ENDBR_PRESENT157# endif158# define _CET_NOTRACK notrack159#else160# define _CET_ENDBR161# define _CET_NOTRACK162#endif163 164#endif165 
codekingpro/portable-devtools · Team Ai