Remove warning caused by D demangle testcase
[valgrind.git] / VEX / useful / cpuid.c
bloba6ded547e9e91ecfa548b06aee2a3a68dc6c6b24
2 #include <stdio.h>
4 typedef unsigned int UInt;
5 typedef unsigned long long int ULong;
7 void cpuid ( UInt* eax, UInt* ebx, UInt* ecx, UInt* edx,
8 UInt index, UInt ecx_in )
10 UInt a,b,c,d;
11 asm volatile ("cpuid"
12 : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
13 : "0" (index), "2"(ecx_in) );
14 *eax = a; *ebx = b; *ecx = c; *edx = d;
15 printf("%08x %08x -> %08x %08x %08x %08x\n",
16 index,ecx_in, a,b,c,d );
19 int main ( void )
21 UInt eax, ebx, ecx, edx;
22 UInt maxidx, maxextidx, i,ecx_in;
24 printf("\n");
25 cpuid(&eax,&ebx,&ecx,&edx, 0,0);
26 maxidx = eax;
27 for (i = 1; i <= maxidx +5; i++) {
29 UInt subleaf = 0;
31 if (i == 4) subleaf = 10;
32 if (i == 7) subleaf = 10;
33 if (i == 0xB) subleaf = 10;
34 if (i == 0xD) subleaf = 10;
36 if (subleaf > 0) printf("\n");
38 cpuid(&eax,&ebx,&ecx,&edx, i,0);
40 for (ecx_in = 1; ecx_in < subleaf; ecx_in++) {
41 cpuid(&eax,&ebx,&ecx,&edx, i,ecx_in);
44 if (subleaf > 0) printf("\n");
48 printf("\n");
50 cpuid(&eax,&ebx,&ecx,&edx, 0x80000000,0);
51 maxextidx = eax;
52 for (i = 0x80000001; i <= maxextidx +5; i++) {
53 cpuid(&eax,&ebx,&ecx,&edx, i,0);
56 printf("invalid\n");
57 cpuid(&eax,&ebx,&ecx,&edx, 1234,0);
58 cpuid(&eax,&ebx,&ecx,&edx, 0x800004d3,0);
61 return 0;