View | Details | Raw Unified
Collapse All | Expand All

(-) ./klibc-1.5.11/usr/klibc/memmove.c (-12 / +12 lines)
 Lines 8-24    Link Here 
{
{
	const char *p = src;
	const char *p = src;
	char *q = dst;
	char *q = dst;
#if defined(__i386__) || defined(__x86_64__)
//#if defined(__i386__) || defined(__x86_64__)
	if (q < p) {
//	if (q < p) {
		asm volatile("cld ; rep ; movsb"
//		asm volatile("cld ; rep ; movsb"
			     : "+c" (n), "+S"(p), "+D"(q));
//			     : "+c" (n), "+S"(p), "+D"(q));
	} else {
//	} else {
		p += (n - 1);
//		p += (n - 1);
		q += (n - 1);
//		q += (n - 1);
		asm volatile("std ; rep ; movsb"
//		asm volatile("std ; rep ; movsb"
			     : "+c" (n), "+S"(p), "+D"(q));
//			     : "+c" (n), "+S"(p), "+D"(q));
	}
//	}
#else
//#else
	if (q < p) {
	if (q < p) {
		while (n--) {
		while (n--) {
			*q++ = *p++;
			*q++ = *p++;
 Lines 30-36    Link Here 
			*--q = *--p;
			*--q = *--p;
		}
		}
	}
	}
#endif
//#endif
	return dst;
	return dst;
}
}