Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / arm / include / asm / string.h
blob6c607c68f3ad75a84aef0a82a778466ccf53ab91
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_ARM_STRING_H
3 #define __ASM_ARM_STRING_H
5 /*
6 * We don't do inline string functions, since the
7 * optimised inline asm versions are not small.
9 * The __underscore versions of some functions are for KASan to be able
10 * to replace them with instrumented versions.
13 #define __HAVE_ARCH_STRRCHR
14 extern char * strrchr(const char * s, int c);
16 #define __HAVE_ARCH_STRCHR
17 extern char * strchr(const char * s, int c);
19 #define __HAVE_ARCH_MEMCPY
20 extern void * memcpy(void *, const void *, __kernel_size_t);
21 extern void *__memcpy(void *dest, const void *src, __kernel_size_t n);
23 #define __HAVE_ARCH_MEMMOVE
24 extern void * memmove(void *, const void *, __kernel_size_t);
25 extern void *__memmove(void *dest, const void *src, __kernel_size_t n);
27 #define __HAVE_ARCH_MEMCHR
28 extern void * memchr(const void *, int, __kernel_size_t);
30 #define __HAVE_ARCH_MEMSET
31 extern void * memset(void *, int, __kernel_size_t);
32 extern void *__memset(void *s, int c, __kernel_size_t n);
34 #define __HAVE_ARCH_MEMSET32
35 extern void *__memset32(uint32_t *, uint32_t v, __kernel_size_t);
36 static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n)
38 return __memset32(p, v, n * 4);
41 #define __HAVE_ARCH_MEMSET64
42 extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_t hi);
43 static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n)
45 return __memset64(p, v, n * 8, v >> 32);
49 * For files that are not instrumented (e.g. mm/slub.c) we
50 * must use non-instrumented versions of the mem*
51 * functions named __memcpy() etc. All such kernel code has
52 * been tagged with KASAN_SANITIZE_file.o = n, which means
53 * that the address sanitization argument isn't passed to the
54 * compiler, and __SANITIZE_ADDRESS__ is not set. As a result
55 * these defines kick in.
57 #if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
58 #define memcpy(dst, src, len) __memcpy(dst, src, len)
59 #define memmove(dst, src, len) __memmove(dst, src, len)
60 #define memset(s, c, n) __memset(s, c, n)
62 #ifndef __NO_FORTIFY
63 #define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
64 #endif
66 #endif
68 #endif