267267 : "0"(__leaf), "2"(__count))
268268#else
269269/* x86-64 uses %rbx as the base register, so preserve it. */
270- #define __cpuid (__leaf , __eax , __ebx , __ecx , __edx ) \
271- __asm(" xchgq %% rbx,%q1\n" \
272- " cpuid\n" \
273- " xchgq %% rbx,%q1" \
274- : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
270+ #define __cpuid (__leaf , __eax , __ebx , __ecx , __edx ) \
271+ __asm(" xchg{q|} {%%|} rbx,%q1\n" \
272+ " cpuid\n" \
273+ " xchg{q|} {%%|} rbx,%q1" \
274+ : "=a"(__eax), "=r"(__ebx), "=c"(__ecx), "=d"(__edx) \
275275 : "0"(__leaf))
276276
277- #define __cpuid_count (__leaf , __count , __eax , __ebx , __ecx , __edx ) \
278- __asm(" xchgq %% rbx,%q1\n" \
279- " cpuid\n" \
280- " xchgq %% rbx,%q1" \
281- : "=a"(__eax), "=r" (__ebx), "=c"(__ecx), "=d"(__edx) \
277+ #define __cpuid_count (__leaf , __count , __eax , __ebx , __ecx , __edx ) \
278+ __asm(" xchg{q|} {%%|} rbx,%q1\n" \
279+ " cpuid\n" \
280+ " xchg{q|} {%%|} rbx,%q1" \
281+ : "=a"(__eax), "=r"(__ebx), "=c"(__ecx), "=d"(__edx) \
282282 : "0"(__leaf), "2"(__count))
283283#endif
284284
@@ -289,20 +289,22 @@ static __inline unsigned int __get_cpuid_max (unsigned int __leaf,
289289#ifdef __i386__
290290 int __cpuid_supported ;
291291
292- __asm(" pushfl \n"
293- " popl %% eax\n"
294- " movl %%eax,%%ecx\n"
295- " xorl $0x00200000,%%eax\n"
296- " pushl %% eax\n"
297- " popfl \n"
298- " pushfl \n"
299- " popl %% eax\n"
300- " movl $0,%0\n"
301- " cmpl %%eax,%%ecx\n"
292+ __asm(" pushf{l|d} \n"
293+ " pop{l|} {%%|} eax\n"
294+ " mov{l|} { %%eax,%%ecx|ecx,eax} \n"
295+ " xor{l|} { $0x00200000,%%eax|eax,0x00200000} \n"
296+ " push{l|} {%%|} eax\n"
297+ " popf{l|d} \n"
298+ " pushf{l|d} \n"
299+ " pop{l|} {%%|} eax\n"
300+ " mov{l|} { $0,%0|%0,0} \n"
301+ " cmp{l|} { %%eax,%%ecx|ecx,eax} \n"
302302 " je 1f\n"
303- " movl $1,%0\n"
303+ " mov{l|} { $1,%0|%0,1} \n"
304304 "1:"
305- : "=r" (__cpuid_supported ) : : "eax" , "ecx" );
305+ : "=r" (__cpuid_supported )
306+ :
307+ : "eax" , "ecx" );
306308 if (!__cpuid_supported )
307309 return 0 ;
308310#endif
0 commit comments