ucspi-ssl 0.13.03
ucspi-ssl
Loading...
Searching...
No Matches
x86cpuid.c
Go to the documentation of this file.
1/* Public domain. */
2
3#include <signal.h>
4
5void nope()
6{
7 exit(1);
8}
9
10int main()
11{
12 unsigned long x[4];
13 unsigned long y[4];
14 int i;
15 int j;
16 char c;
17
18 signal(SIGILL,nope);
19
20 x[0] = 0;
21 x[1] = 0;
22 x[2] = 0;
23 x[3] = 0;
24
25 asm volatile(".byte 15;.byte 162" : "=a"(x[0]),"=b"(x[1]),"=c"(x[3]),"=d"(x[2]) : "0"(0) );
26 if (!x[0]) return 0;
27 asm volatile(".byte 15;.byte 162" : "=a"(y[0]),"=b"(y[1]),"=c"(y[2]),"=d"(y[3]) : "0"(1) );
28
29 for (i = 1;i < 4;++i)
30 for (j = 0;j < 4;++j) {
31 c = x[i] >> (8 * j);
32 if (c < 32) c = 32;
33 if (c > 126) c = 126;
34 putchar(c);
35 }
36
37 printf("-%08x-%08x\n",y[0],y[3]);
38
39 return 0;
40}
void nope()
Definition: x86cpuid.c:5
int main()
Definition: x86cpuid.c:10