aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
authorludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-30 20:30:17 +0000
committerludwig <ludwig@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-30 20:30:17 +0000
commitc3f255e38a077ac61bed4e2a1cec41ea05ca26a0 (patch)
tree5f95d0afa9208cf2e964565b7065d3f014a553c2 /code/qcommon
parentcb550ebf221dbdf9d341b3f69b132088eb827304 (diff)
downloadioquake3-aero-c3f255e38a077ac61bed4e2a1cec41ea05ca26a0.tar.gz
ioquake3-aero-c3f255e38a077ac61bed4e2a1cec41ea05ca26a0.zip
support for 64bit native mods
git-svn-id: svn://svn.icculus.org/quake3/trunk@34 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rw-r--r--code/qcommon/qcommon.h25
-rw-r--r--code/qcommon/vm.c26
-rw-r--r--code/qcommon/vm_local.h4
3 files changed, 34 insertions, 21 deletions
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;