Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/common/lib/libc/arch/powerpc/string on ppc601 do byte-wise c...



details:   https://anonhg.NetBSD.org/src/rev/25dab6e8e3fd
branches:  trunk
changeset: 794012:25dab6e8e3fd
user:      macallan <macallan%NetBSD.org@localhost>
date:      Mon Mar 03 15:30:31 2014 +0000

description:
on ppc601 do byte-wise copies when in _KERNEL
from scole_mail, ok matt@

diffstat:

 common/lib/libc/arch/powerpc/string/memcpy.S |  31 +++++++++++++++++++++++++++-
 1 files changed, 30 insertions(+), 1 deletions(-)

diffs (52 lines):

diff -r 996fcf571d22 -r 25dab6e8e3fd common/lib/libc/arch/powerpc/string/memcpy.S
--- a/common/lib/libc/arch/powerpc/string/memcpy.S      Mon Mar 03 14:26:32 2014 +0000
+++ b/common/lib/libc/arch/powerpc/string/memcpy.S      Mon Mar 03 15:30:31 2014 +0000
@@ -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 @@
        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 */



Home | Main Index | Thread Index | Old Index