First, remove the !__KERNEL__ block, since U-Boot is always compiled with -D__KERNEL__. Second, remove the mention of the non-existing file arch/sh/lib/strcasecmp.c and the redundant declaration of strcasecmp() If sh did have a strcasecmp.c file, presumably the header would have had to #define __HAVE_ARCH_STRCASECMP. Third, remove the explicit #undefs of various __HAVE_ARCH_* and redundant declarations of standard functions, which are anyway declared in linux/string.h. In the linux source tree, those are all #defines, and indeed linux does have asm implementations of those functions. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
83 lines
1.6 KiB
C
83 lines
1.6 KiB
C
#ifndef __ASM_SH_STRING_H
|
|
#define __ASM_SH_STRING_H
|
|
|
|
/*
|
|
* Copyright (C) 1999 Niibe Yutaka
|
|
* But consider these trivial functions to be public domain.
|
|
*
|
|
* from linux kernel code.
|
|
*/
|
|
|
|
#define __HAVE_ARCH_STRCPY
|
|
static inline char *strcpy(char *__dest, const char *__src)
|
|
{
|
|
register char *__xdest = __dest;
|
|
unsigned long __dummy;
|
|
|
|
__asm__ __volatile__("1:\n\t"
|
|
"mov.b @%1+, %2\n\t"
|
|
"mov.b %2, @%0\n\t"
|
|
"cmp/eq #0, %2\n\t"
|
|
"bf/s 1b\n\t"
|
|
" add #1, %0\n\t"
|
|
: "=r" (__dest), "=r" (__src), "=&z" (__dummy)
|
|
: "0" (__dest), "1" (__src)
|
|
: "memory", "t");
|
|
|
|
return __xdest;
|
|
}
|
|
|
|
#define __HAVE_ARCH_STRNCPY
|
|
static inline char *strncpy(char *__dest, const char *__src, size_t __n)
|
|
{
|
|
register char *__xdest = __dest;
|
|
unsigned long __dummy;
|
|
|
|
if (__n == 0)
|
|
return __xdest;
|
|
|
|
__asm__ __volatile__(
|
|
"1:\n"
|
|
"mov.b @%1+, %2\n\t"
|
|
"mov.b %2, @%0\n\t"
|
|
"cmp/eq #0, %2\n\t"
|
|
"bt/s 2f\n\t"
|
|
" cmp/eq %5,%1\n\t"
|
|
"bf/s 1b\n\t"
|
|
" add #1, %0\n"
|
|
"2:"
|
|
: "=r" (__dest), "=r" (__src), "=&z" (__dummy)
|
|
: "0" (__dest), "1" (__src), "r" (__src+__n)
|
|
: "memory", "t");
|
|
|
|
return __xdest;
|
|
}
|
|
|
|
#define __HAVE_ARCH_STRCMP
|
|
static inline int strcmp(const char *__cs, const char *__ct)
|
|
{
|
|
register int __res;
|
|
unsigned long __dummy;
|
|
|
|
__asm__ __volatile__(
|
|
"mov.b @%1+, %3\n"
|
|
"1:\n\t"
|
|
"mov.b @%0+, %2\n\t"
|
|
"cmp/eq #0, %3\n\t"
|
|
"bt 2f\n\t"
|
|
"cmp/eq %2, %3\n\t"
|
|
"bt/s 1b\n\t"
|
|
" mov.b @%1+, %3\n\t"
|
|
"add #-2, %1\n\t"
|
|
"mov.b @%1, %3\n\t"
|
|
"sub %3, %2\n"
|
|
"2:"
|
|
: "=r" (__cs), "=r" (__ct), "=&r" (__res), "=&z" (__dummy)
|
|
: "0" (__cs), "1" (__ct)
|
|
: "t");
|
|
|
|
return __res;
|
|
}
|
|
|
|
#endif /* __ASM_SH_STRING_H */
|