Mercurial > pub > dyncall > dyncall
comparison dyncallback/dyncall_callback_sparc64.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_sparc64.c | 5 File: dyncallback/dyncall_callback_sparc64.c |
6 Description: Callback - Implementation for sparc64 | 6 Description: Callback - Implementation for sparc64 |
7 License: | 7 License: |
8 | 8 |
9 Copyright (c) 2007-2018 Daniel Adler <dadler@uni-goettingen.de>, | 9 Copyright (c) 2007-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 struct DCCallback | 35 struct DCCallback |
35 { | 36 { |
37 DCCallbackHandler* handler; /* offset 56, size 8 */ | 38 DCCallbackHandler* handler; /* offset 56, size 8 */ |
38 void* userdata; /* offset 64, size 8 */ | 39 void* userdata; /* offset 64, size 8 */ |
39 }; | 40 }; |
40 | 41 |
41 | 42 |
42 void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata) | 43 void dcbInitCallback2(DCCallback* pcb, const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs) |
43 { | 44 { |
44 pcb->handler = handler; | 45 pcb->handler = handler; |
45 pcb->userdata = userdata; | 46 pcb->userdata = userdata; |
46 } | 47 } |
47 | 48 |
48 DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) | 49 |
50 DCCallback* dcbNewCallback2(const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs) | |
49 { | 51 { |
50 DCCallback* pcb; | 52 DCCallback* pcb; |
51 int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb); | 53 int err = dcAllocWX(sizeof(DCCallback), (void**) &pcb); |
52 if(err) | 54 if(err) |
53 return NULL; | 55 return NULL; |
54 | 56 |
57 dcbInitCallback2(pcb, signature, handler, userdata, aggrs); | |
55 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); | 58 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); |
56 dcbInitCallback(pcb, signature, handler, userdata); | |
57 | 59 |
58 err = dcInitExecWX(pcb, sizeof(DCCallback)); | 60 err = dcInitExecWX(pcb, sizeof(DCCallback)); |
59 if(err) { | 61 if(err) { |
60 dcFreeWX(pcb, sizeof(DCCallback)); | 62 dcFreeWX(pcb, sizeof(DCCallback)); |
61 return NULL; | 63 return NULL; |
62 } | 64 } |
63 | 65 |
64 return pcb; | 66 return pcb; |
65 } | 67 } |
66 | 68 |
67 void dcbFreeCallback(DCCallback* pcb) | |
68 { | |
69 dcFreeWX(pcb, sizeof(DCCallback)); | |
70 } | |
71 | |
72 void* dcbGetUserData(DCCallback* pcb) | |
73 { | |
74 return pcb->userdata; | |
75 } | |
76 |