comparison dyncall/dyncall_callvm_arm32_thumb.c @ 27:523c45dfa8fb

- refactored arm calling conventions' callvm code, so that the code that keeps the caller from overwriting the return value on some platforms also works on OpenBSD (before we casted the function pointer to have long long as return type, to hint the caller that there is one, but that triggers an intentional SIGABRT on OpenBSD for security reasons; now the decl reflects this, directly)
author cslag
date Tue, 15 Sep 2015 12:48:52 +0200
parents 1c539fb1d2dd
children 67961454902b
comparison
equal deleted inserted replaced
26:32e397e1674c 27:523c45dfa8fb
147 147
148 /* Call. */ 148 /* Call. */
149 void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target) 149 void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target)
150 { 150 {
151 DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self; 151 DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
152 // This cast is needed in order for the cleanup code in the caller (this very function) to not 152 dcCall_arm32_thumb(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
153 // overwrite and use r0 and r1, as we want to pass them back. On some platforms (FreeBSD/arm, Nintendo DS
154 // the compiler generates cleanup code that writes to those registers by assuming dcCall_arm32_thumb didn't
155 // use them.
156 ((DClonglong(*)(DCpointer, DCpointer, DCsize))&dcCall_arm32_thumb)(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
157 } 153 }
158 154
159 155
160 DCCallVM_vt gVT_arm32_thumb = 156 DCCallVM_vt gVT_arm32_thumb =
161 { 157 {