|
|
1.1 root 1: /*
2: * /conf/emgenc.c - C support for tool to generate emulator kernel.
3: *
4: * Usage: /conf/emgenc <kernel-object-directory>
5: *
6: * Argument is "kCohxx", with "xx" >= 72.
7: */
8:
9: #define ANSLEN 10
10:
11: #include <stdio.h>
12: #include <string.h>
13: #include <sys/sysi86.h>
14:
15: /*
16: * Get kernel revision level with uname(). Must be r72 or greater.
17: *
18: * Get ndp type with sysi86(SI86FPHW,).
19: * If ndp present, ask if they want to continue.
20: * If emulator present, exit with error status.
21: */
22: main(argc, argv)
23: int argc;
24: char * argv[];
25: {
26: int result;
27: int rev = 0;
28: int data;
29: char ans[ANSLEN];
30:
31: if (argc < 2 || strncmp(argv[1], "kCoh", 4)) {
32: fprintf(stderr,
33: "Missing kernel object directory /conf/kCoh72 or later.\n");
34: exit(1);
35: }
36: fprintf(stderr, "Using kernel object directory %s.\n", argv[1]);
37: rev = atoi(argv[1] + 4);
38: if (rev < 72) {
39: fprintf(stderr, "Can only attach emulator to r72 or later.\n");
40: exit(1);
41: }
42:
43: result = sysi86(SI86FPHW, &data);
44: if (result >= 0) {
45: switch (data) {
46: case FP_NO:
47: break;
48: case FP_SW:
49: break;
50: case FP_287:
51: case FP_387:
52: fprintf(stderr,
53: "Coprocessor detected. You do not need FP emulation.\n\n"
54: "You may link the emulator module to the COHERENT kernel, but\n"
55: "the FP coprocessor, rather than the emulator, will be used.\n"
56: "To force use of the emulator on systems with a coprocessor, do\n"
57: " /conf/patch -v <kernel-name> \"ndpType=1:s\"\n\n");
58: fprintf(stderr,
59: "Continue [y]? ");
60: result = fgets(ans, ANSLEN, stdin);
61: if (result
62: && tolower(ans[0]) != 'y'
63: && tolower(ans[0]) != '\n')
64: exit(1);
65: break;
66: default:
67: fprintf(stderr, "unexpected result from SI86FPHW\n");
68: exit(1);
69: }
70: } else {
71: perror(argv[0]);
72: exit(1);
73: }
74: exit(0);
75: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.