Date: Mon, 7 May 2018 20:54:42 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333332 - head/sys/amd64/amd64 Message-ID: <201805072054.w47KsgJV014728@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Mon May 7 20:54:42 2018 New Revision: 333332 URL: https://svnweb.freebsd.org/changeset/base/333332 Log: amd64: fix up memset added in r333324 There was a missing trick expanding the passed pattern to a full word by multiplication. As a side effect non-zero patterns would be incorrectly laid down. This stems from the use of rep stosq which is word-sized, while the passed argument is byte-sized. I initially repurposed memcpy into memset without taking this into account. All but non-bzero testing was performed with a variant utilizing ERMS, i.e. using only stosb which happens to not into the problem whatsoever. So my bad twice. Thanks to Oliver Pinter for noting the problem and providing a testcase. Modified: head/sys/amd64/amd64/support.S Modified: head/sys/amd64/amd64/support.S ============================================================================== --- head/sys/amd64/amd64/support.S Mon May 7 20:41:24 2018 (r333331) +++ head/sys/amd64/amd64/support.S Mon May 7 20:54:42 2018 (r333332) @@ -239,7 +239,8 @@ ENTRY(memset) PUSH_FRAME_POINTER movq %rdi,%r9 movq %rdx,%rcx - movq %rsi,%rax + movabs $0x0101010101010101,%rax + imulq %rsi,%rax shrq $3,%rcx rep stosq
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805072054.w47KsgJV014728>