Mercurial > pub > dyncall > dyncall
comparison dyncallback/dyncall_callback_mips.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 | f5577f6bf97a |
children |
comparison
equal
deleted
inserted
replaced
532:d4bf63ab9164 | 533:71c884e610f0 |
---|---|
4 Library: dyncallback | 4 Library: dyncallback |
5 File: dyncallback/dyncall_callback_mips.c | 5 File: dyncallback/dyncall_callback_mips.c |
6 Description: Callback - Implementation Header for MIPS | 6 Description: Callback - Implementation Header for MIPS |
7 License: | 7 License: |
8 | 8 |
9 Copyright (c) 2013-2018 Daniel Adler <dadler@uni-goettingen.de>, | 9 Copyright (c) 2013-2022 Daniel Adler <dadler@uni-goettingen.de>, |
10 Tassilo Philipp <tphilipp@potion-studios.com> | 10 Tassilo Philipp <tphilipp@potion-studios.com> |
11 | 11 |
12 Permission to use, copy, modify, and distribute this software for any | 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 | 13 purpose with or without fee is hereby granted, provided that the above |
14 copyright notice and this permission notice appear in all copies. | 14 copyright notice and this permission notice appear in all copies. |
26 | 26 |
27 #include "dyncall_callback.h" | 27 #include "dyncall_callback.h" |
28 #include "dyncall_alloc_wx.h" | 28 #include "dyncall_alloc_wx.h" |
29 #include "dyncall_thunk.h" | 29 #include "dyncall_thunk.h" |
30 | 30 |
31 | |
31 /* Callback symbol. */ | 32 /* Callback symbol. */ |
32 extern void dcCallbackThunkEntry(); | 33 extern void dcCallbackThunkEntry(); |
33 | 34 |
34 /* might want to make use of __packed__ or so @@@ */ | 35 /* might want to make use of __packed__ or so @@@ */ |
35 struct DCCallback /* mips32 | mips64 */ | 36 struct DCCallback /* mips32 | mips64 */ |
38 DCCallbackHandler* handler; /* offset 20 size 4 | offset 56 size 8 */ | 39 DCCallbackHandler* handler; /* offset 20 size 4 | offset 56 size 8 */ |
39 void* userdata; /* offset 24 size 4 | offset 64 size 8 */ | 40 void* userdata; /* offset 24 size 4 | offset 64 size 8 */ |
40 }; | 41 }; |
41 | 42 |
42 | 43 |
43 void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata) | 44 void dcbInitCallback2(DCCallback* pcb, const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs) |
44 { | 45 { |
45 pcb->handler = handler; | 46 pcb->handler = handler; |
46 pcb->userdata = userdata; | 47 pcb->userdata = userdata; |
47 } | 48 } |
48 | 49 |
49 | 50 |
50 DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) | 51 DCCallback* dcbNewCallback2(const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs) |
51 { | 52 { |
52 int err; | |
53 DCCallback* pcb; | 53 DCCallback* pcb; |
54 err = dcAllocWX(sizeof(DCCallback), (void**)&pcb); | 54 int err = dcAllocWX(sizeof(DCCallback), (void**)&pcb); |
55 if(err) | 55 if(err) |
56 return NULL; | 56 return NULL; |
57 | 57 |
58 dcbInitCallback2(pcb, signature, handler, userdata, aggrs); | |
58 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); | 59 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); |
59 dcbInitCallback(pcb, signature, handler, userdata); | |
60 | 60 |
61 err = dcInitExecWX(pcb, sizeof(DCCallback)); | 61 err = dcInitExecWX(pcb, sizeof(DCCallback)); |
62 if(err) { | 62 if(err) { |
63 dcFreeWX(pcb, sizeof(DCCallback)); | 63 dcFreeWX(pcb, sizeof(DCCallback)); |
64 return NULL; | 64 return NULL; |
65 } | 65 } |
66 | 66 |
67 return pcb; | 67 return pcb; |
68 } | 68 } |
69 | 69 |
70 | |
71 void dcbFreeCallback(DCCallback* pcb) | |
72 { | |
73 dcFreeWX(pcb, sizeof(DCCallback)); | |
74 } | |
75 | |
76 void* dcbGetUserData(DCCallback* pcb) | |
77 { | |
78 return pcb->userdata; | |
79 } |