2
/*------------------------------------------------------------------------*/
3
/*--- Replacements for memcpy() et al, which run on the simulated CPU. ---*/
4
/*--- o_replace_memops.c ---*/
5
/*------------------------------------------------------------------------*/
8
This file is part of Omega, a Valgrind tool for instantly detecting
11
Copyright (C) 2006-2007 Bryan "Brain Murders" Meredith
13
Derived from mac_replace_strmem.c
14
Copyright (C) 2000-2006 Julian Seward
17
This program is free software; you can redistribute it and/or
18
modify it under the terms of the GNU General Public License as
19
published by the Free Software Foundation; either version 2 of the
20
License, or (at your option) any later version.
22
This program is distributed in the hope that it will be useful, but
23
WITHOUT ANY WARRANTY; without even the implied warranty of
24
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
General Public License for more details.
27
You should have received a copy of the GNU General Public License
28
along with this program; if not, write to the Free Software
29
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
32
The GNU General Public License is contained in the file COPYING.
34
The current maintainer is Rich Coe <richard.coe@med.ge.com>.
38
#include "pub_tool_basics.h"
40
#include "exp-omega.h"
42
/* ---------------------------------------------------------------------
43
We have our own versions of these functions so that we can correctly
44
track pointers that are duplicated or overwritten.
46
THEY RUN ON THE SIMD CPU!
47
------------------------------------------------------------------ */
49
int I_WRAP_SONAME_FNNAME_ZU(NONE,main) ( int n, char *a[], char *e[] );
50
int I_WRAP_SONAME_FNNAME_ZU(NONE,main) ( int n, char *a[], char *e[] )
54
VALGRIND_GET_ORIG_FN(fn);
55
VALGRIND_DO_ENTER_MAIN;
56
CALL_FN_W_WWW(r, fn, n, a, e);
57
VALGRIND_DO_LEAVE_MAIN;
62
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memcpy)( void *dst, const void *src, SizeT len );
63
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memcpy)( void *dst, const void *src, SizeT len )
72
d = (char *)dst + len - 1;
73
s = (char *)src + len - 1;
84
} else if ( dst < src ) {
101
void* I_WRAP_SONAME_FNNAME_ZU(NONE,mempcpy)( void *dst, const void *src, SizeT len );
102
void* I_WRAP_SONAME_FNNAME_ZU(NONE,mempcpy)( void *dst, const void *src, SizeT len )
111
d = (char *)dst + len - 1;
112
s = (char *)src + len - 1;
123
} else if ( dst < src ) {
137
return ((Char*)dst + len);
140
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memmove)(void *dstV, const void *srcV, SizeT n);
141
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memmove)(void *dstV, const void *srcV, SizeT n)
144
Char* dst = (Char*)dstV;
145
Char* src = (Char*)srcV;
147
for (i = 0; i < n; i++)
152
for (i = 0; i < n; i++)
153
dst[n-i-1] = src[n-i-1];
158
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memset)(void *s, Int c, SizeT n);
159
void* I_WRAP_SONAME_FNNAME_ZU(NONE,memset)(void *s, Int c, SizeT n)
161
unsigned char *cp = s;
169
/*--------------------------------------------------------------------*/
171
/*--------------------------------------------------------------------*/