Revert amd64: tidy up kernel memmove

There is a braino in the non-erms variant which breaks the
functionality.

Will be fixed at a later time with a different patch.

Reported by:	Manfred Antar
Approved by:	re (implicit)
This commit is contained in:
Mateusz Guzik 2018-09-16 21:46:27 +00:00
parent 234afdb9cc
commit 9d1b868da0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=338702

View File

@ -108,12 +108,12 @@ END(sse2_pagezero)
*/
ENTRY(memmove_std)
PUSH_FRAME_POINTER
movq %rdi,%rax
movq %rdi,%r9
movq %rdx,%rcx
movq %rdi,%r8
subq %rsi,%r8
cmpq %rcx,%r8 /* overlapping && src < dst? */
movq %rdi,%rax
subq %rsi,%rax
cmpq %rcx,%rax /* overlapping && src < dst? */
jb 1f
shrq $3,%rcx /* copy by 64-bit words */
@ -128,6 +128,7 @@ ENTRY(memmove_std)
2:
rep
movsb
movq %r9,%rax
POP_FRAME_POINTER
ret
@ -139,10 +140,8 @@ ENTRY(memmove_std)
decq %rsi
andq $7,%rcx /* any fractional bytes? */
std
jne 3f
rep
movsb
3:
movq %rdx,%rcx /* copy remainder by 32-bit words */
shrq $3,%rcx
subq $7,%rsi
@ -150,22 +149,24 @@ ENTRY(memmove_std)
rep
movsq
cld
movq %r9,%rax
POP_FRAME_POINTER
ret
END(memmove_std)
ENTRY(memmove_erms)
PUSH_FRAME_POINTER
movq %rdi,%rax
movq %rdi,%r9
movq %rdx,%rcx
movq %rdi,%r8
subq %rsi,%r8
cmpq %rcx,%r8 /* overlapping && src < dst? */
movq %rdi,%rax
subq %rsi,%rax
cmpq %rcx,%rax /* overlapping && src < dst? */
jb 1f
rep
movsb
movq %r9,%rax
POP_FRAME_POINTER
ret
@ -178,6 +179,7 @@ ENTRY(memmove_erms)
rep
movsb
cld
movq %r9,%rax
POP_FRAME_POINTER
ret
END(memmove_erms)