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