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,33 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_arm32_thumb.h
|
6
|
+
Description: Callback - Header for ARM32 (THUMB mode)
|
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
|
+
#ifndef DYNCALL_CALLBACK_ARM32_THUMB_H_
|
28
|
+
#define DYNCALL_CALLBACK_ARM32_THUMB_H_
|
29
|
+
|
30
|
+
#include "dyncall_callback_arm32_arm.h" /* Uses same code as ARM mode. */
|
31
|
+
|
32
|
+
#endif /* DYNCALL_CALLBACK_ARM32_THUMB_H_ */
|
33
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_arm32_thumb_gas.s
|
6
|
+
Description: Callback Thunk - Implementation for ARM32 (THUMB mode)
|
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
|
+
/* We can use the ARM mode callback code here, because the thunk switches */
|
28
|
+
/* into ARM mode, the parameters passed use the same registers/stack spase */
|
29
|
+
/* as the ARM mode, and the bx instruction switches back to THUMB mode, if */
|
30
|
+
/* the function to be called has a "THUMB function address" (=address+1). */
|
31
|
+
.include "dyncall_callback_arm32_arm_apple.s"
|
32
|
+
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_arm32_thumb_gas.s
|
6
|
+
Description: Callback Thunk - Implementation for ARM32 (THUMB mode)
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2007-2013 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
|
+
/* We can use the ARM mode callback code here, because the thunk switches */
|
28
|
+
/* into ARM mode, the parameters passed use the same registers/stack space */
|
29
|
+
/* as the ARM mode, and the bx instruction switches back to THUMB mode, if */
|
30
|
+
/* the function to be called has a "THUMB function address" (=address+1). */
|
31
|
+
.include "dyncall_callback_arm32_arm_gas.s"
|
32
|
+
|
@@ -0,0 +1,61 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_mips.c
|
6
|
+
Description: Callback - Implementation Header for MIPS
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2013 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
|
+
#include "dyncall_callback.h"
|
27
|
+
#include "dyncall_callback_mips.h"
|
28
|
+
|
29
|
+
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
30
|
+
{
|
31
|
+
const char* ptr;
|
32
|
+
char ch;
|
33
|
+
|
34
|
+
pcb->handler = handler;
|
35
|
+
pcb->userdata = userdata;
|
36
|
+
}
|
37
|
+
|
38
|
+
extern void dcCallbackThunkEntry();
|
39
|
+
|
40
|
+
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
41
|
+
{
|
42
|
+
DCCallback* pcb;
|
43
|
+
int err = dcAllocWX(sizeof(DCCallback), (void**)&pcb);
|
44
|
+
if (err != 0) return 0;
|
45
|
+
|
46
|
+
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
47
|
+
dcbInitCallback(pcb, signature, handler, userdata);
|
48
|
+
|
49
|
+
return pcb;
|
50
|
+
}
|
51
|
+
|
52
|
+
void dcbFreeCallback(DCCallback* pcb)
|
53
|
+
{
|
54
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
55
|
+
}
|
56
|
+
|
57
|
+
void* dcbGetUserData(DCCallback* pcb)
|
58
|
+
{
|
59
|
+
return pcb->userdata;
|
60
|
+
}
|
61
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_mips.h
|
6
|
+
Description: Callback - Header for MIPS
|
7
|
+
License:
|
8
|
+
|
9
|
+
Copyright (c) 2013 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
|
+
#ifndef DYNCALL_CALLBACK_MIPS_H
|
27
|
+
#define DYNCALL_CALLBACK_MIPS_H
|
28
|
+
|
29
|
+
#include "dyncall_callback.h"
|
30
|
+
|
31
|
+
#include "dyncall_thunk.h"
|
32
|
+
#include "dyncall_args_mips.h"
|
33
|
+
|
34
|
+
struct DCCallback
|
35
|
+
{
|
36
|
+
DCThunk thunk; /* offset 0, size 20 */
|
37
|
+
DCCallbackHandler* handler; /* offset 20, size 4 */
|
38
|
+
void* userdata; /* offset 24, size 4 */
|
39
|
+
};
|
40
|
+
|
41
|
+
#endif /* DYNCALL_CALLBACK_MIPS_H */
|
42
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_ppc32.S
|
6
|
+
Description: Callback Thunk - Implementation for PowerPC 32-bit on Darwin/Apple's as
|
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
|
+
#include "../portasm/portasm-ppc.S"
|
27
|
+
.machine ppc
|
28
|
+
.text
|
29
|
+
.align 2
|
30
|
+
GLOBAL_C(dcCallbackThunkEntry)
|
31
|
+
ENTRY_C(dcCallbackThunkEntry)
|
32
|
+
blr /* return */
|
33
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_ppc32.c
|
6
|
+
Description: Callback - Implementation Header for ppc32 (TODO: not implemented yet)
|
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
|
+
#include "dyncall_callback.h"
|
27
|
+
#include "dyncall_callback_ppc32.h"
|
28
|
+
|
29
|
+
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
|
30
|
+
{
|
31
|
+
const char* ptr;
|
32
|
+
char ch;
|
33
|
+
|
34
|
+
pcb->handler = handler;
|
35
|
+
pcb->userdata = userdata;
|
36
|
+
}
|
37
|
+
|
38
|
+
extern void dcCallbackThunkEntry();
|
39
|
+
|
40
|
+
DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata)
|
41
|
+
{
|
42
|
+
DCCallback* pcb;
|
43
|
+
int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb);
|
44
|
+
if (err != 0) return 0;
|
45
|
+
|
46
|
+
dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
|
47
|
+
dcbInitCallback(pcb, signature, handler, userdata);
|
48
|
+
|
49
|
+
return pcb;
|
50
|
+
}
|
51
|
+
|
52
|
+
void dcbFreeCallback(DCCallback* pcb)
|
53
|
+
{
|
54
|
+
dcFreeWX(pcb, sizeof(DCCallback));
|
55
|
+
}
|
56
|
+
|
57
|
+
void* dcbGetUserData(DCCallback* pcb)
|
58
|
+
{
|
59
|
+
return pcb->userdata;
|
60
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_ppc32.h
|
6
|
+
Description: Callback - Header for ppc32
|
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
|
+
#ifndef DYNCALL_CALLBACK_PPC32_H
|
27
|
+
#define DYNCALL_CALLBACK_PPC32_H
|
28
|
+
|
29
|
+
#include "dyncall_callback.h"
|
30
|
+
|
31
|
+
#include "dyncall_thunk.h"
|
32
|
+
#include "dyncall_args_ppc32.h"
|
33
|
+
|
34
|
+
struct DCCallback
|
35
|
+
{
|
36
|
+
DCThunk thunk; /* offset 0, size 40 */
|
37
|
+
DCCallbackHandler* handler; /* offset 40, size 4 */
|
38
|
+
size_t stack_cleanup; /* offset 44, size 4 */
|
39
|
+
void* userdata; /* offset 48, size 4 */
|
40
|
+
};
|
41
|
+
|
42
|
+
#endif /* DYNCALL_CALLBACK_PPC32_H */
|
43
|
+
|
@@ -0,0 +1,180 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Package: dyncall
|
4
|
+
Library: dyncallback
|
5
|
+
File: dyncallback/dyncall_callback_ppc32_apple.s
|
6
|
+
Description: Callback Thunk - Implementation for PowerPC 32-bit on Darwin/Apple's as
|
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
|
+
.machine ppc
|
27
|
+
.text
|
28
|
+
.align 2
|
29
|
+
|
30
|
+
/* Callback Thunk Entry code for Apple Mac OS X PowerPC 32-bit. */
|
31
|
+
|
32
|
+
/* Stack Frame Layout:
|
33
|
+
|
34
|
+
206 DCValue ( )
|
35
|
+
56 DCArgs (32+104+4+8 = 150)
|
36
|
+
24 Parameter area ( 4*8 = 32 )
|
37
|
+
0 Linkage area ( 24 )
|
38
|
+
|
39
|
+
|
40
|
+
*/
|
41
|
+
|
42
|
+
/* Constants. */
|
43
|
+
INT_REGS = 8
|
44
|
+
FLOAT_REGS = 13
|
45
|
+
SIZEOF_INT = 4
|
46
|
+
SIZEOF_DOUBLE = 8
|
47
|
+
|
48
|
+
|
49
|
+
/* Linkage area. */
|
50
|
+
LINK_SP = 0
|
51
|
+
LINK_CR = 4
|
52
|
+
LINK_LR = 8
|
53
|
+
LINK_OFFSET = 0
|
54
|
+
LINK_SIZE = 24
|
55
|
+
/* Parameter area. */
|
56
|
+
PAR_OFFSET = LINK_SIZE
|
57
|
+
PAR_SIZE = 32
|
58
|
+
/* local struct DCArgs */
|
59
|
+
ARGS_OFFSET = (PAR_OFFSET+PAR_SIZE)
|
60
|
+
ARGS_SIZE = (SIZEOF_INT*INT_REGS)+(SIZEOF_DOUBLE*FLOAT_REGS) /* = 136 */
|
61
|
+
/* local struct DCValue */
|
62
|
+
RESULT_OFFSET = (ARGS_OFFSET+ARGS_SIZE)
|
63
|
+
RESULT_SIZE = 16
|
64
|
+
/* additional locals (reg 30/31) */
|
65
|
+
LOCALS_OFFSET = (RESULT_OFFSET+RESULT_SIZE)
|
66
|
+
LOCALS_SIZE = 2*SIZEOF_INT
|
67
|
+
/* total */
|
68
|
+
FRAME_SIZE = ( (LOCALS_OFFSET+LOCALS_SIZE)+15 & (-16) )
|
69
|
+
|
70
|
+
/* struct DCCallback */
|
71
|
+
DCB_THUNK = 0
|
72
|
+
DCB_HANDLER = 24
|
73
|
+
DCB_STACKCLEAN = 28
|
74
|
+
DCB_USERDATA = 32
|
75
|
+
|
76
|
+
/* struct DCArgs */
|
77
|
+
DCA_IARRAY = 0
|
78
|
+
DCA_FARRAY = SIZEOF_INT*INT_REGS
|
79
|
+
DCA_SP = DCA_FARRAY + SIZEOF_DOUBLE*FLOAT_REGS
|
80
|
+
DCA_ICOUNT = DCA_SP + 4
|
81
|
+
DCA_FCOUNT = DCA_ICOUNT + 4
|
82
|
+
|
83
|
+
/* struct DCValue */
|
84
|
+
DCV_INT = 0
|
85
|
+
DCV_FLOAT = 0
|
86
|
+
DCV_DOUBLE = 0
|
87
|
+
DCV_LONG_HI32 = 0
|
88
|
+
DCV_LONG_LO32 = 4
|
89
|
+
DCV_SIZE = 8
|
90
|
+
|
91
|
+
iregfile = ARGS_OFFSET+DCA_IARRAY
|
92
|
+
fregfile = ARGS_OFFSET+DCA_FARRAY
|
93
|
+
save_sp = ARGS_OFFSET+DCA_SP
|
94
|
+
icount = ARGS_OFFSET+DCA_ICOUNT
|
95
|
+
fcount = ARGS_OFFSET+DCA_FCOUNT
|
96
|
+
.globl _dcCallbackThunkEntry
|
97
|
+
|
98
|
+
/*
|
99
|
+
Thunk entry:
|
100
|
+
R2 = DCCallback*
|
101
|
+
*/
|
102
|
+
_dcCallbackThunkEntry:
|
103
|
+
|
104
|
+
mflr r0
|
105
|
+
stw r0, 8(r1) /* store return address */
|
106
|
+
/* stmw r30, -8(r1) */ /* store preserved registers (r30/r31) */
|
107
|
+
addi r12, r1, PAR_OFFSET /* temporary r12 = parameter area on callers stack frame */
|
108
|
+
stwu r1, -FRAME_SIZE(r1) /* save callers stack pointer and make new stack frame. */
|
109
|
+
stw r3, iregfile+0*4(r1) /* spill 8 integer parameter registers */
|
110
|
+
stw r4, iregfile+1*4(r1)
|
111
|
+
stw r5, iregfile+2*4(r1)
|
112
|
+
stw r6, iregfile+3*4(r1)
|
113
|
+
stw r7, iregfile+4*4(r1)
|
114
|
+
stw r8, iregfile+5*4(r1)
|
115
|
+
stw r9, iregfile+6*4(r1)
|
116
|
+
stw r10,iregfile+7*4(r1)
|
117
|
+
stfd f1, fregfile+ 0*8(r1) /* spill 13 float parameter registers */
|
118
|
+
stfd f2, fregfile+ 1*8(r1)
|
119
|
+
stfd f3, fregfile+ 2*8(r1)
|
120
|
+
stfd f4, fregfile+ 3*8(r1)
|
121
|
+
stfd f5, fregfile+ 4*8(r1)
|
122
|
+
stfd f6, fregfile+ 5*8(r1)
|
123
|
+
stfd f7, fregfile+ 6*8(r1)
|
124
|
+
stfd f8, fregfile+ 7*8(r1)
|
125
|
+
stfd f9, fregfile+ 8*8(r1)
|
126
|
+
stfd f10,fregfile+ 9*8(r1)
|
127
|
+
stfd f11,fregfile+10*8(r1)
|
128
|
+
stfd f12,fregfile+11*8(r1)
|
129
|
+
stfd f13,fregfile+12*8(r1)
|
130
|
+
/* initialize struct DCCallback */
|
131
|
+
stw r12,save_sp(r1) /* init stack pointer */
|
132
|
+
xor r0, r0, r0 /* init register counters */
|
133
|
+
stw r0, icount(r1)
|
134
|
+
stw r0, fcount(r1)
|
135
|
+
/* invoke callback handler */
|
136
|
+
mr r3, r2 /* arg 1: DCCallback* pcb */
|
137
|
+
addi r4, r1, ARGS_OFFSET /* arg 2: DCArgs* args */
|
138
|
+
addi r5, r1, RESULT_OFFSET /* arg 3: DCValue* result */
|
139
|
+
lwz r6, DCB_USERDATA(r2) /* arg 4: void* userdata */
|
140
|
+
|
141
|
+
/* branch-and-link to DCCallback.handler */
|
142
|
+
lwz r12, DCB_HANDLER(r2)
|
143
|
+
mtctr r12
|
144
|
+
bctrl
|
145
|
+
addi r0, r1, RESULT_OFFSET /* r0 = DCValue* */
|
146
|
+
/* switch on base result type */
|
147
|
+
cmpi cr0, r3, 'B
|
148
|
+
beq .i32
|
149
|
+
cmpi cr0, r3, 'i
|
150
|
+
beq .i32
|
151
|
+
cmpi cr0, r3, 'l
|
152
|
+
beq .i64
|
153
|
+
cmpi cr0, r3, 'f
|
154
|
+
beq .f32
|
155
|
+
cmpi cr0, r3, 'd
|
156
|
+
beq .f64
|
157
|
+
cmpi cr0, r3, 'p
|
158
|
+
beq .i32
|
159
|
+
.void: /* ignore result (void call) */
|
160
|
+
b .end
|
161
|
+
.i32: /* result is integer <= 32-bit result */
|
162
|
+
lwz r3, RESULT_OFFSET + DCV_INT(r1)
|
163
|
+
b .end
|
164
|
+
.f32: /* result is C float result */
|
165
|
+
lfs f1, RESULT_OFFSET + DCV_FLOAT(r1)
|
166
|
+
b .end
|
167
|
+
.f64:
|
168
|
+
lfd f1, RESULT_OFFSET + DCV_FLOAT(r1)
|
169
|
+
b .end
|
170
|
+
.i64: /* result is C double result */
|
171
|
+
lwz r3, RESULT_OFFSET + DCV_LONG_HI32(r1)
|
172
|
+
lwz r4, RESULT_OFFSET + DCV_LONG_LO32(r1)
|
173
|
+
b .end
|
174
|
+
.end:
|
175
|
+
lwz r1, 0(r1) /* restore stack pointer */
|
176
|
+
/* lmw r30, -8(r1) */ /* restore preserved registers */
|
177
|
+
lwz r0, 8(r1) /* load link register with return address */
|
178
|
+
mtlr r0
|
179
|
+
blr /* branch back to link register */
|
180
|
+
|