diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-06-16 01:11:45 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-10 21:28:21 +0000 |
commit | 1d26bab126400b065525340c9b6a377fbf9069f0 (patch) | |
tree | 29edb28448c9a3d8a4a9ef422871e4022eae65b7 /src/qcommon/vm_x86_64.c | |
parent | 2dd04e69725fcb96b43aeac13aa03c8a863e9cd3 (diff) |
Various fixes to vm_interpreted.c: - Add opStack protection - Fix dataMask check for OP_BLOCK_COPY - Add instruction number check for conditional jumps - Make errors in VM_PrepareInterpreter nonfatal
Diffstat (limited to 'src/qcommon/vm_x86_64.c')
-rw-r--r-- | src/qcommon/vm_x86_64.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/qcommon/vm_x86_64.c b/src/qcommon/vm_x86_64.c index c77ab6a3..93b56a37 100644 --- a/src/qcommon/vm_x86_64.c +++ b/src/qcommon/vm_x86_64.c @@ -382,21 +382,6 @@ static void* getentrypoint(vm_t* vm) return vm->codeBase; } -static void CROSSCALL block_copy_vm(unsigned dest, unsigned src, unsigned count) -{ - unsigned dataMask = currentVM->dataMask; - - if ((dest & dataMask) != dest - || (src & dataMask) != src - || ((dest+count) & dataMask) != dest + count - || ((src+count) & dataMask) != src + count) - { - Com_Error(ERR_DROP, "OP_BLOCK_COPY out of range!"); - } - - memcpy(currentVM->dataBase+dest, currentVM->dataBase+src, count); -} - static void CROSSCALL eop(void) { Com_Error(ERR_DROP, "End of program reached without return!"); @@ -783,7 +768,7 @@ void VM_Compile( vm_t *vm, vmHeader_t *header ) { emit("movl 4(%%r9, %%rbx, 4), %%edi"); // 1st argument dest emit("movl 8(%%r9, %%rbx, 4), %%rsi"); // 2nd argument src emit("movl $%d, %%edx", iarg); // 3rd argument count - emit("movq $%"PRIu64", %%rax", (intptr_t) block_copy_vm); + emit("movq $%"PRIu64", %%rax", (intptr_t) VM_BlockCopy); emit("callq *%%rax"); emit("pop %%rsi"); emit("addq %%rsi, %%rsp"); |