Code fixes to support x64.

This commit is contained in:
Artem Kharytoniuk
2014-06-22 19:35:07 +03:00
parent 45f0e016d2
commit eae0ddcccc
13 changed files with 50 additions and 273 deletions

View File

@@ -238,9 +238,7 @@ void QDECL Com_Error( int code, const char *fmt, ... ) {
#if defined(_WIN32) && defined(_DEBUG)
if ( code != ERR_DISCONNECT && code != ERR_NEED_CD ) {
if (!com_noErrorInterrupt->integer) {
__asm {
int 0x03
}
__debugbreak();
}
}
#endif

View File

@@ -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(void*), paksort );
for ( i = 0 ; i < numfiles ; i++ ) {
pakfile = FS_BuildOSPath( path, dir, sorted[i] );

View File

@@ -676,15 +676,6 @@ extern char cl_cdkey[34];
// returnbed by Sys_GetProcessorId
#define CPUID_GENERIC 0 // any unrecognized processor
#define CPUID_AXP 0x10
#define CPUID_INTEL_UNSUPPORTED 0x20 // Intel 386/486
#define CPUID_INTEL_PENTIUM 0x21 // Intel Pentium or PPro
#define CPUID_INTEL_MMX 0x22 // Intel Pentium/MMX or P2/MMX
#define CPUID_INTEL_KATMAI 0x23 // Intel Katmai
#define CPUID_AMD_3DNOW 0x30 // AMD K6 3DNOW!
// TTimo
// centralized and cleaned, that's the max string you can send to a Com_Printf / Com_DPrintf (above gets truncated)
#define MAXPRINTMSG 4096

View File

@@ -325,7 +325,7 @@ Dlls will call this directly
============
*/
int QDECL VM_DllSyscall( int arg, ... ) {
#if ((defined __linux__) && (defined __powerpc__))
#ifdef _WIN64
// rcg010206 - see commentary above
int args[16];
int i;
@@ -541,6 +541,10 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
// copy or compile the instructions
vm->codeLength = header->codeLength;
#ifdef _WIN64
vm->compiled = qfalse;
VM_PrepareInterpreter( vm, header );
#else
if ( interpret >= VMI_COMPILED ) {
vm->compiled = qtrue;
VM_Compile( vm, header );
@@ -548,6 +552,7 @@ vm_t *VM_Create( const char *module, int (*systemCalls)(int *),
vm->compiled = qfalse;
VM_PrepareInterpreter( vm, header );
}
#endif
// free the original file
FS_FreeFile( header );
@@ -698,10 +703,27 @@ 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]);
} else if ( vm->compiled ) {
}
#ifndef _WIN64
else if ( vm->compiled )
{
r = VM_CallCompiled( vm, &callnum );
} else {
r = VM_CallInterpreted( vm, &callnum );
}
#endif
else
{
struct {
int callnum;
int args[10];
} a;
a.callnum = callnum;
va_start(ap, callnum);
for (i = 0; i < sizeof (a.args) / sizeof (a.args[i]); i++) {
a.args[i] = va_arg(ap, int);
}
va_end(ap);
r = VM_CallInterpreted( vm, &a );
}
if ( oldVM != NULL ) // bk001220 - assert(currentVM!=NULL) for oldVM==NULL

View File

@@ -21,6 +21,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// vm_x86.c -- load time compiler and execution environment for x86
#ifndef _WIN64
#include "vm_local.h"
#ifdef __FreeBSD__ // rb0101023
@@ -1208,4 +1210,4 @@ int VM_CallCompiled( vm_t *vm, int *args ) {
}
#endif // !DLL_ONLY
#endif // _WIN64