Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
On 19/11/2018 14:52, Mihai Donțu wrote: > On Mon, 2018-11-19 at 13:29 +, Andrew Cooper wrote: >> On 19/11/2018 13:11, Andrew Cooper wrote: >>> Some versions of GCC can't compile cpuid.c, and fail with the rather >>> cryptic: >>> >>> In file included from lib/x86/cpuid.c:3:0: >>> lib/x86/cp

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Mihai Donțu
On Mon, 2018-11-19 at 13:29 +, Andrew Cooper wrote: > On 19/11/2018 13:11, Andrew Cooper wrote: > > Some versions of GCC can't compile cpuid.c, and fail with the rather > > cryptic: > > > > In file included from lib/x86/cpuid.c:3:0: > > lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Jan Beulich
>>> On 19.11.18 at 15:33, wrote: > On 19/11/2018 13:51, Jan Beulich wrote: >>> static inline void cpuid_leaf(uint32_t leaf, struct cpuid_leaf *l) >>> { >>> -asm ( "cpuid" >>> - : "=a" (l->a), "=b" (l->b), "=c" (l->c), "=d" (l->d) >>> +asm ( XCHG_BX >>> + "cpuid;" >>> +

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
On 19/11/2018 13:51, Jan Beulich wrote: >> static inline void cpuid_leaf(uint32_t leaf, struct cpuid_leaf *l) >> { >> -asm ( "cpuid" >> - : "=a" (l->a), "=b" (l->b), "=c" (l->c), "=d" (l->d) >> +asm ( XCHG_BX >> + "cpuid;" >> + XCHG_BX >> + : "=a" (l->a

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
On 19/11/2018 14:23, Jan Beulich wrote: On 19.11.18 at 15:08, wrote: >> On 19/11/2018 13:51, Jan Beulich wrote: >> On 19.11.18 at 14:11, wrote: In practice, this is a collision between the output constraint and the GOT which is held in %ebx when compiling with -fPIC for librari

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Jan Beulich
>>> On 19.11.18 at 15:08, wrote: > On 19/11/2018 13:51, Jan Beulich wrote: > On 19.11.18 at 14:11, wrote: >>> In practice, this is a collision between the output constraint and the GOT >>> which is held in %ebx when compiling with -fPIC for libraries. >>> >>> This affects at least GCC 4.9 as

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Jan Beulich
>>> On 19.11.18 at 15:08, wrote: > On 19/11/2018 13:51, Jan Beulich wrote: > On 19.11.18 at 14:11, wrote: >>> --- a/xen/include/xen/lib/x86/cpuid.h >>> +++ b/xen/include/xen/lib/x86/cpuid.h >>> @@ -20,21 +20,48 @@ struct cpuid_leaf >>> uint32_t a, b, c, d; >>> }; >>> >>> +/* >>> + * S

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
On 19/11/2018 13:51, Jan Beulich wrote: On 19.11.18 at 14:11, wrote: >> Some versions of GCC can't compile cpuid.c, and fail with the rather cryptic: >> >> In file included from lib/x86/cpuid.c:3:0: >> lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_native’: >> include/xen/lib/x86/c

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Jan Beulich
>>> On 19.11.18 at 14:11, wrote: > Some versions of GCC can't compile cpuid.c, and fail with the rather cryptic: > > In file included from lib/x86/cpuid.c:3:0: > lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_native’: > include/xen/lib/x86/cpuid.h:25:5: error: inconsistent operand cons

Re: [Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
On 19/11/2018 13:11, Andrew Cooper wrote: > Some versions of GCC can't compile cpuid.c, and fail with the rather cryptic: > > In file included from lib/x86/cpuid.c:3:0: > lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_native’: > include/xen/lib/x86/cpuid.h:25:5: error: inconsistent opera

[Xen-devel] [PATCH] libx86: Work around GCC bug with ebx output constrants

2018-11-19 Thread Andrew Cooper
Some versions of GCC can't compile cpuid.c, and fail with the rather cryptic: In file included from lib/x86/cpuid.c:3:0: lib/x86/cpuid.c: In function ‘x86_cpuid_policy_fill_native’: include/xen/lib/x86/cpuid.h:25:5: error: inconsistent operand constraints in an ‘asm’ asm ( "cpuid"