aboutsummaryrefslogtreecommitdiffstats
path: root/code/qcommon
diff options
context:
space:
mode:
authorzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-27 02:24:00 +0000
committerzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-27 02:24:00 +0000
commit2cbb0a8b22175da7a5b9b15f120f24def39c9abb (patch)
tree0a7591016e4770b5f9fd766c6c3c99c3820498bc /code/qcommon
parent6bf20c78f5b69d40bcc4931df93d29198435ab67 (diff)
downloadioquake3-aero-2cbb0a8b22175da7a5b9b15f120f24def39c9abb.tar.gz
ioquake3-aero-2cbb0a8b22175da7a5b9b15f120f24def39c9abb.zip
Ludwig's 1st diff: Some 64bit fixes for x86_64. Also fixes Makefile build.
git-svn-id: svn://svn.icculus.org/quake3/trunk@7 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'code/qcommon')
-rwxr-xr-xcode/qcommon/cm_polylib.c4
-rwxr-xr-xcode/qcommon/common.c3
-rwxr-xr-xcode/qcommon/files.c2
-rwxr-xr-xcode/qcommon/md4.c2
-rwxr-xr-xcode/qcommon/vm.c33
-rwxr-xr-xcode/qcommon/vm_interpreted.c2
6 files changed, 35 insertions, 11 deletions
diff --git a/code/qcommon/cm_polylib.c b/code/qcommon/cm_polylib.c
index e96c713..e13eaa6 100755
--- a/code/qcommon/cm_polylib.c
+++ b/code/qcommon/cm_polylib.c
@@ -272,11 +272,11 @@ CopyWinding
*/
winding_t *CopyWinding (winding_t *w)
{
- int size;
+ unsigned long size;
winding_t *c;
c = AllocWinding (w->numpoints);
- size = (int)((winding_t *)0)->p[w->numpoints];
+ size = (long)((winding_t *)0)->p[w->numpoints];
Com_Memcpy (c, w, size);
return c;
}
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index 7d8f823..7eadabb 100755
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -145,6 +145,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
char msg[MAXPRINTMSG];
static qboolean opening_qconsole = qfalse;
+
va_start (argptr,fmt);
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
va_end (argptr);
@@ -1527,7 +1528,7 @@ void Com_InitHunkMemory( void ) {
Com_Error( ERR_FATAL, "Hunk data failed to allocate %i megs", s_hunkTotal / (1024*1024) );
}
// cacheline align
- s_hunkData = (byte *) ( ( (int)s_hunkData + 31 ) & ~31 );
+ s_hunkData = (byte *) ( ( (long)s_hunkData + 31 ) & ~31 );
Hunk_Clear();
Cmd_AddCommand( "meminfo", Com_Meminfo_f );
diff --git a/code/qcommon/files.c b/code/qcommon/files.c
index 0e21165..c0f990b 100755
--- a/code/qcommon/files.c
+++ b/code/qcommon/files.c
@@ -2503,7 +2503,7 @@ static void FS_AddGameDirectory( const char *path, const char *dir ) {
sorted[i] = pakfiles[i];
}
- qsort( sorted, numfiles, 4, paksort );
+ qsort( sorted, numfiles, sizeof(char*), paksort );
for ( i = 0 ; i < numfiles ; i++ ) {
pakfile = FS_BuildOSPath( path, dir, sorted[i] );
diff --git a/code/qcommon/md4.c b/code/qcommon/md4.c
index 03fbcc2..e530b07 100755
--- a/code/qcommon/md4.c
+++ b/code/qcommon/md4.c
@@ -12,7 +12,7 @@ typedef unsigned char *POINTER;
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
-typedef unsigned long int UINT4;
+typedef unsigned int UINT4;
/* MD4.H - header file for MD4C.C */
diff --git a/code/qcommon/vm.c b/code/qcommon/vm.c
index a6b1e3c..b509700 100755
--- a/code/qcommon/vm.c
+++ b/code/qcommon/vm.c
@@ -48,11 +48,14 @@ void VM_VmInfo_f( void );
void VM_VmProfile_f( void );
+
+#if 0 // 64bit!
// converts a VM pointer to a C pointer and
// checks to make sure that the range is acceptable
void *VM_VM2C( vmptr_t p, int length ) {
return (void *)p;
}
+#endif
void VM_Debug( int level ) {
vm_debugLevel = level;
@@ -151,6 +154,7 @@ int VM_SymbolToValue( vm_t *vm, const char *symbol ) {
VM_SymbolForCompiledPointer
=====================
*/
+#if 0 // 64bit!
const char *VM_SymbolForCompiledPointer( vm_t *vm, void *code ) {
int i;
@@ -172,6 +176,7 @@ const char *VM_SymbolForCompiledPointer( vm_t *vm, void *code ) {
// now look up the bytecode instruction pointer
return VM_ValueToSymbol( vm, i );
}
+#endif
@@ -445,6 +450,11 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
Com_Error( ERR_FATAL, "VM_Create: bad parms" );
}
+#if !defined(__i386__) && !defined(__ppc__)
+ if(interpret >= VMI_COMPILED)
+ interpret = VMI_BYTECODE;
+#endif
+
remaining = Hunk_MemoryRemaining();
// see if we already have the VM
@@ -669,9 +679,6 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
vm_t *oldVM;
int r;
int i;
- int args[16];
- va_list ap;
-
if ( !vm ) {
Com_Error( ERR_FATAL, "VM_Call with NULL vm" );
@@ -688,6 +695,8 @@ int QDECL VM_Call( vm_t *vm, int 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];
+ va_list ap;
va_start(ap, callnum);
for (i = 0; i < sizeof (args) / sizeof (args[i]); i++) {
args[i] = va_arg(ap, int);
@@ -698,10 +707,24 @@ int QDECL VM_Call( vm_t *vm, int callnum, ... ) {
args[4], args[5], args[6], args[7],
args[8], args[9], args[10], args[11],
args[12], args[13], args[14], args[15]);
+#if defined(__ppc__) || defined(__i386__)
} else if ( vm->compiled ) {
r = VM_CallCompiled( vm, &callnum );
+#endif
} else {
- r = VM_CallInterpreted( vm, &callnum );
+ struct {
+ int callnum;
+ int args[16];
+ } a;
+ va_list ap;
+
+ 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);
+ }
+ va_end(ap);
+ r = VM_CallInterpreted( vm, &a.callnum );
}
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL
@@ -820,7 +843,7 @@ void VM_LogSyscalls( int *args ) {
f = fopen("syscalls.log", "w" );
}
callnum++;
- fprintf(f, "%i: %i (%i) = %i %i %i %i\n", callnum, args - (int *)currentVM->dataBase,
+ fprintf(f, "%i: %li (%i) = %i %i %i %i\n", callnum, args - (int *)currentVM->dataBase,
args[0], args[1], args[2], args[3], args[4] );
}
diff --git a/code/qcommon/vm_interpreted.c b/code/qcommon/vm_interpreted.c
index 2c0087f..e2d69a7 100755
--- a/code/qcommon/vm_interpreted.c
+++ b/code/qcommon/vm_interpreted.c
@@ -479,7 +479,7 @@ nextInstruction2:
src = (int *)&image[ r0&dataMask ];
dest = (int *)&image[ r1&dataMask ];
- if ( ( (int)src | (int)dest | count ) & 3 ) {
+ if ( ( (long)src | (long)dest | count ) & 3 ) {
Com_Error( ERR_DROP, "OP_BLOCK_COPY not dword aligned" );
}
count >>= 2;