on ppc601 do byte-wise copies when in _KERNEL

from scole_mail, ok matt@
This commit is contained in:
macallan 2014-03-03 15:30:31 +00:00
parent 49daa07b4f
commit a00f9ab046

View File

@ -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 */