summaryrefslogtreecommitdiffstats
path: root/sys/lib/libkern/arch/amd64
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-01-09 05:39:41 +0000
committertedu <tedu@openbsd.org>2014-01-09 05:39:41 +0000
commitc067621f5d6d8289d191d8ceea10ba6c6e328ed8 (patch)
treecbe7de41453782d8623f3289726e475122bb9fbb /sys/lib/libkern/arch/amd64
parentSwitch to string copy rather than memcpy so we stop past '\0' and (diff)
downloadwireguard-openbsd-c067621f5d6d8289d191d8ceea10ba6c6e328ed8.tar.xz
wireguard-openbsd-c067621f5d6d8289d191d8ceea10ba6c6e328ed8.zip
tiny tweak to asm. prefer memcpy and memmove, with bcopy wrapper
ok guenther
Diffstat (limited to 'sys/lib/libkern/arch/amd64')
-rw-r--r--sys/lib/libkern/arch/amd64/memmove.S13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/lib/libkern/arch/amd64/memmove.S b/sys/lib/libkern/arch/amd64/memmove.S
index cf81c4c3880..1516c743660 100644
--- a/sys/lib/libkern/arch/amd64/memmove.S
+++ b/sys/lib/libkern/arch/amd64/memmove.S
@@ -40,11 +40,6 @@
* ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800
*/
-ENTRY(memcpy)
- movq %rdi,%r11 /* save dest */
- movq %rdx,%rcx
- jmp 2f /* jump to forward copy code path */
-
ENTRY(bcopy)
xchgq %rdi,%rsi
/* fall into memmove */
@@ -56,7 +51,13 @@ ENTRY(memmove)
subq %rsi,%rax
cmpq %rcx,%rax /* overlapping? */
jb 1f
-2: cld /* nope, copy forwards. */
+ jmp 2f /* nope */
+
+ENTRY(memcpy)
+ movq %rdi,%r11 /* save dest */
+ movq %rdx,%rcx
+2:
+ cld /* copy forwards. */
shrq $3,%rcx /* copy by words */
rep
movsq