Mercurial > pub > dyncall > dyncall
diff dyncall/dyncall_callvm_arm32_arm.c @ 17:17b10cc8ce8b
- fix for arm on some platforms (e.g. freebsd/arm32, nintendo ds) to keep compiler from overwriting return values in caller-cleanup code
author | cslag |
---|---|
date | Sat, 01 Aug 2015 19:13:21 +0200 |
parents | 3e629dc19168 |
children | 523c45dfa8fb |
line wrap: on
line diff
--- a/dyncall/dyncall_callvm_arm32_arm.c Sat Jul 25 22:45:14 2015 +0200 +++ b/dyncall/dyncall_callvm_arm32_arm.c Sat Aug 01 19:13:21 2015 +0200 @@ -149,7 +149,11 @@ void dc_callvm_call_arm32_arm(DCCallVM* in_self, DCpointer target) { DCCallVM_arm32_arm* self = (DCCallVM_arm32_arm*)in_self; - dcCall_arm32_arm(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead)); + // This cast is needed in order for the cleanup code in the caller (this very function) to not + // overwrite and use r0 and r1, as we want to pass them back. On some platforms (FreeBSD/arm, Nintendo DS + // the compiler generates cleanup code that writes to those registers by assuming dcCall_arm32_arm didn't + // use them. + ((DClonglong(*)(DCpointer, DCpointer, DCsize))&dcCall_arm32_arm)(target, dcVecData(&self->mVecHead), dcVecSize(&self->mVecHead)); }