18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef ___ASM_SPARC_STRING_H
38c2ecf20Sopenharmony_ci#define ___ASM_SPARC_STRING_H
48c2ecf20Sopenharmony_ci#if defined(__sparc__) && defined(__arch64__)
58c2ecf20Sopenharmony_ci#include <asm/string_64.h>
68c2ecf20Sopenharmony_ci#else
78c2ecf20Sopenharmony_ci#include <asm/string_32.h>
88c2ecf20Sopenharmony_ci#endif
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* First the mem*() things. */
118c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMMOVE
128c2ecf20Sopenharmony_civoid *memmove(void *, const void *, __kernel_size_t);
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMCPY
158c2ecf20Sopenharmony_ci#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMSET
188c2ecf20Sopenharmony_ci#define memset(s, c, count) __builtin_memset(s, c, count)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMSCAN
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define memscan(__arg0, __char, __arg2)						\
238c2ecf20Sopenharmony_ci({										\
248c2ecf20Sopenharmony_ci	void *__memscan_zero(void *, size_t);					\
258c2ecf20Sopenharmony_ci	void *__memscan_generic(void *, int, size_t);				\
268c2ecf20Sopenharmony_ci	void *__retval, *__addr = (__arg0);					\
278c2ecf20Sopenharmony_ci	size_t __size = (__arg2);						\
288c2ecf20Sopenharmony_ci										\
298c2ecf20Sopenharmony_ci	if(__builtin_constant_p(__char) && !(__char))				\
308c2ecf20Sopenharmony_ci		__retval = __memscan_zero(__addr, __size);			\
318c2ecf20Sopenharmony_ci	else									\
328c2ecf20Sopenharmony_ci		__retval = __memscan_generic(__addr, (__char), __size);		\
338c2ecf20Sopenharmony_ci										\
348c2ecf20Sopenharmony_ci	__retval;								\
358c2ecf20Sopenharmony_ci})
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define __HAVE_ARCH_MEMCMP
388c2ecf20Sopenharmony_ciint memcmp(const void *,const void *,__kernel_size_t);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* Now the str*() stuff... */
418c2ecf20Sopenharmony_ci#define __HAVE_ARCH_STRLEN
428c2ecf20Sopenharmony_ci__kernel_size_t strlen(const char *);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#define __HAVE_ARCH_STRNCMP
458c2ecf20Sopenharmony_ciint strncmp(const char *, const char *, __kernel_size_t);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif
48