Changeset View
Changeset View
Standalone View
Standalone View
games/iourbanterror/files/patch-code_qcommon_vm__interpreted.c
- This file was added.
Property | Old Value | New Value |
---|---|---|
fbsd:nokeywords | null | yes \ No newline at end of property |
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
--- code/qcommon/vm_interpreted.c.orig 2016-10-05 18:47:05 UTC | |||||
+++ code/qcommon/vm_interpreted.c | |||||
@@ -534,18 +534,20 @@ nextInstruction2: | |||||
//VM_LogSyscalls( (int *)&image[ programStack + 4 ] ); | |||||
{ | |||||
- intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ]; | |||||
- #if __WORDSIZE == 64 | |||||
- // the vm has ints on the stack, we expect | |||||
- // longs so we have to convert it | |||||
- intptr_t argarr[16]; | |||||
- int i; | |||||
- for (i = 0; i < 16; ++i) { | |||||
- argarr[i] = *(int*)&image[ programStack + 4 + 4*i ]; | |||||
+ // the vm has ints on the stack, we expect | |||||
+ // pointers so we might have to convert it | |||||
+ if (sizeof(intptr_t) != sizeof(int)) { | |||||
+ intptr_t argarr[16]; | |||||
+ int *imagePtr = (int *)&image[programStack]; | |||||
+ int i; | |||||
+ for (i = 0; i < 16; ++i) { | |||||
+ argarr[i] = *(++imagePtr); | |||||
+ } | |||||
+ r = vm->systemCall( argarr ); | |||||
+ } else { | |||||
+ intptr_t* argptr = (intptr_t *)&image[ programStack + 4 ]; | |||||
+ r = vm->systemCall( argptr ); | |||||
} | |||||
- argptr = argarr; | |||||
- #endif | |||||
- r = vm->systemCall( argptr ); | |||||
} | |||||
#ifdef DEBUG_VM |