Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cpu_info_by_asm.c « cmake - gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1a70a815a7994dc3874b4a383f87852e2e46b792 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
int main() {
    unsigned int CPUInfo0;
    unsigned int CPUInfo1;
    unsigned int CPUInfo2;
    unsigned int CPUInfo3;
    unsigned int InfoType;
#if defined(__i386__) && defined(__PIC__)
/* %ebx is PIC register in 32-bit, so mustn't clobber it. */
    __asm__ __volatile__ (
        "xchg %%ebx, %1\n"
        "cpuid\n"
        "xchg %%ebx, %1\n":
        "=a" (CPUInfo0),
        "=r" (CPUInfo1),
        "=c" (CPUInfo2),
        "=d" (CPUInfo3) :
        "0" (InfoType), "2" (0)
    );
#else
    __asm__ __volatile__ (
        "cpuid":
        "=a" (CPUInfo0),
        "=b" (CPUInfo1),
        "=c" (CPUInfo2),
        "=d" (CPUInfo3) :
        "0" (InfoType), "2" (0)
    );
#endif
    return 0;
}