From owner-svn-src-head@freebsd.org Mon Mar 27 16:18:21 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 27FDDD20C7F; Mon, 27 Mar 2017 16:18:21 +0000 (UTC) (envelope-from markj@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 mx1.freebsd.org (Postfix) with ESMTPS id EBC1697; Mon, 27 Mar 2017 16:18:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v2RGIK6n063580; Mon, 27 Mar 2017 16:18:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2RGIKtl063579; Mon, 27 Mar 2017 16:18:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201703271618.v2RGIKtl063579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 27 Mar 2017 16:18:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316031 - head/sys/i386/include X-SVN-Group: head 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.23 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, 27 Mar 2017 16:18:21 -0000 Author: markj Date: Mon Mar 27 16:18:19 2017 New Revision: 316031 URL: https://svnweb.freebsd.org/changeset/base/316031 Log: Adjust the constraint for "src" in atomic_(f)cmpset_8. "r" is not sufficient to prevent the use of invalid byte-width registers with at least gcc. Reported and reviewed by: bde X-MFC-With: r315718 Modified: head/sys/i386/include/atomic.h Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Mon Mar 27 16:01:44 2017 (r316030) +++ head/sys/i386/include/atomic.h Mon Mar 27 16:18:19 2017 (r316031) @@ -182,7 +182,7 @@ struct __hack * * Returns 0 on failure, non-zero on success. */ -#define ATOMIC_CMPSET(TYPE) \ +#define ATOMIC_CMPSET(TYPE, CONS) \ static __inline int \ atomic_cmpset_##TYPE(volatile u_##TYPE *dst, u_##TYPE expect, u_##TYPE src) \ { \ @@ -196,7 +196,7 @@ atomic_cmpset_##TYPE(volatile u_##TYPE * : "=q" (res), /* 0 */ \ "+m" (*dst), /* 1 */ \ "+a" (expect) /* 2 */ \ - : "r" (src) /* 3 */ \ + : CONS (src) /* 3 */ \ : "memory", "cc"); \ return (res); \ } \ @@ -214,14 +214,14 @@ atomic_fcmpset_##TYPE(volatile u_##TYPE : "=q" (res), /* 0 */ \ "+m" (*dst), /* 1 */ \ "+a" (*expect) /* 2 */ \ - : "r" (src) /* 3 */ \ + : CONS (src) /* 3 */ \ : "memory", "cc"); \ return (res); \ } -ATOMIC_CMPSET(char); -ATOMIC_CMPSET(short); -ATOMIC_CMPSET(int); +ATOMIC_CMPSET(char, "q"); +ATOMIC_CMPSET(short, "r"); +ATOMIC_CMPSET(int, "r"); /* * Atomically add the value of v to the integer pointed to by p and return