18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
48c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
58c2ecf20Sopenharmony_ci * for more details.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Corporation Limited
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci#ifndef _ASM_STRING_H
108c2ecf20Sopenharmony_ci#define _ASM_STRING_H
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMSET
138c2ecf20Sopenharmony_ciextern void *memset(void *__s, int __c, size_t __count);
148c2ecf20Sopenharmony_ciextern void *__memset(void *__s, int __c, size_t __count);
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMCPY
178c2ecf20Sopenharmony_ciextern void *memcpy(void *__to, __const__ void *__from, size_t __n);
188c2ecf20Sopenharmony_ciextern void *__memcpy(void *__to, __const__ void *__from, size_t __n);
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMMOVE
218c2ecf20Sopenharmony_ciextern void *memmove(void *__dest, __const__ void *__src, size_t __n);
228c2ecf20Sopenharmony_ciextern void *__memmove(void *__dest, __const__ void *__src, size_t __n);
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#if defined(CONFIG_KASAN) && !defined(__SANITIZE_ADDRESS__)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/*
278c2ecf20Sopenharmony_ci * For files that are not instrumented (e.g. mm/slub.c) we
288c2ecf20Sopenharmony_ci * should use not instrumented version of mem* functions.
298c2ecf20Sopenharmony_ci */
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define memset(s, c, n) __memset(s, c, n)
328c2ecf20Sopenharmony_ci#define memcpy(dst, src, len) __memcpy(dst, src, len)
338c2ecf20Sopenharmony_ci#define memmove(dst, src, len) __memmove(dst, src, len)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifndef __NO_FORTIFY
368c2ecf20Sopenharmony_ci#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
378c2ecf20Sopenharmony_ci#endif
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#endif
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci#endif /* _ASM_STRING_H */
42