2 * String handling functions.
4 * Copyright IBM Corp. 2012
7 #include <linux/linkage.h>
8 #include <asm/nospec-insn.h>
13 * memset implementation
15 * This code corresponds to the C construct below. We do distinguish
16 * between clearing (c == 0) and setting a memory array (c != 0) simply
17 * because nearly all memset invocations in the kernel clear memory and
18 * the xc instruction is preferred in such cases.
20 * void *memset(void *s, int c, size_t n)
23 * return __builtin_memset(s, 0, n);
24 * return __builtin_memset(s, c, n);
36 jz .Lmemset_clear_rest
40 brctg %r3,.Lmemset_clear_loop
58 brctg %r3,.Lmemset_fill_loop
70 * memcpy implementation
72 * void *memcpy(void *dest, const void *src, size_t n)
91 brctg %r5,.Lmemcpy_loop