Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_args_ppc64.c @ 606:85b7a117b807
- more statics in test code (this is partly needed on an experimental freebsd sparc64 build where the elf cleanup code crashes for some reason ... it's probably that experimental build, but a good change to do regardless)
author | Tassilo Philipp |
---|---|
date | Wed, 21 Sep 2022 15:20:58 +0200 |
parents | 2562c89d5bb5 |
children | 93ce63d72d59 |
rev | line source |
---|---|
0 | 1 /* |
2 | |
3 Package: dyncall | |
4 Library: dyncallback | |
5 File: dyncallback/dyncall_args_ppc64.c | |
6 Description: Callback's Arguments VM - Implementation for ppc64 | |
7 License: | |
8 | |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
83
diff
changeset
|
9 Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>, |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
83
diff
changeset
|
10 2022 Tassilo Philipp <tphilipp@potion-studios.com> |
0 | 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_args_ppc64.h" | |
27 | |
28 DCint dcbArgInt (DCArgs* p) { return (DCint) dcbArgLongLong(p); } | |
29 DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgLongLong(p); } | |
30 DCulonglong dcbArgULongLong(DCArgs* p) { return (DCulonglong) dcbArgLongLong(p); } | |
31 | |
32 DClonglong dcbArgLongLong(DCArgs* p) | |
33 { | |
34 DClonglong value; | |
35 if (p->ireg_count < 8) { | |
36 value = p->ireg_data[p->ireg_count++]; | |
37 } else { | |
38 value = *( (long long*) p->stackptr ); | |
39 } | |
40 p->stackptr += sizeof(long long); | |
41 return value; | |
42 } | |
43 | |
44 DClong dcbArgLong (DCArgs* p) { return (DClong) dcbArgLongLong(p); } | |
45 DCulong dcbArgULong (DCArgs* p) { return (DCulong) dcbArgLongLong(p); } | |
46 DCchar dcbArgChar (DCArgs* p) { return (DCchar) dcbArgLongLong(p); } | |
47 DCuchar dcbArgUChar (DCArgs* p) { return (DCuchar) dcbArgLongLong(p); } | |
48 DCshort dcbArgShort (DCArgs* p) { return (DCshort) dcbArgLongLong(p); } | |
49 DCushort dcbArgUShort (DCArgs* p) { return (DCushort)dcbArgLongLong(p); } | |
50 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); } | |
51 | |
52 DCpointer dcbArgPointer (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); } | |
53 | |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
54 DCdouble dcbArgDouble (DCArgs* p) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
55 { |
0 | 56 DCdouble result; |
57 | |
58 if (p->freg_count < 13) { | |
59 result = p->freg_data[p->freg_count++]; | |
60 if (p->ireg_count < 8) { | |
61 p->ireg_count++; | |
62 } | |
63 } else { | |
64 result = * ( (double*) p->stackptr ); | |
65 } | |
66 | |
67 p->stackptr += sizeof(double); | |
68 return result; | |
69 } | |
70 | |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
71 DCfloat dcbArgFloat (DCArgs* p) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
72 { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
73 DCfloat result; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
74 |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
75 #if defined(DC__Endian_BIG) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
76 struct sf { DCfloat f_pad; DCfloat f; } sf; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
77 #else /* Endian_LITTLE */ |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
78 struct sf { DCfloat f; DCfloat f_pad; } sf; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
79 #endif |
0 | 80 |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
81 if (p->freg_count < 13) { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
82 result = (float)p->freg_data[p->freg_count++]; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
83 if (p->ireg_count < 8) { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
84 p->ireg_count++; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
85 } |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
86 } else { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
87 sf = * ( (struct sf*) p->stackptr ); |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
88 result = sf.f; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
89 } |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
90 |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
91 p->stackptr += sizeof(double); |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
92 return result; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
93 } |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
83
diff
changeset
|
94 |
580
2562c89d5bb5
- added missing return values for dcbArgAggr() on functions w/o aggregate support
Tassilo Philipp
parents:
544
diff
changeset
|
95 DCpointer dcbArgAggr (DCArgs* p, DCpointer target) { /* @@@AGGR not impl */ return NULL; } |
533
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
83
diff
changeset
|
96 void dcbReturnAggr (DCArgs *args, DCValue *result, DCpointer ret) { /* @@@AGGR not impl */ } |
71c884e610f0
- integration of patches from Raphael Luba, Thekla, Inc.:
Tassilo Philipp
parents:
83
diff
changeset
|
97 |