comparison dyncallback/dyncall_callback_arm32.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 e2899b4ff713
children
comparison
equal deleted inserted replaced
532:d4bf63ab9164 533:71c884e610f0
4 Library: dyncallback 4 Library: dyncallback
5 File: dyncallback/dyncall_callback_arm32.c 5 File: dyncallback/dyncall_callback_arm32.c
6 Description: Callback - Implementation for ARM32 (ARM and THUMB mode) 6 Description: Callback - Implementation for ARM32 (ARM and THUMB mode)
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 12 */ 38 DCCallbackHandler* handler; /* offset 12 */
38 void* userdata; /* offset 16 */ 39 void* userdata; /* offset 16 */
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 49
49 DCCallback* dcbNewCallback(const char* signature, DCCallbackHandler* handler, void* userdata) 50 DCCallback* dcbNewCallback2(const DCsigchar* signature, DCCallbackHandler* handler, void* userdata, DCaggr *const * aggrs)
50 { 51 {
51 int err;
52 DCCallback* pcb; 52 DCCallback* pcb;
53 err = dcAllocWX(sizeof(DCCallback), (void**)&pcb); 53 int err = dcAllocWX(sizeof(DCCallback), (void**)&pcb);
54 if(err) 54 if(err)
55 return NULL; 55 return NULL;
56 56
57 dcbInitCallback2(pcb, signature, handler, userdata, aggrs);
57 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry); 58 dcbInitThunk(&pcb->thunk, dcCallbackThunkEntry);
58 dcbInitCallback(pcb, signature, handler, userdata);
59 59
60 err = dcInitExecWX(pcb, sizeof(DCCallback)); 60 err = dcInitExecWX(pcb, sizeof(DCCallback));
61 if(err) { 61 if(err) {
62 dcFreeWX(pcb, sizeof(DCCallback)); 62 dcFreeWX(pcb, sizeof(DCCallback));
63 return NULL; 63 return NULL;
64 } 64 }
65 65
66 return pcb; 66 return pcb;
67 } 67 }
68 68
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 }
79