aboutsummaryrefslogtreecommitdiffstats
path: root/code
diff options
context:
space:
mode:
Diffstat (limited to 'code')
-rw-r--r--code/qcommon/qcommon.h4
-rw-r--r--code/qcommon/vm.c3
-rw-r--r--code/qcommon/vm_interpreted.c15
3 files changed, 17 insertions, 5 deletions
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index 9b5bd5d..3cad841 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -330,10 +330,10 @@ static inline float _vmf(long x)
{
union {
long l;
- float fh, fl;
+ float f;
} t;
t.l = x;
- return t.fl;
+ return t.f;
}
#define VMF(x) _vmf(args[x])
diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
index 2700d59..713e6ae 100644
--- a/code/qcommon/vm.c
+++ b/code/qcommon/vm.c
@@ -484,8 +484,7 @@ vm_t *VM_Create( const char *module, long (*systemCalls)(long *),
}
}
- // always try dll first? -- ln
- if ( 1 || interpret == VMI_NATIVE ) {
+ if ( interpret == VMI_NATIVE ) {
// try to load as a system dll
Com_Printf( "Loading dll file %s.\n", vm->name );
vm->dllHandle = Sys_LoadDll( module, vm->fqpath , &vm->entryPoint, VM_DllSyscall );
diff --git a/code/qcommon/vm_interpreted.c b/code/qcommon/vm_interpreted.c
index e2d69a7..1989a5d 100644
--- a/code/qcommon/vm_interpreted.c
+++ b/code/qcommon/vm_interpreted.c
@@ -518,7 +518,20 @@ nextInstruction2:
*(int *)&image[ programStack + 4 ] = -1 - programCounter;
//VM_LogSyscalls( (int *)&image[ programStack + 4 ] );
- r = vm->systemCall( (int *)&image[ programStack + 4 ] );
+ {
+ long* argptr = (long *)&image[ programStack + 4 ];
+ #if __WORDSIZE == 64
+ // the vm has ints on the stack, we expect
+ // longs so we have to convert it
+ long argarr[16];
+ int i;
+ for (i = 0; i < 16; ++i) {
+ argarr[i] = *(int*)&image[ programStack + 4 + 4*i ];
+ argptr = argarr;
+ }
+ #endif
+ r = vm->systemCall( argptr );
+ }
#ifdef DEBUG_VM
// this is just our stack frame pointer, only needed