Commit 5077a231 authored by Christophe Massiot's avatar Christophe Massiot

* src/misc/cpu.c: Fixed the use of cpuid() on amd64 (thanks to Aison on

   IRC).
parent d1667dd5
......@@ -84,6 +84,19 @@ uint32_t CPUCapabilities( void )
volatile vlc_bool_t b_amd;
/* Needed for x86 CPU capabilities detection */
# if defined( __x86_64__ )
# define cpuid( reg ) \
asm volatile ( "push %%rbx\n\t" \
"cpuid\n\t" \
"movl %%ebx,%1\n\t" \
"pop %%rbx\n\t" \
: "=a" ( i_eax ), \
"=r" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( reg ) \
: "cc" );
# else
# define cpuid( reg ) \
asm volatile ( "push %%ebx\n\t" \
"cpuid\n\t" \
......@@ -95,6 +108,7 @@ uint32_t CPUCapabilities( void )
"=d" ( i_edx ) \
: "a" ( reg ) \
: "cc" );
# endif
# if defined( CAN_COMPILE_SSE ) || defined ( CAN_COMPILE_3DNOW ) \
&& defined( HAVE_SIGNAL_H )
......@@ -103,6 +117,8 @@ uint32_t CPUCapabilities( void )
i_capabilities |= CPU_CAPABILITY_FPU;
# if defined( __i386__ )
/* check if cpuid instruction is supported */
asm volatile ( "push %%ebx\n\t"
"pushf\n\t"
"pop %%eax\n\t"
......@@ -127,6 +143,9 @@ uint32_t CPUCapabilities( void )
# endif
return i_capabilities;
}
# else
/* x86_64 supports cpuid instruction, so we dont need to check it */
# endif
i_capabilities |= CPU_CAPABILITY_486;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment