mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
File restructure (again)
This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall.h
|
||||
Description: public header for library dyncall
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall C API
|
||||
|
||||
REVISION
|
||||
2015/07/08 added SYS_PPC64 system call
|
||||
2015/01/16 added SYS_PPC32 system call
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_H
|
||||
#define DYNCALL_H
|
||||
|
||||
#include "dyncall_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DCCallVM_ DCCallVM;
|
||||
typedef struct DCstruct_ DCstruct;
|
||||
|
||||
/* Supported Calling Convention Modes */
|
||||
|
||||
#define DC_CALL_C_DEFAULT 0
|
||||
#define DC_CALL_C_ELLIPSIS 100
|
||||
#define DC_CALL_C_ELLIPSIS_VARARGS 101
|
||||
#define DC_CALL_C_X86_CDECL 1
|
||||
#define DC_CALL_C_X86_WIN32_STD 2
|
||||
#define DC_CALL_C_X86_WIN32_FAST_MS 3
|
||||
#define DC_CALL_C_X86_WIN32_FAST_GNU 4
|
||||
#define DC_CALL_C_X86_WIN32_THIS_MS 5
|
||||
#define DC_CALL_C_X86_WIN32_THIS_GNU 6
|
||||
#define DC_CALL_C_X64_WIN64 7
|
||||
#define DC_CALL_C_X64_SYSV 8
|
||||
#define DC_CALL_C_PPC32_DARWIN 9
|
||||
#define DC_CALL_C_PPC32_OSX DC_CALL_C_PPC32_DARWIN /* alias */
|
||||
#define DC_CALL_C_ARM_ARM_EABI 10
|
||||
#define DC_CALL_C_ARM_THUMB_EABI 11
|
||||
#define DC_CALL_C_ARM_ARMHF 30
|
||||
#define DC_CALL_C_MIPS32_EABI 12
|
||||
#define DC_CALL_C_MIPS32_PSPSDK DC_CALL_C_MIPS32_EABI /* alias - deprecated. */
|
||||
#define DC_CALL_C_PPC32_SYSV 13
|
||||
#define DC_CALL_C_PPC32_LINUX DC_CALL_C_PPC32_SYSV /* alias */
|
||||
#define DC_CALL_C_ARM_ARM 14
|
||||
#define DC_CALL_C_ARM_THUMB 15
|
||||
#define DC_CALL_C_MIPS32_O32 16
|
||||
#define DC_CALL_C_MIPS64_N32 17
|
||||
#define DC_CALL_C_MIPS64_N64 18
|
||||
#define DC_CALL_C_X86_PLAN9 19
|
||||
#define DC_CALL_C_SPARC32 20
|
||||
#define DC_CALL_C_SPARC64 21
|
||||
#define DC_CALL_C_ARM64 22
|
||||
#define DC_CALL_C_PPC64 23
|
||||
#define DC_CALL_C_PPC64_LINUX DC_CALL_C_PPC64 /* alias */
|
||||
#define DC_CALL_SYS_DEFAULT 200
|
||||
#define DC_CALL_SYS_X86_INT80H_LINUX 201
|
||||
#define DC_CALL_SYS_X86_INT80H_BSD 202
|
||||
#define DC_CALL_SYS_PPC32 210
|
||||
#define DC_CALL_SYS_PPC64 211
|
||||
|
||||
/* Error codes. */
|
||||
|
||||
#define DC_ERROR_NONE 0
|
||||
#define DC_ERROR_UNSUPPORTED_MODE -1
|
||||
|
||||
DC_API DCCallVM* dcNewCallVM (DCsize size);
|
||||
DC_API void dcFree (DCCallVM* vm);
|
||||
DC_API void dcReset (DCCallVM* vm);
|
||||
|
||||
DC_API void dcMode (DCCallVM* vm, DCint mode);
|
||||
|
||||
DC_API void dcArgBool (DCCallVM* vm, DCbool value);
|
||||
DC_API void dcArgChar (DCCallVM* vm, DCchar value);
|
||||
DC_API void dcArgShort (DCCallVM* vm, DCshort value);
|
||||
DC_API void dcArgInt (DCCallVM* vm, DCint value);
|
||||
DC_API void dcArgLong (DCCallVM* vm, DClong value);
|
||||
DC_API void dcArgLongLong (DCCallVM* vm, DClonglong value);
|
||||
DC_API void dcArgFloat (DCCallVM* vm, DCfloat value);
|
||||
DC_API void dcArgDouble (DCCallVM* vm, DCdouble value);
|
||||
DC_API void dcArgPointer (DCCallVM* vm, DCpointer value);
|
||||
DC_API void dcArgStruct (DCCallVM* vm, DCstruct* s, DCpointer value);
|
||||
|
||||
DC_API void dcCallVoid (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCbool dcCallBool (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCchar dcCallChar (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCshort dcCallShort (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCint dcCallInt (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DClong dcCallLong (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DClonglong dcCallLongLong (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCfloat dcCallFloat (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCdouble dcCallDouble (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API DCpointer dcCallPointer (DCCallVM* vm, DCpointer funcptr);
|
||||
DC_API void dcCallStruct (DCCallVM* vm, DCpointer funcptr, DCstruct* s, DCpointer returnValue);
|
||||
|
||||
DC_API DCint dcGetError (DCCallVM* vm);
|
||||
|
||||
#define DEFAULT_ALIGNMENT 0
|
||||
DC_API DCstruct* dcNewStruct (DCsize fieldCount, DCint alignment);
|
||||
DC_API void dcStructField (DCstruct* s, DCint type, DCint alignment, DCsize arrayLength);
|
||||
DC_API void dcSubStruct (DCstruct* s, DCsize fieldCount, DCint alignment, DCsize arrayLength);
|
||||
/* Each dcNewStruct or dcSubStruct call must be paired with a dcCloseStruct. */
|
||||
DC_API void dcCloseStruct (DCstruct* s);
|
||||
DC_API DCsize dcStructSize (DCstruct* s);
|
||||
DC_API DCsize dcStructAlignment(DCstruct* s);
|
||||
DC_API void dcFreeStruct (DCstruct* s);
|
||||
|
||||
DC_API DCstruct* dcDefineStruct (const char* signature);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_H */
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_alloc_wx.h
|
||||
Description: Allocate write/executable memory - Interface
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_ALLOC_WX_HPP
|
||||
#define DYNCALL_ALLOC_WX_HPP
|
||||
|
||||
#include "dyncall_types.h"
|
||||
|
||||
typedef int DCerror;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DCerror dcAllocWX(DCsize size, void** p);
|
||||
void dcFreeWX (void* p, DCsize size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* DYNCALL_ALLOC_WX_HPP */
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args.h
|
||||
Description: Callback's Arguments VM - Interface
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_ARGS_H
|
||||
#define DYNCALL_ARGS_H
|
||||
|
||||
/*
|
||||
* dyncall args C API
|
||||
*
|
||||
* dyncall args provides serialized access to arguments of a function call.
|
||||
* related concepts: callback
|
||||
*
|
||||
*/
|
||||
|
||||
#include "dyncall.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct DCArgs DCArgs;
|
||||
|
||||
DC_API DCbool dcbArgBool (DCArgs*);
|
||||
DC_API DCchar dcbArgChar (DCArgs*);
|
||||
DC_API DCshort dcbArgShort (DCArgs*);
|
||||
DC_API DCint dcbArgInt (DCArgs*);
|
||||
DC_API DClong dcbArgLong (DCArgs*);
|
||||
DC_API DClonglong dcbArgLongLong (DCArgs*);
|
||||
DC_API DCuchar dcbArgUChar (DCArgs*);
|
||||
DC_API DCushort dcbArgUShort (DCArgs*);
|
||||
DC_API DCuint dcbArgUInt (DCArgs*);
|
||||
DC_API DCulong dcbArgULong (DCArgs*);
|
||||
DC_API DCulonglong dcbArgULongLong(DCArgs*);
|
||||
DC_API DCfloat dcbArgFloat (DCArgs*);
|
||||
DC_API DCdouble dcbArgDouble (DCArgs*);
|
||||
DC_API DCpointer dcbArgPointer (DCArgs*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_ARGS_H */
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_arm32_arm.h
|
||||
Description: Callback's Arguments VM - Header for ARM32 (ARM mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_ARM32_ARM_H
|
||||
#define DYNCALLBACK_ARGS_ARM32_ARM_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
/* Don't change order! */
|
||||
long reg_data[4];
|
||||
int reg_count;
|
||||
long* stack_ptr;
|
||||
#if defined(DC__ABI_ARM_HF)
|
||||
DCfloat f[16];
|
||||
int freg_count;
|
||||
int dreg_count;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_ARM32_ARM_H */
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_arm32_thumb.h
|
||||
Description: Callback's Arguments VM - Header for ARM32 (THUMB mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_ARM32_THUMB_H
|
||||
#define DYNCALLBACK_ARGS_ARM32_THUMB_H
|
||||
|
||||
#include "dyncall_args_arm32_arm.h" /* Uses same code as ARM mode. */
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_ARM32_THUMB_H */
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_mips.h
|
||||
Description: Callback's Arguments VM - Header for MIPS
|
||||
License:
|
||||
|
||||
Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_MIPS_H
|
||||
#define DYNCALLBACK_ARGS_MIPS_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
int ireg_data[8];
|
||||
float freg_data[8];
|
||||
int ireg_count;
|
||||
int freg_count;
|
||||
unsigned char* stackptr;
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_MIPS_H */
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_ppc32.h
|
||||
Description: Callback's Arguments VM - Header for ppc32
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_PPC32_H
|
||||
#define DYNCALLBACK_ARGS_PPC32_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
/* Common Args iterator for Apple and System V ABI. */
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
int ireg_data[8]; /* offset: 0 size: 4*8 = 32 */
|
||||
double freg_data[13]; /* offset: 32 size: 8*13= 104 */
|
||||
unsigned char* stackptr; /* offset: 136 size: 4 */
|
||||
int ireg_count; /* offset: 140 size: 4 */
|
||||
int freg_count; /* offset: 144 size: 4 */
|
||||
}; /* total size: 148 */
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_PPC32_H */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_ppc64.h
|
||||
Description: Callback's Arguments VM - Header for ppc64
|
||||
License:
|
||||
|
||||
Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_PPC64_H
|
||||
#define DYNCALLBACK_ARGS_PPC64_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
long long ireg_data[8];
|
||||
double freg_data[13];
|
||||
unsigned char* stackptr;
|
||||
int ireg_count;
|
||||
int freg_count;
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_PPC64_H */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_sparc32.h
|
||||
Description: Callback's Arguments VM - Header for sparc32
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_SPARC32_H
|
||||
#define DYNCALLBACK_ARGS_SPARC32_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_SPARC32_H */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_sparc64.h
|
||||
Description: Callback's Arguments VM - Header for sparc32 - not yet
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_SPARC64_H
|
||||
#define DYNCALLBACK_ARGS_SPARC64_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
int dummy;
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_SPARC64_H */
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_x64.h
|
||||
Description: Callback's Arguments VM - Header for x64
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALLBACK_ARGS_X64_H
|
||||
#define DYNCALLBACK_ARGS_X64_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
#include "dyncall_callvm_x64.h" /* reuse structures */
|
||||
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
/* state */
|
||||
int64* stack_ptr;
|
||||
DCRegCount_x64 reg_count; /* @@@ win64 version should maybe force alignment to 8 in order to be secure */
|
||||
|
||||
/* reg data */
|
||||
DCRegData_x64_s reg_data;
|
||||
};
|
||||
|
||||
#endif /* DYNCALLBACK_ARGS_X64_H */
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_args_x86.h
|
||||
Description: Callback's Arguments VM - Header for x86
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNCALL_ARGS_X86_H_
|
||||
#define DYNCALL_ARGS_X86_H_
|
||||
|
||||
#include "dyncall_args.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DCint (*i32)(DCArgs*);
|
||||
DClonglong (*i64)(DCArgs*);
|
||||
DCfloat (*f32)(DCArgs*);
|
||||
DCdouble (*f64)(DCArgs*);
|
||||
} DCArgsVT;
|
||||
|
||||
extern DCArgsVT dcArgsVT_default;
|
||||
extern DCArgsVT dcArgsVT_this_ms;
|
||||
extern DCArgsVT dcArgsVT_fast_ms;
|
||||
extern DCArgsVT dcArgsVT_fast_gnu;
|
||||
|
||||
struct DCArgs
|
||||
{
|
||||
/* callmode */
|
||||
DCArgsVT* vt;
|
||||
|
||||
/* state */
|
||||
int* stack_ptr;
|
||||
|
||||
/* fast data / 'this-ptr' info */
|
||||
int fast_data[2];
|
||||
int fast_count;
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_ARGS_X86_H_ */
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback.h
|
||||
Description: Callback - Interface
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_H
|
||||
#define DYNCALL_CALLBACK_H
|
||||
|
||||
#include "dyncall_args.h"
|
||||
#include "dyncall_signature.h"
|
||||
#include "dyncall_value.h"
|
||||
|
||||
typedef struct DCCallback DCCallback;
|
||||
|
||||
// TODO: return value is the type encoded as a signature char (character of the set [vBcCsSiIjJlLfd]).
|
||||
|
||||
typedef char (DCCallbackHandler)(DCCallback* pcb, DCArgs* args, DCValue* result, void* userdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* funcptr, void* userdata);
|
||||
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata);
|
||||
void dcbFreeCallback(DCCallback* pcb);
|
||||
void* dcbGetUserData (DCCallback* pcb);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_H */
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_arm32_arm.h
|
||||
Description: Callback - Header for ARM32 (ARM mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_ARM32_ARM_H_
|
||||
#define DYNCALL_CALLBACK_ARM32_ARM_H_
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_arm32_arm.h"
|
||||
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; // offset 0
|
||||
DCCallbackHandler* handler; // offset 12
|
||||
void* userdata; // offset 16
|
||||
};
|
||||
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_ARM32_ARM_H_ */
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_arm32_thumb.h
|
||||
Description: Callback - Header for ARM32 (THUMB mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_ARM32_THUMB_H_
|
||||
#define DYNCALL_CALLBACK_ARM32_THUMB_H_
|
||||
|
||||
#include "dyncall_callback_arm32_arm.h" /* Uses same code as ARM mode. */
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_ARM32_THUMB_H_ */
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_mips.h
|
||||
Description: Callback - Header for MIPS
|
||||
License:
|
||||
|
||||
Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_MIPS_H
|
||||
#define DYNCALL_CALLBACK_MIPS_H
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_mips.h"
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; /* offset 0, size 20 */
|
||||
DCCallbackHandler* handler; /* offset 20, size 4 */
|
||||
void* userdata; /* offset 24, size 4 */
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_MIPS_H */
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_ppc32.h
|
||||
Description: Callback - Header for ppc32
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_PPC32_H
|
||||
#define DYNCALL_CALLBACK_PPC32_H
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_ppc32.h"
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; /* offset 0, size 24 */
|
||||
DCCallbackHandler* handler; /* offset 24, size 4 */
|
||||
size_t stack_cleanup; /* offset 28, size 4 */
|
||||
void* userdata; /* offset 32, size 4 */
|
||||
}; /* total size 36 */
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_PPC32_H */
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_ppc64.h
|
||||
Description: Callback - Header for ppc64
|
||||
License:
|
||||
|
||||
Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_PPC64_H
|
||||
#define DYNCALL_CALLBACK_PPC64_H
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_ppc64.h"
|
||||
|
||||
/*
|
||||
ELF v2
|
||||
thunk : offset 0, size 48
|
||||
handler : offset 48, size 8
|
||||
stack_cleanup : offset 56, size 8
|
||||
userdata : offset 64, size 8
|
||||
|
||||
ELF v1
|
||||
thunk : offset 0, size 64
|
||||
handler : offset 64, size 8
|
||||
stack_cleanup : offset 72, size 8
|
||||
userdata : offset 80, size 8
|
||||
*/
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk;
|
||||
DCCallbackHandler* handler;
|
||||
size_t stack_cleanup;
|
||||
void* userdata;
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_PPC64_H */
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_sparc32.h
|
||||
Description: Callback - Header for sparc32
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_SPARC32_H
|
||||
#define DYNCALL_CALLBACK_SPARC32_H
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_sparc32.h"
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; /* offset 0, size ?? */
|
||||
DCCallbackHandler* handler; /* offset ??, size 4 */
|
||||
size_t stack_cleanup; /* offset ??, size 4 */
|
||||
void* userdata; /* offset ??, size 4 */
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_SPARC32_H */
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_x64.h
|
||||
Description: Callback - Header for x64
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_X64_H_
|
||||
#define DYNCALL_CALLBACK_X64_H_
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_x64.h"
|
||||
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; // offset 0, size 24
|
||||
DCCallbackHandler* handler; // offset 24
|
||||
void* userdata; // offset 32
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_X64_H_ */
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_callback_x86.h
|
||||
Description: Callback - Header for x86
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLBACK_X86_H_
|
||||
#define DYNCALL_CALLBACK_X86_H_
|
||||
|
||||
#include "dyncall_callback.h"
|
||||
|
||||
#include "dyncall_thunk.h"
|
||||
#include "dyncall_args_x86.h"
|
||||
|
||||
struct DCCallback
|
||||
{
|
||||
DCThunk thunk; /* offset 0, size 16 */
|
||||
DCCallbackHandler* handler; /* offset 16 */
|
||||
DCArgsVT* args_vt; /* offset 20 */
|
||||
size_t stack_cleanup; /* offset 24 */
|
||||
void* userdata; /* offset 28 */
|
||||
};
|
||||
|
||||
int dcCleanupSize_x86_cdecl (const char* args_signature);
|
||||
int dcCleanupSize_x86_std (const char* args_signature);
|
||||
int dcCleanupSize_x86_fast_ms (const char* args_signature);
|
||||
int dcCleanupSize_x86_fast_gnu(const char* args_signature);
|
||||
|
||||
#endif /* DYNCALL_CALLBACK_X86_H_ */
|
||||
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_callf.h
|
||||
Description: formatted call interface to dyncall
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall formatted calls C API
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_CALLF_H
|
||||
#define DYNCALL_CALLF_H
|
||||
|
||||
/* dyncall formatted calls */
|
||||
|
||||
#include "dyncall.h"
|
||||
#include "dyncall_signature.h"
|
||||
#include "dyncall_value.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
void dcArgF (DCCallVM* vm, const DCsigchar* signature, ...);
|
||||
void dcVArgF(DCCallVM* vm, const DCsigchar* signature, va_list args);
|
||||
|
||||
void dcCallF (DCCallVM* vm, DCValue* result, DCpointer funcptr, const DCsigchar* signature, ...);
|
||||
void dcVCallF(DCCallVM* vm, DCValue* result, DCpointer funcptr, const DCsigchar* signature, va_list args);
|
||||
|
||||
#endif /* DYNCALL_CALLF_H */
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_config.h
|
||||
Description: Macro configuration file for non-standard C types
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall type configuration
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_CONFIG_H
|
||||
#define DYNCALL_CONFIG_H
|
||||
|
||||
#include "dyncall_macros.h"
|
||||
|
||||
#define DC_BOOL int
|
||||
#define DC_LONG_LONG long long
|
||||
#define DC_POINTER void*
|
||||
|
||||
#endif /* DYNCALL_CONFIG_H */
|
||||
|
||||
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_macros.h
|
||||
Description: Platform detection macros
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall macros
|
||||
|
||||
Platform detection, specific defines and configuration.
|
||||
The purpose of this file is to provide coherent platform and compiler
|
||||
specific defines. So instead of defines like WIN32, _OpenBSD_ or
|
||||
__GNUC__, one should use DC__OS_Win32, DC__OS_OpenBSD or DC__C_GNU,
|
||||
respectively.
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_MACROS_H
|
||||
#define DYNCALL_MACROS_H
|
||||
|
||||
|
||||
/* Platform specific defines. */
|
||||
|
||||
/* MS Windows XP x64/Vista64 or later. */
|
||||
#if defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
|
||||
#define DC__OS_Win64
|
||||
|
||||
/* MS Windows NT/95/98/ME/2000/XP/Vista32. */
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) || defined(__WINDOWS__) || defined(_WINDOWS)
|
||||
#define DC__OS_Win32
|
||||
|
||||
/* All the OS' based on Darwin OS (MacOS X, OpenDarwin). Note that '__APPLE__' may be defined for classic MacOS, too. */
|
||||
/* __MACOSX__ is not defined in gcc assembler mode (switch: -S) */
|
||||
/* @@@ TODO: Check for Classic OS */
|
||||
|
||||
#elif defined(__APPLE__) || defined(__Darwin__)
|
||||
# define DC__OS_Darwin
|
||||
# if defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
|
||||
# define DC__OS_IPhone
|
||||
# else /* defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) */
|
||||
# define DC__OS_MacOSX
|
||||
# endif
|
||||
|
||||
/* The most popular open source Unix-like OS - Linux. */
|
||||
#elif defined(__linux__) || defined(__linux) || defined(__gnu_linux__)
|
||||
#define DC__OS_Linux
|
||||
|
||||
/* The most powerful open source Unix-like OS - FreeBSD. */
|
||||
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||
#define DC__OS_FreeBSD
|
||||
|
||||
/* The most secure open source Unix-like OS - OpenBSD. */
|
||||
#elif defined(__OpenBSD__)
|
||||
#define DC__OS_OpenBSD
|
||||
|
||||
/* The most portable open source Unix-like OS - NetBSD. */
|
||||
#elif defined(__NetBSD__)
|
||||
#define DC__OS_NetBSD
|
||||
|
||||
/* The FreeBSD fork having heavy clusterization in mind - DragonFlyBSD. */
|
||||
#elif defined(__DragonFly__)
|
||||
#define DC__OS_DragonFlyBSD
|
||||
|
||||
/* Sun's Unix-like OS - SunOS / Solaris. */
|
||||
#elif defined(__sun__) || defined(__sun) || defined(sun)
|
||||
#define DC__OS_SunOS
|
||||
|
||||
/* The "Linux-like environment for Windows" - Cygwin. */
|
||||
#elif defined(__CYGWIN__)
|
||||
#define DC__OS_Cygwin
|
||||
|
||||
/* The "Minimalist GNU for Windows" - MinGW. */
|
||||
#elif defined(__MINGW__)/*@@@*/
|
||||
#define DC__OS_MinGW
|
||||
|
||||
/* The Nintendo DS (homebrew) using devkitpro. */
|
||||
#elif defined(__nds__)
|
||||
#define DC__OS_NDS
|
||||
|
||||
/* The PlayStation Portable (homebrew) SDK. */
|
||||
#elif defined(__psp__) || defined(PSP)
|
||||
#define DC__OS_PSP
|
||||
|
||||
/* Haiku (BeOS alike). */
|
||||
#elif defined(__HAIKU__)
|
||||
#define DC__OS_BeOS
|
||||
|
||||
/* The Unix successor - Plan9 from Bell Labs */
|
||||
#elif defined(Plan9) || defined(__Plan9__)
|
||||
#define DC__OS_Plan9
|
||||
|
||||
/* Digital's Unix-like OS - VMS */
|
||||
#elif defined(__vms)
|
||||
#define DC__OS_VMS
|
||||
|
||||
#elif defined(__minix)
|
||||
#define DC__OS_Minix
|
||||
|
||||
#else
|
||||
#error Unsupported OS.
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Compiler specific defines. Do not change the order, because */
|
||||
/* some of the compilers define flags for compatible ones, too. */
|
||||
|
||||
/* Intel's C/C++ compiler. */
|
||||
#if defined(__INTEL_COMPILER)
|
||||
#define DC__C_Intel
|
||||
|
||||
/* MS C/C++ compiler. */
|
||||
#elif defined(_MSC_VER)
|
||||
#define DC__C_MSVC
|
||||
|
||||
/* LLVM clang. */
|
||||
#elif defined(__clang__)
|
||||
#define DC__C_CLANG
|
||||
|
||||
/* The GNU Compiler Collection - GCC. */
|
||||
#elif defined(__GNUC__)
|
||||
#define DC__C_GNU
|
||||
|
||||
/* Watcom compiler. */
|
||||
#elif defined(__WATCOMC__)
|
||||
#define DC__C_WATCOM
|
||||
|
||||
/* Portable C Compiler. */
|
||||
#elif defined(__PCC__)
|
||||
#define DC__C_PCC
|
||||
|
||||
/* Sun Pro C. */
|
||||
#elif defined(__SUNPRO_C)
|
||||
#define DC__C_SUNPRO
|
||||
|
||||
/* Undetected C Compiler. */
|
||||
#else
|
||||
#define DC__C_UNKNOWN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Architecture. */
|
||||
|
||||
/* Check architecture. */
|
||||
#if defined(_M_X64_) || defined(_M_AMD64) || defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
|
||||
# define DC__Arch_AMD64
|
||||
#elif defined(_M_IX86) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__) || defined(__386__) || defined(__i386)
|
||||
# define DC__Arch_Intel_x86
|
||||
#elif defined(_M_IA64) || defined(__ia64__)
|
||||
# define DC__Arch_Itanium
|
||||
#elif defined(_M_PPC) || defined(__powerpc__) || defined(__powerpc) || defined(__POWERPC__) || defined(__ppc__) || defined(__power__)
|
||||
# if defined(__ppc64__) || defined(_ARCH_PPC64) || defined(__power64__) || defined(__powerpc64__)
|
||||
# define DC__Arch_PPC64
|
||||
# else
|
||||
# define DC__Arch_PPC32
|
||||
# endif
|
||||
#elif defined(__mips64__) || defined(__mips64)
|
||||
# define DC__Arch_MIPS64
|
||||
#elif defined(_M_MRX000) || defined(__mips__) || defined(__mips) || defined(_mips)
|
||||
# define DC__Arch_MIPS
|
||||
#elif defined(__arm__)
|
||||
# define DC__Arch_ARM
|
||||
#elif defined(__aarch64__)
|
||||
# define DC__Arch_ARM64
|
||||
#elif defined(__sh__)
|
||||
# define DC__Arch_SuperH
|
||||
#elif defined(__sparcv9) || defined(__sparc64__) || ( defined(__sparc) && defined(__arch64__) )
|
||||
/* this could be needed on Linux/GNU sparc64 in the future: || ( defined(__sparc) && defined(__arch64__) ) */
|
||||
# define DC__Arch_Sparcv9
|
||||
#elif defined(__sparc)
|
||||
# define DC__Arch_Sparc
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Rough OS classification. */
|
||||
|
||||
#if defined(DC__OS_Win32) || defined(DC__OS_Win64)
|
||||
# define DC_WINDOWS
|
||||
#elif defined(DC__OS_Plan9)
|
||||
# define DC_PLAN9
|
||||
#elif defined(DC__OS_NDS) || defined(DC__OS_PSP)
|
||||
# define DC_OTHER
|
||||
#else
|
||||
# define DC_UNIX
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Misc machine-dependent modes, ABIs, etc.. */
|
||||
|
||||
#if defined(__arm__) && !defined(__thumb__)
|
||||
# define DC__Arch_ARM_ARM
|
||||
#elif defined(__arm__) && defined(__thumb__)
|
||||
# define DC__Arch_ARM_THUMB
|
||||
#endif
|
||||
|
||||
#if defined(DC__Arch_ARM_ARM) || defined(DC__Arch_ARM_THUMB)
|
||||
# if defined(__ARM_EABI__) || defined(DC__OS_NDS)
|
||||
# if defined (__ARM_PCS_VFP) && (__ARM_PCS_VFP == 1)
|
||||
# define DC__ABI_ARM_HF
|
||||
# else
|
||||
# define DC__ABI_ARM_EABI
|
||||
# endif
|
||||
# elif defined(__APCS_32__)
|
||||
# define DC__ABI_ARM_OABI
|
||||
# endif
|
||||
#endif /* ARM */
|
||||
|
||||
#if defined(DC__Arch_MIPS) || defined(DC__Arch_MIPS64)
|
||||
# if defined(_ABIO32) || defined(_MIPS_ARCH_MIPS1) || defined(_MIPS_ARCH_MIPS2)
|
||||
# define DC__ABI_MIPS_O32
|
||||
# elif defined(_ABIN32)
|
||||
# define DC__ABI_MIPS_N32
|
||||
# elif defined(_ABI64)
|
||||
# define DC__ABI_MIPS_N64
|
||||
# else
|
||||
# define DC__ABI_MIPS_EABI
|
||||
# endif
|
||||
#endif /* MIPS */
|
||||
|
||||
#if defined(DC__Arch_PPC64)
|
||||
# if defined(_CALL_ELF)
|
||||
# define DC__ABI_PPC64_ELF_V _CALL_ELF
|
||||
# else
|
||||
# define DC__ABI_PPC64_ELF_V 0 /* 0 means not explicitly set, otherwise this is 1 (big endian) and 2 (little endian) */
|
||||
# endif
|
||||
#endif /* MIPS */
|
||||
|
||||
|
||||
/* Endian detection. */
|
||||
#if defined(DC__Arch_Intel_x86) || defined(DC__Arch_AMD64) /* always little */
|
||||
# define DC__Endian_LITTLE
|
||||
#elif defined(DC__Arch_Sparc) /*always big until v9*/
|
||||
# define DC__Endian_BIG
|
||||
#else /* all others are bi-endian */
|
||||
/* @@@check flags used on following bi-endianness archs:
|
||||
DC__Arch_ARM
|
||||
DC__Arch_ARM64
|
||||
DC__Arch_Itanium
|
||||
DC__Arch_MIPS
|
||||
DC__Arch_MIPS64
|
||||
DC__Arch_PPC32
|
||||
DC__Arch_PPC64
|
||||
DC__Arch_Sparcv9
|
||||
DC__Arch_SuperH
|
||||
*/
|
||||
# if (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 1)) || defined(_BIG_ENDIAN) || defined(MIPSEB)
|
||||
# define DC__Endian_BIG
|
||||
# elif (defined(DC__Arch_PPC64) && (DC__ABI_PPC64_ELF_V == 2)) || defined(_LITTLE_ENDIAN) || defined(MIPSEL)
|
||||
# define DC__Endian_LITTLE
|
||||
# endif /* no else, leave unset if not sure */
|
||||
#endif
|
||||
|
||||
|
||||
/* Internal macro/tag. */
|
||||
#if !defined(DC_API)
|
||||
#define DC_API
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_MACROS_H */
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_signature.h
|
||||
Description: Type and calling-convention signature character defines
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall signature characters
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_SIGNATURE_H
|
||||
#define DYNCALL_SIGNATURE_H
|
||||
|
||||
typedef char DCsigchar;
|
||||
|
||||
#define DC_SIGCHAR_VOID 'v'
|
||||
#define DC_SIGCHAR_BOOL 'B'
|
||||
#define DC_SIGCHAR_CHAR 'c'
|
||||
#define DC_SIGCHAR_UCHAR 'C'
|
||||
#define DC_SIGCHAR_SHORT 's'
|
||||
#define DC_SIGCHAR_USHORT 'S'
|
||||
#define DC_SIGCHAR_INT 'i'
|
||||
#define DC_SIGCHAR_UINT 'I'
|
||||
#define DC_SIGCHAR_LONG 'j'
|
||||
#define DC_SIGCHAR_ULONG 'J'
|
||||
#define DC_SIGCHAR_LONGLONG 'l'
|
||||
#define DC_SIGCHAR_ULONGLONG 'L'
|
||||
#define DC_SIGCHAR_FLOAT 'f'
|
||||
#define DC_SIGCHAR_DOUBLE 'd'
|
||||
#define DC_SIGCHAR_POINTER 'p'
|
||||
#define DC_SIGCHAR_STRING 'Z'
|
||||
#define DC_SIGCHAR_STRUCT 'T'
|
||||
#define DC_SIGCHAR_ENDARG ')' /* also works for end struct */
|
||||
|
||||
/* callback signatures */
|
||||
|
||||
#define DC_SIGCHAR_CC_PREFIX '_'
|
||||
#define DC_SIGCHAR_CC_ELLIPSIS 'e'
|
||||
#define DC_SIGCHAR_CC_STDCALL 's'
|
||||
#define DC_SIGCHAR_CC_FASTCALL_GNU 'f'
|
||||
#define DC_SIGCHAR_CC_FASTCALL_MS 'F'
|
||||
#define DC_SIGCHAR_CC_THISCALL_MS '+'
|
||||
|
||||
#endif /* DYNCALL_SIGNATURE_H */
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk.h
|
||||
Description: Thunk - Interface
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_H
|
||||
#define DYNCALL_THUNK_H
|
||||
|
||||
/**
|
||||
** dyncall thunks
|
||||
**
|
||||
** thunks are small-size hybrid code/data objects, created at run-time to
|
||||
** be used as function pointers with associated data and entry functions.
|
||||
**
|
||||
** The header contains code, that does load its address into a designated scratch
|
||||
** register and will jump to a thunk function.
|
||||
**
|
||||
** Thunk entry procedures are compiled functions, that are called as a result of
|
||||
** a thunk function.
|
||||
** There is one thunk entry currently for supporting callbacks.
|
||||
**
|
||||
** Thunk context register ( ::= an available scratch register in the calling convention):
|
||||
**
|
||||
** x86: eax
|
||||
** x64: rax
|
||||
** ppc: r2
|
||||
** arm: r12
|
||||
** arm64: x9
|
||||
**
|
||||
**/
|
||||
|
||||
#include "dyncall_macros.h"
|
||||
|
||||
typedef struct DCThunk_ DCThunk;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void dcbInitThunk(DCThunk* p, void (*entry)());
|
||||
|
||||
#if defined(DC__Arch_Intel_x86)
|
||||
#include "dyncall_thunk_x86.h"
|
||||
#elif defined (DC__Arch_AMD64)
|
||||
#include "dyncall_thunk_x64.h"
|
||||
#elif defined (DC__Arch_PPC32)
|
||||
#include "dyncall_thunk_ppc32.h"
|
||||
#elif defined (DC__Arch_PPC64)
|
||||
#include "dyncall_thunk_ppc64.h"
|
||||
#elif defined (DC__Arch_ARM_ARM)
|
||||
#include "dyncall_thunk_arm32_arm.h"
|
||||
#elif defined (DC__Arch_ARM_THUMB)
|
||||
#include "dyncall_thunk_arm32_thumb.h"
|
||||
#elif defined (DC__Arch_MIPS)
|
||||
#include "dyncall_thunk_mips.h"
|
||||
#elif defined (DC__Arch_Sparc)
|
||||
#include "dyncall_thunk_sparc32.h"
|
||||
#elif defined (DC__Arch_Sparcv9)
|
||||
#include "dyncall_thunk_sparc64.h"
|
||||
#elif defined (DC__Arch_ARM64)
|
||||
#include "dyncall_thunk_arm64.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* DYNCALL_THUNK_H */
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_arm32_arm.h
|
||||
Description: Thunk - Header for ARM32 (ARM mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_ARM32_ARM_H
|
||||
#define DYNCALL_THUNK_ARM32_ARM_H
|
||||
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
unsigned int code[2];
|
||||
void (*entry)();
|
||||
};
|
||||
|
||||
#define DCTHUNK_ARM32_ARM_SIZE 12
|
||||
|
||||
|
||||
#endif /* DYNCALL_THUNK_ARM32_ARM_H */
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_arm32_thumb.h
|
||||
Description: Thunk - Header for ARM32 (THUMB mode)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_ARM32_THUMB_H
|
||||
#define DYNCALL_THUNK_ARM32_THUMB_H
|
||||
|
||||
#include "dyncall_thunk_arm32_arm.h" /* Uses same code as ARM mode. */
|
||||
|
||||
#define DCTHUNK_ARM32_THUMB_SIZE 12
|
||||
|
||||
|
||||
#endif /* DYNCALL_THUNK_ARM32_THUMB_H */
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_arm64.h
|
||||
Description: Thunk - Header for ARM64 / ARMv8 / AAPCS64
|
||||
License:
|
||||
|
||||
Copyright (c) 2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_THUNK_ARM64_H
|
||||
#define DYNCALL_THUNK_ARM64_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
// off size
|
||||
//-----|----------
|
||||
unsigned int code[4]; // 0 16
|
||||
void (*entry)(); // 16 8
|
||||
void* reserved; // 24 8
|
||||
|
||||
// 32 total size
|
||||
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_THUNK_ARM64_H */
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_mips.h
|
||||
Description: Thunk - Header for MIPS
|
||||
License:
|
||||
|
||||
Copyright (c) 2013-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_MIPS_H
|
||||
#define DYNCALL_THUNK_MIPS_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
unsigned short data[6];
|
||||
unsigned int jump;
|
||||
unsigned short bddt[2];
|
||||
};
|
||||
|
||||
#endif /* DYNCALL_THUNK_MIPS_H */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_ppc32.h
|
||||
Description: Thunk - Header for ppc32 (darwin/sysv)
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_THUNK_PPC32_H
|
||||
#define DYNCALL_THUNK_PPC32_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
unsigned short code_load_hi, addr_self_hi; /* offset: 0 size: 4 */
|
||||
unsigned short code_load_lo, addr_self_lo; /* offset: 4 size: 4 */
|
||||
unsigned int code_jump[3]; /* offset: 8 size: 12 */
|
||||
void (*addr_entry)(); /* offset: 20 size: 4 */
|
||||
}; /* total size: 24 */
|
||||
|
||||
#define DCTHUNK_SIZE_PPC32 24
|
||||
|
||||
#endif /* DYNCALL_THUNK_PPC32_H */
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_ppc64.h
|
||||
Description: Thunk - Header for ppc64
|
||||
License:
|
||||
|
||||
Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_THUNK_PPC64_H
|
||||
#define DYNCALL_THUNK_PPC64_H
|
||||
|
||||
#if DC__ABI_PPC64_ELF_V != 2
|
||||
struct DCThunk_ /* v1 */
|
||||
{
|
||||
void (*thunk_entry)(); /* offset: 0 */
|
||||
long toc_thunk; /* offset: 8 */
|
||||
unsigned short code_load_hi, addr_self_hi; /* offset: 16 */
|
||||
unsigned short code_load_lo, addr_self_lo; /* offset: 20 */
|
||||
unsigned int code_jump[6]; /* offset: 24 */
|
||||
void (*addr_entry)(); /* offset: 48 */
|
||||
long toc_entry; /* offset: 56 */
|
||||
};
|
||||
#define DCTHUNK_SIZE_PPC64 64
|
||||
#else
|
||||
struct DCThunk_ /* v2 */
|
||||
{
|
||||
unsigned short addr_self_hist, code_load_hist; /* offset: 0 */
|
||||
unsigned short addr_self_hier, code_load_hier; /* offset: 4 */
|
||||
unsigned int code_rot; /* offset: 8 */
|
||||
unsigned short addr_self_hi, code_load_hi; /* offset: 12 */
|
||||
unsigned short addr_self_lo, code_load_lo; /* offset: 16 */
|
||||
unsigned int code_jump[5]; /* offset: 20 */
|
||||
void (*addr_entry)(); /* offset: 40 */
|
||||
};
|
||||
#define DCTHUNK_SIZE_PPC64 48
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_THUNK_PPC64_H */
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_sparc32.h
|
||||
Description: Thunk - Header for sparc32 - not yet implemented
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_SPARC32_H
|
||||
#define DYNCALL_THUNK_SPARC32_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
int x[4]; /* dummy */
|
||||
};
|
||||
|
||||
#define DCTHUNK_SIZE_SPARC32 32
|
||||
|
||||
#endif /* DYNCALL_THUNK_SPARC32_H */
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_sparc64.h
|
||||
Description: Thunk - Header for sparc64 - not yet implemented
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_SPARC64_H
|
||||
#define DYNCALL_THUNK_SPARC64_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
int x[4]; /* dummy */
|
||||
};
|
||||
|
||||
#define DCTHUNK_SIZE_SPARC64 32
|
||||
|
||||
#endif /* DYNCALL_THUNK_SPARC32_H */
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_x64.h
|
||||
Description: Thunk - Header for x64
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_X64_H
|
||||
#define DYNCALL_THUNK_X64_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
unsigned long long code[2];
|
||||
void (*entry)();
|
||||
};
|
||||
|
||||
#define DCTHUNK_X64_SIZE 24
|
||||
|
||||
|
||||
#endif /* DYNCALL_THUNK_X64_H */
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncallback
|
||||
File: dyncallback/dyncall_thunk_x86.h
|
||||
Description: Thunk - Header for x86
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef DYNCALL_THUNK_X86_H
|
||||
#define DYNCALL_THUNK_X86_H
|
||||
|
||||
struct DCThunk_
|
||||
{
|
||||
unsigned int code_load;
|
||||
void* addr_self;
|
||||
unsigned int code_jump;
|
||||
void (*addr_entry)();
|
||||
};
|
||||
|
||||
#define DCTHUNK_X86_SIZE 16
|
||||
|
||||
#endif /* DYNCALL_THUNK_X86_H */
|
||||
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_types.h
|
||||
Description: Typedefs
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall argument- and return-types
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_TYPES_H
|
||||
#define DYNCALL_TYPES_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "dyncall_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void DCvoid;
|
||||
typedef DC_BOOL DCbool;
|
||||
typedef char DCchar;
|
||||
typedef unsigned char DCuchar;
|
||||
typedef short DCshort;
|
||||
typedef unsigned short DCushort;
|
||||
typedef int DCint;
|
||||
typedef unsigned int DCuint;
|
||||
typedef long DClong;
|
||||
typedef unsigned long DCulong;
|
||||
typedef DC_LONG_LONG DClonglong;
|
||||
typedef unsigned DC_LONG_LONG DCulonglong;
|
||||
typedef float DCfloat;
|
||||
typedef double DCdouble;
|
||||
typedef DC_POINTER DCpointer;
|
||||
typedef const char* DCstring;
|
||||
|
||||
typedef size_t DCsize;
|
||||
|
||||
#define DC_TRUE 1
|
||||
#define DC_FALSE 0
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_TYPES_H */
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dyncall
|
||||
File: dyncall/dyncall_value.h
|
||||
Description: Value variant type
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
dyncall value variant
|
||||
|
||||
a value variant union-type that carries all supported dyncall types.
|
||||
|
||||
REVISION
|
||||
2007/12/11 initial
|
||||
|
||||
*/
|
||||
|
||||
#ifndef DYNCALL_VALUE_H
|
||||
#define DYNCALL_VALUE_H
|
||||
|
||||
#include "dyncall_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef union DCValue_ DCValue;
|
||||
|
||||
union DCValue_
|
||||
{
|
||||
#if defined (DC__Arch_PPC32) && defined(DC__Endian_BIG)
|
||||
DCbool B;
|
||||
struct { DCchar c_pad[3]; DCchar c; };
|
||||
struct { DCuchar C_pad[3]; DCuchar C; };
|
||||
struct { DCshort s_pad; DCshort s; };
|
||||
struct { DCshort S_pad; DCshort S; };
|
||||
DCint i;
|
||||
DCuint I;
|
||||
#elif defined (DC__Arch_PPC64) && defined(DC__Endian_BIG)
|
||||
struct { DCbool B_pad; DCbool B; };
|
||||
struct { DCchar c_pad[7]; DCchar c; };
|
||||
struct { DCuchar C_pad[7]; DCuchar C; };
|
||||
struct { DCshort s_pad[3]; DCshort s; };
|
||||
struct { DCshort S_pad[3]; DCshort S; };
|
||||
struct { DCint i_pad; DCint i; };
|
||||
struct { DCint I_pad; DCuint I; };
|
||||
#else
|
||||
DCbool B;
|
||||
DCchar c;
|
||||
DCuchar C;
|
||||
DCshort s;
|
||||
DCushort S;
|
||||
DCint i;
|
||||
DCuint I;
|
||||
#endif
|
||||
DClong j;
|
||||
DCulong J;
|
||||
DClonglong l;
|
||||
DCulonglong L;
|
||||
DCfloat f;
|
||||
DCdouble d;
|
||||
DCpointer p;
|
||||
DCstring Z;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNCALL_VALUE_H */
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
|
||||
Package: dyncall
|
||||
Library: dynload
|
||||
File: dynload/dynload.h
|
||||
Description: public header for library dynload
|
||||
License:
|
||||
|
||||
Copyright (c) 2007-2015 Daniel Adler <dadler@uni-goettingen.de>,
|
||||
Tassilo Philipp <tphilipp@potion-studios.com>
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifndef DYNLOAD_H
|
||||
#define DYNLOAD_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef DL_API
|
||||
#define DL_API
|
||||
#endif
|
||||
|
||||
/* --- public api ---------------------------------------------------------- */
|
||||
|
||||
/* shared library loading and explicit symbol resolving */
|
||||
|
||||
typedef struct DLLib_ DLLib;
|
||||
|
||||
DL_API DLLib* dlLoadLibrary(const char* libpath);
|
||||
DL_API void dlFreeLibrary(DLLib* pLib);
|
||||
DL_API void* dlFindSymbol(DLLib* pLib, const char* pSymbolName);
|
||||
|
||||
/* symbol table enumeration - only for symbol lookup, not resolve */
|
||||
|
||||
typedef struct DLSyms_ DLSyms;
|
||||
|
||||
DL_API DLSyms* dlSymsInit (const char* libPath);
|
||||
DL_API void dlSymsCleanup(DLSyms* pSyms);
|
||||
|
||||
DL_API int dlSymsCount (DLSyms* pSyms);
|
||||
DL_API const char* dlSymsName (DLSyms* pSyms, int index);
|
||||
DL_API const char* dlSymsNameFromValue(DLSyms* pSyms, void* value); /* symbol must be loaded */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DYNLOAD_H */
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user