This source file includes following definitions.
- setup_arch
- get_cpuinfo
1
2
3
4
5
6
7
8
9
10
11 #include <linux/errno.h>
12 #include <linux/sched.h>
13 #include <linux/kernel.h>
14 #include <linux/mm.h>
15 #include <linux/stddef.h>
16 #include <linux/unistd.h>
17 #include <linux/ptrace.h>
18 #include <linux/malloc.h>
19 #include <linux/ldt.h>
20 #include <linux/user.h>
21 #include <linux/a.out.h>
22 #include <linux/tty.h>
23 #include <linux/ioport.h>
24 #include <linux/delay.h>
25
26 #include <asm/segment.h>
27 #include <asm/system.h>
28
29
30
31
32 char hard_math = 0;
33 char x86 = 0;
34 char x86_model = 0;
35 char x86_mask = 0;
36 int x86_capability = 0;
37 int fdiv_bug = 0;
38
39 char x86_vendor_id[13] = "Unknown";
40
41 char ignore_irq13 = 0;
42 char wp_works_ok = 0;
43 char hlt_works_ok = 1;
44
45
46
47
48 int EISA_bus = 0;
49
50
51
52
53 struct drive_info_struct { char dummy[32]; } drive_info;
54 struct screen_info screen_info;
55
56 unsigned char aux_device_present;
57 extern int ramdisk_size;
58 extern int root_mountflags;
59 extern int _etext, _edata, _end;
60
61 extern char empty_zero_page[PAGE_SIZE];
62
63
64
65
66 #define PARAM empty_zero_page
67 #define EXT_MEM_K (*(unsigned short *) (PARAM+2))
68 #define DRIVE_INFO (*(struct drive_info_struct *) (PARAM+0x80))
69 #define SCREEN_INFO (*(struct screen_info *) (PARAM+0))
70 #define MOUNT_ROOT_RDONLY (*(unsigned short *) (PARAM+0x1F2))
71 #define RAMDISK_SIZE (*(unsigned short *) (PARAM+0x1F8))
72 #define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
73 #define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
74 #define COMMAND_LINE ((char *) (PARAM+2048))
75 #define COMMAND_LINE_SIZE 256
76
77 static char command_line[COMMAND_LINE_SIZE] = { 0, };
78
79 void setup_arch(char **cmdline_p,
80 unsigned long * memory_start_p, unsigned long * memory_end_p)
81 {
82 unsigned long memory_start, memory_end;
83 char c = ' ', *to = command_line, *from = COMMAND_LINE;
84 int len = 0;
85
86 ROOT_DEV = ORIG_ROOT_DEV;
87 drive_info = DRIVE_INFO;
88 screen_info = SCREEN_INFO;
89 aux_device_present = AUX_DEVICE_INFO;
90 memory_end = (1<<20) + (EXT_MEM_K<<10);
91 memory_end &= PAGE_MASK;
92 ramdisk_size = RAMDISK_SIZE;
93 #ifdef CONFIG_MAX_16M
94 if (memory_end > 16*1024*1024)
95 memory_end = 16*1024*1024;
96 #endif
97 if (MOUNT_ROOT_RDONLY)
98 root_mountflags |= MS_RDONLY;
99 memory_start = (unsigned long) &_end;
100 init_task.mm->start_code = TASK_SIZE;
101 init_task.mm->end_code = TASK_SIZE + (unsigned long) &_etext;
102 init_task.mm->end_data = TASK_SIZE + (unsigned long) &_edata;
103 init_task.mm->brk = TASK_SIZE + (unsigned long) &_end;
104
105 for (;;) {
106 if (c == ' ' && *(unsigned long *)from == *(unsigned long *)"mem=") {
107 memory_end = simple_strtoul(from+4, &from, 0);
108 if ( *from == 'K' || *from == 'k' ) {
109 memory_end = memory_end << 10;
110 from++;
111 } else if ( *from == 'M' || *from == 'm' ) {
112 memory_end = memory_end << 20;
113 from++;
114 }
115 }
116 c = *(from++);
117 if (!c)
118 break;
119 if (COMMAND_LINE_SIZE <= ++len)
120 break;
121 *(to++) = c;
122 }
123 *to = '\0';
124 *cmdline_p = command_line;
125 *memory_start_p = memory_start;
126 *memory_end_p = memory_end;
127
128 request_region(0x00,0x20,"dma1");
129 request_region(0x40,0x20,"timer");
130 request_region(0x70,0x10,"rtc");
131 request_region(0x80,0x20,"dma page reg");
132 request_region(0xc0,0x20,"dma2");
133 request_region(0xf0,0x2,"npu");
134 request_region(0xf8,0x8,"npu");
135 }
136
137 int get_cpuinfo(char * buffer)
138 {
139 char *model[2][9]={{"DX","SX","DX/2","4","SX/2","6",
140 "DX/2-WB","DX/4"},
141 {"Pentium 60/66","Pentium 90/100","3",
142 "4","5","6","7","8"}};
143 char mask[2];
144 mask[0] = x86_mask+'@';
145 mask[1] = '\0';
146 return sprintf(buffer,"cpu\t\t: %c86\n"
147 "model\t\t: %s\n"
148 "mask\t\t: %s\n"
149 "vid\t\t: %s\n"
150 "fdiv_bug\t: %s\n"
151 "math\t\t: %s\n"
152 "hlt\t\t: %s\n"
153 "wp\t\t: %s\n"
154 "Integrated NPU\t: %s\n"
155 "Enhanced VM86\t: %s\n"
156 "IO Breakpoints\t: %s\n"
157 "4MB Pages\t: %s\n"
158 "TS Counters\t: %s\n"
159 "Pentium MSR\t: %s\n"
160 "Mach. Ch. Exep.\t: %s\n"
161 "CMPXCHGB8B\t: %s\n"
162 "BogoMips\t: %lu.%02lu\n",
163 x86+'0',
164 x86_model ? model[x86-4][x86_model-1] : "Unknown",
165 x86_mask ? mask : "Unknown",
166 x86_vendor_id,
167 fdiv_bug ? "yes" : "no",
168 hard_math ? "yes" : "no",
169 hlt_works_ok ? "yes" : "no",
170 wp_works_ok ? "yes" : "no",
171 x86_capability & 1 ? "yes" : "no",
172 x86_capability & 2 ? "yes" : "no",
173 x86_capability & 4 ? "yes" : "no",
174 x86_capability & 8 ? "yes" : "no",
175 x86_capability & 16 ? "yes" : "no",
176 x86_capability & 32 ? "yes" : "no",
177 x86_capability & 128 ? "yes" : "no",
178 x86_capability & 256 ? "yes" : "no",
179 loops_per_sec/500000, (loops_per_sec/5000) % 100
180 );
181 }