Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2015 09:45:31 +0000
From:      Alexey Dokuchaev <danfe@FreeBSD.org>
To:        Tijl Coosemans <tijl@FreeBSD.org>
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:  <20150831094531.GA25459@FreeBSD.org>
In-Reply-To: <20150831101421.4a9f0528@kalimero.tijl.coosemans.org>
References:  <201508310442.t7V4gxnm038292@repo.freebsd.org> <20150831101421.4a9f0528@kalimero.tijl.coosemans.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 31, 2015 at 10:14:21AM +0200, Tijl Coosemans wrote:
> On Mon, 31 Aug 2015 04:42:59 +0000 (UTC) Alexey Dokuchaev <danfe@FreeBSD.org> 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
> > [...]
> 
> 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.

Thanks Tijl, your version looks definitely cleaner!

> Also, for cpuid eax and ecx are intput/output and ebx and edx are
> output only.

Yeah, I was suspecting it, but was too lazy to dig up the manual again.

./danfe



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150831094531.GA25459>