From owner-svn-src-all@freebsd.org Fri Feb 24 12:53:42 2017 Return-Path: Delivered-To: svn-src-all@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 65D7FCEB6FD; Fri, 24 Feb 2017 12:53:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 D7E7F5E6; Fri, 24 Feb 2017 12:53:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v1OCradr028392 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 24 Feb 2017 14:53:36 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v1OCradr028392 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v1OCrZZ3028391; Fri, 24 Feb 2017 14:53:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Feb 2017 14:53:35 +0200 From: Konstantin Belousov To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r314087 - head/sys/x86/x86 Message-ID: <20170224125335.GV2092@kib.kiev.ua> References: <201702220707.v1M7764i020598@repo.freebsd.org> <20170223053954.J1044@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170223053954.J1044@besplex.bde.org> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 12:53:42 -0000 On Thu, Feb 23, 2017 at 06:33:43AM +1100, Bruce Evans wrote: > On Wed, 22 Feb 2017, Konstantin Belousov wrote: > > > Log: > > More fixes for regression in r313898 on i386. > > Use long long constants where needed. > > The long long abomination is never needed, and is always a style bug. I never saw any explanation behind this claim. Esp. the first part of it, WRT 'never needed'. > I don't like using explicit long constants either. Here the number of bits > in the register is fixed by the hardware at 64. The number of bits in a > long on amd64 and a long on i386 is only fixed by ABI because the ABI is > broken for historical reasons. I really cannot make any sense of this statement. > Only very MD code can safely assume the > size of long and long long. This code was MD enough before it was merged, > but now it shouldn't use long since that varies between amd64 and i386, > and it shouldn't use long long since that is a style bug. Well, I do not see anything wrong with long long, at least until explained. Anyway, below is the patch to use uint64_t cast in important place, and removal of LL suffix in unimportant expression. diff --git a/sys/x86/x86/x86_mem.c b/sys/x86/x86/x86_mem.c index d639224f840..8bc4d3917a0 100644 --- a/sys/x86/x86/x86_mem.c +++ b/sys/x86/x86/x86_mem.c @@ -260,7 +260,7 @@ x86_mrfetch(struct mem_range_softc *sc) /* Compute the range from the mask. Ick. */ mrd->mr_len = (~(msrv & mtrr_physmask) & - (mtrr_physmask | 0xfffLL)) + 1; + (mtrr_physmask | 0xfff)) + 1; if (!mrvalid(mrd->mr_base, mrd->mr_len)) mrd->mr_flags |= MDF_BOGUS; @@ -638,7 +638,8 @@ x86_mrinit(struct mem_range_softc *sc) * Determine the size of the PhysMask and PhysBase fields in * the variable range MTRRs. */ - mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) & ~0xfffULL; + mtrr_physmask = (((uint64_t)1 << cpu_maxphyaddr) - 1) & + ~(uint64_t)0xfff; /* If fixed MTRRs supported and enabled. */ if ((mtrrcap & MTRR_CAP_FIXED) && (mtrrdef & MTRR_DEF_FIXED_ENABLE)) {