1 /* 2 * From code in arch/x86/lib/usercopy_64.c, copied to keep tools/ copy 3 * of the kernel's arch/x86/lib/memcpy_64.s used in 'perf bench mem memcpy' 4 * happy. 5 */ 6 #include <linux/types.h> 7 8 unsigned long __memcpy_mcsafe(void *dst, const void *src, size_t cnt); 9 unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len); 10 11 unsigned long mcsafe_handle_tail(char *to, char *from, unsigned len) 12 { 13 for (; len; --len, to++, from++) { 14 /* 15 * Call the assembly routine back directly since 16 * memcpy_mcsafe() may silently fallback to memcpy. 17 */ 18 unsigned long rem = __memcpy_mcsafe(to, from, 1); 19 20 if (rem) 21 break; 22 } 23 return len; 24 }