rbdc 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bindings/ruby/rbdc/extconf.rb +57 -0
- data/bindings/ruby/rbdc/rbdc.c +304 -0
- data/dyncall/AUTHORS +4 -0
- data/dyncall/BUGS +3 -0
- data/dyncall/CMakeLists.txt +79 -0
- data/dyncall/ChangeLog +165 -0
- data/dyncall/LICENSE +15 -0
- data/dyncall/Makefile.M +15 -0
- data/dyncall/Makefile.embedded +71 -0
- data/dyncall/Makefile.generic +36 -0
- data/dyncall/Nmakefile +45 -0
- data/dyncall/README +92 -0
- data/dyncall/ToDo +114 -0
- data/dyncall/autovar/LICENSE.txt +15 -0
- data/dyncall/autovar/README.txt +69 -0
- data/dyncall/autovar/autovar_ABI.h +44 -0
- data/dyncall/autovar/autovar_ARCH.h +56 -0
- data/dyncall/autovar/autovar_CC.h +46 -0
- data/dyncall/autovar/autovar_OS.h +78 -0
- data/dyncall/autovar/autovar_OSFAMILY.h +39 -0
- data/dyncall/buildsys/cmake/Modules/FindDynCall.cmake +43 -0
- data/dyncall/buildsys/cmake/Modules/FindDynCallback.cmake +43 -0
- data/dyncall/buildsys/cmake/Modules/FindDynLoad.cmake +45 -0
- data/dyncall/buildsys/cmake/Modules/UseLATEX.cmake +811 -0
- data/dyncall/buildsys/dynmake/Makefile.base.M +82 -0
- data/dyncall/buildsys/dynmake/dynmake.bat +2 -0
- data/dyncall/buildsys/dynmake/dynmake.sh +4 -0
- data/dyncall/buildsys/lua/Makefile +10 -0
- data/dyncall/buildsys/lua/README.txt +4 -0
- data/dyncall/buildsys/lua/bootstrap.sh +34 -0
- data/dyncall/buildsys/lua/cleanup.sh +6 -0
- data/dyncall/buildsys/lua/mkfile +34 -0
- data/dyncall/buildsys/lua/setenv.sh +4 -0
- data/dyncall/buildsys/mk/app.mk +30 -0
- data/dyncall/buildsys/mk/dirs.mk +27 -0
- data/dyncall/buildsys/mk/epilog.mk +30 -0
- data/dyncall/buildsys/mk/lib.mk +23 -0
- data/dyncall/buildsys/mk/pcc.mk +60 -0
- data/dyncall/buildsys/mk/prolog.mk +35 -0
- data/dyncall/buildsys/nmake/common.nmake +61 -0
- data/dyncall/buildsys/nmake/epilog.nmake +28 -0
- data/dyncall/buildsys/nmake/prolog.nmake +76 -0
- data/dyncall/buildsys/nmake/tool_gcc.nmake +82 -0
- data/dyncall/buildsys/nmake/tool_msvc.nmake +67 -0
- data/dyncall/buildsys/scripts/batch-build-linux.sh +11 -0
- data/dyncall/buildsys/scripts/batch-build-minix.sh +11 -0
- data/dyncall/buildsys/scripts/batch-build-psp.sh +11 -0
- data/dyncall/buildsys/scripts/conf-nds.bat +41 -0
- data/dyncall/buildsys/scripts/setenv-cross-ios.sh +8 -0
- data/dyncall/buildsys/scripts/setenv-sdk-ios.sh +22 -0
- data/dyncall/buildsys/vs2005/dyncall/dyncall.vcproj +245 -0
- data/dyncall/buildsys/vs2005/test_plain/test_plain.vcproj +202 -0
- data/dyncall/buildsys/vs2005/vs2005.sln +29 -0
- data/dyncall/configure +152 -0
- data/dyncall/configure.bat +157 -0
- data/dyncall/configure.rc +234 -0
- data/dyncall/dynMakefile +4 -0
- data/dyncall/dyncall/CMakeLists.txt +53 -0
- data/dyncall/dyncall/DynCallConfig.cmake +3 -0
- data/dyncall/dyncall/Makefile.M +10 -0
- data/dyncall/dyncall/Makefile.embedded +20 -0
- data/dyncall/dyncall/Makefile.generic +16 -0
- data/dyncall/dyncall/Nmakefile +62 -0
- data/dyncall/dyncall/README-Developer.txt +45 -0
- data/dyncall/dyncall/README.txt +65 -0
- data/dyncall/dyncall/TODO +9 -0
- data/dyncall/dyncall/dynMakefile +4 -0
- data/dyncall/dyncall/dyncall.3 +189 -0
- data/dyncall/dyncall/dyncall.h +135 -0
- data/dyncall/dyncall/dyncall_alloc.h +40 -0
- data/dyncall/dyncall/dyncall_api.c +167 -0
- data/dyncall/dyncall/dyncall_call.S +72 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm.S +80 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm.h +61 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.S +96 -0
- data/dyncall/dyncall/dyncall_call_arm32_arm_armhf.h +44 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb.h +65 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_apple.s +80 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_armhf.S +121 -0
- data/dyncall/dyncall/dyncall_call_arm32_thumb_gas.s +101 -0
- data/dyncall/dyncall/dyncall_call_mips.h +50 -0
- data/dyncall/dyncall/dyncall_call_mips_eabi.h +61 -0
- data/dyncall/dyncall/dyncall_call_mips_eabi_gas.s +115 -0
- data/dyncall/dyncall/dyncall_call_mips_gas.S +36 -0
- data/dyncall/dyncall/dyncall_call_mips_n32.h +67 -0
- data/dyncall/dyncall/dyncall_call_mips_n32_gas.s +192 -0
- data/dyncall/dyncall/dyncall_call_mips_n64.h +67 -0
- data/dyncall/dyncall/dyncall_call_mips_n64_gas.s +192 -0
- data/dyncall/dyncall/dyncall_call_mips_o32.h +70 -0
- data/dyncall/dyncall/dyncall_call_mips_o32_gas.s +109 -0
- data/dyncall/dyncall/dyncall_call_ppc32.S +266 -0
- data/dyncall/dyncall/dyncall_call_ppc32.h +62 -0
- data/dyncall/dyncall/dyncall_call_sparc.S +192 -0
- data/dyncall/dyncall/dyncall_call_sparc.h +42 -0
- data/dyncall/dyncall/dyncall_call_sparc64.S +361 -0
- data/dyncall/dyncall/dyncall_call_sparc64.h +42 -0
- data/dyncall/dyncall/dyncall_call_sparc_v9.S +220 -0
- data/dyncall/dyncall/dyncall_call_sparc_v9.h +42 -0
- data/dyncall/dyncall/dyncall_call_x64-att.S +146 -0
- data/dyncall/dyncall/dyncall_call_x64.S +149 -0
- data/dyncall/dyncall/dyncall_call_x64.h +63 -0
- data/dyncall/dyncall/dyncall_call_x64_generic_masm.asm +70 -0
- data/dyncall/dyncall/dyncall_call_x86.S +238 -0
- data/dyncall/dyncall/dyncall_call_x86.h +70 -0
- data/dyncall/dyncall/dyncall_call_x86_8a.s +127 -0
- data/dyncall/dyncall/dyncall_call_x86_generic_masm.asm +136 -0
- data/dyncall/dyncall/dyncall_call_x86_nasm.asm +234 -0
- data/dyncall/dyncall/dyncall_callf.c +112 -0
- data/dyncall/dyncall/dyncall_callf.h +52 -0
- data/dyncall/dyncall/dyncall_callvm.c +68 -0
- data/dyncall/dyncall/dyncall_callvm.h +88 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.c +250 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm.h +59 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.c +204 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_arm_armhf.h +63 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.c +271 -0
- data/dyncall/dyncall/dyncall_callvm_arm32_thumb.h +59 -0
- data/dyncall/dyncall/dyncall_callvm_base.c +33 -0
- data/dyncall/dyncall/dyncall_callvm_mips.c +40 -0
- data/dyncall/dyncall/dyncall_callvm_mips.h +37 -0
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.c +181 -0
- data/dyncall/dyncall/dyncall_callvm_mips_eabi.h +61 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n32.c +268 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n64.c +268 -0
- data/dyncall/dyncall/dyncall_callvm_mips_n64.h +53 -0
- data/dyncall/dyncall/dyncall_callvm_mips_o32.c +235 -0
- data/dyncall/dyncall/dyncall_callvm_mips_o32.h +45 -0
- data/dyncall/dyncall/dyncall_callvm_ppc32.c +372 -0
- data/dyncall/dyncall/dyncall_callvm_ppc32.h +61 -0
- data/dyncall/dyncall/dyncall_callvm_sparc.c +155 -0
- data/dyncall/dyncall/dyncall_callvm_sparc.h +44 -0
- data/dyncall/dyncall/dyncall_callvm_sparc64.c +239 -0
- data/dyncall/dyncall/dyncall_callvm_sparc64.h +47 -0
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.c +182 -0
- data/dyncall/dyncall/dyncall_callvm_sparc_v9.h +45 -0
- data/dyncall/dyncall/dyncall_callvm_x64.c +228 -0
- data/dyncall/dyncall/dyncall_callvm_x64.h +111 -0
- data/dyncall/dyncall/dyncall_callvm_x86.c +667 -0
- data/dyncall/dyncall/dyncall_callvm_x86.h +75 -0
- data/dyncall/dyncall/dyncall_config.h +46 -0
- data/dyncall/dyncall/dyncall_macros.h +248 -0
- data/dyncall/dyncall/dyncall_signature.h +71 -0
- data/dyncall/dyncall/dyncall_struct.c +255 -0
- data/dyncall/dyncall/dyncall_struct.h +69 -0
- data/dyncall/dyncall/dyncall_types.h +74 -0
- data/dyncall/dyncall/dyncall_utils.h +38 -0
- data/dyncall/dyncall/dyncall_value.h +73 -0
- data/dyncall/dyncall/dyncall_vector.c +52 -0
- data/dyncall/dyncall/dyncall_vector.h +56 -0
- data/dyncall/dyncall/gen-masm.sh +7 -0
- data/dyncall/dyncall/mkfile +29 -0
- data/dyncall/dyncallback/CMakeLists.txt +55 -0
- data/dyncall/dyncallback/DynCallbackConfig.cmake +2 -0
- data/dyncall/dyncallback/Makefile.M +10 -0
- data/dyncall/dyncallback/Makefile.embedded +15 -0
- data/dyncall/dyncallback/Makefile.generic +20 -0
- data/dyncall/dyncallback/Nmakefile +71 -0
- data/dyncall/dyncallback/README.txt +9 -0
- data/dyncall/dyncallback/TODO +4 -0
- data/dyncall/dyncallback/dynMakefile +4 -0
- data/dyncall/dyncallback/dyncall_alloc_wx.c +35 -0
- data/dyncall/dyncallback/dyncall_alloc_wx.h +46 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_malloc.c +40 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_mmap.c +42 -0
- data/dyncall/dyncallback/dyncall_alloc_wx_win32.c +42 -0
- data/dyncall/dyncallback/dyncall_args.c +45 -0
- data/dyncall/dyncallback/dyncall_args.h +65 -0
- data/dyncall/dyncallback/dyncall_args_arm32_arm.c +112 -0
- data/dyncall/dyncallback/dyncall_args_arm32_arm.h +40 -0
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_args_arm32_thumb.h +32 -0
- data/dyncall/dyncallback/dyncall_args_mips.c +81 -0
- data/dyncall/dyncallback/dyncall_args_mips.h +41 -0
- data/dyncall/dyncallback/dyncall_args_ppc32.c +88 -0
- data/dyncall/dyncallback/dyncall_args_ppc32.h +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc32.c +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc32.h +37 -0
- data/dyncall/dyncallback/dyncall_args_sparc64.c +41 -0
- data/dyncall/dyncallback/dyncall_args_sparc64.h +37 -0
- data/dyncall/dyncallback/dyncall_args_x64.c +73 -0
- data/dyncall/dyncallback/dyncall_args_x64.h +44 -0
- data/dyncall/dyncallback/dyncall_args_x86.c +121 -0
- data/dyncall/dyncallback/dyncall_args_x86.h +58 -0
- data/dyncall/dyncallback/dyncall_callback.c +45 -0
- data/dyncall/dyncallback/dyncall_callback.h +51 -0
- data/dyncall/dyncallback/dyncall_callback_arch.S +71 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.c +63 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm.h +45 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_apple.s +73 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_arm_gas.s +73 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb.h +33 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_apple.s +32 -0
- data/dyncall/dyncallback/dyncall_callback_arm32_thumb_gas.s +32 -0
- data/dyncall/dyncallback/dyncall_callback_mips.c +61 -0
- data/dyncall/dyncallback/dyncall_callback_mips.h +42 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.S +33 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.c +60 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32.h +43 -0
- data/dyncall/dyncallback/dyncall_callback_ppc32_apple.s +180 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.c +57 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.h +43 -0
- data/dyncall/dyncallback/dyncall_callback_sparc32.s +30 -0
- data/dyncall/dyncallback/dyncall_callback_sparc64.c +57 -0
- data/dyncall/dyncallback/dyncall_callback_sparc64.s +30 -0
- data/dyncall/dyncallback/dyncall_callback_x64.S +187 -0
- data/dyncall/dyncallback/dyncall_callback_x64.c +69 -0
- data/dyncall/dyncallback/dyncall_callback_x64.h +44 -0
- data/dyncall/dyncallback/dyncall_callback_x64_apple.s +122 -0
- data/dyncall/dyncallback/dyncall_callback_x64_gas.s +119 -0
- data/dyncall/dyncallback/dyncall_callback_x64_gas_w64.s +102 -0
- data/dyncall/dyncallback/dyncall_callback_x64_masm.asm +89 -0
- data/dyncall/dyncallback/dyncall_callback_x86.S +115 -0
- data/dyncall/dyncallback/dyncall_callback_x86.c +281 -0
- data/dyncall/dyncallback/dyncall_callback_x86.h +49 -0
- data/dyncall/dyncallback/dyncall_callback_x86_8a.s +100 -0
- data/dyncall/dyncallback/dyncall_callback_x86_masm.asm +74 -0
- data/dyncall/dyncallback/dyncall_thunk.c +47 -0
- data/dyncall/dyncallback/dyncall_thunk.h +84 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.c +45 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_arm.h +40 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.c +29 -0
- data/dyncall/dyncallback/dyncall_thunk_arm32_thumb.h +35 -0
- data/dyncall/dyncallback/dyncall_thunk_mips.c +52 -0
- data/dyncall/dyncallback/dyncall_thunk_mips.h +37 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc32.c +51 -0
- data/dyncall/dyncallback/dyncall_thunk_ppc32.h +40 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc32.c +32 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc32.h +36 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc64.c +32 -0
- data/dyncall/dyncallback/dyncall_thunk_sparc64.h +36 -0
- data/dyncall/dyncallback/dyncall_thunk_x64.c +48 -0
- data/dyncall/dyncallback/dyncall_thunk_x64.h +39 -0
- data/dyncall/dyncallback/dyncall_thunk_x86.c +44 -0
- data/dyncall/dyncallback/dyncall_thunk_x86.h +39 -0
- data/dyncall/dyncallback/dyncallback.3 +134 -0
- data/dyncall/dyncallback/gen-masm.sh +8 -0
- data/dyncall/dyncallback/mkfile +29 -0
- data/dyncall/dynload/CMakeLists.txt +25 -0
- data/dyncall/dynload/DynLoadConfig.cmake +3 -0
- data/dyncall/dynload/Makefile.M +10 -0
- data/dyncall/dynload/Makefile.embedded +22 -0
- data/dyncall/dynload/Makefile.generic +18 -0
- data/dyncall/dynload/Nmakefile +57 -0
- data/dyncall/dynload/README.txt +113 -0
- data/dyncall/dynload/TODO +20 -0
- data/dyncall/dynload/dynMakefile +4 -0
- data/dyncall/dynload/dynload.3 +64 -0
- data/dyncall/dynload/dynload.c +38 -0
- data/dyncall/dynload/dynload.h +65 -0
- data/dyncall/dynload/dynload_alloc.h +40 -0
- data/dyncall/dynload/dynload_darwin.c +89 -0
- data/dyncall/dynload/dynload_syms.c +38 -0
- data/dyncall/dynload/dynload_syms_elf.c +214 -0
- data/dyncall/dynload/dynload_syms_mach-o.c +167 -0
- data/dyncall/dynload/dynload_syms_pe.c +109 -0
- data/dyncall/dynload/dynload_unix.c +57 -0
- data/dyncall/dynload/dynload_windows.c +59 -0
- data/dyncall/mkfile +36 -0
- data/dyncall/portasm/README.txt +42 -0
- data/dyncall/portasm/gen-masm.sh +3 -0
- data/dyncall/portasm/portasm-arm.S +36 -0
- data/dyncall/portasm/portasm-ppc.S +98 -0
- data/dyncall/portasm/portasm-x64-att.S +155 -0
- data/dyncall/portasm/portasm-x86.S +127 -0
- metadata +311 -0
@@ -0,0 +1,109 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dynload
|
5
|
+
File: dynload/dynload_syms_pe.c
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
+
Olivier Chafik <olivier.chafik@gmail.com>
|
12
|
+
|
13
|
+
Permission to use, copy, modify, and distribute this software for any
|
14
|
+
purpose with or without fee is hereby granted, provided that the above
|
15
|
+
copyright notice and this permission notice appear in all copies.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
18
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
19
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
20
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
21
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
22
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
23
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
24
|
+
|
25
|
+
*/
|
26
|
+
|
27
|
+
|
28
|
+
#include "dynload.h"
|
29
|
+
#include "dynload_alloc.h"
|
30
|
+
|
31
|
+
#include <windows.h>
|
32
|
+
|
33
|
+
struct DLLib_
|
34
|
+
{
|
35
|
+
IMAGE_DOS_HEADER dos_header;
|
36
|
+
};
|
37
|
+
|
38
|
+
|
39
|
+
struct DLSyms_
|
40
|
+
{
|
41
|
+
DLLib* pLib;
|
42
|
+
const char* pBase;
|
43
|
+
const DWORD* pNames;
|
44
|
+
const DWORD* pFuncs;
|
45
|
+
const unsigned short* pOrds;
|
46
|
+
size_t count;
|
47
|
+
};
|
48
|
+
|
49
|
+
|
50
|
+
DLSyms* dlSymsInit(const char* libPath)
|
51
|
+
{
|
52
|
+
DLLib* pLib = dlLoadLibrary(libPath);
|
53
|
+
DLSyms* pSyms = (DLSyms*)dlAllocMem(sizeof(DLSyms));
|
54
|
+
const char* base = (const char*) pLib;
|
55
|
+
IMAGE_DOS_HEADER* pDOSHeader = (IMAGE_DOS_HEADER*) base;
|
56
|
+
IMAGE_NT_HEADERS* pNTHeader = (IMAGE_NT_HEADERS*) ( base + pDOSHeader->e_lfanew );
|
57
|
+
IMAGE_DATA_DIRECTORY* pExportsDataDir = &pNTHeader->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT];
|
58
|
+
IMAGE_EXPORT_DIRECTORY* pExports = (IMAGE_EXPORT_DIRECTORY*) (base + pExportsDataDir->VirtualAddress);
|
59
|
+
|
60
|
+
pSyms->pBase = base;
|
61
|
+
pSyms->pNames = (DWORD*)(base + pExports->AddressOfNames);
|
62
|
+
pSyms->pFuncs = (DWORD*)(base + pExports->AddressOfFunctions);
|
63
|
+
pSyms->pOrds = (unsigned short*)(base + pExports->AddressOfNameOrdinals);
|
64
|
+
pSyms->count = (size_t)pExports->NumberOfNames;
|
65
|
+
pSyms->pLib = pLib;
|
66
|
+
|
67
|
+
return pSyms;
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
void dlSymsCleanup(DLSyms* pSyms)
|
72
|
+
{
|
73
|
+
if(pSyms) {
|
74
|
+
dlFreeLibrary(pSyms->pLib);
|
75
|
+
dlFreeMem(pSyms);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
|
80
|
+
int dlSymsCount(DLSyms* pSyms)
|
81
|
+
{
|
82
|
+
return (int)pSyms->count;
|
83
|
+
}
|
84
|
+
|
85
|
+
|
86
|
+
const char* dlSymsName(DLSyms* pSyms, int index)
|
87
|
+
{
|
88
|
+
return (const char*)((const char*)pSyms->pBase + pSyms->pNames[index]);
|
89
|
+
}
|
90
|
+
|
91
|
+
|
92
|
+
void* dlSymsValue(DLSyms* pSyms, int index)
|
93
|
+
{
|
94
|
+
return (void*)(pSyms->pBase + pSyms->pFuncs[pSyms->pOrds[index]]);
|
95
|
+
}
|
96
|
+
|
97
|
+
|
98
|
+
const char* dlSymsNameFromValue(DLSyms* pSyms, void* value)
|
99
|
+
{
|
100
|
+
int i, c=dlSymsCount(pSyms);
|
101
|
+
for(i=0; i<c; ++i)
|
102
|
+
{
|
103
|
+
if(dlSymsValue(pSyms, i) == value)
|
104
|
+
return dlSymsName(pSyms, i);
|
105
|
+
}
|
106
|
+
|
107
|
+
/* Not found. */
|
108
|
+
return NULL;
|
109
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dynload
|
5
|
+
File: dynload/dynload_unix.c
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
+
|
12
|
+
Permission to use, copy, modify, and distribute this software for any
|
13
|
+
purpose with or without fee is hereby granted, provided that the above
|
14
|
+
copyright notice and this permission notice appear in all copies.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
/*
|
28
|
+
|
29
|
+
dynload_unix.c
|
30
|
+
|
31
|
+
dynload module for .so (unix) and .dylib (mach-o darwin/OS X) files
|
32
|
+
|
33
|
+
*/
|
34
|
+
|
35
|
+
|
36
|
+
#include "dynload.h"
|
37
|
+
|
38
|
+
#include <dlfcn.h>
|
39
|
+
|
40
|
+
|
41
|
+
DLLib* dlLoadLibrary(const char* libPath)
|
42
|
+
{
|
43
|
+
return (DLLib*)dlopen(libPath,RTLD_NOW|RTLD_GLOBAL);
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
void* dlFindSymbol(DLLib* libHandle, const char* symbol)
|
48
|
+
{
|
49
|
+
return dlsym((void*)libHandle, symbol);
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
void dlFreeLibrary(DLLib* libHandle)
|
54
|
+
{
|
55
|
+
dlclose((void*)libHandle);
|
56
|
+
}
|
57
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dynload
|
5
|
+
File: dynload/dynload_windows.c
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2011 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
+
|
12
|
+
Permission to use, copy, modify, and distribute this software for any
|
13
|
+
purpose with or without fee is hereby granted, provided that the above
|
14
|
+
copyright notice and this permission notice appear in all copies.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
/*
|
28
|
+
|
29
|
+
dynload_windows.c
|
30
|
+
|
31
|
+
dynload module for .dll files
|
32
|
+
|
33
|
+
*/
|
34
|
+
|
35
|
+
|
36
|
+
#include "dynload.h"
|
37
|
+
|
38
|
+
#include <windows.h>
|
39
|
+
|
40
|
+
DLLib* dlLoadLibrary(const char* libPath)
|
41
|
+
{
|
42
|
+
if (libPath != NULL) {
|
43
|
+
return (DLLib*) LoadLibraryA(libPath);
|
44
|
+
/*return (DLLib*) LoadLibraryA(libPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);*/
|
45
|
+
} else {
|
46
|
+
return (DLLib*) GetModuleHandle(NULL);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
void* dlFindSymbol(DLLib* libHandle, const char* symbol)
|
51
|
+
{
|
52
|
+
return (void*) GetProcAddress( (HINSTANCE)libHandle, symbol);
|
53
|
+
}
|
54
|
+
|
55
|
+
void dlFreeLibrary(DLLib* libHandle)
|
56
|
+
{
|
57
|
+
FreeLibrary( (HINSTANCE)libHandle );
|
58
|
+
}
|
59
|
+
|
data/dyncall/mkfile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
#//////////////////////////////////////////////////////////////////////////////
|
2
|
+
#
|
3
|
+
# Copyright (c) 2010 Daniel Adler <dadler@uni-goettingen.de>,
|
4
|
+
# Tassilo Philipp <tphilipp@potion-studios.com>
|
5
|
+
#
|
6
|
+
# Permission to use, copy, modify, and distribute this software for any
|
7
|
+
# purpose with or without fee is hereby granted, provided that the above
|
8
|
+
# copyright notice and this permission notice appear in all copies.
|
9
|
+
#
|
10
|
+
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
11
|
+
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
12
|
+
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
13
|
+
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
14
|
+
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
15
|
+
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
16
|
+
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
17
|
+
#
|
18
|
+
#//////////////////////////////////////////////////////////////////////////////
|
19
|
+
|
20
|
+
|
21
|
+
TOP = .
|
22
|
+
|
23
|
+
<$TOP/buildsys/mk/prolog.mk
|
24
|
+
|
25
|
+
# directories:
|
26
|
+
DIRS = dyncall dyncallback
|
27
|
+
AUTOS = ConfigVars
|
28
|
+
|
29
|
+
#.PHONY: tests doc
|
30
|
+
tests:V:
|
31
|
+
cd test; $MK
|
32
|
+
doc:V:
|
33
|
+
cd $target/manual; $MK
|
34
|
+
|
35
|
+
<$TOP/buildsys/mk/epilog.mk
|
36
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
portasm - a toolkit for writing portable generic assembler sources
|
2
|
+
------------------------------------------------------------------
|
3
|
+
|
4
|
+
Copyright (C) 2011 Daniel Adler <dadler@uni-goettingen.de>.
|
5
|
+
Licensed under BSD two-clause license.
|
6
|
+
|
7
|
+
|
8
|
+
Requirements
|
9
|
+
------------
|
10
|
+
- C Preprocessor
|
11
|
+
|
12
|
+
|
13
|
+
Supported Architectures and Tool-chains:
|
14
|
+
----------------------------------------
|
15
|
+
|
16
|
+
- x86: gas, apple as, masm
|
17
|
+
- x64: gas, apple as, masm
|
18
|
+
- ppc: gas, apple as
|
19
|
+
- arm: gas, apple as
|
20
|
+
|
21
|
+
|
22
|
+
Usage:
|
23
|
+
------
|
24
|
+
|
25
|
+
Implement assembler sources in *.S files which use C preprocessor.
|
26
|
+
#include portasm-<ARCH>.S at front
|
27
|
+
|
28
|
+
In order to generate MASM files for X86 and X64, run
|
29
|
+
'gen-masm.sh <name>' script which reads <name>.S and outputs <name>.masm file.
|
30
|
+
|
31
|
+
|
32
|
+
Common Macros:
|
33
|
+
--------------
|
34
|
+
|
35
|
+
BEGIN_ASM
|
36
|
+
END_ASM
|
37
|
+
BEGIN_PROC(name)
|
38
|
+
END_PROC(name)
|
39
|
+
GLOBAL(name)
|
40
|
+
HEX(value)
|
41
|
+
|
42
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: portasm
|
5
|
+
File: portasm/portasm-arm.S
|
6
|
+
Description:
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2011 Daniel Adler <dadler@uni-goettingen.de>,
|
10
|
+
Tassilo Philipp <tphilipp@potion-studios.com>
|
11
|
+
|
12
|
+
Permission to use, copy, modify, and distribute this software for any
|
13
|
+
purpose with or without fee is hereby granted, provided that the above
|
14
|
+
copyright notice and this permission notice appear in all copies.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
17
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
18
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
19
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
20
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
21
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
22
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
23
|
+
|
24
|
+
*/
|
25
|
+
|
26
|
+
|
27
|
+
#define BEGIN_ASM .text
|
28
|
+
#include "../autovar/autovar_OS.h"
|
29
|
+
#if defined(OS_Darwin)
|
30
|
+
#define GLOBAL_C(X) .globl _##X
|
31
|
+
#define ENTRY_C(X) _##X:
|
32
|
+
#else
|
33
|
+
#define GLOBAL_C(X) .globl X
|
34
|
+
#define ENTRY_C(X) X:
|
35
|
+
#endif
|
36
|
+
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: portasm
|
5
|
+
File: portasm/portasm-ppc.S
|
6
|
+
Description: Portable Assembler Macros for ppc
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2011 Daniel Adler <dadler@uni-goettingen.de>
|
10
|
+
|
11
|
+
Permission to use, copy, modify, and distribute this software for any
|
12
|
+
purpose with or without fee is hereby granted, provided that the above
|
13
|
+
copyright notice and this permission notice appear in all copies.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
16
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
17
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
18
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
19
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
20
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
21
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
22
|
+
|
23
|
+
*/
|
24
|
+
|
25
|
+
|
26
|
+
#include "../autovar/autovar_OS.h"
|
27
|
+
#if defined(OS_Darwin)
|
28
|
+
#define GLOBAL_C(X) .globl _##X
|
29
|
+
#define ENTRY_C(X) _##X:
|
30
|
+
#else
|
31
|
+
#define GLOBAL_C(X) .globl X
|
32
|
+
#define ENTRY_C(X) X:
|
33
|
+
#define r0 0
|
34
|
+
#define r1 1
|
35
|
+
#define r2 2
|
36
|
+
#define r3 3
|
37
|
+
#define r4 4
|
38
|
+
#define r5 5
|
39
|
+
#define r6 6
|
40
|
+
#define r7 7
|
41
|
+
#define r8 8
|
42
|
+
#define r9 9
|
43
|
+
#define r10 10
|
44
|
+
#define r11 11
|
45
|
+
#define r12 12
|
46
|
+
#define r13 13
|
47
|
+
#define r14 14
|
48
|
+
#define r15 15
|
49
|
+
#define r16 16
|
50
|
+
#define r17 17
|
51
|
+
#define r18 18
|
52
|
+
#define r19 19
|
53
|
+
#define r20 20
|
54
|
+
#define r21 21
|
55
|
+
#define r22 22
|
56
|
+
#define r23 23
|
57
|
+
#define r24 24
|
58
|
+
#define r25 25
|
59
|
+
#define r26 26
|
60
|
+
#define r27 27
|
61
|
+
#define r28 28
|
62
|
+
#define r29 29
|
63
|
+
#define r30 30
|
64
|
+
#define r31 31
|
65
|
+
#define f0 0
|
66
|
+
#define f1 1
|
67
|
+
#define f2 2
|
68
|
+
#define f3 3
|
69
|
+
#define f4 4
|
70
|
+
#define f5 5
|
71
|
+
#define f6 6
|
72
|
+
#define f7 7
|
73
|
+
#define f8 8
|
74
|
+
#define f9 9
|
75
|
+
#define f10 10
|
76
|
+
#define f11 11
|
77
|
+
#define f12 12
|
78
|
+
#define f13 13
|
79
|
+
#define f14 14
|
80
|
+
#define f15 15
|
81
|
+
#define f16 16
|
82
|
+
#define f17 17
|
83
|
+
#define f18 18
|
84
|
+
#define f19 19
|
85
|
+
#define f20 20
|
86
|
+
#define f21 21
|
87
|
+
#define f22 22
|
88
|
+
#define f23 23
|
89
|
+
#define f24 24
|
90
|
+
#define f25 25
|
91
|
+
#define f26 26
|
92
|
+
#define f27 27
|
93
|
+
#define f28 28
|
94
|
+
#define f29 29
|
95
|
+
#define f30 30
|
96
|
+
#define f31 31
|
97
|
+
#endif
|
98
|
+
|