Date: Fri, 15 Feb 2019 07:16:04 +0000 From: Alexey Dokuchaev <danfe@freebsd.org> To: Konstantin Belousov <kib@freebsd.org> 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> In-Reply-To: <201902141353.x1EDrB0Z076223@repo.freebsd.org> References: <201902141353.x1EDrB0Z076223@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190215071604.GA89653>