Esempio n. 1
0
void *memmove(void *dest, const void *src, size_t len)
{
	check_memory_region((unsigned long)src, len, false, _RET_IP_);
	check_memory_region((unsigned long)dest, len, true, _RET_IP_);

	return __memmove(dest, src, len);
}
Esempio n. 2
0
void *memmove(void *dest, const void *src, size_t len)
{
	__asan_loadN((unsigned long)src, len);
	__asan_storeN((unsigned long)dest, len);

	return __memmove(dest, src, len);
}
Esempio n. 3
0
/* *
 * memmove - copies the values of @n bytes from the location pointed by @src to
 * the memory area pointed by @dst. @src and @dst are allowed to overlap.
 * @dst     pointer to the destination array where the content is to be copied
 * @src     pointer to the source of data to by copied
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *memmove(void *dst, const void *src, size_t n)
{
#ifdef __HAVE_ARCH_MEMMOVE
	return __memmove(dst, src, n);
#else
	const char *s = src;
	char *d = dst;
	if (s < d && s + n > d) {
		s += n, d += n;
		while (n-- > 0) {
			*--d = *--s;
		}
	} else {
		while (n-- > 0) {
			*d++ = *s++;
		}
	}
	return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
Esempio n. 4
0
static void memmove_func() {
	char* origin;
	char* src;
	char* dst;

	for(int i = 1; i < 4000; i++) {
		origin = malloc(i * 2);
		src = origin;
		dst = origin + i;
	
		for(int j = 0; j < i; j++) {
			__memmove(dst, src, j);		
			
			for(int x = 0; x < j; x++) {
				assert_int_equal(dst[x], src[x]);
			}
		}	

		free(origin);
		origin = NULL;
		src = NULL;
		dst = NULL;
	}	
}
Esempio n. 5
0
void * memmove(void * dest, const void * src, size_t n)
{
  return __memmove(dest, src, n);
}