From 1d26bab126400b065525340c9b6a377fbf9069f0 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Thu, 16 Jun 2011 01:11:45 +0000 Subject: 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 --- src/qcommon/vm_x86_64.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src/qcommon/vm_x86_64.c') 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"); -- cgit