memcpy patch = problem, solved.

Michel LESPINASSE (walken@via.ecp.fr)
Sun, 15 Sep 1996 20:30:30 +0200 (MET DST)


Okay, I have to admit that this was only a silly bug that I should have
corrected myself before reporting to this list.

The problem was only that the memcpy patch (the one we can get on Robert
Krawitz's page) does not apply cleanly on linux 2.0.19 and over.
I didn't noticed this because I didn't got any .rej files, only a
"Hunk #1 succeeded at 5 with fuzz 2." on linux/arch/i386/lib/Makefile...
(I use patch version 2.1)

I had so many linking errors that I was only able to scrollback to those
that concerned the sound driver :-/

The fix is trivial : you have to change " L_OBJS = checksum.o" in the
memcpy patch by : " L_OBJS = checksum.o semaphore.o"

I'm sorry for making some people on this list loose their time :(((
[but btw I'm surprised that nobody noticed that the memcpy patch cannot
apply on >2.0.18 kernels.... that's strange. do they use another version
of patch ??? or another version of the memcpy patch ??? or did they made
themselves the obvious changes and then forgot about them ?]

If that can help you to pardon me, I will include here another
modification to the memcopy patch that some of us use here, in order to
have it work with the experimental ntfs file system driver. First I
believed that I had a problem of the same kind with the sound driver, but
that wasn't the case :-) This patch just ensures that the function
prototypes in the memcpy-patch are consistent with themselves. You have to
apply this one over the memcpy patch.

diff -ur linux/arch/i386/lib/copy.c.orig linux/arch/i386/lib/copy.c
--- linux/arch/i386/lib/copy.c.orig Tue Jul 23 02:50:17 1996
+++ linux/arch/i386/lib/copy.c Fri Jul 26 03:23:05 1996
@@ -21,9 +21,12 @@
* Clearing and restoring the TS bit in the cr0 register fixes a memory
* corruption bug, per Gerhard Koerting
* <G.Koerting@koerting.techem.ruhr-uni-bochum.de>
+ *
+ * Function must return its first argument, as memset does.
+ * Fixed by Regis Duchesne, at VIA, ECP, France <regis@via.ecp.fr>
*/

-void
+void *
___zero_chunk (void *_to, size_t _bytes)
{
unsigned long temp0, temp1;
@@ -87,6 +90,7 @@
: "D" (to), "a" (0), "c" (bytes), "d" (bytes)
: "cx","memory");
}
+ return _to;
}

void *
diff -ur linux/include/asm-i386/string-486.h.orig linux/include/asm-i386/string-486.h
--- linux/include/asm-i386/string-486.h.orig Tue Jul 23 02:50:17 1996
+++ linux/include/asm-i386/string-486.h Fri Jul 26 03:33:22 1996
@@ -560,7 +560,7 @@

#define __HAVE_ARCH_MEMSET
#ifdef CONFIG_M586_COPY
-extern void ___zero_chunk(void *to, size_t bytes);
+extern void * ___zero_chunk(void *to, size_t bytes);
#define memset(s, c, count) \
((((c) == 0) && !(((unsigned long) s) & 7) && !((count) & 7) && ((count) >= 512)) ? \
___zero_chunk((s),(count)) : \
diff -ur linux/include/asm-i386/string.h.orig linux/include/asm-i386/string.h
--- linux/include/asm-i386/string.h.orig Tue Jul 23 02:50:17 1996
+++ linux/include/asm-i386/string.h Fri Jul 26 03:34:50 1996
@@ -609,7 +609,7 @@

#define __HAVE_ARCH_MEMSET
#ifdef CONFIG_M586_COPY
-extern void ___zero_chunk(void *to, size_t bytes);
+extern void * ___zero_chunk(void *to, size_t bytes);
#define memset(s, c, count) \
(((c) == 0) && ((count) >= 512) ? \
___zero_chunk((s),(count)) : \

Michel "Walken" LESPINASSE - Student at Ecole Centrale Paris (France)
www Email : walken@via.ecp.fr
(o o) Http : www.via.ecp.fr/~walken/
------oOO--(_)--OOo--------------------------------------------------