yann@966
|
1 |
Fix memset on PowerPC 8xx, by Nye Liu:
|
yann@966
|
2 |
http://sourceware.org/ml/crossgcc/2008-10/msg00067.html
|
yann@966
|
3 |
|
yann@966
|
4 |
Quote:
|
yann@966
|
5 |
I am working on a powerpc 860 toolchain, but I am having problems
|
yann@966
|
6 |
convincing glibc to not emit code that uses the dcbz instruction (CPU15
|
yann@966
|
7 |
dcbX bug). The source of the problem is sysdeps/powerpc/power3/memset.S
|
yann@966
|
8 |
|
yann@966
|
9 |
--- glibc-2.7/sysdeps/powerpc/powerpc32/memset.S 2007-03-26 13:09:07.000000000 -0700
|
yann@966
|
10 |
+++ glibc-2.7/sysdeps/powerpc/powerpc32/memset.S.new 2008-10-23 12:20:04.000000000 -0700
|
yann@966
|
11 |
@@ -112,11 +112,13 @@
|
yann@966
|
12 |
clrrwi. rALIGN, rLEN, 5
|
yann@966
|
13 |
mtcrf 0x01, rLEN /* 40th instruction from .align */
|
yann@966
|
14 |
|
yann@966
|
15 |
+#ifndef BROKEN_PPC_8xx_CPU15
|
yann@966
|
16 |
/* Check if we can use the special case for clearing memory using dcbz.
|
yann@966
|
17 |
This requires that we know the correct cache line size for this
|
yann@966
|
18 |
processor. Getting the __cache_line_size may require establishing GOT
|
yann@966
|
19 |
addressability, so branch out of line to set this up. */
|
yann@966
|
20 |
beq cr1, L(checklinesize)
|
yann@966
|
21 |
+#endif
|
yann@966
|
22 |
|
yann@966
|
23 |
/* Store blocks of 32-bytes (256-bits) starting on a 32-byte boundary.
|
yann@966
|
24 |
Can't assume that rCHR is zero or that the cache line size is either
|
yann@966
|
25 |
@@ -248,6 +250,7 @@
|
yann@966
|
26 |
stw rCHR, -8(rMEMP)
|
yann@966
|
27 |
blr
|
yann@966
|
28 |
|
yann@966
|
29 |
+#ifndef BROKEN_PPC_8xx_CPU15
|
yann@966
|
30 |
L(checklinesize):
|
yann@966
|
31 |
#ifdef SHARED
|
yann@966
|
32 |
mflr rTMP
|
yann@966
|
33 |
@@ -329,6 +332,7 @@
|
yann@966
|
34 |
L(handletail32):
|
yann@966
|
35 |
clrrwi. rALIGN, rLEN, 5
|
yann@966
|
36 |
b L(nondcbz)
|
yann@966
|
37 |
+#endif /* ! BROKEN_PPC_8xx_CPU15 */
|
yann@966
|
38 |
|
yann@966
|
39 |
END (BP_SYM (memset))
|
yann@966
|
40 |
libc_hidden_builtin_def (memset)
|