# HG changeset patch # User Tassilo Philipp # Date 1586955443 -7200 # Node ID ad5f9803f52fa7dab77cfaa65d625b23595650a8 # Parent 1d03a3a4220d6a15d9edb7eb2b4bc1b31def17dc - removal of some unnecessary headers that only contained internally used forward declarations, so no need to have them diff -r 1d03a3a4220d -r ad5f9803f52f ChangeLog --- a/ChangeLog Tue Apr 14 19:58:31 2020 +0200 +++ b/ChangeLog Wed Apr 15 14:57:23 2020 +0200 @@ -6,6 +6,7 @@ that coexist on a platform with other conventions) o made "formatted" call interface use calling convention signature chars o added helper function dcGetModeFromCCSigChar() mapping callconv sig chars to respective mode + o removed some unnecessary headers (only contained internal used forward declarations) dynload: o fix to build with musl libc doc: diff -r 1d03a3a4220d -r ad5f9803f52f ToDo --- a/ToDo Tue Apr 14 19:58:31 2020 +0200 +++ b/ToDo Wed Apr 15 14:57:23 2020 +0200 @@ -7,8 +7,6 @@ - openbsd-4.0-* test/resolve_self fails, but unsure why. dlopen correctly returns RTLD_DEFAULT, which should lookup via dlsym the function in the object itself, but cannot. So... some compiler flag might be missing to keep symbol names, or some prefixing happens -- dyncall/dyncall_call*h could probably be all removed, as forward declarations in corresponding .c - files would be enough; no headers are needed b/c those functions declared in there are of no public use - test/thunk win/x64 doesn't output anything decent for stack test (neither sigsegv nor output), which can create a problem for test log file as it'll mess with the subsequent test's output) - remove test/gen-masm alltogether - test code: add sparc tests for when out of register windows, meaning multiple layers deep in the call stack @@ -96,6 +94,9 @@ dynload: -------- +- investigate issue where if dlGetLibraryPath() is called from within a .so, + passing NULL will return .so name, whereas passing result of + dlLoadLibrary(NULL) returns process' name - dlGetLibraryPath: dl_iterate_phdr() used on OpenBSD, but not available on version < 3.7 - bug: test/nm crashes on qemu mips linux o32 debian etch - rename SymsInit to InitSyms and similar for cleanup function to reflect naming @@ -134,11 +135,11 @@ bindings: --------- - release bindings as standalone packages (already done for rbdc as a gem and rdyncall on cran) - * add note to documentation, where bindings are and that some bindings are svn-only ATM + * add note to documentation, where bindings are - add rdoc documentation to ruby gem - add pydoc for python - add manpage for shdc -- expose callf-convenience functions to go +- expose callf-convenience functions to godc - add godoc for godc - add javadoc to java - add more bindings @@ -147,7 +148,9 @@ manual: ------- -- introduce doc overview tables and common vocab for calling convention specifics, following example of table on page 13 of https://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf; also as inspiration, e.g. user 'preserved' instead of 'permanent', etc. https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW4 +- introduce doc overview tables and common vocab for calling convention specifics, following example of table on page 13 of + https://www.linux-mips.org/pub/linux/mips/doc/ABI/MIPS-N32-ABI-Handbook.pdf; also as inspiration, e.g. user 'preserved' instead of 'permanent', etc. + https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW4 * also, get inspiration for naming for GCC predefs as talked about in https://stffrdhrn.github.io/software/embedded/openrisc/2018/06/08/gcc_stack_frames.html - make stack layout diagrams better, e.g. add grow direction (example: https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/art/arm_stack.jpg on https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv6FunctionCallingConventions.html#//apple_ref/doc/uid/TP40009021-SW1) * another example, chapter 3 of: ftp://www.sourceware.org/pub/binutils/ppc-docs/ppc-poweropen/ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_arm32_arm.h --- a/dyncall/dyncall_call_arm32_arm.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_arm32_arm.h - Description: - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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 32bit ARM32 family interface (ARM mode) - - REVISION - 2007/12/11 initial - -*/ - - -#ifndef DYNCALL_CALL_ARM32_ARM_H -#define DYNCALL_CALL_ARM32_ARM_H - - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** arm32 arm mode calling convention calls -** -** - hybrid return-type call (bool ... pointer) -** -** Note the return type of this declaration is intentially of double-word size. -** On some platforms (FreeBSD/arm, Nintendo DS, ...) the compiler generates cleanup code -** in the caller (dc_callvm_call_arm32_arm) that reuses, thus overwrites r0 and r1. -** With this "hint", we preserve those registers by letting the compiler assume both -** registers are used for the return type. -*/ - -DClonglong dcCall_arm32_arm(DCpointer target, DCpointer stackdata, DCsize size); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_ARM32_ARM_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_arm32_arm_armhf.h --- a/dyncall/dyncall_call_arm32_arm_armhf.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_arm32_arm_armhf.h - Description: - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_ARM32_ARM_ARMHF_H -#define DYNCALL_CALL_ARM32_ARM_ARMHF_H - - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** arm32 armhf mode calling convention calls -** -** - hybrid return-type call (bool ... pointer) -** -** Note the return type of this declaration is intentially of double-word size. -** On some platforms the compiler generates cleanup code in the caller (dyncall_callvm_arm32_arm_armhf.c's -** call()) that reuses,thus overwrites r0 and r1. -** With this "hint", we preserve those registers by letting the compiler assume both -** registers are used for the return type. -*/ - -DClonglong dcCall_arm32_armhf(DCpointer target, DCpointer stackdata, DCsize size, DCfloat* p_s16); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_ARM32_ARM_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_arm32_thumb.h --- a/dyncall/dyncall_call_arm32_thumb.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_arm32_thumb.h - Description: - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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 32bit ARM32 family interface (THUMB mode) - - REVISION - 2008/08/12 initial - -*/ - - -#ifndef DYNCALL_CALL_ARM32_THUMB_H -#define DYNCALL_CALL_ARM32_THUMB_H - - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** arm32 thumb mode calling convention calls -** -** - hybrid return-type call (bool ... pointer) -** -** Note the return type of this declaration is intentially of double-word size. -** On some platforms (FreeBSD/arm, Nintendo DS, ...) the compiler generates cleanup code -** in the caller (dc_callvm_call_arm32_thumb) that reuses, thus overwrites r0 and r1. -** With this "hint", we preserve those registers by letting the compiler assume both -** registers are used for the return type. -*/ - -DClonglong dcCall_arm32_thumb(DCpointer target, DCpointer stackdata, DCsize size); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_ARM32_THUMB_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_arm64.h --- a/dyncall/dyncall_call_arm64.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_arm64.h - Description: ARM 64-bit - License: - - Copyright (c) 2015-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_ARM64_DEBIAN_H -#define DYNCALL_CALL_ARM64_DEBIAN_H - - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void dcCall_arm64(DCpointer target, DCpointer data, DCsize size, DCpointer regdata); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_ARM64_DEBIAN_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_mips.h --- a/dyncall/dyncall_call_mips.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_mips.h - Description: mips call-kernel C interfaces. - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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 MIPS call kernel C interface for all ABIs - - REVISION - 2010/06/03 initial - -*/ - - -#ifndef DYNCALL_CALL_MIPS_H -#define DYNCALL_CALL_MIPS_H - -/* supported abi-specific call kernels: */ - -#include "dyncall_call_mips_o32.h" -#include "dyncall_call_mips_eabi.h" -#include "dyncall_call_mips_n64.h" -#include "dyncall_call_mips_n32.h" - -typedef void (*dcCall_mips_common) (DCpointer target, DCpointer regdata_abispecific, DCsize stacksize, DCpointer stackdata); - -#endif /* DYNCALL_CALL_MIPS_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_mips_eabi.h --- a/dyncall/dyncall_call_mips_eabi.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,62 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_mips_eabi.h - Description: mips "eabi" abi call kernel C interface. - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_MIPS_EABI_H -#define DYNCALL_CALL_MIPS_EABI_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Call-kernel register data: - - Details: - Two register content buffers for the corresponding register types - integer and float are filled from CallVM code and then later at - call-kernel loaded into the registers. - */ - -struct DCRegData_mips_eabi -{ - DCint mIntData[8]; - DCfloat mSingleData[8]; -}; - - -/* Call kernel. */ - -void dcCall_mips_eabi(DCpointer target, struct DCRegData_mips_eabi* regdata, DCsize stksize, DCpointer stkdata); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_MIPS_EABI_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_mips_n32.h --- a/dyncall/dyncall_call_mips_n32.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_mips_n32.h - Description: mips64 "n32" ABI call-kernel C interface. - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_MIPS_N32_H -#define DYNCALL_CALL_MIPS_N32_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - two register-files for integer (promoted to 64-bit) and float (not promoted!) - are used. - - arguments are transfered in a free slot on the corresponding register file. - the other register-file will be skipped by one. - - float arguments are either loaded from single or double - - a auto-conversion into double and then loaded as double precision - turned out to fail for several tests. - - therefore a union for storage of float or double is used instead. - a bitmask (mUseDouble) records which type is used and will be - interpreted in the call-kernel. -*/ - -struct DCRegData_mips_n32 -{ - DClonglong mIntData[8]; - union { DCfloat f; DCdouble d; } mFloatData[8]; - DClonglong mUseDouble; /* bitmask: lower 8 bits specify to use float or double from union array. */ -}; - -void dcCall_mips_n32(DCpointer target, struct DCRegData_mips_n32* regdata, DCsize stksize, DCpointer stkdata); -/* @@@ this is the same as n64, combine code */ - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_MIPS_N64_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_mips_n64.h --- a/dyncall/dyncall_call_mips_n64.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_mips_n64.h - Description: mips "n64" ABI call-kernel C interface. - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_MIPS_N64_H -#define DYNCALL_CALL_MIPS_N64_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* - two register-files for integer (promoted to 64-bit) and float (not promoted!) - are used. - - arguments are transfered in a free slot on the corresponding register file. - the other register-file will be skipped by one. - - float arguments are either loaded from single or double - - a auto-conversion into double and then loaded as double precision - turned out to fail for several tests. - - therefore a union for storage of float or double is used instead. - a bitmask (mUseDouble) records which type is used and will be - interpreted in the call-kernel. -*/ - -struct DCRegData_mips_n64 -{ - DClonglong mIntData[8]; -#if defined(DC__ABI_HARDFLOAT) - union { DCfloat f; DCdouble d; } mFloatData[8]; - DClonglong mUseDouble; /* bitmask: lower 8 bits specify to use float or double from union array. */ -#endif /* DC__ABI_HARDFLOAT */ -}; - -void dcCall_mips_n64(DCpointer target, struct DCRegData_mips_n64* regdata, DCsize stksize, DCpointer stkdata); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_MIPS_N64_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_mips_o32.h --- a/dyncall/dyncall_call_mips_o32.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_mips_o32.h - Description: mips "o32" abi call kernel C interface. - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_CALL_MIPS_O32_H -#define DYNCALL_CALL_MIPS_O32_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Call-kernel register data: - - Details: - - The structure holds the argument data for transfering float/double arguments - via registers as well. - The call-kernel on hardfloat platforms implements loads two doubles, which - involves four 32-bit floating pointer registers. It's unused for softfloat - platforms. - - Float arguments map as following: - - float argument 0 is at u[0][0] for little, u[0][1] for big endian and - float argument 1 is at u[1][0] for little, u[1][1] for big endian of - DCRegData_mips_o32 union. - -*/ - -typedef struct -{ -#if defined(DC__ABI_HARDFLOAT) - union { - double d; - float f[2]; - } u[2]; -#endif /* DC__ABI_HARDFLOAT */ -} DCRegData_mips_o32; - - -/* Call kernel. */ - -void dcCall_mips_o32(DCpointer target, DCRegData_mips_o32* regdata, DCsize stksize, DCpointer stkdata); - - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_MIPS_O32_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_ppc32.h --- a/dyncall/dyncall_call_ppc32.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_ppc32.h - Description: - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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_PPC32_H -#define DYNCALL_PPC32_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct DCRegData_ppc32_ -{ - DCint mIntData[8]; - DCdouble mFloatData[13]; /* 13 for darwin, 8 for sysv */ -}; - -/* -** PowerPC 32-bit calling convention call -** -** - hybrid return-type call (bool ... pointer) -** -*/ - -/* Darwin ABI */ -void dcCall_ppc32_darwin (DCpointer target, struct DCRegData_ppc32_* ppc32data, DCsize stksize, DCpointer stkdata); - -/* System V ABI */ -void dcCall_ppc32_sysv (DCpointer target, struct DCRegData_ppc32_* ppc32data, DCsize stksize, DCpointer stkdata); - -/* syscall @@@ Bus Error on Darwin */ -void dcCall_ppc32_syscall (DCpointer target, struct DCRegData_ppc32_* ppc32data, DCsize stksize, DCpointer stkdata); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNCALL_PPC32_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_ppc64.h --- a/dyncall/dyncall_call_ppc64.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_ppc64.h - Description: - License: - - Copyright (c) 2014-2015 Masanori Mitsugi - - 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_PPC64_H -#define DYNCALL_PPC64_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct DCRegData_ppc64_ -{ - DClonglong mIntData[8]; - DCdouble mFloatData[13]; -}; - -/* -** PowerPC 64-bit calling convention call -** -** - hybrid return-type call (bool ... pointer) -** -*/ - -void dcCall_ppc64(DCpointer target, struct DCRegData_ppc64_* ppc64data, DCsize stksize, DCpointer stkdata); - -/* syscall */ -void dcCall_ppc64_syscall(DCpointer target, struct DCRegData_ppc64_* ppc64data, DCsize stksize, DCpointer stkdata); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNCALL_PPC64_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_sparc.h --- a/dyncall/dyncall_call_sparc.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_sparc.h - Description: - License: - - Copyright (c) 2011-2018 Daniel Adler - - 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_CALL_SPARC_H -#define DYNCALL_CALL_SPARC_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void dcCall_sparc (DCpointer target, DCsize size, DCpointer data); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNCALL_CALL_SPARC_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_sparc64.h --- a/dyncall/dyncall_call_sparc64.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_sparc64.h - Description: - License: - - Copyright (c) 2011-2018 Daniel Adler - - 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_CALL_SPARC_V9_H -#define DYNCALL_CALL_SPARC_V9_H - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void dcCall_v9 (DCCallVM* vm, DCpointer target); - -#ifdef __cplusplus -} -#endif - -#endif /* DYNCALL_CALL_SPARC_v9_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_x64.h --- a/dyncall/dyncall_call_x64.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_x64.h - Description: - License: - - Copyright (c) 2007-2020 Daniel Adler , - Tassilo Philipp - - 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 x64 - - REVISION - 2007/12/11 initial - -*/ - - -#ifndef DYNCALL_CALL_X64_H -#define DYNCALL_CALL_X64_H - - -#include "dyncall.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** x64 SystemV calling convention -** -** - hybrid return-type call (bool ... pointer) -** -*/ - -void dcCall_x64_sysv(DCsize stacksize, DCpointer stackdata, DCpointer regdata_i, DCpointer regdata_f, DCpointer target); -void dcCall_x64_win64(DCsize stacksize, DCpointer stackdata, DCpointer regdata, DCpointer target); -void dcCall_x64_syscall_sysv(DCpointer argdata, DCpointer target); - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_X64_H */ - diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_call_x86.h --- a/dyncall/dyncall_call_x86.h Tue Apr 14 19:58:31 2020 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* - - Package: dyncall - Library: dyncall - File: dyncall/dyncall_call_x86.h - Description: heap memory management interface (header only) - License: - - Copyright (c) 2007-2018 Daniel Adler , - Tassilo Philipp - - 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 32bit Intel x86 family interface - - REVISION - 2007/12/10 initial - -*/ - - -#ifndef DYNCALL_CALL_X86_H -#define DYNCALL_CALL_X86_H - - -#include "dyncall_types.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** x86 calling convention calls -** -** - hybrid return-type call (bool ... pointer) -** -*/ - -#if defined(DC__OS_Plan9) /* No support for other cconvs on Plan9 and vice-versa. */ -void dcCall_x86_plan9 (DCpointer target, DCpointer stackdata, DCsize size); -#else -void dcCall_x86_cdecl (DCpointer target, DCpointer stackdata, DCsize size); -void dcCall_x86_win32_std (DCpointer target, DCpointer stackdata, DCsize size); -void dcCall_x86_win32_fast (DCpointer target, DCpointer stackdata, DCsize size); -void dcCall_x86_win32_msthis (DCpointer target, DCpointer stackdata, DCsize size); -void dcCall_x86_syscall_int80h_linux(DCpointer target, DCpointer stackdata, DCsize size); -void dcCall_x86_syscall_int80h_bsd (DCpointer target, DCpointer stackdata, DCsize size); -#endif - -#ifdef __cplusplus -} -#endif - - -#endif /* DYNCALL_CALL_X86_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_arm.c --- a/dyncall/dyncall_callvm_arm32_arm.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_arm.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: ARM 32-bit "arm" ABI callvm implementation License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,6 +41,22 @@ #include "dyncall_callvm_arm32_arm.h" #include "dyncall_alloc.h" + +/* +** arm32 arm mode calling convention calls +** +** - hybrid return-type call (bool ... pointer) +** +** Note the return type of this declaration is intentially of double-word size (despite +** the return value not being used in the code below). +** On some platforms (FreeBSD/arm, Nintendo DS, ...) the compiler generates cleanup code +** in the caller (dc_callvm_call_arm32_arm) that reuses - thus overwrites - r0 and r1. +** With this "hint", we preserve those registers by letting the compiler assume both +** registers are used for the return type. +*/ +DClonglong dcCall_arm32_arm(DCpointer target, DCpointer stackdata, DCsize size); + + static void dc_callvm_free_arm32_arm(DCCallVM* in_self) { dcFreeMem(in_self); diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_arm.h --- a/dyncall/dyncall_callvm_arm32_arm.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_arm.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,7 +41,6 @@ #ifndef DYNCALL_CALLVM_ARM32_ARM_H #define DYNCALL_CALLVM_ARM32_ARM_H -#include "dyncall_call_arm32_arm.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_arm_armhf.c --- a/dyncall/dyncall_callvm_arm32_arm_armhf.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_arm_armhf.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: ARM 'armhf' ABI implementation License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,6 +28,21 @@ #include "dyncall_alloc.h" +/* +** arm32 armhf mode calling convention calls +** +** - hybrid return-type call (bool ... pointer) +** +** Note the return type of this declaration is intentially of double-word size (despite +** the return value not being used in the code below). +** On some platforms the compiler generates cleanup code in the caller +** (dyncall_callvm_arm32_arm_armhf.c's call()) that reuses- thus overwrites - r0 and r1. +** With this "hint", we preserve those registers by letting the compiler assume both +** registers are used for the return type. +*/ +DClonglong dcCall_arm32_armhf(DCpointer target, DCpointer stackdata, DCsize size, DCfloat* p_s16); + + static void deinit(DCCallVM* in_self) { dcFreeMem(in_self); diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_arm_armhf.h --- a/dyncall/dyncall_callvm_arm32_arm_armhf.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_arm_armhf.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,7 +41,6 @@ #ifndef DYNCALL_CALLVM_ARM32_ARM_ARMHF_H #define DYNCALL_CALLVM_ARM32_ARM_ARMHF_H -#include "dyncall_call_arm32_arm_armhf.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_thumb.c --- a/dyncall/dyncall_callvm_arm32_thumb.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_thumb.c Wed Apr 15 14:57:23 2020 +0200 @@ -41,6 +41,21 @@ #include "dyncall_callvm_arm32_thumb.h" #include "dyncall_alloc.h" +/* +** arm32 thumb mode calling convention calls +** +** - hybrid return-type call (bool ... pointer) +** +** Note the return type of this declaration is intentially of double-word size (despite +** the return value not being used in the code below). +** On some platforms (FreeBSD/arm, Nintendo DS, ...) the compiler generates cleanup code +** in the caller (dc_callvm_call_arm32_thumb) that reuses, thus overwrites r0 and r1. +** With this "hint", we preserve those registers by letting the compiler assume both +** registers are used for the return type. +*/ +DClonglong dcCall_arm32_thumb(DCpointer target, DCpointer stackdata, DCsize size); + + static void dc_callvm_mode_arm32_thumb(DCCallVM* in_self,DCint mode); static void dc_callvm_free_arm32_thumb(DCCallVM* in_self) diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm32_thumb.h --- a/dyncall/dyncall_callvm_arm32_thumb.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm32_thumb.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,7 +41,6 @@ #ifndef DYNCALL_CALLVM_ARM32_THUMB_H #define DYNCALL_CALLVM_ARM32_THUMB_H -#include "dyncall_call_arm32_thumb.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm64.c --- a/dyncall/dyncall_callvm_arm64.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm64.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: ARM 64-bit ABI implementation License: - Copyright (c) 2015-2018 Daniel Adler , + Copyright (c) 2015-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,6 +28,9 @@ #include "dyncall_alloc.h" +void dcCall_arm64(DCpointer target, DCpointer data, DCsize size, DCpointer regdata); + + static void reset(DCCallVM* in_p) { DCCallVM_arm64* p = (DCCallVM_arm64*)in_p; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm64.h --- a/dyncall/dyncall_callvm_arm64.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm64.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2015-2018 Daniel Adler , + Copyright (c) 2015-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -26,7 +26,6 @@ #ifndef DYNCALL_CALLVM_ARM64_H #define DYNCALL_CALLVM_ARM64_H -#include "dyncall_call_arm64.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_arm64_apple.c --- a/dyncall/dyncall_callvm_arm64_apple.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_arm64_apple.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: ARM 64-bit Apple ABI implementation License: - Copyright (c) 2015-2018 Daniel Adler , + Copyright (c) 2015-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,6 +28,9 @@ #include "dyncall_alloc.h" +void dcCall_arm64(DCpointer target, DCpointer data, DCsize size, DCpointer regdata); + + static void reset(DCCallVM* in_p) { DCCallVM_arm64* p = (DCCallVM_arm64*)in_p; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_eabi.c --- a/dyncall/dyncall_callvm_mips_eabi.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_eabi.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: Implementation of Call VM for mips "eabi" abi. License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,6 +28,10 @@ #include "dyncall_callvm_mips_eabi.h" #include "dyncall_alloc.h" + +void dcCall_mips_eabi(DCpointer target, DCRegData_mips_eabi* regdata, DCsize stksize, DCpointer stkdata); + + static void dc_callvm_reset_mips_eabi(DCCallVM* in_self) { DCCallVM_mips_eabi* self = (DCCallVM_mips_eabi*)in_self; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_eabi.h --- a/dyncall/dyncall_callvm_mips_eabi.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_eabi.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,17 +41,32 @@ #ifndef DYNCALL_CALLVM_MIPS_EABI_H #define DYNCALL_CALLVM_MIPS_EABI_H -#include "dyncall_call_mips_eabi.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" + +/* Call-kernel register data: + + Details: + Two register content buffers for the corresponding register types + integer and float are filled from CallVM code and then later at + call-kernel loaded into the registers. + */ + typedef struct { - DCCallVM mInterface; - int mIntRegs; - int mSingleRegs; - struct DCRegData_mips_eabi mRegData; - DCVecHead mVecHead; + DCint mIntData[8]; + DCfloat mSingleData[8]; +} DCRegData_mips_eabi; + + +typedef struct +{ + DCCallVM mInterface; + int mIntRegs; + int mSingleRegs; + DCRegData_mips_eabi mRegData; + DCVecHead mVecHead; } DCCallVM_mips_eabi; #endif /* DYNCALL_CALLVM_MIPS_EABI_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_n32.c --- a/dyncall/dyncall_callvm_mips_n32.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_n32.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips64 "n32" ABI callvm implementation License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -53,6 +53,10 @@ #include "dyncall_alloc.h" #include "dyncall_utils.h" + +void dcCall_mips_n32(DCpointer target, DCRegData_mips_n32* regdata, DCsize stksize, DCpointer stkdata); + + static void dc_callvm_reset_mips_n32(DCCallVM* in_self) { DCCallVM_mips_n32* self = (DCCallVM_mips_n32*)in_self; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_n32.h --- a/dyncall/dyncall_callvm_mips_n32.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_n32.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips64 "n32" ABI callvm C interface. License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,7 +28,6 @@ #ifndef DYNCALL_CALLVM_MIPS_N32_H #define DYNCALL_CALLVM_MIPS_N32_H -#include "dyncall_call_mips_n32.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" @@ -36,14 +35,39 @@ extern "C" { #endif + +/* + two register-files for integer (promoted to 64-bit) and float (not promoted!) + are used. + + arguments are transfered in a free slot on the corresponding register file. + the other register-file will be skipped by one. + + float arguments are either loaded from single or double - + a auto-conversion into double and then loaded as double precision + turned out to fail for several tests. + + therefore a union for storage of float or double is used instead. + a bitmask (mUseDouble) records which type is used and will be + interpreted in the call-kernel. +*/ + typedef struct { - DCCallVM mInterface; - DCint mRegCount; - struct DCRegData_mips_n32 mRegData; - DCVecHead mVecHead; + DClonglong mIntData[8]; + union { DCfloat f; DCdouble d; } mFloatData[8]; + DClonglong mUseDouble; /* bitmask: lower 8 bits specify to use float or double from union array. */ +} DCRegData_mips_n32; + + +typedef struct +{ + DCCallVM mInterface; + DCint mRegCount; + DCRegData_mips_n32 mRegData; + DCVecHead mVecHead; } DCCallVM_mips_n32; -/* @@@ this is the same as n64, combine code */ + #ifdef __cplusplus } diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_n64.c --- a/dyncall/dyncall_callvm_mips_n64.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_n64.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips "n64" ABI callvm implementation License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -53,6 +53,10 @@ #include "dyncall_alloc.h" #include "dyncall_utils.h" + +void dcCall_mips_n64(DCpointer target, DCRegData_mips_n64* regdata, DCsize stksize, DCpointer stkdata); + + static void dc_callvm_reset_mips_n64(DCCallVM* in_self) { DCCallVM_mips_n64* self = (DCCallVM_mips_n64*)in_self; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_n64.h --- a/dyncall/dyncall_callvm_mips_n64.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_n64.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips "n64" ABI callvm C interface. License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,7 +28,6 @@ #ifndef DYNCALL_CALLVM_MIPS_N64_H #define DYNCALL_CALLVM_MIPS_N64_H -#include "dyncall_call_mips_n64.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" @@ -36,14 +35,42 @@ extern "C" { #endif + +/* + two register-files for integer (promoted to 64-bit) and float (not promoted!) + are used. + + arguments are transfered in a free slot on the corresponding register file. + the other register-file will be skipped by one. + + float arguments are either loaded from single or double - + a auto-conversion into double and then loaded as double precision + turned out to fail for several tests. + + therefore a union for storage of float or double is used instead. + a bitmask (mUseDouble) records which type is used and will be + interpreted in the call-kernel. +*/ + typedef struct { - DCCallVM mInterface; - DCint mRegCount; - struct DCRegData_mips_n64 mRegData; - DCVecHead mVecHead; + DClonglong mIntData[8]; +#if defined(DC__ABI_HARDFLOAT) + union { DCfloat f; DCdouble d; } mFloatData[8]; + DClonglong mUseDouble; /* bitmask: lower 8 bits specify to use float or double from union array. */ +#endif /* DC__ABI_HARDFLOAT */ +} DCRegData_mips_n64; + + +typedef struct +{ + DCCallVM mInterface; + DCint mRegCount; + DCRegData_mips_n64 mRegData; + DCVecHead mVecHead; } DCCallVM_mips_n64; + #ifdef __cplusplus } #endif diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_o32.c --- a/dyncall/dyncall_callvm_mips_o32.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_o32.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips "o32" ABI callvm implementation License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -53,6 +53,9 @@ #include "dyncall_utils.h" +void dcCall_mips_o32(DCpointer target, DCRegData_mips_o32* regdata, DCsize stksize, DCpointer stkdata); + + static void dc_callvm_reset_mips_o32(DCCallVM* in_self) { DCCallVM_mips_o32* self = (DCCallVM_mips_o32*)in_self; diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_mips_o32.h --- a/dyncall/dyncall_callvm_mips_o32.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_mips_o32.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: mips "o32" ABI callvm C interface. License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -28,10 +28,39 @@ #ifndef DYNCALL_CALLVM_MIPS_O32_H #define DYNCALL_CALLVM_MIPS_O32_H -#include "dyncall_call_mips_o32.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" + +/* Call-kernel register data: + + Details: + + The structure holds the argument data for transfering float/double arguments + via registers as well. + The call-kernel on hardfloat platforms implements loads two doubles, which + involves four 32-bit floating pointer registers. It's unused for softfloat + platforms. + + Float arguments map as following: + + float argument 0 is at u[0][0] for little, u[0][1] for big endian and + float argument 1 is at u[1][0] for little, u[1][1] for big endian of + DCRegData_mips_o32 union. + +*/ + +typedef struct +{ +#if defined(DC__ABI_HARDFLOAT) + union { + double d; + float f[2]; + } u[2]; +#endif /* DC__ABI_HARDFLOAT */ +} DCRegData_mips_o32; + + typedef struct { DCCallVM mInterface; @@ -40,5 +69,6 @@ DCVecHead mVecHead; } DCCallVM_mips_o32; + #endif /* DYNCALL_CALLVM_MIPS_O32_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_ppc32.c --- a/dyncall/dyncall_callvm_ppc32.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_ppc32.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -42,14 +42,30 @@ */ #include "dyncall_callvm_ppc32.h" -#include "dyncall_call_ppc32.h" #include "dyncall_alloc.h" #include "dyncall_macros.h" #include "dyncall_types.h" #include "dyncall_utils.h" + +/* +** PowerPC 32-bit calling convention call +** +** - hybrid return-type call (bool ... pointer) +** +*/ + +/* Darwin ABI */ +void dcCall_ppc32_darwin(DCpointer target, DCRegData_ppc32* ppc32data, DCsize stksize, DCpointer stkdata); + +/* System V ABI */ +void dcCall_ppc32_sysv(DCpointer target, DCRegData_ppc32* ppc32data, DCsize stksize, DCpointer stkdata); + +/* syscall @@@ Bus Error on Darwin */ +void dcCall_ppc32_syscall(DCpointer target, DCRegData_ppc32* ppc32data, DCsize stksize, DCpointer stkdata); /* Support for Mac OS X (Darwin) and Systen V ABI for Power PC 32-bit */ + #if defined(DC_UNIX) # if defined(DC__OS_Darwin) # define DC__ABI_Darwin diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_ppc32.h --- a/dyncall/dyncall_callvm_ppc32.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_ppc32.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: License: - Copyright (c) 2007-2018 Daniel Adler , + Copyright (c) 2007-2020 Daniel Adler , Tassilo Philipp Permission to use, copy, modify, and distribute this software for any @@ -41,20 +41,24 @@ */ -#include "dyncall_call_ppc32.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" -typedef struct DCCallVM_ppc32_ DCCallVM_ppc32; - -struct DCCallVM_ppc32_ +typedef struct { - DCCallVM mInterface; - int mIntRegs; - int mFloatRegs; - struct DCRegData_ppc32_ mRegData; + DCint mIntData[8]; + DCdouble mFloatData[13]; /* 13 for darwin, 8 for sysv */ +} DCRegData_ppc32; + + +typedef struct +{ + DCCallVM mInterface; + int mIntRegs; + int mFloatRegs; + DCRegData_ppc32 mRegData; DCVecHead mVecHead; -}; +} DCCallVM_ppc32; #endif /* DYNCALL_CALLVM_PPC32_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_ppc64.c --- a/dyncall/dyncall_callvm_ppc64.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_ppc64.c Wed Apr 15 14:57:23 2020 +0200 @@ -7,6 +7,8 @@ License: Copyright (c) 2014-2015 Masanori Mitsugi + 2020 Tassilo Philipp + Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -38,11 +40,25 @@ */ #include "dyncall_callvm_ppc64.h" -#include "dyncall_call_ppc64.h" #include "dyncall_alloc.h" #include "dyncall_macros.h" #include "dyncall_types.h" + +/* +** PowerPC 64-bit calling convention call +** +** - hybrid return-type call (bool ... pointer) +** +*/ + +void dcCall_ppc64(DCpointer target, DCRegData_ppc64* ppc64data, DCsize stksize, DCpointer stkdata); + +/* syscall */ +void dcCall_ppc64_syscall(DCpointer target, DCRegData_ppc64* ppc64data, DCsize stksize, DCpointer stkdata); + + + /* Support for Power PC 64-bit */ static void dc_callvm_free_ppc64(DCCallVM* in_self) diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_ppc64.h --- a/dyncall/dyncall_callvm_ppc64.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_ppc64.h Wed Apr 15 14:57:23 2020 +0200 @@ -7,6 +7,7 @@ License: Copyright (c) 2014-2015 Masanori Mitsugi + 2020 Tassilo Philipp Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -39,20 +40,25 @@ */ -#include "dyncall_call_ppc64.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" -typedef struct DCCallVM_ppc64_ DCCallVM_ppc64; -struct DCCallVM_ppc64_ +typedef struct { - DCCallVM mInterface; - int mIntRegs; - int mFloatRegs; - struct DCRegData_ppc64_ mRegData; - DCVecHead mVecHead; -}; + DClonglong mIntData[8]; + DCdouble mFloatData[13]; +} DCRegData_ppc64; + +typedef struct +{ + DCCallVM mInterface; + int mIntRegs; + int mFloatRegs; + DCRegData_ppc64 mRegData; + DCVecHead mVecHead; +} DCCallVM_ppc64; + #endif /* DYNCALL_CALLVM_PPC64_H */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_sparc.c --- a/dyncall/dyncall_callvm_sparc.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_sparc.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: Call VM for sparc processor architecture. License: - Copyright (c) 2011-2018 Daniel Adler + Copyright (c) 2011-2020 Daniel Adler Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -25,11 +25,14 @@ #include "dyncall_callvm_sparc.h" -#include "dyncall_call_sparc.h" #include "dyncall_utils.h" #include "dyncall_alloc.h" #define DEFAULT_STACK_ALIGN 16 + +void dcCall_sparc(DCpointer target, DCsize size, DCpointer data); + + /* Destructor. */ static void dc_callvm_free_sparc(DCCallVM* in_self) { diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_sparc.h --- a/dyncall/dyncall_callvm_sparc.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_sparc.h Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: Call VM for sparc processor architecture. License: - Copyright (c) 2011-2018 Daniel Adler + Copyright (c) 2011-2020 Daniel Adler Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_sparc64.c --- a/dyncall/dyncall_callvm_sparc64.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_sparc64.c Wed Apr 15 14:57:23 2020 +0200 @@ -6,7 +6,7 @@ Description: Call VM for sparc64 (v9) ABI. License: - Copyright (c) 2011-2018 Daniel Adler + Copyright (c) 2011-2020 Daniel Adler Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -25,9 +25,12 @@ #include "dyncall_callvm_sparc64.h" -#include "dyncall_call_sparc64.h" #include "dyncall_alloc.h" + +void dcCall_v9(DCCallVM* vm, DCpointer target); + + /* Reset argument buffer. */ static void dc_callvm_reset_v9(DCCallVM* in_self) { diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_x64.c --- a/dyncall/dyncall_callvm_x64.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_x64.c Wed Apr 15 14:57:23 2020 +0200 @@ -34,6 +34,18 @@ #include "dyncall_struct.h" +/* +** x64 SystemV calling convention +** +** - hybrid return-type call (bool ... pointer) +** +*/ + +void dcCall_x64_sysv(DCsize stacksize, DCpointer stackdata, DCpointer regdata_i, DCpointer regdata_f, DCpointer target); +void dcCall_x64_win64(DCsize stacksize, DCpointer stackdata, DCpointer regdata, DCpointer target); +void dcCall_x64_syscall_sysv(DCpointer argdata, DCpointer target); + + static void dc_callvm_free_x64(DCCallVM* in_self) { dcFreeMem(in_self); diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_x64.h --- a/dyncall/dyncall_callvm_x64.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_x64.h Wed Apr 15 14:57:23 2020 +0200 @@ -42,7 +42,6 @@ #define DYNCALL_CALLVM_X64_H #include "dyncall_macros.h" -#include "dyncall_call_x64.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_x86.c --- a/dyncall/dyncall_callvm_x86.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_x86.c Wed Apr 15 14:57:23 2020 +0200 @@ -29,6 +29,25 @@ #include "dyncall_alloc.h" +/* +** x86 calling convention calls +** +** - hybrid return-type call (bool ... pointer) +** +*/ + +#if defined(DC__OS_Plan9) /* No support for other cconvs on Plan9 and vice-versa. */ +void dcCall_x86_plan9 (DCpointer target, DCpointer stackdata, DCsize size); +#else +void dcCall_x86_cdecl (DCpointer target, DCpointer stackdata, DCsize size); +void dcCall_x86_win32_std (DCpointer target, DCpointer stackdata, DCsize size); +void dcCall_x86_win32_fast (DCpointer target, DCpointer stackdata, DCsize size); +void dcCall_x86_win32_msthis (DCpointer target, DCpointer stackdata, DCsize size); +void dcCall_x86_syscall_int80h_linux(DCpointer target, DCpointer stackdata, DCsize size); +void dcCall_x86_syscall_int80h_bsd (DCpointer target, DCpointer stackdata, DCsize size); +#endif + + void dc_callvm_mode_x86(DCCallVM* in_self, DCint mode); /* call vm destructor */ diff -r 1d03a3a4220d -r ad5f9803f52f dyncall/dyncall_callvm_x86.h --- a/dyncall/dyncall_callvm_x86.h Tue Apr 14 19:58:31 2020 +0200 +++ b/dyncall/dyncall_callvm_x86.h Wed Apr 15 14:57:23 2020 +0200 @@ -42,7 +42,6 @@ */ -#include "dyncall_call_x86.h" #include "dyncall_callvm.h" #include "dyncall_vector.h" diff -r 1d03a3a4220d -r ad5f9803f52f dynload/dynload_unix.c --- a/dynload/dynload_unix.c Tue Apr 14 19:58:31 2020 +0200 +++ b/dynload/dynload_unix.c Wed Apr 15 14:57:23 2020 +0200 @@ -105,7 +105,6 @@ #include -/* @@@ if called from within a .so, passing NULL will return .so name, whereas passing result of dlLoadLibrary(NULL) returns process' name */ int dlGetLibraryPath(DLLib* pLib, char* sOut, int bufSize) { struct link_map* p = NULL;