Commit bdfeb0cc authored by Guo Ren's avatar Guo Ren

csky: Fixup abiv1 memset error

Current memset implementation in abiv1 is wrong and it'll cause unalign
access. Just remove it and use the generic one. This patch will cause
performance degradation and we will improve it with a new design in next
patchset.
Signed-off-by: default avatarGuo Ren <ren_guo@c-sky.com>
Cc: Arnd Bergmann <arnd@arndb.de>
parent 4e562c11
...@@ -5,5 +5,4 @@ obj-y += bswapsi.o ...@@ -5,5 +5,4 @@ obj-y += bswapsi.o
obj-y += cacheflush.o obj-y += cacheflush.o
obj-y += mmap.o obj-y += mmap.o
obj-y += memcpy.o obj-y += memcpy.o
obj-y += memset.o
obj-y += strksyms.o obj-y += strksyms.o
...@@ -7,7 +7,4 @@ ...@@ -7,7 +7,4 @@
#define __HAVE_ARCH_MEMCPY #define __HAVE_ARCH_MEMCPY
extern void *memcpy(void *, const void *, __kernel_size_t); extern void *memcpy(void *, const void *, __kernel_size_t);
#define __HAVE_ARCH_MEMSET
extern void *memset(void *, int, __kernel_size_t);
#endif /* __ABI_CSKY_STRING_H */ #endif /* __ABI_CSKY_STRING_H */
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
#include <linux/types.h>
void *memset(void *dest, int c, size_t l)
{
char *d = dest;
int ch = c & 0xff;
int tmp = (ch | ch << 8 | ch << 16 | ch << 24);
while (((uintptr_t)d & 0x3) && l--)
*d++ = ch;
while (l >= 16) {
*(((u32 *)d)) = tmp;
*(((u32 *)d)+1) = tmp;
*(((u32 *)d)+2) = tmp;
*(((u32 *)d)+3) = tmp;
l -= 16;
d += 16;
}
while (l > 3) {
*(((u32 *)d)) = tmp;
l -= 4;
d += 4;
}
while (l) {
*d = ch;
l--;
d++;
}
return dest;
}
...@@ -4,4 +4,3 @@ ...@@ -4,4 +4,3 @@
#include <linux/module.h> #include <linux/module.h>
EXPORT_SYMBOL(memcpy); EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment