Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | |
2 | |||
3 | |||
4 | #define EDX_CX8 (1 << 8) /* CMPXCHG8B */ |
||
5 | #define EDX_CMOV (1 << 15) |
||
6 | #define EDX_MMX (1 << 23) |
||
7 | #define EDX_FXSR (1 << 24) /* FXSAVE and FXRSTOR */ |
||
8 | #define EDX_SSE (1 << 25) |
||
9 | #define EDX_SSE2 (1 << 26) |
||
10 | |||
11 | |||
12 | #define ECX_SSE3 (1 << 0) |
||
13 | #define ECX_CX16 (1 << 13) /* CMPXCHG16B */ |
||
14 | |||
15 | |||
16 | #define EDX_3DNOW (1 << 31) |
||
17 | #define EDX_3DNOWP (1 << 30) |
||
18 | #define EDX_LM (1 << 29) /*LONG MODE */ |
||
19 | |||
20 | |||
21 | __asm__ __volatile__ ("cpuid;" \ |
||
22 | : "=a" (a), "=b" (b), "=c" (c), "=d" (d)\ |
||
23 | : "0" (level)) |
||
24 | |||
25 | |||
26 | |||
27 | |||
28 | |||
29 | |||
30 | { |
||
31 | unsigned int eax, ebx, ecx, edx; |
||
32 | |||
33 | |||
34 | if (eax == 0) |
||
35 | return; |
||
36 | |||
37 | |||
38 | |||
39 | |||
40 | __cpu_features |= _CRT_CMPXCHG8B; |
||
41 | if (edx & EDX_CMOV) |
||
42 | __cpu_features |= _CRT_CMOV; |
||
43 | |||
44 | |||
45 | __cpu_features |= _CRT_MMX; |
||
46 | if (edx & EDX_FXSR) |
||
47 | __cpu_features |= _CRT_FXSR; |
||
48 | if (edx & EDX_SSE) |
||
49 | __cpu_features |= _CRT_SSE; |
||
50 | if (edx & EDX_SSE2) |
||
51 | __cpu_features |= _CRT_SSE2; |
||
52 | |||
53 | |||
54 | |||
55 | __cpu_features |= _CRT_SSE3; |
||
56 | if (ecx & ECX_CX16) |
||
57 | __cpu_features |= _CRT_CMPXCHG16B; |
||
58 | |||
59 | |||
60 | if (eax < 0x80000001) |
||
61 | return; |
||
62 | __cpuid (0x80000001, eax, ebx, ecx, edx); |
||
63 | if (edx & EDX_3DNOW) |
||
64 | __cpu_features |= _CRT_3DNOW; |
||
65 | if (edx & EDX_3DNOWP) |
||
66 | __cpu_features |= _CRT_3DNOWP; |
||
67 | |||
68 | |||
69 | }>><>><>><>><>><>><>><>><>><>><>><> |
||
70 |