summaryrefslogtreecommitdiff
path: root/src/qcommon/vm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/qcommon/vm.c')
-rw-r--r--src/qcommon/vm.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/qcommon/vm.c b/src/qcommon/vm.c
index ce131c2b..caf10863 100644
--- a/src/qcommon/vm.c
+++ b/src/qcommon/vm.c
@@ -950,3 +950,25 @@ void VM_LogSyscalls( int *args ) {
fprintf(f, "%i: %p (%i) = %i %i %i %i\n", callnum, (void*)(args - (int *)currentVM->dataBase),
args[0], args[1], args[2], args[3], args[4] );
}
+
+/*
+=================
+VM_BlockCopy
+Executes a block copy operation within currentVM data space
+=================
+*/
+
+void VM_BlockCopy(unsigned int dest, unsigned int src, size_t n)
+{
+ unsigned int dataMask = currentVM->dataMask;
+
+ if ((dest & dataMask) != dest
+ || (src & dataMask) != src
+ || ((dest + n) & dataMask) != dest + n
+ || ((src + n) & dataMask) != src + n)
+ {
+ Com_Error(ERR_DROP, "OP_BLOCK_COPY out of range!");
+ }
+
+ Com_Memcpy(currentVM->dataBase + dest, currentVM->dataBase + src, n);
+}