From owner-svn-src-all@freebsd.org Fri Feb 15 07:16:05 2019 Return-Path: Delivered-To: svn-src-all@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 0216A14F1FF8; Fri, 15 Feb 2019 07:16:05 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9D08382330; Fri, 15 Feb 2019 07:16:04 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 6B5511A4B6; Fri, 15 Feb 2019 07:16:04 +0000 (UTC) Date: Fri, 15 Feb 2019 07:16:04 +0000 From: Alexey Dokuchaev To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r344118 - head/sys/i386/include Message-ID: <20190215071604.GA89653@FreeBSD.org> References: <201902141353.x1EDrB0Z076223@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201902141353.x1EDrB0Z076223@repo.freebsd.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: 9D08382330 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.93)[-0.934,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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, 15 Feb 2019 07:16:05 -0000 On Thu, Feb 14, 2019 at 01:53:11PM +0000, Konstantin Belousov wrote: > New Revision: 344118 > URL: https://svnweb.freebsd.org/changeset/base/344118 > > Log: > Provide userspace versions of do_cpuid() and cpuid_count() on i386. > > Some older compilers, when generating PIC code, cannot handle inline > asm that clobbers %ebx (because %ebx is used as the GOT offset > register). Userspace versions avoid clobbering %ebx by saving it to > stack before executing the CPUID instruction. > > ... > +static __inline void > +do_cpuid(u_int ax, u_int *p) > +{ > + __asm __volatile( > + "pushl\t%%ebx\n\t" > + "cpuid\n\t" > + "movl\t%%ebx,%1\n\t" > + "popl\t%%ebx" Is there a reason to prefer pushl+movl+popl instead of movl+xchgl? "movl %%ebx, %1\n\t" "cpuid\n\t" "xchgl %%ebx, %1" ./danfe