Skip to content

Commit de577a3

Browse files
antonblanchardozbenh
authored andcommitted
powerpc: Use generic memcpy code in little endian
We need to fix some endian issues in our memcpy code. For now just enable the generic memcpy routine for little endian builds. Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent 7a332b0 commit de577a3

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎arch/powerpc/include/asm/string.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#define __HAVE_ARCH_STRNCMP
1111
#define __HAVE_ARCH_STRCAT
1212
#define __HAVE_ARCH_MEMSET
13+
#ifdef __BIG_ENDIAN__
1314
#define __HAVE_ARCH_MEMCPY
15+
#endif
1416
#define __HAVE_ARCH_MEMMOVE
1517
#define __HAVE_ARCH_MEMCMP
1618
#define __HAVE_ARCH_MEMCHR
@@ -22,7 +24,9 @@ extern int strcmp(const char *,const char *);
2224
extern int strncmp(const char *, const char *, __kernel_size_t);
2325
extern char * strcat(char *, const char *);
2426
extern void * memset(void *,int,__kernel_size_t);
27+
#ifdef __BIG_ENDIAN__
2528
extern void * memcpy(void *,const void *,__kernel_size_t);
29+
#endif
2630
extern void * memmove(void *,const void *,__kernel_size_t);
2731
extern int memcmp(const void *,const void *,__kernel_size_t);
2832
extern void * memchr(const void *,int,__kernel_size_t);

‎arch/powerpc/kernel/ppc_ksyms.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ EXPORT_SYMBOL(__ucmpdi2);
148148
#endif
149149
long long __bswapdi2(long long);
150150
EXPORT_SYMBOL(__bswapdi2);
151+
#ifdef __BIG_ENDIAN__
151152
EXPORT_SYMBOL(memcpy);
153+
#endif
152154
EXPORT_SYMBOL(memset);
153155
EXPORT_SYMBOL(memmove);
154156
EXPORT_SYMBOL(memcmp);

‎arch/powerpc/lib/Makefile‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ obj-$(CONFIG_PPC32) += div64.o copy_32.o
1515
obj-$(CONFIG_HAS_IOMEM) += devres.o
1616

1717
obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
18-
memcpy_64.o usercopy_64.o mem_64.o string.o \
18+
usercopy_64.o mem_64.o string.o \
1919
hweight_64.o \
20-
copyuser_power7.o string_64.o copypage_power7.o \
21-
memcpy_power7.o
20+
copyuser_power7.o string_64.o copypage_power7.o
2221
ifeq ($(CONFIG_GENERIC_CSUM),)
2322
obj-y += checksum_$(CONFIG_WORD_SIZE).o
2423
obj-$(CONFIG_PPC64) += checksum_wrappers_64.o
2524
endif
2625

26+
ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),)
27+
obj-$(CONFIG_PPC64) += memcpy_power7.o memcpy_64.o
28+
endif
29+
2730
obj-$(CONFIG_PPC_EMULATE_SSTEP) += sstep.o ldstfp.o
2831

2932
ifeq ($(CONFIG_PPC64),y)

0 commit comments

Comments
 (0)