comparison x86cpuid.c @ 0:2cb46628feec

from cdb-0.75 per http://cr.yp.to/cdb.html, retrieved 2025-01-03, contents appear to have been create on 2000-02-19
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 29 Jan 2025 10:50:34 +0000
parents
children 3bfef1f22a97
comparison
equal deleted inserted replaced
-1:000000000000 0:2cb46628feec
1 #include <signal.h>
2
3 void nope()
4 {
5 exit(1);
6 }
7
8 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 }