summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2013-06-09 12:42:22 +0000
committertedu <tedu@openbsd.org>2013-06-09 12:42:22 +0000
commitb2d15859c48601a73f7dec548716b988ddc02721 (patch)
tree8b2e9a1db26f9292c62e676d03a18a3f426c56e3
parentfix an off by one preventing access to the last filesystem. (diff)
downloadwireguard-openbsd-b2d15859c48601a73f7dec548716b988ddc02721.tar.xz
wireguard-openbsd-b2d15859c48601a73f7dec548716b988ddc02721.zip
the kernel is supposed to provide memmove, but some archs are missing it.
add i386 sparc and sparc64. ok deraadt
-rw-r--r--sys/arch/i386/i386/locore.s11
-rw-r--r--sys/arch/sparc/sparc/locore.s10
-rw-r--r--sys/arch/sparc64/sparc64/locore.s9
3 files changed, 24 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s
index ff1516df7cb..c179bbbc840 100644
--- a/sys/arch/i386/i386/locore.s
+++ b/sys/arch/i386/i386/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.145 2012/11/18 12:17:40 sf Exp $ */
+/* $OpenBSD: locore.s,v 1.146 2013/06/09 12:42:22 tedu Exp $ */
/* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */
/*-
@@ -828,10 +828,13 @@ docopy:
ret
/*
- * Emulate memcpy() by loading the first two arguments in reverse order
- * and jumping into bcopy()
+ * Emulate memmove() by loading the first two arguments in reverse order
+ * and jumping into bcopy(), which handles overlapping regions.
+ * memcpy() is not guaranteed to have this guarantee, but it's safe
+ * to offer it (if a bit slower).
*/
-ENTRY(memcpy)
+ALTENTRY(memcpy)
+ENTRY(memmove)
pushl %esi
pushl %edi
movl 12(%esp),%edi
diff --git a/sys/arch/sparc/sparc/locore.s b/sys/arch/sparc/sparc/locore.s
index 7f970cda8e7..3dcd45173cc 100644
--- a/sys/arch/sparc/sparc/locore.s
+++ b/sys/arch/sparc/sparc/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.91 2012/11/05 13:20:16 miod Exp $ */
+/* $OpenBSD: locore.s,v 1.92 2013/06/09 12:42:22 tedu Exp $ */
/* $NetBSD: locore.s,v 1.73 1997/09/13 20:36:48 pk Exp $ */
/*
@@ -4803,6 +4803,14 @@ Lbcopy_done:
1:
retl
stb %o4,[%o1]
+
+ENTRY(memmove)
+ /*
+ * Swap args and continue to ovbcopy.
+ */
+ mov %o0, %o3
+ mov %o1, %o0
+ mov %o3, %o1
/*
* ovbcopy(src, dst, len): like old bcopy, but regions may overlap.
*/
diff --git a/sys/arch/sparc64/sparc64/locore.s b/sys/arch/sparc64/sparc64/locore.s
index 24408c3940d..c6097530b50 100644
--- a/sys/arch/sparc64/sparc64/locore.s
+++ b/sys/arch/sparc64/sparc64/locore.s
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.s,v 1.170 2013/05/12 18:48:53 kettenis Exp $ */
+/* $OpenBSD: locore.s,v 1.171 2013/06/09 12:42:22 tedu Exp $ */
/* $NetBSD: locore.s,v 1.137 2001/08/13 06:10:10 jdolecek Exp $ */
/*
@@ -8548,6 +8548,13 @@ Lkcerr:
mov EFAULT, %o0
NOTREACHED
+ENTRY(memmove) /* dest, src, size */
+ /*
+ * Swap args and continue to ovbcopy.
+ */
+ mov %o0, %o3
+ mov %o1, %o0
+ mov %o3, %o1
/*
* ovbcopy(src, dst, len): like bcopy, but regions may overlap.
*/