2 * String handling functions.
4 * Copyright IBM Corp. 2012
7 #include <linux/linkage.h>
8 #include <asm/export.h>
11 * void *memmove(void *dest, const void *src, size_t n)
26 jz .Lmemmove_forward_remainder
27 .Lmemmove_forward_loop:
31 brctg %r0,.Lmemmove_forward_loop
32 .Lmemmove_forward_remainder:
33 larl %r5,.Lmemmove_mvc
39 brctg %r4,.Lmemmove_reverse
45 EXPORT_SYMBOL(memmove)
48 * memset implementation
50 * This code corresponds to the C construct below. We do distinguish
51 * between clearing (c == 0) and setting a memory array (c != 0) simply
52 * because nearly all memset invocations in the kernel clear memory and
53 * the xc instruction is preferred in such cases.
55 * void *memset(void *s, int c, size_t n)
58 * return __builtin_memset(s, 0, n);
59 * return __builtin_memset(s, c, n);
71 jz .Lmemset_clear_remainder
75 brctg %r3,.Lmemset_clear_loop
76 .Lmemset_clear_remainder:
88 jz .Lmemset_fill_remainder
92 brctg %r3,.Lmemset_fill_loop
93 .Lmemset_fill_remainder:
101 EXPORT_SYMBOL(memset)
104 * memcpy implementation
106 * void *memcpy(void *dest, const void *src, size_t n)
117 larl %r5,.Lmemcpy_mvc
121 mvc 0(256,%r1),0(%r3)
124 brctg %r5,.Lmemcpy_loop
128 EXPORT_SYMBOL(memcpy)