1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __ASM_SH_STRING_H
3 #define __ASM_SH_STRING_H
8 * Copyright (C) 1999 Niibe Yutaka
9 * But consider these trivial functions to be public domain.
12 #define __HAVE_ARCH_STRCPY
13 static inline char *strcpy(char *__dest
, const char *__src
)
15 register char *__xdest
= __dest
;
16 unsigned long __dummy
;
18 __asm__
__volatile__("1:\n\t"
24 : "=r" (__dest
), "=r" (__src
), "=&z" (__dummy
)
25 : "0" (__dest
), "1" (__src
)
31 #define __HAVE_ARCH_STRNCPY
32 static inline char *strncpy(char *__dest
, const char *__src
, size_t __n
)
34 register char *__xdest
= __dest
;
35 unsigned long __dummy
;
50 : "=r" (__dest
), "=r" (__src
), "=&z" (__dummy
)
51 : "0" (__dest
), "1" (__src
), "r" (__src
+__n
)
57 #define __HAVE_ARCH_STRCMP
58 static inline int strcmp(const char *__cs
, const char *__ct
)
61 unsigned long __dummy
;
76 : "=r" (__cs
), "=r" (__ct
), "=&r" (__res
), "=&z" (__dummy
)
77 : "0" (__cs
), "1" (__ct
)
83 #define __HAVE_ARCH_STRNCMP
84 static inline int strncmp(const char *__cs
, const char *__ct
, size_t __n
)
87 unsigned long __dummy
;
102 " mov.b @%1+, %3\n\t"
108 :"=r" (__cs
), "=r" (__ct
), "=&r" (__res
), "=&z" (__dummy
)
109 : "0" (__cs
), "1" (__ct
), "r" (__cs
+__n
)
115 #define __HAVE_ARCH_MEMSET
116 extern void *memset(void *__s
, int __c
, size_t __count
);
118 #define __HAVE_ARCH_MEMCPY
119 extern void *memcpy(void *__to
, __const__
void *__from
, size_t __n
);
121 #define __HAVE_ARCH_MEMMOVE
122 extern void *memmove(void *__dest
, __const__
void *__src
, size_t __n
);
124 #define __HAVE_ARCH_MEMCHR
125 extern void *memchr(const void *__s
, int __c
, size_t __n
);
127 #define __HAVE_ARCH_STRLEN
128 extern size_t strlen(const char *);
130 #endif /* __KERNEL__ */
132 #endif /* __ASM_SH_STRING_H */