release
[hcoop/zz_old/debian/djbdns.git] / x86cpuid.c
CommitLineData
dc0d77d7
CE
1#include <signal.h>
2
3void nope()
4{
5 exit(1);
6}
7
8int main()
9{
10 unsigned long x[4];
11 unsigned long y[4];
12 int i;
13 int j;
14 char c;
15
16 signal(SIGILL,nope);
17
18 x[0] = 0;
19 x[1] = 0;
20 x[2] = 0;
21 x[3] = 0;
22
23 asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
24 if (!x[0]) return 0;
25 asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) );
26
27 for (i = 1;i < 4;++i)
28 for (j = 0;j < 4;++j) {
29 c = x[i] >> (8 * j);
30 if (c < 32) c = 32;
31 if (c > 126) c = 126;
32 putchar(c);
33 }
34
35 printf("-%08x-%08x\n",y[0],y[3]);
36
37 return 0;
38}