1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 2020 Loongson Technology Corporation Limited
8  */
9 #ifndef _ASM_STRING_H
10 #define _ASM_STRING_H
11 
12 #define __HAVE_ARCH_MEMSET
13 extern void *memset(void *__s, int __c, size_t __count);
14 extern void *__memset(void *__s, int __c, size_t __count);
15 
16 #define __HAVE_ARCH_MEMCPY
17 extern void *memcpy(void *__to, __const__ void *__from, size_t __n);
18 extern void *__memcpy(void *__to, __const__ void *__from, size_t __n);
19 
20 #define __HAVE_ARCH_MEMMOVE
21 extern void *memmove(void *__dest, __const__ void *__src, size_t __n);
22 extern void *__memmove(void *__dest, __const__ void *__src, size_t __n);
23 
24 #if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
25 
26 /*
27  * For files that are not instrumented (e.g. mm/slub.c) we
28  * should use not instrumented version of mem* functions.
29  */
30 
31 #define memset(s, c, n) __memset(s, c, n)
32 #define memcpy(dst, src, len) __memcpy(dst, src, len)
33 #define memmove(dst, src, len) __memmove(dst, src, len)
34 
35 #ifndef __NO_FORTIFY
36 #define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
37 #endif
38 
39 #endif
40 
41 #endif /* _ASM_STRING_H */
42