Module Name: src Committed By: macallan Date: Mon Mar 3 15:30:31 UTC 2014
Modified Files: src/common/lib/libc/arch/powerpc/string: memcpy.S Log Message: on ppc601 do byte-wise copies when in _KERNEL from scole_mail, ok matt@ To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/arch/powerpc/string/memcpy.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/common/lib/libc/arch/powerpc/string/memcpy.S diff -u src/common/lib/libc/arch/powerpc/string/memcpy.S:1.3 src/common/lib/libc/arch/powerpc/string/memcpy.S:1.4 --- src/common/lib/libc/arch/powerpc/string/memcpy.S:1.3 Sat Jan 15 07:31:12 2011 +++ src/common/lib/libc/arch/powerpc/string/memcpy.S Mon Mar 3 15:30:31 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: memcpy.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */ +/* $NetBSD: memcpy.S,v 1.4 2014/03/03 15:30:31 macallan Exp $ */ /* stropt/memcpy_440.S, pl_string_common, pl_linux 10/11/04 11:45:36 * ========================================================================== @@ -52,6 +52,9 @@ */ #include <machine/asm.h> +#ifdef _KERNEL +#include "opt_ppcarch.h" +#endif .text .align 4 @@ -63,6 +66,32 @@ ENTRY(memcpy) cmpwi %r5,0 beqlr- +#if defined(_KERNEL) && defined(PPC_OEA601) + /* + * 601 will generate alignment exceptions if operand crosses + * 4k page boundary, so do byte copy when exception handler + * not available. Maybe want to have a different memcpy for 601 + * that checks for page boundaries/word alignment... + */ + mfspr %r6, 287 /* mfpvbr %r6 PVR = 287 */ + srwi %r6, %r6, 0x10 /* get version field from PVR */ + cmpwi %r6, 0x1 /* 601 CPU = 0x0001 */ + bne bnorm /* skip byte-only unless 601 */ + +bcpy: + mtctr %r5 /* byte copy everything */ + li %r6, 0 +bloop: + lbzx %r7, %r4, %r6 + stbx %r7, %r3, %r6 + addi %r6, %r6, 1 + bdnz bloop + blr + +bnorm: + +#endif + mr %r8, %r3 /* Copy dst (return value) */ addi %r4, %r4, -4 /* Prepare for main loop's auto */