comparison dyncall/dyncall_callvm_arm32_thumb.c @ 18:beafc56094bc

- fix for arm/thumb on some platforms (e.g. nintendo ds) to keep compiler from overwriting return values in caller-cleanup code
author cslag
date Sat, 01 Aug 2015 19:50:49 +0200
parents 3e629dc19168
children 1c539fb1d2dd
comparison
equal deleted inserted replaced
17:17b10cc8ce8b 18:beafc56094bc
152 152
153 /* Call. */ 153 /* Call. */
154 void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target) 154 void dc_callvm_call_arm32_thumb(DCCallVM* in_self, DCpointer target)
155 { 155 {
156 DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self; 156 DCCallVM_arm32_thumb* self = (DCCallVM_arm32_thumb*)in_self;
157 dcCall_arm32_thumb(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead)); 157 // This cast is needed in order for the cleanup code in the caller (this very function) to not
158 // overwrite and use r0 and r1, as we want to pass them back. On some platforms (FreeBSD/arm, Nintendo DS
159 // the compiler generates cleanup code that writes to those registers by assuming dcCall_arm32_arm didn't
160 // use them.
161 ((DClonglong(*)(DCpointer, DCpointer, DCsize))&dcCall_arm32_thumb)(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead));
158 } 162 }
159 163
160 164
161 #if 0 165 #if 0
162 DClong dc_callvm_call_arm32_thumb_word(DCCallVM* in_self, DCpointer target) 166 DClong dc_callvm_call_arm32_thumb_word(DCCallVM* in_self, DCpointer target)