From owner-svn-src-head@freebsd.org Mon May 7 20:54:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA59FBC99E; Mon, 7 May 2018 20:54:43 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF92568F26; Mon, 7 May 2018 20:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DC005208A3; Mon, 7 May 2018 20:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w47Ksg0f014729; Mon, 7 May 2018 20:54:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w47KsgJV014728; Mon, 7 May 2018 20:54:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201805072054.w47KsgJV014728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Mon, 7 May 2018 20:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333332 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 333332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 May 2018 20:54:43 -0000 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