On Sat, Jan 10, 2009 at 09:24:14PM +0200, Antti Harri wrote:
> >I haven't had any problem with this patch in amd64 and this shouldn't
> >affect other arches. It is definitely working here.
>
> Ok by me but I need to get home and verify it's not breaking
> on my i386 desktop.
Wouldn't be something like the diff below be cleaner? __WORDSIZE
is a glibcism and absolutely not portable, IMHO it's quite pointless
to fake __WORDSIZE=64 just for amd64.
This may be worth testing on other archs.
Please note that I didn't even try to compile this. The code is so
ugly that I fear it could damage gcc ;-)
Ciao,
Kili
Index: patches/patch-code_qcommon_vm_interpreted_c
===================================================================
RCS file: patches/patch-code_qcommon_vm_interpreted_c
diff -N patches/patch-code_qcommon_vm_interpreted_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-code_qcommon_vm_interpreted_c 10 Jan 2009 20:26:11 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- code/qcommon/vm_interpreted.c.orig Sat Aug 9 18:28:20 2008
++++ code/qcommon/vm_interpreted.c Sat Jan 10 21:23:02 2009
+@@ -532,8 +532,8 @@ nextInstruction2:
+
+ //VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
+ {
+- intptr_t* argptr = (intptr_t *)&image[
programStack + 4 ];
+- #if __WORDSIZE == 64
++ intptr_t* argptr;
++ #if LONG_BIT == 64
+ // the vm has ints on the stack, we expect
+ // longs so we have to convert it
+ intptr_t argarr[16];
+@@ -542,6 +542,8 @@ nextInstruction2:
+ argarr[i] = *(int*)&image[
programStack + 4 + 4*i ];
+ }
+ argptr = argarr;
++ #else
++ argptr = (intptr_t *)&image[
programStack + 4 ];
+ #endif
+ r = vm->systemCall( argptr );
+ }