Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_args_mips64.c @ 533:71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
* integration of aggregate-by-value (struct, union) support patch for x64 (win and sysv)
* windows/x64 asm additions to specify how stack unwinds (help for debuggers, exception handling, etc.)
* see Changelog for details
- new calling convention modes for thiscalls (platform agnostic, was specific before)
* new signature character for platform agnostic thiscalls ('*' / DC_SIGCHAR_CC_THISCALL)
- dcCallF(), dcVCallF(), dcArgF() and dcVArgF():
* added support for aggregates-by-value (wasn't part of patch)
* change that those functions don't implicitly call dcReset() anymore, which was unflexible (breaking change)
- added macros to feature test implementation for aggregate-by-value and syscall support
- changed libdyncall_s.lib and libdyncallback_s.lib order in callback test makefiles, as some toolchains are picky about order
- doc:
* man page updates to describe aggregate interface
* manual overview changes to highlight platforms with aggregate-by-value support
- test/plain: replaced tests w/ old/stale sctruct interface with new aggregate one
author | Tassilo Philipp |
---|---|
date | Thu, 21 Apr 2022 13:35:47 +0200 |
parents | b104c5beec8b |
children | 111236b31c75 |
rev | line source |
---|---|
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
1 /* |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
2 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
3 Package: dyncall |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
4 Library: dyncallback |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
5 File: dyncallback/dyncall_args_mips64.c |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
6 Description: Callback's Arguments VM - Implementation for MIPS64 n32&n64 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
7 License: |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
8 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
305
diff
changeset
|
9 Copyright (c) 2016-2022 Tassilo Philipp <tphilipp@potion-studios.com> |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
10 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
11 Permission to use, copy, modify, and distribute this software for any |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
12 purpose with or without fee is hereby granted, provided that the above |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
13 copyright notice and this permission notice appear in all copies. |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
14 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
22 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
23 */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
24 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
25 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
26 #include "dyncall_args_mips.h" |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
27 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
28 /* @@@ test and add n32 code here, also, if needed */ |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
29 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
30 DClonglong dcbArgLongLong(DCArgs* p) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
31 { |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
32 DClonglong value; |
305 | 33 if(p->reg_count < DCARGS_MIPS_NUM_REGS) |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
34 value = p->ireg_data[p->reg_count++]; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
35 else { |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
36 value = *((DClonglong*)p->stackptr); |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
37 p->stackptr += sizeof(DClonglong); |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
38 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
39 return value; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
40 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
41 DCulonglong dcbArgULongLong(DCArgs* p) { return (DCulonglong)dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
42 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
43 DCint dcbArgInt (DCArgs* p) { return (DCint) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
44 DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
45 DClong dcbArgLong (DCArgs* p) { return (DClong) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
46 DCulong dcbArgULong (DCArgs* p) { return (DCulong) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
47 DCchar dcbArgChar (DCArgs* p) { return (DCchar) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
48 DCuchar dcbArgUChar (DCArgs* p) { return (DCuchar) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
49 DCshort dcbArgShort (DCArgs* p) { return (DCshort) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
50 DCushort dcbArgUShort (DCArgs* p) { return (DCushort) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
51 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
52 DCpointer dcbArgPointer(DCArgs* p) { return (DCpointer)dcbArgLongLong(p); } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
53 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
54 DCdouble dcbArgDouble(DCArgs* p) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
55 { |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
56 DCdouble result; |
305 | 57 if(p->reg_count < DCARGS_MIPS_NUM_REGS) |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
58 result = p->freg_data[p->reg_count++]; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
59 else { |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
60 result = *((DCdouble*)p->stackptr); |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
61 p->stackptr += sizeof(DCdouble); |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
62 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
63 return result; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
64 } |
126
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
65 DCfloat dcbArgFloat(DCArgs* p) |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
66 { |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
67 DCfloat result; |
305 | 68 if(p->reg_count < DCARGS_MIPS_NUM_REGS) { |
126
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
69 result = ((DCfloat*)&p->freg_data[p->reg_count++]) |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
70 #if defined(DC__Endian_LITTLE) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
71 [0]; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
72 #else |
126
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
73 [1]; /* single precision floats are right-justified in big-endian registers */ |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
74 #endif |
126
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
75 } else { |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
76 result = *((DCfloat*)p->stackptr); /* single precision floats are left-justified on stack in 64bit slots */ |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
77 p->stackptr += sizeof(DCdouble); |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
78 } |
be08b699dca5
- mips64 n64 float fixes (big endian), now mips64 n64 is fully supported (for at least big-endian platforms, still need to test little endian)
cslag
parents:
122
diff
changeset
|
79 return result; |
122
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
80 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
81 |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
305
diff
changeset
|
82 |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
305
diff
changeset
|
83 void dcbArgAggr (DCArgs* p, DCpointer target) { /* @@@AGGR not impl */ } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
305
diff
changeset
|
84 void dcbReturnAggr (DCArgs *args, DCValue *result, DCpointer ret) { /* @@@AGGR not impl */ } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
305
diff
changeset
|
85 |