From a442972318b1cece238dcd824aac3d4f98a52ffa Mon Sep 17 00:00:00 2001 From: bde Date: Sun, 20 Apr 1997 12:09:18 +0000 Subject: Merged with the 1996/11/12 NetBSD version: - use a slightly less bogus copyright. This file was never contributed to Berkeley. It still claims to be copright by the Regents. - use instead of "DEFS.h". - use RCSID($Id$) instead of explicit assembly code and messy ifdefs. The rcsid won't be put into the object file until we make RCSID() non-null. NetBSD uses a LIBC_SCCS ifdef here. We used a LIBC_RCS instead, but I want RCSID() to be controlled directly by LIBC_RCS (actually by LIB_RCS). This is the only difference with the NetBSD version. - added ifdefs to support generation of memcpy() and memmove(). The other changes are "while I'm here" to get this. - improved style of the copy backwards case. --- lib/libc/i386/string/bcopy.S | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/libc/i386/string/bcopy.S b/lib/libc/i386/string/bcopy.S index 21f0d41..d2a571e 100644 --- a/lib/libc/i386/string/bcopy.S +++ b/lib/libc/i386/string/bcopy.S @@ -2,7 +2,7 @@ * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * - * This code is derived from software contributed to Berkeley by + * This code is derived from locore.s. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -31,27 +31,35 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $Id$ */ -#if defined(LIBC_RCS) && !defined(lint) - .text - .asciz "$Id$" -#endif /* LIBC_RCS and not lint */ +#include -#include "DEFS.h" + RCSID("$NetBSD: bcopy.S,v 1.6 1996/11/12 00:50:06 jtc Exp $") /* * (ov)bcopy (src,dst,cnt) * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 */ +#ifdef MEMCOPY +ENTRY(memcpy) +#else +#ifdef MEMMOVE +ENTRY(memmove) +#else ENTRY(bcopy) +#endif +#endif pushl %esi pushl %edi +#if defined(MEMCOPY) || defined(MEMMOVE) + movl 12(%esp),%edi + movl 16(%esp),%esi +#else movl 12(%esp),%esi movl 16(%esp),%edi +#endif movl 20(%esp),%ecx movl %edi,%eax subl %esi,%eax @@ -65,16 +73,19 @@ ENTRY(bcopy) andl $3,%ecx /* any bytes left? */ rep movsb +#if defined(MEMCOPY) || defined(MEMMOVE) + movl 12(%esp),%eax +#endif popl %edi popl %esi ret 1: addl %ecx,%edi /* copy backwards. */ addl %ecx,%esi + std + andl $3,%ecx /* any fractional bytes? */ decl %edi decl %esi - andl $3,%ecx /* any fractional bytes? */ - std rep movsb movl 20(%esp),%ecx /* copy remainder by words */ @@ -83,6 +94,9 @@ ENTRY(bcopy) subl $3,%edi rep movsl +#if defined(MEMCOPY) || defined(MEMMOVE) + movl 12(%esp),%eax +#endif popl %edi popl %esi cld -- cgit v1.1