From owner-svn-ports-all@freebsd.org Mon Aug 31 08:15:34 2015 Return-Path: Delivered-To: svn-ports-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 52EAD9C6FFA; Mon, 31 Aug 2015 08:15:34 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay102.isp.belgacom.be (mailrelay102.isp.belgacom.be [195.238.20.129]) by mx1.freebsd.org (Postfix) with ESMTP id 67DDA289; Mon, 31 Aug 2015 08:15:32 +0000 (UTC) (envelope-from tijl@freebsd.org) X-Belgacom-Dynamic: yes X-Cloudmark-SP-Filtered: true X-Cloudmark-SP-Result: v=1.1 cv=d6O4W030xngO5QkzyDOul/vmjwC4sFqcTOV5kZr+d1k= c=1 sm=2 a=6I5d2MoRAAAA:8 a=bw0os7FHgZ3n6nItbL4A:9 a=CjuIK1q_8ugA:10 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A2B/BgB9C+RV/4OL8VFegxtUWg/AIoV7AoEfPBEBAQEBAQEBgQqEJAEBBDocIxALDgYECSUPKh4GE4gyAQjBQQEBAQEBAQEDAQEBAQEBARcEi2uEWDMHhCwBBJVBhQeHalKaGyaCDxyBVjwzgk0BAQE Received: from 131.139-241-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.241.139.131]) by relay.skynet.be with ESMTP; 31 Aug 2015 10:14:21 +0200 Received: from kalimero.tijl.coosemans.org (kalimero.tijl.coosemans.org [127.0.0.1]) by kalimero.tijl.coosemans.org (8.15.2/8.15.2) with ESMTP id t7V8ELon001509; Mon, 31 Aug 2015 10:14:21 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Mon, 31 Aug 2015 10:14:21 +0200 From: Tijl Coosemans To: Alexey Dokuchaev Cc: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: Re: svn commit: r395648 - head/graphics/appleseed/files Message-ID: <20150831101421.4a9f0528@kalimero.tijl.coosemans.org> In-Reply-To: <201508310442.t7V4gxnm038292@repo.freebsd.org> References: <201508310442.t7V4gxnm038292@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Aug 2015 08:15:34 -0000 On Mon, 31 Aug 2015 04:42:59 +0000 (UTC) Alexey Dokuchaev wrote: > Author: danfe > Date: Mon Aug 31 04:42:58 2015 > New Revision: 395648 > URL: https://svnweb.freebsd.org/changeset/ports/395648 > > Log: > - Use %edi register to save/restore contents of %ebx instead of pushing > it on stack to make the code work for both 32/64-bit x86 > - Make the corresponding comment more accurate while I'm at it > > Reported by: pkg-fallout > > Modified: > head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp > > Modified: head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp > ============================================================================== > --- head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp Mon Aug 31 02:54:15 2015 (r395647) > +++ head/graphics/appleseed/files/patch-src_appleseed_foundation_platform_system.cpp Mon Aug 31 04:42:58 2015 (r395648) > @@ -15,7 +15,7 @@ > // Other platforms. > #else > > -@@ -421,6 +429,384 @@ uint64 System::get_process_virtual_memor > +@@ -421,6 +429,386 @@ uint64 System::get_process_virtual_memor > return static_cast(rss) * sysconf(_SC_PAGESIZE); > } > > @@ -43,16 +43,17 @@ > + size_t linesize; > +} mycaches[3]; > + > -+// %ebx may be used to store GOT (Global Offset Table) for PIC (Position > -+// Independent Code), so use %esi instead. > ++// %ebx is used to point to GOT (Global Offset Table) for PIC (Position > ++// Independent Code) on 32-bit x86, so use %edi to preserve %ebx across > ++// the call and %esi when passing CPUID arguments and return values. > +static inline void > +cpuid(uint32_t* data) > +{ > -+ asm("pushl %%ebx\n\t" > ++ asm("movl %%ebx, %%edi\n\t" > + "movl %%esi, %%ebx\n\t" > + "cpuid\n\t" > + "movl %%ebx, %%esi\n\t" > -+ "popl %%ebx" > ++ "movl %%edi, %%ebx" > + : "=a" (data[eax]), > + "=S" (data[ebx]), > + "=c" (data[ecx]), > @@ -60,7 +61,8 @@ > + : "a" (data[eax]), > + "S" (data[ebx]), > + "c" (data[ecx]), > -+ "d" (data[edx])); > ++ "d" (data[edx]) > ++ : "%edi"); > +} > + > +// For modern CPUs, we use Deterministic Cache Parameters (Function 04h) to You can simply use: asm("cpuid" : "+a" (data[eax]), "=b" (data[ebx]), "+c" (data[ecx]), "=d" (data[edx])); The compiler will preserve any registers if necessary. It might have saved ebx somewhere already for some other reason. Also, for cpuid eax and ecx are intput/output and ebx and edx are output only.