blob: 69974e924611191ae448d8707affaec8ac4c3de9 [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 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
7 */
8
9#ifndef __SPARC_STRING_H__
10#define __SPARC_STRING_H__
11
12#include <asm/page.h>
13
14/* Really, userland/ksyms should not see any of this stuff. */
15
16#ifdef __KERNEL__
17
Sam Ravnborgf05a6862014-05-16 23:25:50 +020018void __memmove(void *,const void *,__kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070019
20#ifndef EXPORT_SYMTAB_STROPS
21
22/* First the mem*() things. */
23#define __HAVE_ARCH_MEMMOVE
24#undef memmove
25#define memmove(_to, _from, _n) \
26({ \
27 void *_t = (_to); \
28 __memmove(_t, (_from), (_n)); \
29 _t; \
30})
31
32#define __HAVE_ARCH_MEMCPY
David S. Miller4d14a452009-12-10 23:32:10 -080033#define memcpy(t, f, n) __builtin_memcpy(t, f, n)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070034
35#define __HAVE_ARCH_MEMSET
David S. Miller4d14a452009-12-10 23:32:10 -080036#define memset(s, c, count) __builtin_memset(s, c, count)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070037
38#define __HAVE_ARCH_MEMSCAN
39
40#undef memscan
41#define memscan(__arg0, __char, __arg2) \
42({ \
Sam Ravnborgf05a6862014-05-16 23:25:50 +020043 void *__memscan_zero(void *, size_t); \
44 void *__memscan_generic(void *, int, size_t); \
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070045 void *__retval, *__addr = (__arg0); \
46 size_t __size = (__arg2); \
47 \
48 if(__builtin_constant_p(__char) && !(__char)) \
49 __retval = __memscan_zero(__addr, __size); \
50 else \
51 __retval = __memscan_generic(__addr, (__char), __size); \
52 \
53 __retval; \
54})
55
56#define __HAVE_ARCH_MEMCMP
Sam Ravnborgf05a6862014-05-16 23:25:50 +020057int memcmp(const void *,const void *,__kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070058
59/* Now the str*() stuff... */
60#define __HAVE_ARCH_STRLEN
Sam Ravnborgf05a6862014-05-16 23:25:50 +020061__kernel_size_t strlen(const char *);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070062
63#define __HAVE_ARCH_STRNCMP
Sam Ravnborgf05a6862014-05-16 23:25:50 +020064int strncmp(const char *, const char *, __kernel_size_t);
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070065
66#endif /* !EXPORT_SYMTAB_STROPS */
67
68#endif /* __KERNEL__ */
69
70#endif /* !(__SPARC_STRING_H__) */