[ccan] [PATCH 6/6] cpuid: Minor improvements

Emilio G. Cota cota at braap.org
Wed Oct 2 02:56:25 EST 2013


On Wed, Sep 25, 2013 at 14:48:01 +0000, Ahmed Samy wrote:
> Remove the assembly file that checks if the CPUID instruction is
> supported and have it in inline assembly as suggested by Rusty.
> 
> Signed-off-by: Ahmed Samy <f.fallen45 at gmail.com>
(snip)
> --- a/ccan/cpuid/cpuid.c
> +++ b/ccan/cpuid/cpuid.c
(snip)
> -int cpuid_test_feature(cpuid_t feature)
> +bool cpuid_is_supported(void)
> +{
> +	int ret = 0;
> +
> +	asm volatile(
> +		"pushfl\n\t"
> +		"popl %%eax\n\t"
> +		"movl %%eax, %%ecx\n\t"
> +		"xorl $0x200000, %%eax\n\t"
> +		"pushl %%eax\n\t"
> +		"popfl\n\t"
> +
> +		"pushfl\n\t"
> +		"popl %%eax\n\t"
> +		"xorl %%ecx, %%eax\n\t"
> +		"shrl $21, %%eax\n\t"
> +		"andl $1, %%eax\n\t"
> +		"pushl %%ecx\n\t"
> +		"popfl\n\t"
> +
> +		: "=a" (ret)
> +	);

This breaks the build on x86_64! It uses 32-bit encoding
unconditionally; please fix.

Thanks,

		Emilio



More information about the ccan mailing list