162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2013 ARM Ltd.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef __ASM_STRING_H
662306a36Sopenharmony_ci#define __ASM_STRING_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#if !(defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS))
962306a36Sopenharmony_ci#define __HAVE_ARCH_STRRCHR
1062306a36Sopenharmony_ciextern char *strrchr(const char *, int c);
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define __HAVE_ARCH_STRCHR
1362306a36Sopenharmony_ciextern char *strchr(const char *, int c);
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#define __HAVE_ARCH_STRCMP
1662306a36Sopenharmony_ciextern int strcmp(const char *, const char *);
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci#define __HAVE_ARCH_STRNCMP
1962306a36Sopenharmony_ciextern int strncmp(const char *, const char *, __kernel_size_t);
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define __HAVE_ARCH_STRLEN
2262306a36Sopenharmony_ciextern __kernel_size_t strlen(const char *);
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci#define __HAVE_ARCH_STRNLEN
2562306a36Sopenharmony_ciextern __kernel_size_t strnlen(const char *, __kernel_size_t);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define __HAVE_ARCH_MEMCMP
2862306a36Sopenharmony_ciextern int memcmp(const void *, const void *, size_t);
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define __HAVE_ARCH_MEMCHR
3162306a36Sopenharmony_ciextern void *memchr(const void *, int, __kernel_size_t);
3262306a36Sopenharmony_ci#endif
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci#define __HAVE_ARCH_MEMCPY
3562306a36Sopenharmony_ciextern void *memcpy(void *, const void *, __kernel_size_t);
3662306a36Sopenharmony_ciextern void *__memcpy(void *, const void *, __kernel_size_t);
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci#define __HAVE_ARCH_MEMMOVE
3962306a36Sopenharmony_ciextern void *memmove(void *, const void *, __kernel_size_t);
4062306a36Sopenharmony_ciextern void *__memmove(void *, const void *, __kernel_size_t);
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#define __HAVE_ARCH_MEMSET
4362306a36Sopenharmony_ciextern void *memset(void *, int, __kernel_size_t);
4462306a36Sopenharmony_ciextern void *__memset(void *, int, __kernel_size_t);
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ci#ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE
4762306a36Sopenharmony_ci#define __HAVE_ARCH_MEMCPY_FLUSHCACHE
4862306a36Sopenharmony_civoid memcpy_flushcache(void *dst, const void *src, size_t cnt);
4962306a36Sopenharmony_ci#endif
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#if (defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)) && \
5262306a36Sopenharmony_ci	!defined(__SANITIZE_ADDRESS__)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/*
5562306a36Sopenharmony_ci * For files that are not instrumented (e.g. mm/slub.c) we
5662306a36Sopenharmony_ci * should use not instrumented version of mem* functions.
5762306a36Sopenharmony_ci */
5862306a36Sopenharmony_ci
5962306a36Sopenharmony_ci#define memcpy(dst, src, len) __memcpy(dst, src, len)
6062306a36Sopenharmony_ci#define memmove(dst, src, len) __memmove(dst, src, len)
6162306a36Sopenharmony_ci#define memset(s, c, n) __memset(s, c, n)
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_ci#ifndef __NO_FORTIFY
6462306a36Sopenharmony_ci#define __NO_FORTIFY /* FORTIFY_SOURCE uses __builtin_memcpy, etc. */
6562306a36Sopenharmony_ci#endif
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#endif
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#endif
70