1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef __ASM_ARM_STRING_H 3 #define __ASM_ARM_STRING_H 4 5 /* 6 * We don't do inline string functions, since the 7 * optimised inline asm versions are not small. 8 */ 9 10 #define __HAVE_ARCH_STRRCHR 11 extern char * strrchr(const char * s, int c); 12 13 #define __HAVE_ARCH_STRCHR 14 extern char * strchr(const char * s, int c); 15 16 #define __HAVE_ARCH_MEMCPY 17 extern void * memcpy(void *, const void *, __kernel_size_t); 18 19 #define __HAVE_ARCH_MEMMOVE 20 extern void * memmove(void *, const void *, __kernel_size_t); 21 22 #define __HAVE_ARCH_MEMCHR 23 extern void * memchr(const void *, int, __kernel_size_t); 24 25 #define __HAVE_ARCH_MEMSET 26 extern void * memset(void *, int, __kernel_size_t); 27 28 #define __HAVE_ARCH_MEMSET32 29 extern void *__memset32(uint32_t *, uint32_t v, __kernel_size_t); 30 static inline void *memset32(uint32_t *p, uint32_t v, __kernel_size_t n) 31 { 32 return __memset32(p, v, n * 4); 33 } 34 35 #define __HAVE_ARCH_MEMSET64 36 extern void *__memset64(uint64_t *, uint32_t low, __kernel_size_t, uint32_t hi); 37 static inline void *memset64(uint64_t *p, uint64_t v, __kernel_size_t n) 38 { 39 return __memset64(p, v, n * 8, v >> 32); 40 } 41 42 extern void __memzero(void *ptr, __kernel_size_t n); 43 44 #define memset(p,v,n) \ 45 ({ \ 46 void *__p = (p); size_t __n = n; \ 47 if ((__n) != 0) { \ 48 if (__builtin_constant_p((v)) && (v) == 0) \ 49 __memzero((__p),(__n)); \ 50 else \ 51 memset((__p),(v),(__n)); \ 52 } \ 53 (__p); \ 54 }) 55 56 #endif 57