original comment: +Wilson03172004,marked due to this pci host does not support MWI
[linux-2.4.git] / include / asm-s390 / string.h
1 /*
2  *  include/asm-s390/string.h
3  *
4  *  S390 version
5  *    Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6  *    Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7  */
8
9 #ifndef _S390_STRING_H_
10 #define _S390_STRING_H_
11
12 #ifdef __KERNEL__
13
14 #ifndef _LINUX_TYPES_H
15 #include <linux/types.h>
16 #endif
17
18 #define __HAVE_ARCH_MEMCHR
19 #define __HAVE_ARCH_MEMCPY
20 #define __HAVE_ARCH_MEMSET
21 #define __HAVE_ARCH_STRCAT
22 #define __HAVE_ARCH_STRCMP
23 #define __HAVE_ARCH_STRCPY
24 #define __HAVE_ARCH_STRLEN
25 #define __HAVE_ARCH_STRNCPY
26
27 #undef __HAVE_ARCH_MEMMOVE
28 #undef __HAVE_ARCH_STRNICMP
29 #undef __HAVE_ARCH_STRNCAT
30 #undef __HAVE_ARCH_STRNCMP
31 #undef __HAVE_ARCH_STRCHR
32 #undef __HAVE_ARCH_STRRCHR
33 #undef __HAVE_ARCH_STRNLEN
34 #undef __HAVE_ARCH_STRSPN
35 #undef __HAVE_ARCH_STRPBRK
36 #undef __HAVE_ARCH_STRTOK
37 #undef __HAVE_ARCH_BCOPY
38 #undef __HAVE_ARCH_MEMCMP
39 #undef __HAVE_ARCH_MEMSCAN
40 #undef __HAVE_ARCH_STRSTR
41
42 extern void *memset(void *, int, size_t);
43 extern void *memcpy(void *, const void *, size_t);
44 extern void *memmove(void *, const void *, size_t);
45 extern char *strncpy(char *, const char *, size_t);
46 extern int strcmp(const char *,const char *);
47
48 static inline void * memchr(const void * cs,int c,size_t count)
49 {
50     void *ptr;
51
52     __asm__ __volatile__ ("   lr    0,%2\n"
53                           "   lr    1,%1\n"
54                           "   la    %0,0(%3,%1)\n"
55                           "0: srst  %0,1\n"
56                           "   jo    0b\n"
57                           "   brc   13,1f\n"
58                           "   slr   %0,%0\n"
59                           "1:"
60                           : "=&a" (ptr) : "a" (cs), "d" (c), "d" (count)
61                           : "cc", "0", "1" );
62     return ptr;
63 }
64
65 static __inline__ char *strcpy(char *dest, const char *src)
66 {
67     char *tmp = dest;
68
69     __asm__ __volatile__ ("   sr    0,0\n"
70                           "0: mvst  %0,%1\n"
71                           "   jo    0b"
72                           : "+&a" (dest), "+&a" (src) :
73                           : "cc", "memory", "0" );
74     return tmp;
75 }
76
77 static __inline__ size_t strlen(const char *s)
78 {
79     size_t len;
80
81     __asm__ __volatile__ ("   sr    0,0\n"
82                           "   lr    %0,%1\n"
83                           "0: srst  0,%0\n"
84                           "   jo    0b\n"
85                           "   lr    %0,0\n"
86                           "   sr    %0,%1"
87                           : "=&a" (len) : "a" (s) 
88                           : "cc", "0" );
89     return len;
90 }
91
92 static __inline__ char *strcat(char *dest, const char *src)
93 {
94     char *tmp = dest;
95
96     __asm__ __volatile__ ("   sr    0,0\n"
97                           "0: srst  0,%0\n"
98                           "   jo    0b\n"
99                           "   lr    %0,0\n"
100                           "   sr    0,0\n"
101                           "1: mvst  %0,%1\n"
102                           "   jo    1b"
103                           : "+&a" (dest), "+&a" (src) :
104                           : "cc", "memory", "0" );
105     return tmp;
106 }
107
108 extern void *alloca(size_t);
109
110 #endif /* __KERNEL__ */
111
112 #endif /* __S390_STRING_H_ */
113
114
115
116
117