- Kai Germaschewski: ymfpci cleanups and resource leak fixes
[davej-history.git] / include / asm-s390 / string.h
blob2e8081912169b4285ba469a9d6e7147e10449f98
1 /*
2 * include/asm-s390/string.h
4 * S390 version
5 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com),
7 */
9 #ifndef _S390_STRING_H_
10 #define _S390_STRING_H_
12 #ifdef __KERNEL__
14 #ifndef _LINUX_TYPES_H
15 #include <linux/types.h>
16 #endif
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
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
42 extern void *memset(void *, int, size_t);
44 extern inline void * memchr(const void * cs,int c,size_t count)
46 void *ptr;
48 __asm__ __volatile__ (" lr 0,%2\n"
49 " la %0,0(%3,%1)\n"
50 "0: srst %0,%1\n"
51 " jo 0b\n"
52 " brc 13,1f\n"
53 " slr %0,%0\n"
54 "1:"
55 : "=a" (ptr) : "a" (cs), "d" (c), "d" (count)
56 : "cc", "0" );
57 return ptr;
60 extern __inline__ char *strcpy(char *dest, const char *src)
62 char *tmp = dest;
64 __asm__ __volatile__ (" sr 0,0\n"
65 "0: mvst %0,%1\n"
66 " jo 0b"
67 : "+&a" (dest), "+&a" (src) :
68 : "cc", "memory", "0" );
69 return tmp;
72 extern __inline__ size_t strlen(const char *s)
74 size_t len;
76 __asm__ __volatile__ (" sr 0,0\n"
77 " lr %0,%1\n"
78 "0: srst 0,%0\n"
79 " jo 0b\n"
80 " lr %0,0\n"
81 " sr %0,%1"
82 : "=&a" (len) : "a" (s)
83 : "cc", "0" );
84 return len;
87 extern __inline__ char *strcat(char *dest, const char *src)
89 char *tmp = dest;
91 __asm__ __volatile__ (" sr 0,0\n"
92 "0: srst 0,%0\n"
93 " jo 0b\n"
94 " lr %0,0\n"
95 " sr 0,0\n"
96 "1: mvst %0,%1\n"
97 " jo 1b"
98 : "+&a" (dest), "+&a" (src) :
99 : "cc", "memory", "0" );
100 return tmp;
104 #endif /* __KERNEL__ */
106 #endif /* __S390_STRING_H_ */