Commit f942343d authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Improve x86 cpuid

There is no need for hoops around EBX for non-PIC code.
parent 35a45488
...@@ -105,28 +105,21 @@ void vlc_CPU_init (void) ...@@ -105,28 +105,21 @@ void vlc_CPU_init (void)
bool b_amd; bool b_amd;
/* Needed for x86 CPU capabilities detection */ /* Needed for x86 CPU capabilities detection */
# if defined( __x86_64__ ) # if defined (__i386__) && defined (__PIC__)
# define cpuid( reg ) \ # define cpuid(reg) \
asm volatile ( "cpuid\n\t" \ asm volatile ("xchgl %%ebx,%1\n\t" \
: "=a" ( i_eax ), \ "cpuid\n\t" \
"=b" ( i_ebx ), \ "xchgl %%ebx,%1\n\t" \
"=c" ( i_ecx ), \ : "=a" (i_eax), "=r" (i_ebx), "=c" (i_ecx), "=d" (i_edx) \
"=d" ( i_edx ) \ : "a" (reg) \
: "a" ( reg ) \ : "cc");
: "cc" ); # else
# else # define cpuid(reg) \
# define cpuid( reg ) \ asm volatile ("cpuid\n\t" \
asm volatile ( "push %%ebx\n\t" \ : "=a" (i_eax), "=b" (i_ebx), "=c" (i_ecx), "=d" (i_edx) \
"cpuid\n\t" \ : "a" (reg) \
"movl %%ebx,%1\n\t" \ : "cc");
"pop %%ebx\n\t" \ # endif
: "=a" ( i_eax ), \
"=r" ( i_ebx ), \
"=c" ( i_ecx ), \
"=d" ( i_edx ) \
: "a" ( reg ) \
: "cc" );
# endif
/* Check if the OS really supports the requested instructions */ /* Check if the OS really supports the requested instructions */
# if defined (__i386__) && !defined (__i486__) && !defined (__i586__) \ # if defined (__i386__) && !defined (__i486__) && !defined (__i586__) \
&& !defined (__i686__) && !defined (__pentium4__) \ && !defined (__i686__) && !defined (__pentium4__) \
......
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