blob: 5936b8ff3c050c15d873e2fc650185ede4912c1e [file] [log] [blame]
Sam Ravnborgf5e706a2008-07-17 21:55:51 -07001/*
2 * string.h: External definitions for optimized assembly string
3 * routines for the Linux Kernel.
4 *
5 * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
6 * Copyright (C) 1996,1997,1999 Jakub Jelinek (jakub@redhat.com)
7 */
8
9#ifndef __SPARC64_STRING_H__
10#define __SPARC64_STRING_H__
11
12/* Really, userland/ksyms should not see any of this stuff. */
13
14#ifdef __KERNEL__
15
16#include <asm/asi.h>
17
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070018#ifndef EXPORT_SYMTAB_STROPS
19
20/* First the mem*() things. */
21#define __HAVE_ARCH_MEMMOVE
Sam Ravnborgf05a6862014-05-16 23:25:50 +020022void *memmove(void *, const void *, __kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070023
24#define __HAVE_ARCH_MEMCPY
David S. Miller4d14a452009-12-10 23:32:10 -080025#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070026
27#define __HAVE_ARCH_MEMSET
David S. Miller4d14a452009-12-10 23:32:10 -080028#define memset(s, c, count) __builtin_memset(s, c, count)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070029
30#define __HAVE_ARCH_MEMSCAN
31
32#undef memscan
33#define memscan(__arg0, __char, __arg2) \
34({ \
Sam Ravnborgf05a6862014-05-16 23:25:50 +020035 void *__memscan_zero(void *, size_t); \
36 void *__memscan_generic(void *, int, size_t); \
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070037 void *__retval, *__addr = (__arg0); \
38 size_t __size = (__arg2); \
39 \
40 if(__builtin_constant_p(__char) && !(__char)) \
41 __retval = __memscan_zero(__addr, __size); \
42 else \
43 __retval = __memscan_generic(__addr, (__char), __size); \
44 \
45 __retval; \
46})
47
48#define __HAVE_ARCH_MEMCMP
Sam Ravnborgf05a6862014-05-16 23:25:50 +020049int memcmp(const void *,const void *,__kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070050
51/* Now the str*() stuff... */
52#define __HAVE_ARCH_STRLEN
Sam Ravnborgf05a6862014-05-16 23:25:50 +020053__kernel_size_t strlen(const char *);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070054
55#define __HAVE_ARCH_STRNCMP
Sam Ravnborgf05a6862014-05-16 23:25:50 +020056int strncmp(const char *, const char *, __kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070057
58#endif /* !EXPORT_SYMTAB_STROPS */
59
60#endif /* __KERNEL__ */
61
62#endif /* !(__SPARC64_STRING_H__) */