Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_args_ppc64.c @ 297:dd1d0b0fd896
- doc typo
author | Tassilo Philipp |
---|---|
date | Wed, 16 May 2018 18:27:59 +0200 |
parents | 54930a037e8a |
children | 71c884e610f0 |
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 | |
9 Copyright (c) 2014-2015 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com> | |
10 | |
11 Permission to use, copy, modify, and distribute this software for any | |
12 purpose with or without fee is hereby granted, provided that the above | |
13 copyright notice and this permission notice appear in all copies. | |
14 | |
15 THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
16 WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
17 MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
18 ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
21 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
22 | |
23 */ | |
24 | |
25 #include "dyncall_args_ppc64.h" | |
26 | |
27 DCint dcbArgInt (DCArgs* p) { return (DCint) dcbArgLongLong(p); } | |
28 DCuint dcbArgUInt (DCArgs* p) { return (DCuint) dcbArgLongLong(p); } | |
29 DCulonglong dcbArgULongLong(DCArgs* p) { return (DCulonglong) dcbArgLongLong(p); } | |
30 | |
31 DClonglong dcbArgLongLong(DCArgs* p) | |
32 { | |
33 DClonglong value; | |
34 if (p->ireg_count < 8) { | |
35 value = p->ireg_data[p->ireg_count++]; | |
36 } else { | |
37 value = *( (long long*) p->stackptr ); | |
38 } | |
39 p->stackptr += sizeof(long long); | |
40 return value; | |
41 } | |
42 | |
43 DClong dcbArgLong (DCArgs* p) { return (DClong) dcbArgLongLong(p); } | |
44 DCulong dcbArgULong (DCArgs* p) { return (DCulong) dcbArgLongLong(p); } | |
45 DCchar dcbArgChar (DCArgs* p) { return (DCchar) dcbArgLongLong(p); } | |
46 DCuchar dcbArgUChar (DCArgs* p) { return (DCuchar) dcbArgLongLong(p); } | |
47 DCshort dcbArgShort (DCArgs* p) { return (DCshort) dcbArgLongLong(p); } | |
48 DCushort dcbArgUShort (DCArgs* p) { return (DCushort)dcbArgLongLong(p); } | |
49 DCbool dcbArgBool (DCArgs* p) { return (DCbool) dcbArgLongLong(p); } | |
50 | |
51 DCpointer dcbArgPointer (DCArgs* p) { return (DCpointer)dcbArgLongLong(p); } | |
52 | |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
53 DCdouble dcbArgDouble (DCArgs* p) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
54 { |
0 | 55 DCdouble result; |
56 | |
57 if (p->freg_count < 13) { | |
58 result = p->freg_data[p->freg_count++]; | |
59 if (p->ireg_count < 8) { | |
60 p->ireg_count++; | |
61 } | |
62 } else { | |
63 result = * ( (double*) p->stackptr ); | |
64 } | |
65 | |
66 p->stackptr += sizeof(double); | |
67 return result; | |
68 } | |
69 | |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
70 DCfloat dcbArgFloat (DCArgs* p) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
71 { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
72 DCfloat result; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
73 |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
74 #if defined(DC__Endian_BIG) |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
75 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
|
76 #else /* Endian_LITTLE */ |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
77 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
|
78 #endif |
0 | 79 |
83
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
80 if (p->freg_count < 13) { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
81 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
|
82 if (p->ireg_count < 8) { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
83 p->ireg_count++; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
84 } |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
85 } else { |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
86 sf = * ( (struct sf*) p->stackptr ); |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
87 result = sf.f; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
88 } |
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 p->stackptr += sizeof(double); |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
91 return result; |
54930a037e8a
- PPC64 single-precision float fixes for more than 13 float args (thanks Masanori!)
cslag
parents:
0
diff
changeset
|
92 } |