Page MenuHomeFreeBSD

D15374.id42345.diff
No OneTemporary

D15374.id42345.diff

Index: sys/conf/files.i386
===================================================================
--- sys/conf/files.i386
+++ sys/conf/files.i386
@@ -553,7 +553,6 @@
libkern/divdi3.c standard
libkern/ffsll.c standard
libkern/flsll.c standard
-libkern/memmove.c standard
libkern/memset.c standard
libkern/moddi3.c standard
libkern/qdivrem.c standard
Index: sys/conf/files.mips
===================================================================
--- sys/conf/files.mips
+++ sys/conf/files.mips
@@ -61,7 +61,6 @@
libkern/fls.c standard
libkern/flsl.c standard
libkern/flsll.c standard
-libkern/memmove.c standard
libkern/cmpdi2.c optional mips | mipshf | mipsel | mipselhf
libkern/ucmpdi2.c optional mips | mipshf | mipsel | mipselhf
libkern/ashldi3.c standard
Index: sys/conf/files.powerpc
===================================================================
--- sys/conf/files.powerpc
+++ sys/conf/files.powerpc
@@ -85,6 +85,7 @@
libkern/ashldi3.c optional powerpc | powerpcspe
libkern/ashrdi3.c optional powerpc | powerpcspe
libkern/bcmp.c standard
+libkern/bcopy.c standard
libkern/cmpdi2.c optional powerpc | powerpcspe
libkern/divdi3.c optional powerpc | powerpcspe
libkern/ffs.c standard
@@ -94,7 +95,6 @@
libkern/flsl.c standard
libkern/flsll.c standard
libkern/lshrdi3.c optional powerpc | powerpcspe
-libkern/memmove.c standard
libkern/memset.c standard
libkern/moddi3.c optional powerpc | powerpcspe
libkern/qdivrem.c optional powerpc | powerpcspe
@@ -195,7 +195,6 @@
powerpc/powernv/powernv_xscom.c optional powernv
powerpc/powerpc/altivec.c optional powerpc | powerpc64
powerpc/powerpc/autoconf.c standard
-powerpc/powerpc/bcopy.c standard
powerpc/powerpc/bus_machdep.c standard
powerpc/powerpc/busdma_machdep.c standard
powerpc/powerpc/clock.c standard
Index: sys/conf/files.riscv
===================================================================
--- sys/conf/files.riscv
+++ sys/conf/files.riscv
@@ -12,16 +12,15 @@
kern/subr_devmap.c standard
kern/subr_dummy_vdso_tc.c standard
libkern/bcmp.c standard
+libkern/bcopy.c standard
libkern/ffs.c standard
libkern/ffsl.c standard
libkern/ffsll.c standard
libkern/fls.c standard
libkern/flsl.c standard
libkern/flsll.c standard
-libkern/memmove.c standard
libkern/memset.c standard
riscv/riscv/autoconf.c standard
-riscv/riscv/bcopy.c standard
riscv/riscv/bus_machdep.c standard
riscv/riscv/bus_space_asm.S standard
riscv/riscv/busdma_machdep.c standard
Index: sys/conf/files.sparc64
===================================================================
--- sys/conf/files.sparc64
+++ sys/conf/files.sparc64
@@ -71,7 +71,6 @@
libkern/fls.c standard
libkern/flsl.c standard
libkern/flsll.c standard
-libkern/memmove.c standard
sparc64/central/central.c optional central
sparc64/ebus/ebus.c optional ebus
sparc64/ebus/epic.c optional epic ebus
Index: sys/i386/i386/support.s
===================================================================
--- sys/i386/i386/support.s
+++ sys/i386/i386/support.s
@@ -145,38 +145,8 @@
ret
END(fillw)
-ENTRY(bcopyb)
- pushl %esi
- pushl %edi
- movl 12(%esp),%esi
- movl 16(%esp),%edi
- movl 20(%esp),%ecx
- movl %edi,%eax
- subl %esi,%eax
- cmpl %ecx,%eax /* overlapping && src < dst? */
- jb 1f
- rep
- movsb
- popl %edi
- popl %esi
- ret
-
- ALIGN_TEXT
-1:
- addl %ecx,%edi /* copy backwards. */
- addl %ecx,%esi
- decl %edi
- decl %esi
- std
- rep
- movsb
- popl %edi
- popl %esi
- cld
- ret
-END(bcopyb)
-
/*
+ * memmove(dst, src, cnt) (return dst)
* bcopy(src, dst, cnt)
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/
@@ -187,6 +157,15 @@
pushl %edi
movl 8(%ebp),%esi
movl 12(%ebp),%edi
+ jmp 1f
+ALTENTRY(memmove)
+ pushl %ebp
+ movl %esp,%ebp
+ pushl %esi
+ pushl %edi
+ movl 8(%ebp),%edi
+ movl 12(%ebp),%esi
+1:
movl 16(%ebp),%ecx
movl %edi,%eax
@@ -203,6 +182,7 @@
movsb
popl %edi
popl %esi
+ movl 8(%ebp),%eax /* return dst for memmove */
popl %ebp
ret
@@ -225,6 +205,7 @@
popl %edi
popl %esi
cld
+ movl 8(%ebp),%eax /* return dst for memmove */
popl %ebp
ret
END(bcopy)
Index: sys/i386/include/md_var.h
===================================================================
--- sys/i386/include/md_var.h
+++ sys/i386/include/md_var.h
@@ -54,7 +54,6 @@
struct segment_descriptor;
union savefpu;
-void bcopyb(const void *from, void *to, size_t len);
int cp_slow0(vm_offset_t uva, size_t len, bool write,
void (*f)(vm_offset_t, void *), void *arg);
void cpu_switch_load_gs(void) __asm(__STRING(cpu_switch_load_gs));
Index: sys/libkern/bcopy.c
===================================================================
--- sys/libkern/bcopy.c
+++ sys/libkern/bcopy.c
@@ -50,6 +50,10 @@
#include <string.h>
#endif
+#undef memcpy
+#undef memmove
+#undef bcopy
+
/*
* sizeof(word) MUST BE A POWER OF TWO
* SO THAT wmask BELOW IS ALL ONES
@@ -142,6 +146,8 @@
return (dst0);
}
+__strong_reference(memcpy, memmove);
+
void
(bcopy)(const void *src0, void *dst0, size_t length)
{
Index: sys/libkern/memmove.c
===================================================================
--- sys/libkern/memmove.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
- *
- * Copyright (c) 2009 Roman Divacky <rdivacky@FreeBSD.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * 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.
-*/
-
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/libkern.h>
-
-void *
-memmove(void *dest, const void *src, size_t n)
-{
-
- bcopy(src, dest, n);
- return (dest);
-}
Index: sys/mips/mips/bcopy.S
===================================================================
--- sys/mips/mips/bcopy.S
+++ sys/mips/mips/bcopy.S
@@ -65,6 +65,7 @@
#define SIZEREG a2
LEAF(memcpy)
+XLEAF(memmove)
.set noat
.set noreorder
Index: sys/sparc64/sparc64/support.S
===================================================================
--- sys/sparc64/sparc64/support.S
+++ sys/sparc64/sparc64/support.S
@@ -265,9 +265,17 @@
END(bcmp)
/*
+ * void *memmove(void *dst, const void *src, size_t len)
* void bcopy(const void *src, void *dst, size_t len)
*/
-ENTRY(bcopy)
+ENTRY(memmove)
+ /*
+ * Swap src/dst for memmove/bcopy differences
+ */
+ mov %o0, %o6
+ mov %o1, %o0
+ mov %o6, %o1
+ALTENTRY(bcopy)
/*
* Check for overlap, and copy backwards if so.
*/
@@ -290,15 +298,15 @@
ba %xcc, 1b
stb %g1, [%o1]
2: retl
- nop
+ mov %o6, %o0
/*
* Do the fast version.
*/
3: _MEMCPY(%o1, %o0, %o2, EMPTY, EMPTY, EMPTY, EMPTY)
retl
- nop
-END(bcopy)
+ mov %o6, %o0
+END(memmove)
/*
* void bzero(void *b, size_t len)

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 7:33 AM (13 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15933692
Default Alt Text
D15374.id42345.diff (7 KB)

Event Timeline