]> git.ozlabs.org Git - ccan/blob - ccan/cpuid/issupprted.S
8fe859633c7050155ace309aa32b3abdf409781d
[ccan] / ccan / cpuid / issupprted.S
1 /*
2   Test if the CPUID instruction is available.
3   returns 1 if so, 0 otherwise.  */
4
5 .section .text
6 .global cpuid_is_supported
7 .type cpuid_is_supported, @function
8 cpuid_is_supported:
9         nop
10
11         pushfl
12         popl %eax
13         movl %eax, %ecx
14         xorl $0x200000, %eax
15         pushl %eax
16         popfl
17
18         pushfl
19         popl %eax
20         xorl %ecx, %eax
21         shrl $21, %eax
22         andl $1, %eax
23         pushl %ecx
24         popfl
25
26         ret
27
28         .size cpuid_is_supported, .-cpuid_is_supported
29