|
From: Kenn H. <ke...@us...> - 2004-09-28 22:24:49
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/boot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30901 Modified Files: lib.c Log Message: There's no reason why we shouldn't plagiarize lib/string.c for our boot_memset and boot_memmove functions! Index: lib.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/lib.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- lib.c 28 Sep 2004 08:48:52 -0000 1.3 +++ lib.c 28 Sep 2004 22:24:39 -0000 1.4 @@ -1,5 +1,6 @@ #include <linux/init.h> +#include <linux/types.h> #include <asm/mv.h> @@ -52,12 +53,38 @@ } } -void __boot boot_memzero(unsigned char *addr, unsigned int size) + + +void * __boot boot_memset(void *s, int c, size_t count) { - while (size) { - *addr = 0; - addr++; - size--; + char *xs = (char *) s; + + while (count--) + *xs++ = c; + + return s; +} + +void * __boot boot_memzero(void *s, size_t count) +{ + return boot_memset(s, 0, count); +} + + +void __boot boot_memmove(void *dest, const void *src, size_t count) +{ + char *tmp, *s; + + if (dest <= src) { + tmp = (char *) dest; + s = (char *) src; + while (count--) + *tmp++ = *s++; + } else { + tmp = (char *) dest + count; + s = (char *) src + count; + while (count--) + *--tmp = *--s; } } |