Fix #if macros for idx64 and id386

This commit is contained in:
Thilo Schulz 2011-06-15 14:10:20 +00:00
parent a5035841d2
commit a447aa82af
6 changed files with 53 additions and 47 deletions

View file

@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#include "../qcommon/q_platform.h" #include "../qcommon/q_platform.h"
#ifdef idx64 #if idx64
#define EAX "%%rax" #define EAX "%%rax"
#define EBX "%%rbx" #define EBX "%%rbx"
#define ESP "%%rsp" #define ESP "%%rsp"

View file

@ -90,9 +90,9 @@ cvar_t *com_basegame;
cvar_t *com_homepath; cvar_t *com_homepath;
cvar_t *com_busyWait; cvar_t *com_busyWait;
#if defined(idx64) #if idx64
void (*Q_VMftol)(void); void (*Q_VMftol)(void);
#elif defined(id386) #elif id386
long (QDECL *Q_ftol)(float f); long (QDECL *Q_ftol)(float f);
void (QDECL *Q_VMftol)(void); void (QDECL *Q_VMftol)(void);
void (QDECL *Q_SnapVector)(vec3_t vec); void (QDECL *Q_SnapVector)(vec3_t vec);
@ -2580,11 +2580,11 @@ Find out whether we have SSE support for Q_ftol function
================= =================
*/ */
#if defined(id386) || defined(idx64) #if id386 || idx64
static void Com_DetectSSE(void) static void Com_DetectSSE(void)
{ {
#ifndef idx64 #if !idx64
cpuFeatures_t feat; cpuFeatures_t feat;
feat = Sys_GetProcessorFeatures(); feat = Sys_GetProcessorFeatures();
@ -2601,7 +2601,7 @@ static void Com_DetectSSE(void)
Q_VMftol = qvmftolsse; Q_VMftol = qvmftolsse;
Com_Printf("Have SSE support\n"); Com_Printf("Have SSE support\n");
#ifndef idx64 #if !idx64
} }
else else
{ {

View file

@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define __Q_PLATFORM_H #define __Q_PLATFORM_H
// this is for determining if we have an asm version of a C function // this is for determining if we have an asm version of a C function
#define idx64 0
#ifdef Q3_VM #ifdef Q3_VM
#define id386 0 #define id386 0
@ -76,7 +78,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if defined(_WIN64) || defined(__WIN64__) #if defined(_WIN64) || defined(__WIN64__)
#define idx64 #undef idx64
#define idx64 1
#undef QDECL #undef QDECL
#define QDECL __cdecl #define QDECL __cdecl
@ -146,7 +149,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define ARCH_STRING "i386" #define ARCH_STRING "i386"
#define Q3_LITTLE_ENDIAN #define Q3_LITTLE_ENDIAN
#elif defined __x86_64__ #elif defined __x86_64__
#define idx64 #undef idx64
#define idx64 1
#define ARCH_STRING "x86_64" #define ARCH_STRING "x86_64"
#define Q3_LITTLE_ENDIAN #define Q3_LITTLE_ENDIAN
#endif #endif
@ -173,7 +177,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#if defined __i386__ #if defined __i386__
#define ARCH_STRING "i386" #define ARCH_STRING "i386"
#elif defined __x86_64__ #elif defined __x86_64__
#define idx64 #undef idx64
#define idx64 1
#define ARCH_STRING "x86_64" #define ARCH_STRING "x86_64"
#elif defined __powerpc64__ #elif defined __powerpc64__
#define ARCH_STRING "ppc64" #define ARCH_STRING "ppc64"
@ -236,7 +241,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#ifdef __i386__ #ifdef __i386__
#define ARCH_STRING "i386" #define ARCH_STRING "i386"
#elif defined __amd64__ #elif defined __amd64__
#define idx64 #undef idx64
#define idx64 1
#define ARCH_STRING "amd64" #define ARCH_STRING "amd64"
#elif defined __axp__ #elif defined __axp__
#define ARCH_STRING "alpha" #define ARCH_STRING "alpha"

View file

@ -421,7 +421,7 @@ extern vec3_t axisDefault[3];
int Q_isnan(float x); int Q_isnan(float x);
#ifdef idx64 #if idx64
extern long qftolsse(float f); extern long qftolsse(float f);
extern void qvmftolsse(void); extern void qvmftolsse(void);
extern void qsnapvectorsse(vec3_t vec); extern void qsnapvectorsse(vec3_t vec);
@ -430,7 +430,7 @@ int Q_isnan(float x);
#define Q_SnapVector qsnapvectorsse #define Q_SnapVector qsnapvectorsse
extern void (*Q_VMftol)(void); extern void (*Q_VMftol)(void);
#elif defined(id386) #elif id386
extern long QDECL qftolx87(float f); extern long QDECL qftolx87(float f);
extern long QDECL qftolsse(float f); extern long QDECL qftolsse(float f);
extern void QDECL qvmftolx87(void); extern void QDECL qvmftolx87(void);

View file

@ -149,7 +149,7 @@ static void EmitPtr(void *ptr)
intptr_t v = (intptr_t) ptr; intptr_t v = (intptr_t) ptr;
Emit4(v); Emit4(v);
#ifdef idx64 #if idx64
Emit1((v >> 32) & 0xFF); Emit1((v >> 32) & 0xFF);
Emit1((v >> 40) & 0xFF); Emit1((v >> 40) & 0xFF);
Emit1((v >> 48) & 0xFF); Emit1((v >> 48) & 0xFF);
@ -192,7 +192,7 @@ static void EmitString( const char *string ) {
} }
static void EmitRexString(byte rex, const char *string) static void EmitRexString(byte rex, const char *string)
{ {
#ifdef idx64 #if idx64
if(rex) if(rex)
Emit1(rex); Emit1(rex);
#endif #endif
@ -415,7 +415,7 @@ Uses asm to retrieve arguments from registers to work around different calling c
================= =================
*/ */
#if defined(_MSC_VER) && defined(idx64) #if defined(_MSC_VER) && idx64
extern void qsyscall64(void); extern void qsyscall64(void);
extern uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase); extern uint8_t qvmcall64(int *programStack, int *opStack, intptr_t *instructionPointers, byte *dataBase);
@ -457,7 +457,7 @@ static void DoSyscall(void)
if(syscallNum < 0) if(syscallNum < 0)
{ {
int *data; int *data;
#ifdef idx64 #if idx64
int index; int index;
intptr_t args[11]; intptr_t args[11];
#endif #endif
@ -469,7 +469,7 @@ static void DoSyscall(void)
// modify VM stack pointer for recursive VM entry // modify VM stack pointer for recursive VM entry
savedVM->programStack = programStack - 4; savedVM->programStack = programStack - 4;
#ifdef idx64 #if idx64
args[0] = ~syscallNum; args[0] = ~syscallNum;
for(index = 1; index < ARRAY_LEN(args); index++) for(index = 1; index < ARRAY_LEN(args); index++)
args[index] = data[index]; args[index] = data[index];
@ -525,7 +525,7 @@ Call to DoSyscall()
int EmitCallDoSyscall(vm_t *vm) int EmitCallDoSyscall(vm_t *vm)
{ {
// use edx register to store DoSyscall address // use edx register to store DoSyscall address
#if defined(_MSC_VER) && defined(idx64) #if defined(_MSC_VER) && idx64
EmitRexString(0x48, "BA"); // mov edx, qsyscall64 EmitRexString(0x48, "BA"); // mov edx, qsyscall64
EmitPtr(qsyscall64); EmitPtr(qsyscall64);
#else #else
@ -538,7 +538,7 @@ int EmitCallDoSyscall(vm_t *vm)
EmitString("51"); // push ebx EmitString("51"); // push ebx
EmitString("56"); // push esi EmitString("56"); // push esi
EmitString("57"); // push edi EmitString("57"); // push edi
#ifdef idx64 #if idx64
EmitRexString(0x41, "50"); // push r8 EmitRexString(0x41, "50"); // push r8
EmitRexString(0x41, "51"); // push r9 EmitRexString(0x41, "51"); // push r9
#endif #endif
@ -556,7 +556,7 @@ int EmitCallDoSyscall(vm_t *vm)
EmitRexString(0x48, "89 EC"); // mov esp, ebp EmitRexString(0x48, "89 EC"); // mov esp, ebp
EmitString("5D"); // pop ebp EmitString("5D"); // pop ebp
#ifdef idx64 #if idx64
EmitRexString(0x41, "59"); // pop r9 EmitRexString(0x41, "59"); // pop r9
EmitRexString(0x41, "58"); // pop r8 EmitRexString(0x41, "58"); // pop r8
#endif #endif
@ -613,7 +613,7 @@ int EmitCallProcedure(vm_t *vm, int sysCallOfs)
EmitString("73"); // jae badAddr EmitString("73"); // jae badAddr
jmpBadAddr = compiledOfs++; jmpBadAddr = compiledOfs++;
#ifdef idx64 #if idx64
EmitRexString(0x49, "FF 14 C0"); // call qword ptr [r8 + eax * 8] EmitRexString(0x49, "FF 14 C0"); // call qword ptr [r8 + eax * 8]
#else #else
EmitString("FF 14 85"); // call dword ptr [vm->instructionPointers + eax * 4] EmitString("FF 14 85"); // call dword ptr [vm->instructionPointers + eax * 4]
@ -769,7 +769,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_LOAD4: case OP_LOAD4:
EmitPushStack(vm); EmitPushStack(vm);
#ifdef idx64 #if idx64
EmitRexString(0x41, "8B 81"); // mov eax, dword ptr [r9 + 0x12345678] EmitRexString(0x41, "8B 81"); // mov eax, dword ptr [r9 + 0x12345678]
Emit4(Constant4() & vm->dataMask); Emit4(Constant4() & vm->dataMask);
#else #else
@ -785,7 +785,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_LOAD2: case OP_LOAD2:
EmitPushStack(vm); EmitPushStack(vm);
#ifdef idx64 #if idx64
EmitRexString(0x41, "0F B7 81"); // movzx eax, word ptr [r9 + 0x12345678] EmitRexString(0x41, "0F B7 81"); // movzx eax, word ptr [r9 + 0x12345678]
Emit4(Constant4() & vm->dataMask); Emit4(Constant4() & vm->dataMask);
#else #else
@ -801,7 +801,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_LOAD1: case OP_LOAD1:
EmitPushStack(vm); EmitPushStack(vm);
#ifdef idx64 #if idx64
EmitRexString(0x41, "0F B6 81"); // movzx eax, byte ptr [r9 + 0x12345678] EmitRexString(0x41, "0F B6 81"); // movzx eax, byte ptr [r9 + 0x12345678]
Emit4(Constant4() & vm->dataMask); Emit4(Constant4() & vm->dataMask);
#else #else
@ -817,7 +817,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_STORE4: case OP_STORE4:
EmitMovEAXStack(vm, (vm->dataMask & ~3)); EmitMovEAXStack(vm, (vm->dataMask & ~3));
#ifdef idx64 #if idx64
EmitRexString(0x41, "C7 04 01"); // mov dword ptr [r9 + eax], 0x12345678 EmitRexString(0x41, "C7 04 01"); // mov dword ptr [r9 + eax], 0x12345678
Emit4(Constant4()); Emit4(Constant4());
#else #else
@ -832,7 +832,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_STORE2: case OP_STORE2:
EmitMovEAXStack(vm, (vm->dataMask & ~1)); EmitMovEAXStack(vm, (vm->dataMask & ~1));
#ifdef idx64 #if idx64
Emit1(0x66); // mov word ptr [r9 + eax], 0x1234 Emit1(0x66); // mov word ptr [r9 + eax], 0x1234
EmitRexString(0x41, "C7 04 01"); EmitRexString(0x41, "C7 04 01");
Emit2(Constant4()); Emit2(Constant4());
@ -849,7 +849,7 @@ qboolean ConstOptimize(vm_t *vm, int callProcOfsSyscall)
case OP_STORE1: case OP_STORE1:
EmitMovEAXStack(vm, vm->dataMask); EmitMovEAXStack(vm, vm->dataMask);
#ifdef idx64 #if idx64
EmitRexString(0x41, "C6 04 01"); // mov byte [r9 + eax], 0x12 EmitRexString(0x41, "C6 04 01"); // mov byte [r9 + eax], 0x12
Emit1(Constant4()); Emit1(Constant4());
#else #else
@ -1208,7 +1208,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitString("81 C2"); // add edx, 0x12345678 EmitString("81 C2"); // add edx, 0x12345678
Emit4((Constant1() & 0xFF)); Emit4((Constant1() & 0xFF));
MASK_REG("E2", vm->dataMask); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask); // and edx, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1246,7 +1246,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitMovEDXStack(vm, vm->dataMask); EmitMovEDXStack(vm, vm->dataMask);
if(v == 1 && oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL) if(v == 1 && oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL)
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "FF 04 11"); // inc dword ptr [r9 + edx] EmitRexString(0x41, "FF 04 11"); // inc dword ptr [r9 + edx]
#else #else
EmitString("FF 82"); // inc dword ptr [edx + 0x12345678] EmitString("FF 82"); // inc dword ptr [edx + 0x12345678]
@ -1255,7 +1255,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
} }
else else
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "8B 04 11"); // mov eax, dword ptr [r9 + edx] EmitRexString(0x41, "8B 04 11"); // mov eax, dword ptr [r9 + edx]
#else #else
EmitString("8B 82"); // mov eax, dword ptr [edx + 0x12345678] EmitString("8B 82"); // mov eax, dword ptr [edx + 0x12345678]
@ -1266,7 +1266,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
if (oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL) if (oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL)
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1278,7 +1278,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitCommand(LAST_COMMAND_SUB_BL_1); // sub bl, 1 EmitCommand(LAST_COMMAND_SUB_BL_1); // sub bl, 1
EmitString("8B 14 9F"); // mov edx, dword ptr [edi + ebx * 4] EmitString("8B 14 9F"); // mov edx, dword ptr [edi + ebx * 4]
MASK_REG("E2", vm->dataMask); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask); // and edx, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1308,7 +1308,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitMovEDXStack(vm, vm->dataMask); EmitMovEDXStack(vm, vm->dataMask);
if(v == 1 && oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL) if(v == 1 && oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL)
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "FF 0C 11"); // dec dword ptr [r9 + edx] EmitRexString(0x41, "FF 0C 11"); // dec dword ptr [r9 + edx]
#else #else
EmitString("FF 8A"); // dec dword ptr [edx + 0x12345678] EmitString("FF 8A"); // dec dword ptr [edx + 0x12345678]
@ -1317,7 +1317,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
} }
else else
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "8B 04 11"); // mov eax, dword ptr [r9 + edx] EmitRexString(0x41, "8B 04 11"); // mov eax, dword ptr [r9 + edx]
#else #else
EmitString("8B 82"); // mov eax, dword ptr [edx + 0x12345678] EmitString("8B 82"); // mov eax, dword ptr [edx + 0x12345678]
@ -1328,7 +1328,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
if(oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL) if(oc0 == oc1 && pop0 == OP_LOCAL && pop1 == OP_LOCAL)
{ {
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1340,7 +1340,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitCommand(LAST_COMMAND_SUB_BL_1); // sub bl, 1 EmitCommand(LAST_COMMAND_SUB_BL_1); // sub bl, 1
EmitString("8B 14 9F"); // mov edx, dword ptr [edi + ebx * 4] EmitString("8B 14 9F"); // mov edx, dword ptr [edi + ebx * 4]
MASK_REG("E2", vm->dataMask); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask); // and edx, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1360,7 +1360,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
compiledOfs -= 3; compiledOfs -= 3;
vm->instructionPointers[instruction - 1] = compiledOfs; vm->instructionPointers[instruction - 1] = compiledOfs;
MASK_REG("E0", vm->dataMask); // and eax, 0x12345678 MASK_REG("E0", vm->dataMask); // and eax, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "8B 04 01"); // mov eax, dword ptr [r9 + eax] EmitRexString(0x41, "8B 04 01"); // mov eax, dword ptr [r9 + eax]
#else #else
EmitString("8B 80"); // mov eax, dword ptr [eax + 0x1234567] EmitString("8B 80"); // mov eax, dword ptr [eax + 0x1234567]
@ -1371,7 +1371,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
} }
EmitMovEAXStack(vm, vm->dataMask); EmitMovEAXStack(vm, vm->dataMask);
#ifdef idx64 #if idx64
EmitRexString(0x41, "8B 04 01"); // mov eax, dword ptr [r9 + eax] EmitRexString(0x41, "8B 04 01"); // mov eax, dword ptr [r9 + eax]
#else #else
EmitString("8B 80"); // mov eax, dword ptr [eax + 0x12345678] EmitString("8B 80"); // mov eax, dword ptr [eax + 0x12345678]
@ -1381,7 +1381,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
break; break;
case OP_LOAD2: case OP_LOAD2:
EmitMovEAXStack(vm, vm->dataMask); EmitMovEAXStack(vm, vm->dataMask);
#ifdef idx64 #if idx64
EmitRexString(0x41, "0F B7 04 01"); // movzx eax, word ptr [r9 + eax] EmitRexString(0x41, "0F B7 04 01"); // movzx eax, word ptr [r9 + eax]
#else #else
EmitString("0F B7 80"); // movzx eax, word ptr [eax + 0x12345678] EmitString("0F B7 80"); // movzx eax, word ptr [eax + 0x12345678]
@ -1391,7 +1391,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
break; break;
case OP_LOAD1: case OP_LOAD1:
EmitMovEAXStack(vm, vm->dataMask); EmitMovEAXStack(vm, vm->dataMask);
#ifdef idx64 #if idx64
EmitRexString(0x41, "0F B6 04 01"); // movzx eax, byte ptr [r9 + eax] EmitRexString(0x41, "0F B6 04 01"); // movzx eax, byte ptr [r9 + eax]
#else #else
EmitString("0F B6 80"); // movzx eax, byte ptr [eax + 0x12345678] EmitString("0F B6 80"); // movzx eax, byte ptr [eax + 0x12345678]
@ -1403,7 +1403,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitMovEAXStack(vm, 0); EmitMovEAXStack(vm, 0);
EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4] EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4]
MASK_REG("E2", vm->dataMask & ~3); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask & ~3); // and edx, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax EmitRexString(0x41, "89 04 11"); // mov dword ptr [r9 + edx], eax
#else #else
EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax EmitString("89 82"); // mov dword ptr [edx + 0x12345678], eax
@ -1415,7 +1415,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitMovEAXStack(vm, 0); EmitMovEAXStack(vm, 0);
EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4] EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4]
MASK_REG("E2", vm->dataMask & ~1); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask & ~1); // and edx, 0x12345678
#ifdef idx64 #if idx64
Emit1(0x66); // mov word ptr [r9 + edx], eax Emit1(0x66); // mov word ptr [r9 + edx], eax
EmitRexString(0x41, "89 04 11"); EmitRexString(0x41, "89 04 11");
#else #else
@ -1428,7 +1428,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitMovEAXStack(vm, 0); EmitMovEAXStack(vm, 0);
EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4] EmitString("8B 54 9F FC"); // mov edx, dword ptr -4[edi + ebx * 4]
MASK_REG("E2", vm->dataMask); // and edx, 0x12345678 MASK_REG("E2", vm->dataMask); // and edx, 0x12345678
#ifdef idx64 #if idx64
EmitRexString(0x41, "88 04 11"); // mov byte ptr [r9 + edx], eax EmitRexString(0x41, "88 04 11"); // mov byte ptr [r9 + edx], eax
#else #else
EmitString("88 82"); // mov byte ptr [edx + 0x12345678], eax EmitString("88 82"); // mov byte ptr [edx + 0x12345678], eax
@ -1651,7 +1651,7 @@ void VM_Compile(vm_t *vm, vmHeader_t *header)
EmitString("8B 44 9F 04"); // mov eax, dword ptr 4[edi + ebx * 4] EmitString("8B 44 9F 04"); // mov eax, dword ptr 4[edi + ebx * 4]
EmitString("81 F8"); // cmp eax, vm->instructionCount EmitString("81 F8"); // cmp eax, vm->instructionCount
Emit4(vm->instructionCount); Emit4(vm->instructionCount);
#ifdef idx64 #if idx64
EmitString("73 04"); // jae +4 EmitString("73 04"); // jae +4
EmitRexString(0x49, "FF 24 C0"); // jmp qword ptr [r8 + eax * 8] EmitRexString(0x49, "FF 24 C0"); // jmp qword ptr [r8 + eax * 8]
#else #else
@ -1779,7 +1779,7 @@ int VM_CallCompiled(vm_t *vm, int *args)
opStackOfs = 0; opStackOfs = 0;
#ifdef _MSC_VER #ifdef _MSC_VER
#ifdef idx64 #if idx64
opStackOfs = qvmcall64(&programStack, opStack, vm->instructionPointers, vm->dataBase); opStackOfs = qvmcall64(&programStack, opStack, vm->instructionPointers, vm->dataBase);
#else #else
__asm __asm
@ -1799,7 +1799,7 @@ int VM_CallCompiled(vm_t *vm, int *args)
popad popad
} }
#endif #endif
#elif defined(idx64) #elif idx64
__asm__ volatile( __asm__ volatile(
"movq %5, %%rax\r\n" "movq %5, %%rax\r\n"
"movq %3, %%r8\r\n" "movq %3, %%r8\r\n"

View file

@ -68,7 +68,7 @@ Set FPU control word to default value
#define FPUCWMASK1 (_MCW_RC | _MCW_EM) #define FPUCWMASK1 (_MCW_RC | _MCW_EM)
#define FPUCW (_RC_CHOP | _MCW_EM | _PC_53) #define FPUCW (_RC_CHOP | _MCW_EM | _PC_53)
#ifdef idx64 #if idx64
#define FPUCWMASK (FPUCWMASK1) #define FPUCWMASK (FPUCWMASK1)
#else #else
#define FPUCWMASK (FPUCWMASK1 | _MCW_PC) #define FPUCWMASK (FPUCWMASK1 | _MCW_PC)