diff options
Diffstat (limited to 'nacl/cpuid')
-rw-r--r-- | nacl/cpuid/cbytes.c | 16 | ||||
-rw-r--r-- | nacl/cpuid/cpuid.c | 41 | ||||
-rwxr-xr-x | nacl/cpuid/do | 37 | ||||
-rw-r--r-- | nacl/cpuid/unknown.c | 7 | ||||
-rw-r--r-- | nacl/cpuid/x86.c | 41 |
5 files changed, 0 insertions, 142 deletions
diff --git a/nacl/cpuid/cbytes.c b/nacl/cpuid/cbytes.c deleted file mode 100644 index bd5d1444..00000000 --- a/nacl/cpuid/cbytes.c +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | int main() | ||
4 | { | ||
5 | char ch; | ||
6 | int loop = 0; | ||
7 | while (scanf("%c",&ch) == 1) { | ||
8 | printf("0x%02x,",255 & (int) ch); | ||
9 | if (++loop == 16) { | ||
10 | loop = 0; | ||
11 | printf("\n"); | ||
12 | } | ||
13 | } | ||
14 | printf("0x00\n"); | ||
15 | return 0; | ||
16 | } | ||
diff --git a/nacl/cpuid/cpuid.c b/nacl/cpuid/cpuid.c deleted file mode 100644 index 1a5c6b8e..00000000 --- a/nacl/cpuid/cpuid.c +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <signal.h> | ||
4 | #include <unistd.h> | ||
5 | |||
6 | void nope() | ||
7 | { | ||
8 | exit(1); | ||
9 | } | ||
10 | |||
11 | int main() | ||
12 | { | ||
13 | unsigned long x[4]; | ||
14 | unsigned long y[4]; | ||
15 | int i; | ||
16 | int j; | ||
17 | char c; | ||
18 | |||
19 | signal(SIGILL,nope); | ||
20 | |||
21 | x[0] = 0; | ||
22 | x[1] = 0; | ||
23 | x[2] = 0; | ||
24 | x[3] = 0; | ||
25 | |||
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) ); | ||
29 | |||
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); | ||
36 | } | ||
37 | |||
38 | printf("-%08x-%08x\n",y[0],y[3]); | ||
39 | |||
40 | return 0; | ||
41 | } | ||
diff --git a/nacl/cpuid/do b/nacl/cpuid/do deleted file mode 100755 index 8a3a6f7b..00000000 --- a/nacl/cpuid/do +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
1 | #!/bin/sh -e | ||
2 | |||
3 | mkdir include | ||
4 | |||
5 | ( | ||
6 | echo x86 | ||
7 | echo unknown | ||
8 | ) | ( | ||
9 | while read n | ||
10 | do | ||
11 | okabi | ( | ||
12 | while read abi | ||
13 | do | ||
14 | okc-$abi | ( | ||
15 | while read c | ||
16 | do | ||
17 | echo "=== `date` === Trying $n.c with $c..." >&2 | ||
18 | rm -f cpuid.c | ||
19 | cp $n.c cpuid.c || continue | ||
20 | $c -o cpuid cpuid.c || continue | ||
21 | $c -o cbytes cbytes.c || continue | ||
22 | ./cpuid > cpuid.out || continue | ||
23 | echo 'static const char cpuid[] = {' > cpuid.h || continue | ||
24 | ./cbytes < cpuid.out >> cpuid.h || continue | ||
25 | echo '} ;' >> cpuid.h || continue | ||
26 | cp cpuid.h include/cpuid.h || continue | ||
27 | cat cpuid.out | ||
28 | exit 0 | ||
29 | done | ||
30 | exit 111 | ||
31 | ) && exit 0 | ||
32 | done | ||
33 | exit 111 | ||
34 | ) && exit 0 | ||
35 | done | ||
36 | exit 111 | ||
37 | ) | ||
diff --git a/nacl/cpuid/unknown.c b/nacl/cpuid/unknown.c deleted file mode 100644 index 786a5e72..00000000 --- a/nacl/cpuid/unknown.c +++ /dev/null | |||
@@ -1,7 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | main() | ||
4 | { | ||
5 | printf("unknown CPU ID\n"); | ||
6 | return 0; | ||
7 | } | ||
diff --git a/nacl/cpuid/x86.c b/nacl/cpuid/x86.c deleted file mode 100644 index 99e6a0c4..00000000 --- a/nacl/cpuid/x86.c +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <signal.h> | ||
4 | #include <unistd.h> | ||
5 | |||
6 | void nope() | ||
7 | { | ||
8 | exit(1); | ||
9 | } | ||
10 | |||
11 | int main() | ||
12 | { | ||
13 | unsigned long x[4]; | ||
14 | unsigned long y[4]; | ||
15 | int i; | ||
16 | int j; | ||
17 | char c; | ||
18 | |||
19 | signal(SIGILL,nope); | ||
20 | |||
21 | x[0] = 0; | ||
22 | x[1] = 0; | ||
23 | x[2] = 0; | ||
24 | x[3] = 0; | ||
25 | |||
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) ); | ||
29 | |||
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); | ||
36 | } | ||
37 | |||
38 | printf("-%08x-%08x\n",(unsigned int) y[0],(unsigned int) y[3]); | ||
39 | |||
40 | return 0; | ||
41 | } | ||