aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--code/cgame/cg_main.c2
-rw-r--r--code/cgame/cg_syscalls.c4
-rw-r--r--code/client/cl_cgame.c4
-rw-r--r--code/client/cl_ui.c6
-rw-r--r--code/game/g_main.c4
-rw-r--r--code/q3_ui/ui_main.c2
-rw-r--r--code/qcommon/qcommon.h25
-rw-r--r--code/qcommon/vm.c26
-rw-r--r--code/qcommon/vm_local.h4
-rw-r--r--code/server/sv_game.c11
-rw-r--r--code/ui/ui_main.c2
-rw-r--r--code/unix/Makefile1
-rw-r--r--code/unix/unix_main.c6
-rw-r--r--code/win32/win_main.c4
14 files changed, 50 insertions, 51 deletions
diff --git a/code/cgame/cg_main.c b/code/cgame/cg_main.c
index 7212996..f8d423c 100644
--- a/code/cgame/cg_main.c
+++ b/code/cgame/cg_main.c
@@ -43,7 +43,7 @@ This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
-int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
+long vmMain( long command, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long arg8, long arg9, long arg10, long arg11 ) {
switch ( command ) {
case CG_INIT:
diff --git a/code/cgame/cg_syscalls.c b/code/cgame/cg_syscalls.c
index c7ad938..3c1efa0 100644
--- a/code/cgame/cg_syscalls.c
+++ b/code/cgame/cg_syscalls.c
@@ -28,10 +28,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "cg_local.h"
-static int (QDECL *syscall)( int arg, ... ) = (int (QDECL *)( int, ...))-1;
+static long (QDECL *syscall)( int arg, ... ) = (long (QDECL *)( int, ...))-1;
-void dllEntry( int (QDECL *syscallptr)( int arg,... ) ) {
+void dllEntry( long (QDECL *syscallptr)( int arg,... ) ) {
syscall = syscallptr;
}
diff --git a/code/client/cl_cgame.c b/code/client/cl_cgame.c
index c2f6df7..b6c0855 100644
--- a/code/client/cl_cgame.c
+++ b/code/client/cl_cgame.c
@@ -412,9 +412,7 @@ CL_CgameSystemCalls
The cgame module is making a system call
====================
*/
-#define VMA(x) VM_ArgPtr(args[x])
-#define VMF(x) ((float *)args)[x]
-int CL_CgameSystemCalls( int *args ) {
+long CL_CgameSystemCalls( long *args ) {
switch( args[0] ) {
case CG_PRINT:
Com_Printf( "%s", VMA(1) );
diff --git a/code/client/cl_ui.c b/code/client/cl_ui.c
index 66e6265..d1fdd37 100644
--- a/code/client/cl_ui.c
+++ b/code/client/cl_ui.c
@@ -757,10 +757,6 @@ static int FloatAsInt( float f ) {
return temp;
}
-void *VM_ArgPtr( int intValue );
-#define VMA(x) VM_ArgPtr(args[x])
-#define VMF(x) ((float *)args)[x]
-
/*
====================
CL_UISystemCalls
@@ -768,7 +764,7 @@ CL_UISystemCalls
The ui module is making a system call
====================
*/
-int CL_UISystemCalls( int *args ) {
+long CL_UISystemCalls( long *args ) {
switch( args[0] ) {
case UI_ERROR:
Com_Error( ERR_DROP, "%s", VMA(1) );
diff --git a/code/game/g_main.c b/code/game/g_main.c
index 1d262be..178daa2 100644
--- a/code/game/g_main.c
+++ b/code/game/g_main.c
@@ -200,7 +200,7 @@ This is the only way control passes into the module.
This must be the very first function compiled into the .q3vm file
================
*/
-int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
+long vmMain( long command, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long arg8, long arg9, long arg10, long arg11 ) {
switch ( command ) {
case GAME_INIT:
G_InitGame( arg0, arg1, arg2 );
@@ -210,7 +210,7 @@ int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int a
return 0;
case GAME_CLIENT_CONNECT:
#warning 64bit broken!
- return (int)ClientConnect( arg0, arg1, arg2 );
+ return ClientConnect( arg0, arg1, arg2 );
case GAME_CLIENT_THINK:
ClientThink( arg0 );
return 0;
diff --git a/code/q3_ui/ui_main.c b/code/q3_ui/ui_main.c
index 5107cdc..9ba8414 100644
--- a/code/q3_ui/ui_main.c
+++ b/code/q3_ui/ui_main.c
@@ -40,7 +40,7 @@ This is the only way control passes into the module.
This must be the very first function compiled into the .qvm file
================
*/
-int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
+long vmMain( long command, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long arg8, long arg9, long arg10, long arg11 ) {
switch ( command ) {
case UI_GETAPIVERSION:
return UI_API_VERSION;
diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h
index ad175f4..9b5bd5d 100644
--- a/code/qcommon/qcommon.h
+++ b/code/qcommon/qcommon.h
@@ -310,7 +310,7 @@ typedef enum {
} sharedTraps_t;
void VM_Init( void );
-vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
+vm_t *VM_Create( const char *module, long (*systemCalls)(long *),
vmInterpret_t interpret );
// module should be bare: "cgame", not "cgame.dll" or "vm/cgame.qvm"
@@ -318,12 +318,25 @@ void VM_Free( vm_t *vm );
void VM_Clear(void);
vm_t *VM_Restart( vm_t *vm );
-int QDECL VM_Call( vm_t *vm, int callNum, ... );
+long QDECL VM_Call( vm_t *vm, long callNum, ... );
void VM_Debug( int level );
-void *VM_ArgPtr( int intValue );
-void *VM_ExplicitArgPtr( vm_t *vm, int intValue );
+void *VM_ArgPtr( long intValue );
+void *VM_ExplicitArgPtr( vm_t *vm, long intValue );
+
+#define VMA(x) VM_ArgPtr(args[x])
+static inline float _vmf(long x)
+{
+ union {
+ long l;
+ float fh, fl;
+ } t;
+ t.l = x;
+ return t.fl;
+}
+#define VMF(x) _vmf(args[x])
+
/*
==============================================================
@@ -936,8 +949,8 @@ void Sys_Init (void);
// general development dll loading for virtual machine testing
// fqpath param added 7/20/02 by T.Ray - Sys_LoadDll is only called in vm.c at this time
-void * QDECL Sys_LoadDll( const char *name, char *fqpath , int (QDECL **entryPoint)(int, ...),
- int (QDECL *systemcalls)(int, ...) );
+void * QDECL Sys_LoadDll( const char *name, char *fqpath , long (QDECL **entryPoint)(long, ...),
+ long (QDECL *systemcalls)(long, ...) );
void Sys_UnloadDll( void *dllHandle );
void Sys_UnloadGame( void );
diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
index 8cd3062..2700d59 100644
--- a/code/qcommon/vm.c
+++ b/code/qcommon/vm.c
@@ -329,10 +329,10 @@ Dlls will call this directly
============
*/
-int QDECL VM_DllSyscall( int arg, ... ) {
-#if ((defined __linux__) && (defined __powerpc__))
+long QDECL VM_DllSyscall( long arg, ... ) {
+#if ((defined __linux__) && !(defined __i386__))
// rcg010206 - see commentary above
- int args[16];
+ long args[16];
int i;
va_list ap;
@@ -340,7 +340,7 @@ int QDECL VM_DllSyscall( int arg, ... ) {
va_start(ap, arg);
for (i = 1; i < sizeof (args) / sizeof (args[i]); i++)
- args[i] = va_arg(ap, int);
+ args[i] = va_arg(ap, long);
va_end(ap);
return currentVM->systemCall( args );
@@ -367,7 +367,7 @@ vm_t *VM_Restart( vm_t *vm ) {
// DLL's can't be restarted in place
if ( vm->dllHandle ) {
char name[MAX_QPATH];
- int (*systemCall)( int *parms );
+ long (*systemCall)( long *parms );
systemCall = vm->systemCall;
Q_strncpyz( name, vm->name, sizeof( name ) );
@@ -437,7 +437,7 @@ it will attempt to load as a system dll
#define STACK_SIZE 0x20000
-vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
+vm_t *VM_Create( const char *module, long (*systemCalls)(long *),
vmInterpret_t interpret ) {
vm_t *vm;
vmHeader_t *header;
@@ -624,7 +624,7 @@ void VM_Clear(void) {
lastVM = NULL;
}
-void *VM_ArgPtr( int intValue ) {
+void *VM_ArgPtr( long intValue ) {
if ( !intValue ) {
return NULL;
}
@@ -640,7 +640,7 @@ void *VM_ArgPtr( int intValue ) {
}
}
-void *VM_ExplicitArgPtr( vm_t *vm, int intValue ) {
+void *VM_ExplicitArgPtr( vm_t *vm, long intValue ) {
if ( !intValue ) {
return NULL;
}
@@ -685,7 +685,7 @@ locals from sp
#define MAX_STACK 256
#define STACK_MASK (MAX_STACK-1)
-int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
+long QDECL VM_Call( vm_t *vm, long callnum, ... ) {
vm_t *oldVM;
int r;
int i;
@@ -699,17 +699,17 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
lastVM = vm;
if ( vm_debugLevel ) {
- Com_Printf( "VM_Call( %i )\n", callnum );
+ Com_Printf( "VM_Call( %ld )\n", callnum );
}
// if we have a dll loaded, call it directly
if ( vm->entryPoint ) {
//rcg010207 - see dissertation at top of VM_DllSyscall() in this file.
- int args[16];
+ long args[16];
va_list ap;
va_start(ap, callnum);
for (i = 0; i < sizeof (args) / sizeof (args[i]); i++) {
- args[i] = va_arg(ap, int);
+ args[i] = va_arg(ap, long);
}
va_end(ap);
@@ -729,7 +729,7 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
a.callnum = callnum;
va_start(ap, callnum);
for (i = 0; i < sizeof (a.args) / sizeof (a.args[0]); i++) {
- a.args[i] = va_arg(ap, int);
+ a.args[i] = va_arg(ap, long);
}
va_end(ap);
r = VM_CallInterpreted( vm, &a.callnum );
diff --git a/code/qcommon/vm_local.h b/code/qcommon/vm_local.h
index 28628b7..f6fc043 100644
--- a/code/qcommon/vm_local.h
+++ b/code/qcommon/vm_local.h
@@ -127,7 +127,7 @@ struct vm_s {
// DO NOT MOVE OR CHANGE THESE WITHOUT CHANGING THE VM_OFFSET_* DEFINES
// USED BY THE ASM CODE
int programStack; // the vm may be recursively entered
- int (*systemCall)( int *parms );
+ long (*systemCall)( long *parms );
//------------------------------------
@@ -135,7 +135,7 @@ struct vm_s {
// for dynamic linked modules
void *dllHandle;
- int (QDECL *entryPoint)( int callNum, ... );
+ long (QDECL *entryPoint)( long callNum, ... );
// for interpreted modules
qboolean currentlyInterpreting;
diff --git a/code/server/sv_game.c b/code/server/sv_game.c
index 6c1faf8..f921226 100644
--- a/code/server/sv_game.c
+++ b/code/server/sv_game.c
@@ -305,16 +305,7 @@ SV_GameSystemCalls
The module is making a system call
====================
*/
-//rcg010207 - see my comments in VM_DllSyscall(), in qcommon/vm.c ...
-#if ((defined __linux__) && (defined __powerpc__))
-#define VMA(x) ((void *) args[x])
-#else
-#define VMA(x) VM_ArgPtr(args[x])
-#endif
-
-#define VMF(x) ((float *)args)[x]
-
-int SV_GameSystemCalls( int *args ) {
+long SV_GameSystemCalls( long *args ) {
switch( args[0] ) {
case G_PRINT:
Com_Printf( "%s", VMA(1) );
diff --git a/code/ui/ui_main.c b/code/ui/ui_main.c
index a117962..9cf49a6 100644
--- a/code/ui/ui_main.c
+++ b/code/ui/ui_main.c
@@ -165,7 +165,7 @@ void _UI_KeyEvent( int key, qboolean down );
void _UI_MouseEvent( int dx, int dy );
void _UI_Refresh( int realtime );
qboolean _UI_IsFullscreen( void );
-int vmMain( int command, int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6, int arg7, int arg8, int arg9, int arg10, int arg11 ) {
+long vmMain( long command, long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long arg6, long arg7, long arg8, long arg9, long arg10, long arg11 ) {
switch ( command ) {
case UI_GETAPIVERSION:
return UI_API_VERSION;
diff --git a/code/unix/Makefile b/code/unix/Makefile
index 2e4dafc..925cf07 100644
--- a/code/unix/Makefile
+++ b/code/unix/Makefile
@@ -130,6 +130,7 @@ ifeq ($(PLATFORM),linux)
OPTIMIZE = -O3 -ffast-math -funroll-loops -fomit-frame-pointer -fno-strict-aliasing
ifeq ($(ARCH),x86_64)
OPTIMIZE = -O3 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fstrength-reduce -fno-strict-aliasing
+ BASE_CFLAGS += -DHAVE_VM_NATIVE
else
ifeq ($(ARCH),i386)
OPTIMIZE = -O3 -march=i686 -fomit-frame-pointer -ffast-math -falign-loops=2 -falign-jumps=2 -falign-functions=2 -fno-strict-aliasing -fstrength-reduce
diff --git a/code/unix/unix_main.c b/code/unix/unix_main.c
index a00bc43..df64f38 100644
--- a/code/unix/unix_main.c
+++ b/code/unix/unix_main.c
@@ -708,11 +708,11 @@ changed the load procedure to match VFS logic, and allow developer use
extern char *FS_BuildOSPath( const char *base, const char *game, const char *qpath );
void *Sys_LoadDll( const char *name, char *fqpath ,
- int (**entryPoint)(int, ...),
- int (*systemcalls)(int, ...) )
+ long (**entryPoint)(long, ...),
+ long (*systemcalls)(long, ...) )
{
void *libHandle;
- void (*dllEntry)( int (*syscallptr)(int, ...) );
+ void (*dllEntry)( long (*syscallptr)(long, ...) );
char curpath[MAX_OSPATH];
char fname[MAX_OSPATH];
char *basepath;
diff --git a/code/win32/win_main.c b/code/win32/win_main.c
index 9131e31..ff079e5 100644
--- a/code/win32/win_main.c
+++ b/code/win32/win_main.c
@@ -527,10 +527,10 @@ extern char *FS_BuildOSPath( const char *base, const char *game, const char *qp
// fqpath will be empty if dll not loaded, otherwise will hold fully qualified path of dll module loaded
// fqpath buffersize must be at least MAX_QPATH+1 bytes long
void * QDECL Sys_LoadDll( const char *name, char *fqpath , int (QDECL **entryPoint)(int, ...),
- int (QDECL *systemcalls)(int, ...) ) {
+ long (QDECL *systemcalls)(long, ...) ) {
static int lastWarning = 0;
HINSTANCE libHandle;
- void (QDECL *dllEntry)( int (QDECL *syscallptr)(int, ...) );
+ void (QDECL *dllEntry)( long (QDECL *syscallptr)(long, ...) );
char *basepath;
char *cdpath;
char *gamedir;