Mercurial > pub > dyncall > dyncall
comparison dyncallback/dyncall_callback_ppc64.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 | 030fbb70aa1b |
children |
comparison
equal
deleted
inserted
replaced
532:d4bf63ab9164 | 533:71c884e610f0 |
---|---|
4 Library: dyncallback | 4 Library: dyncallback |
5 File: dyncallback/dyncall_callback_ppc64.c | 5 File: dyncallback/dyncall_callback_ppc64.c |
6 Description: Callback - Implementation Header for ppc64 | 6 Description: Callback - Implementation Header for ppc64 |
7 License: | 7 License: |
8 | 8 |
9 Copyright (c) 2014-2016 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com> | 9 Copyright (c) 2014-2016 Masanori Mitsugi <mitsugi@linux.vnet.ibm.com>, |
10 2022 Tassilo Philipp <tphilipp@potion-studios.com> | |
10 | 11 |
11 Permission to use, copy, modify, and distribute this software for any | 12 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 purpose with or without fee is hereby granted, provided that the above |
13 copyright notice and this permission notice appear in all copies. | 14 copyright notice and this permission notice appear in all copies. |
14 | 15 |
25 | 26 |
26 #include "dyncall_callback.h" | 27 #include "dyncall_callback.h" |
27 #include "dyncall_alloc_wx.h" | 28 #include "dyncall_alloc_wx.h" |
28 #include "dyncall_thunk.h" | 29 #include "dyncall_thunk.h" |
29 | 30 |
31 | |
30 /* Callback symbol. */ | 32 /* Callback symbol. */ |
31 extern void dcCallbackThunkEntry(); | 33 extern void dcCallbackThunkEntry(); |
32 | 34 |
33 struct DCCallback /* ELF v1 | ELF v2 */ | 35 struct DCCallback /* ELF v1 | ELF v2 */ |
34 { /* ------------------+------------------ */ | 36 { /* ------------------+------------------ */ |
37 size_t stack_cleanup; /* offset 72 size 8 | offset 56 size 8 */ | 39 size_t stack_cleanup; /* offset 72 size 8 | offset 56 size 8 */ |
38 void* userdata; /* offset 80 size 8 | offset 64 size 8 */ | 40 void* userdata; /* offset 80 size 8 | offset 64 size 8 */ |
39 }; | 41 }; |
40 | 42 |
41 | 43 |
42 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) |
43 { | 45 { |
44 const char* ptr; | |
45 char ch; | |
46 | |
47 pcb->handler = handler; | 46 pcb->handler = handler; |
48 pcb->userdata = userdata; | 47 pcb->userdata = userdata; |
49 } | 48 } |
50 | 49 |
51 DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) | 50 |
51 DCCallback* dcbNewCallback2(const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs) | |
52 { | 52 { |
53 DCCallback* pcb; | 53 DCCallback* pcb; |
54 int 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 void dcbFreeCallback(DCCallback* pcb) | |
71 { | |
72 dcFreeWX(pcb, sizeof(DCCallback)); | |
73 } | |
74 | |
75 void* dcbGetUserData(DCCallback* pcb) | |
76 { | |
77 return pcb->userdata; | |
78 } |