diff options
| -rw-r--r-- | arch/s390/include/asm/string.h | 3 | ||||
| -rw-r--r-- | arch/s390/lib/mem.S | 39 |
2 files changed, 41 insertions, 1 deletions
diff --git a/arch/s390/include/asm/string.h b/arch/s390/include/asm/string.h index 8662f5c8e17f..15a3c005c274 100644 --- a/arch/s390/include/asm/string.h +++ b/arch/s390/include/asm/string.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #define __HAVE_ARCH_MEMCHR /* inline & arch function */ | 14 | #define __HAVE_ARCH_MEMCHR /* inline & arch function */ |
| 15 | #define __HAVE_ARCH_MEMCMP /* arch function */ | 15 | #define __HAVE_ARCH_MEMCMP /* arch function */ |
| 16 | #define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */ | 16 | #define __HAVE_ARCH_MEMCPY /* gcc builtin & arch function */ |
| 17 | #define __HAVE_ARCH_MEMMOVE /* gcc builtin & arch function */ | ||
| 17 | #define __HAVE_ARCH_MEMSCAN /* inline & arch function */ | 18 | #define __HAVE_ARCH_MEMSCAN /* inline & arch function */ |
| 18 | #define __HAVE_ARCH_MEMSET /* gcc builtin & arch function */ | 19 | #define __HAVE_ARCH_MEMSET /* gcc builtin & arch function */ |
| 19 | #define __HAVE_ARCH_STRCAT /* inline & arch function */ | 20 | #define __HAVE_ARCH_STRCAT /* inline & arch function */ |
| @@ -32,6 +33,7 @@ | |||
| 32 | extern int memcmp(const void *, const void *, size_t); | 33 | extern int memcmp(const void *, const void *, size_t); |
| 33 | extern void *memcpy(void *, const void *, size_t); | 34 | extern void *memcpy(void *, const void *, size_t); |
| 34 | extern void *memset(void *, int, size_t); | 35 | extern void *memset(void *, int, size_t); |
| 36 | extern void *memmove(void *, const void *, size_t); | ||
| 35 | extern int strcmp(const char *,const char *); | 37 | extern int strcmp(const char *,const char *); |
| 36 | extern size_t strlcat(char *, const char *, size_t); | 38 | extern size_t strlcat(char *, const char *, size_t); |
| 37 | extern size_t strlcpy(char *, const char *, size_t); | 39 | extern size_t strlcpy(char *, const char *, size_t); |
| @@ -40,7 +42,6 @@ extern char *strncpy(char *, const char *, size_t); | |||
| 40 | extern char *strrchr(const char *, int); | 42 | extern char *strrchr(const char *, int); |
| 41 | extern char *strstr(const char *, const char *); | 43 | extern char *strstr(const char *, const char *); |
| 42 | 44 | ||
| 43 | #undef __HAVE_ARCH_MEMMOVE | ||
| 44 | #undef __HAVE_ARCH_STRCHR | 45 | #undef __HAVE_ARCH_STRCHR |
| 45 | #undef __HAVE_ARCH_STRNCHR | 46 | #undef __HAVE_ARCH_STRNCHR |
| 46 | #undef __HAVE_ARCH_STRNCMP | 47 | #undef __HAVE_ARCH_STRNCMP |
diff --git a/arch/s390/lib/mem.S b/arch/s390/lib/mem.S index be9fa65bfac4..7422a706f310 100644 --- a/arch/s390/lib/mem.S +++ b/arch/s390/lib/mem.S | |||
| @@ -8,6 +8,45 @@ | |||
| 8 | #include <asm/export.h> | 8 | #include <asm/export.h> |
| 9 | 9 | ||
| 10 | /* | 10 | /* |
| 11 | * void *memmove(void *dest, const void *src, size_t n) | ||
| 12 | */ | ||
| 13 | ENTRY(memmove) | ||
| 14 | ltgr %r4,%r4 | ||
| 15 | lgr %r1,%r2 | ||
| 16 | bzr %r14 | ||
| 17 | clgr %r2,%r3 | ||
| 18 | jnh .Lmemmove_forward | ||
| 19 | la %r5,0(%r4,%r3) | ||
| 20 | clgr %r2,%r5 | ||
| 21 | jl .Lmemmove_reverse | ||
| 22 | .Lmemmove_forward: | ||
| 23 | aghi %r4,-1 | ||
| 24 | srlg %r0,%r4,8 | ||
| 25 | ltgr %r0,%r0 | ||
| 26 | jz .Lmemmove_rest | ||
| 27 | .Lmemmove_loop: | ||
| 28 | mvc 0(256,%r1),0(%r3) | ||
| 29 | la %r1,256(%r1) | ||
| 30 | la %r3,256(%r3) | ||
| 31 | brctg %r0,.Lmemmove_loop | ||
| 32 | .Lmemmove_rest: | ||
| 33 | larl %r5,.Lmemmove_mvc | ||
| 34 | ex %r4,0(%r5) | ||
| 35 | br %r14 | ||
| 36 | .Lmemmove_reverse: | ||
| 37 | aghi %r4,-1 | ||
| 38 | .Lmemmove_reverse_loop: | ||
| 39 | ic %r0,0(%r4,%r3) | ||
| 40 | stc %r0,0(%r4,%r1) | ||
| 41 | brctg %r4,.Lmemmove_reverse_loop | ||
| 42 | ic %r0,0(%r4,%r3) | ||
| 43 | stc %r0,0(%r4,%r1) | ||
| 44 | br %r14 | ||
| 45 | .Lmemmove_mvc: | ||
| 46 | mvc 0(1,%r1),0(%r3) | ||
| 47 | EXPORT_SYMBOL(memmove) | ||
| 48 | |||
| 49 | /* | ||
| 11 | * memset implementation | 50 | * memset implementation |
| 12 | * | 51 | * |
| 13 | * This code corresponds to the C construct below. We do distinguish | 52 | * This code corresponds to the C construct below. We do distinguish |
