Skip to content

Commit f6a3308

Browse files
hdellertorvalds
authored andcommitted
Revert "parisc: Add assembly implementations for memset, strlen, strcpy, strncpy and strcat"
This reverts commit 83af58f. It turns out that at least the assembly implementation for strncpy() was buggy. Revert the whole commit and return back to the default coding. Signed-off-by: Helge Deller <[email protected]> Cc: <[email protected]> # v5.4+ Cc: Rasmus Villemoes <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 3f5ad13 commit f6a3308

File tree

5 files changed

+74
-157
lines changed

5 files changed

+74
-157
lines changed

arch/parisc/include/asm/string.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,4 @@ extern void * memset(void *, int, size_t);
88
#define __HAVE_ARCH_MEMCPY
99
void * memcpy(void * dest,const void *src,size_t count);
1010

11-
#define __HAVE_ARCH_STRLEN
12-
extern size_t strlen(const char *s);
13-
14-
#define __HAVE_ARCH_STRCPY
15-
extern char *strcpy(char *dest, const char *src);
16-
17-
#define __HAVE_ARCH_STRNCPY
18-
extern char *strncpy(char *dest, const char *src, size_t count);
19-
20-
#define __HAVE_ARCH_STRCAT
21-
extern char *strcat(char *dest, const char *src);
22-
23-
#define __HAVE_ARCH_MEMSET
24-
extern void *memset(void *, int, size_t);
25-
2611
#endif

arch/parisc/kernel/parisc_ksyms.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717

1818
#include <linux/string.h>
1919
EXPORT_SYMBOL(memset);
20-
EXPORT_SYMBOL(strlen);
21-
EXPORT_SYMBOL(strcpy);
22-
EXPORT_SYMBOL(strncpy);
23-
EXPORT_SYMBOL(strcat);
2420

2521
#include <linux/atomic.h>
2622
EXPORT_SYMBOL(__xchg8);

arch/parisc/lib/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Makefile for parisc-specific library files
44
#
55

6-
lib-y := lusercopy.o bitops.o checksum.o io.o memcpy.o \
7-
ucmpdi2.o delay.o string.o
6+
lib-y := lusercopy.o bitops.o checksum.o io.o memset.o memcpy.o \
7+
ucmpdi2.o delay.o
88

99
obj-y := iomap.o

arch/parisc/lib/memset.c

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
2+
#include <linux/types.h>
3+
#include <asm/string.h>
4+
5+
#define OPSIZ (BITS_PER_LONG/8)
6+
typedef unsigned long op_t;
7+
8+
void *
9+
memset (void *dstpp, int sc, size_t len)
10+
{
11+
unsigned int c = sc;
12+
long int dstp = (long int) dstpp;
13+
14+
if (len >= 8)
15+
{
16+
size_t xlen;
17+
op_t cccc;
18+
19+
cccc = (unsigned char) c;
20+
cccc |= cccc << 8;
21+
cccc |= cccc << 16;
22+
if (OPSIZ > 4)
23+
/* Do the shift in two steps to avoid warning if long has 32 bits. */
24+
cccc |= (cccc << 16) << 16;
25+
26+
/* There are at least some bytes to set.
27+
No need to test for LEN == 0 in this alignment loop. */
28+
while (dstp % OPSIZ != 0)
29+
{
30+
((unsigned char *) dstp)[0] = c;
31+
dstp += 1;
32+
len -= 1;
33+
}
34+
35+
/* Write 8 `op_t' per iteration until less than 8 `op_t' remain. */
36+
xlen = len / (OPSIZ * 8);
37+
while (xlen > 0)
38+
{
39+
((op_t *) dstp)[0] = cccc;
40+
((op_t *) dstp)[1] = cccc;
41+
((op_t *) dstp)[2] = cccc;
42+
((op_t *) dstp)[3] = cccc;
43+
((op_t *) dstp)[4] = cccc;
44+
((op_t *) dstp)[5] = cccc;
45+
((op_t *) dstp)[6] = cccc;
46+
((op_t *) dstp)[7] = cccc;
47+
dstp += 8 * OPSIZ;
48+
xlen -= 1;
49+
}
50+
len %= OPSIZ * 8;
51+
52+
/* Write 1 `op_t' per iteration until less than OPSIZ bytes remain. */
53+
xlen = len / OPSIZ;
54+
while (xlen > 0)
55+
{
56+
((op_t *) dstp)[0] = cccc;
57+
dstp += OPSIZ;
58+
xlen -= 1;
59+
}
60+
len %= OPSIZ;
61+
}
62+
63+
/* Write the last few bytes. */
64+
while (len > 0)
65+
{
66+
((unsigned char *) dstp)[0] = c;
67+
dstp += 1;
68+
len -= 1;
69+
}
70+
71+
return dstpp;
72+
}

arch/parisc/lib/string.S

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)