diff options
author | 2014-01-09 05:39:41 +0000 | |
---|---|---|
committer | 2014-01-09 05:39:41 +0000 | |
commit | c067621f5d6d8289d191d8ceea10ba6c6e328ed8 (patch) | |
tree | cbe7de41453782d8623f3289726e475122bb9fbb /sys/lib/libkern/arch/amd64 | |
parent | Switch to string copy rather than memcpy so we stop past '\0' and (diff) | |
download | wireguard-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.S | 13 |
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 |