Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / libnacl / cpuid / x86.c
blob99e6a0c46c323031ea08ddd56f1df593e5674908
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <signal.h>
4 #include <unistd.h>
6 void nope()
8 exit(1);
11 int main()
13 unsigned long x[4];
14 unsigned long y[4];
15 int i;
16 int j;
17 char c;
19 signal(SIGILL,nope);
21 x[0] = 0;
22 x[1] = 0;
23 x[2] = 0;
24 x[3] = 0;
26 asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
27 if (!x[0]) return 0;
28 asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) );
30 for (i = 1;i < 4;++i)
31 for (j = 0;j < 4;++j) {
32 c = x[i] >> (8 * j);
33 if (c < 32) c = 32;
34 if (c > 126) c = 126;
35 putchar(c);
38 printf("-%08x-%08x\n",(unsigned int) y[0],(unsigned int) y[3]);
40 return 0;