Mercurial > pub > dyncall > dyncall
annotate dyncallback/dyncall_args_mips64.c @ 122:f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
author | cslag |
---|---|
date | Mon, 04 Jul 2016 01:11:08 +0200 |
parents | |
children | be08b699dca5 |
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 |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
9 Copyright (c) 2016 Tassilo Philipp <tphilipp@potion-studios.com> |
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; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
33 if(p->reg_count < DCARGS_MIPS_NUM_IREGS) |
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; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
57 if(p->reg_count < DCARGS_MIPS_NUM_FREGS) |
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 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
65 DCfloat dcbArgFloat(DCArgs* p) { |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
66 DCdouble d = dcbArgDouble(p); |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
67 return ((DCfloat*)&d) // single precision are stored in double slots, but not promoted |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
68 #if defined(DC__Endian_LITTLE) |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
69 [0]; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
70 #else |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
71 [1]; |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
72 #endif |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
73 } |
f63467916f98
- first draft of mips64 n64 callbacks, not everything working, though
cslag
parents:
diff
changeset
|
74 |