machdep.c revision 1.46.2.2 1 1.46.2.2 chs /* $NetBSD: machdep.c,v 1.46.2.2 1999/04/16 16:25:36 chs Exp $ */
2 1.46.2.2 chs
3 1.46.2.2 chs /*
4 1.46.2.2 chs * Copyright (c) 1988 University of Utah.
5 1.46.2.2 chs * Copyright (c) 1982, 1986, 1990, 1993
6 1.46.2.2 chs * The Regents of the University of California. All rights reserved.
7 1.46.2.2 chs *
8 1.46.2.2 chs * This code is derived from software contributed to Berkeley by
9 1.46.2.2 chs * the Systems Programming Group of the University of Utah Computer
10 1.46.2.2 chs * Science Department.
11 1.46.2.2 chs *
12 1.46.2.2 chs * Redistribution and use in source and binary forms, with or without
13 1.46.2.2 chs * modification, are permitted provided that the following conditions
14 1.46.2.2 chs * are met:
15 1.46.2.2 chs * 1. Redistributions of source code must retain the above copyright
16 1.46.2.2 chs * notice, this list of conditions and the following disclaimer.
17 1.46.2.2 chs * 2. Redistributions in binary form must reproduce the above copyright
18 1.46.2.2 chs * notice, this list of conditions and the following disclaimer in the
19 1.46.2.2 chs * documentation and/or other materials provided with the distribution.
20 1.46.2.2 chs * 3. All advertising materials mentioning features or use of this software
21 1.46.2.2 chs * must display the following acknowledgement:
22 1.46.2.2 chs * This product includes software developed by the University of
23 1.46.2.2 chs * California, Berkeley and its contributors.
24 1.46.2.2 chs * 4. Neither the name of the University nor the names of its contributors
25 1.46.2.2 chs * may be used to endorse or promote products derived from this software
26 1.46.2.2 chs * without specific prior written permission.
27 1.46.2.2 chs *
28 1.46.2.2 chs * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29 1.46.2.2 chs * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30 1.46.2.2 chs * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31 1.46.2.2 chs * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32 1.46.2.2 chs * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33 1.46.2.2 chs * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34 1.46.2.2 chs * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35 1.46.2.2 chs * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 1.46.2.2 chs * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37 1.46.2.2 chs * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38 1.46.2.2 chs * SUCH DAMAGE.
39 1.46.2.2 chs *
40 1.46.2.2 chs * from: Utah Hdr: machdep.c 1.74 92/12/20
41 1.46.2.2 chs * from: @(#)machdep.c 8.10 (Berkeley) 4/20/94
42 1.46.2.2 chs */
43 1.46.2.2 chs
44 1.46.2.2 chs #include "opt_bufcache.h"
45 1.46.2.2 chs #include "opt_ddb.h"
46 1.46.2.2 chs #include "opt_sysv.h"
47 1.46.2.2 chs
48 1.46.2.2 chs #include <sys/param.h>
49 1.46.2.2 chs #include <sys/systm.h>
50 1.46.2.2 chs #include <sys/kernel.h>
51 1.46.2.2 chs #include <sys/map.h>
52 1.46.2.2 chs #include <sys/proc.h>
53 1.46.2.2 chs #include <sys/buf.h>
54 1.46.2.2 chs #include <sys/reboot.h>
55 1.46.2.2 chs #include <sys/conf.h>
56 1.46.2.2 chs #include <sys/file.h>
57 1.46.2.2 chs #include <sys/clist.h>
58 1.46.2.2 chs #include <sys/callout.h>
59 1.46.2.2 chs #include <sys/device.h>
60 1.46.2.2 chs #include <sys/malloc.h>
61 1.46.2.2 chs #include <sys/mbuf.h>
62 1.46.2.2 chs #include <sys/msgbuf.h>
63 1.46.2.2 chs #include <sys/ioctl.h>
64 1.46.2.2 chs #include <sys/tty.h>
65 1.46.2.2 chs #include <sys/mount.h>
66 1.46.2.2 chs #include <sys/user.h>
67 1.46.2.2 chs #include <sys/exec.h>
68 1.46.2.2 chs #include <sys/core.h>
69 1.46.2.2 chs #include <sys/kcore.h>
70 1.46.2.2 chs #include <sys/vnode.h>
71 1.46.2.2 chs #include <sys/syscallargs.h>
72 1.46.2.2 chs #ifdef SYSVMSG
73 1.46.2.2 chs #include <sys/msg.h>
74 1.46.2.2 chs #endif
75 1.46.2.2 chs #ifdef SYSVSEM
76 1.46.2.2 chs #include <sys/sem.h>
77 1.46.2.2 chs #endif
78 1.46.2.2 chs #ifdef SYSVSHM
79 1.46.2.2 chs #include <sys/shm.h>
80 1.46.2.2 chs #endif
81 1.46.2.2 chs #ifdef KGDB
82 1.46.2.2 chs #include <sys/kgdb.h>
83 1.46.2.2 chs #endif
84 1.46.2.2 chs
85 1.46.2.2 chs #include <vm/vm.h>
86 1.46.2.2 chs #include <vm/vm_map.h>
87 1.46.2.2 chs #include <vm/vm_kern.h>
88 1.46.2.2 chs #include <vm/vm_page.h>
89 1.46.2.2 chs
90 1.46.2.2 chs #include <uvm/uvm_extern.h>
91 1.46.2.2 chs
92 1.46.2.2 chs #include <sys/sysctl.h>
93 1.46.2.2 chs
94 1.46.2.2 chs #include <dev/cons.h>
95 1.46.2.2 chs
96 1.46.2.2 chs #include <machine/cpu.h>
97 1.46.2.2 chs #include <machine/dvma.h>
98 1.46.2.2 chs #include <machine/idprom.h>
99 1.46.2.2 chs #include <machine/kcore.h>
100 1.46.2.2 chs #include <machine/reg.h>
101 1.46.2.2 chs #include <machine/psl.h>
102 1.46.2.2 chs #include <machine/pte.h>
103 1.46.2.2 chs
104 1.46.2.2 chs #if defined(DDB)
105 1.46.2.2 chs #include <machine/db_machdep.h>
106 1.46.2.2 chs #include <ddb/db_sym.h>
107 1.46.2.2 chs #include <ddb/db_extern.h>
108 1.46.2.2 chs #endif
109 1.46.2.2 chs
110 1.46.2.2 chs #include <sun3/sun3/machdep.h>
111 1.46.2.2 chs
112 1.46.2.2 chs /* Defined in locore.s */
113 1.46.2.2 chs extern char kernel_text[];
114 1.46.2.2 chs /* Defined by the linker */
115 1.46.2.2 chs extern char etext[];
116 1.46.2.2 chs
117 1.46.2.2 chs vm_map_t exec_map = NULL;
118 1.46.2.2 chs vm_map_t mb_map = NULL;
119 1.46.2.2 chs vm_map_t phys_map = NULL;
120 1.46.2.2 chs
121 1.46.2.2 chs int physmem;
122 1.46.2.2 chs int fputype;
123 1.46.2.2 chs caddr_t msgbufaddr;
124 1.46.2.2 chs
125 1.46.2.2 chs /* Virtual page frame for /dev/mem (see mem.c) */
126 1.46.2.2 chs vm_offset_t vmmap;
127 1.46.2.2 chs
128 1.46.2.2 chs /*
129 1.46.2.2 chs * safepri is a safe priority for sleep to set for a spin-wait
130 1.46.2.2 chs * during autoconfiguration or after a panic.
131 1.46.2.2 chs */
132 1.46.2.2 chs int safepri = PSL_LOWIPL;
133 1.46.2.2 chs
134 1.46.2.2 chs /*
135 1.46.2.2 chs * Declare these as initialized data so we can patch them.
136 1.46.2.2 chs */
137 1.46.2.2 chs int nswbuf = 0;
138 1.46.2.2 chs #ifdef NBUF
139 1.46.2.2 chs int nbuf = NBUF;
140 1.46.2.2 chs #else
141 1.46.2.2 chs int nbuf = 0;
142 1.46.2.2 chs #endif
143 1.46.2.2 chs #ifdef BUFPAGES
144 1.46.2.2 chs int bufpages = BUFPAGES;
145 1.46.2.2 chs #else
146 1.46.2.2 chs int bufpages = 0;
147 1.46.2.2 chs #endif
148 1.46.2.2 chs
149 1.46.2.2 chs u_char cpu_machine_id = 0;
150 1.46.2.2 chs char *cpu_string = NULL;
151 1.46.2.2 chs int cpu_has_vme = 0;
152 1.46.2.2 chs int has_iocache = 0;
153 1.46.2.2 chs
154 1.46.2.2 chs static void identifycpu __P((void));
155 1.46.2.2 chs static void initcpu __P((void));
156 1.46.2.2 chs
157 1.46.2.2 chs /*
158 1.46.2.2 chs * Console initialization: called early on from main,
159 1.46.2.2 chs * before vm init or cpu_startup. This system is able
160 1.46.2.2 chs * to use the console for output immediately (via PROM)
161 1.46.2.2 chs * but can not use it for input until after this point.
162 1.46.2.2 chs */
163 1.46.2.2 chs void
164 1.46.2.2 chs consinit()
165 1.46.2.2 chs {
166 1.46.2.2 chs
167 1.46.2.2 chs /*
168 1.46.2.2 chs * Switch from the PROM console (output only)
169 1.46.2.2 chs * to our own console driver.
170 1.46.2.2 chs */
171 1.46.2.2 chs cninit();
172 1.46.2.2 chs
173 1.46.2.2 chs #ifdef DDB
174 1.46.2.2 chs db_machine_init();
175 1.46.2.2 chs {
176 1.46.2.2 chs extern int end[];
177 1.46.2.2 chs extern char *esym;
178 1.46.2.2 chs
179 1.46.2.2 chs /* symsize, symstart, symend */
180 1.46.2.2 chs ddb_init(end[0], end + 1, (int*)esym);
181 1.46.2.2 chs }
182 1.46.2.2 chs #endif DDB
183 1.46.2.2 chs
184 1.46.2.2 chs /*
185 1.46.2.2 chs * Now that the console can do input as well as
186 1.46.2.2 chs * output, consider stopping for a debugger.
187 1.46.2.2 chs */
188 1.46.2.2 chs if (boothowto & RB_KDB) {
189 1.46.2.2 chs #ifdef KGDB
190 1.46.2.2 chs /* XXX - Ask on console for kgdb_dev? */
191 1.46.2.2 chs /* Note: this will just return if kgdb_dev==NODEV */
192 1.46.2.2 chs kgdb_connect(1);
193 1.46.2.2 chs #else /* KGDB */
194 1.46.2.2 chs /* Either DDB or no debugger (just PROM). */
195 1.46.2.2 chs Debugger();
196 1.46.2.2 chs #endif /* KGDB */
197 1.46.2.2 chs }
198 1.46.2.2 chs }
199 1.46.2.2 chs
200 1.46.2.2 chs /*
201 1.46.2.2 chs * allocsys() - Private routine used by cpu_startup() below.
202 1.46.2.2 chs *
203 1.46.2.2 chs * Allocate space for system data structures. We are given
204 1.46.2.2 chs * a starting virtual address and we return a final virtual
205 1.46.2.2 chs * address; along the way we set each data structure pointer.
206 1.46.2.2 chs *
207 1.46.2.2 chs * We call allocsys() with 0 to find out how much space we want,
208 1.46.2.2 chs * allocate that much and fill it with zeroes, and then call
209 1.46.2.2 chs * allocsys() again with the correct base virtual address.
210 1.46.2.2 chs */
211 1.46.2.2 chs #define valloc(name, type, num) \
212 1.46.2.2 chs v = (caddr_t)(((name) = (type *)v) + (num))
213 1.46.2.2 chs static caddr_t allocsys __P((caddr_t));
214 1.46.2.2 chs static caddr_t
215 1.46.2.2 chs allocsys(v)
216 1.46.2.2 chs register caddr_t v;
217 1.46.2.2 chs {
218 1.46.2.2 chs
219 1.46.2.2 chs #ifdef REAL_CLISTS
220 1.46.2.2 chs valloc(cfree, struct cblock, nclist);
221 1.46.2.2 chs #endif
222 1.46.2.2 chs valloc(callout, struct callout, ncallout);
223 1.46.2.2 chs #ifdef SYSVSHM
224 1.46.2.2 chs valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
225 1.46.2.2 chs #endif
226 1.46.2.2 chs #ifdef SYSVSEM
227 1.46.2.2 chs valloc(sema, struct semid_ds, seminfo.semmni);
228 1.46.2.2 chs valloc(sem, struct sem, seminfo.semmns);
229 1.46.2.2 chs /* This is pretty disgusting! */
230 1.46.2.2 chs valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
231 1.46.2.2 chs #endif
232 1.46.2.2 chs #ifdef SYSVMSG
233 1.46.2.2 chs valloc(msgpool, char, msginfo.msgmax);
234 1.46.2.2 chs valloc(msgmaps, struct msgmap, msginfo.msgseg);
235 1.46.2.2 chs valloc(msghdrs, struct msg, msginfo.msgtql);
236 1.46.2.2 chs valloc(msqids, struct msqid_ds, msginfo.msgmni);
237 1.46.2.2 chs #endif
238 1.46.2.2 chs
239 1.46.2.2 chs /*
240 1.46.2.2 chs * Determine how many buffers to allocate. We allocate
241 1.46.2.2 chs * the BSD standard of use 10% of memory for the first 2 Meg,
242 1.46.2.2 chs * 5% of remaining. Insure a minimum of 16 buffers.
243 1.46.2.2 chs * Allocate 1/2 as many swap buffer headers as file i/o buffers.
244 1.46.2.2 chs */
245 1.46.2.2 chs if (bufpages == 0) {
246 1.46.2.2 chs /* We always have more than 2MB of memory. */
247 1.46.2.2 chs bufpages = ((btoc(2 * 1024 * 1024) + physmem) /
248 1.46.2.2 chs (20 * CLSIZE));
249 1.46.2.2 chs }
250 1.46.2.2 chs if (nbuf == 0) {
251 1.46.2.2 chs nbuf = bufpages;
252 1.46.2.2 chs if (nbuf < 16)
253 1.46.2.2 chs nbuf = 16;
254 1.46.2.2 chs }
255 1.46.2.2 chs if (nswbuf == 0) {
256 1.46.2.2 chs nswbuf = (nbuf / 2) &~ 1; /* force even */
257 1.46.2.2 chs if (nswbuf > 256)
258 1.46.2.2 chs nswbuf = 256; /* sanity */
259 1.46.2.2 chs }
260 1.46.2.2 chs valloc(buf, struct buf, nbuf);
261 1.46.2.2 chs return v;
262 1.46.2.2 chs }
263 1.46.2.2 chs #undef valloc
264 1.46.2.2 chs
265 1.46.2.2 chs /*
266 1.46.2.2 chs * cpu_startup: allocate memory for variable-sized tables,
267 1.46.2.2 chs * initialize cpu, and do autoconfiguration.
268 1.46.2.2 chs *
269 1.46.2.2 chs * This is called early in init_main.c:main(), after the
270 1.46.2.2 chs * kernel memory allocator is ready for use, but before
271 1.46.2.2 chs * the creation of processes 1,2, and mountroot, etc.
272 1.46.2.2 chs */
273 1.46.2.2 chs void
274 1.46.2.2 chs cpu_startup()
275 1.46.2.2 chs {
276 1.46.2.2 chs caddr_t v;
277 1.46.2.2 chs int sz, i;
278 1.46.2.2 chs vm_size_t size;
279 1.46.2.2 chs int base, residual;
280 1.46.2.2 chs vm_offset_t minaddr, maxaddr;
281 1.46.2.2 chs
282 1.46.2.2 chs /*
283 1.46.2.2 chs * Initialize message buffer (for kernel printf).
284 1.46.2.2 chs * This is put in physical page zero so it will
285 1.46.2.2 chs * always be in the same place after a reboot.
286 1.46.2.2 chs * Its mapping was prepared in pmap_bootstrap().
287 1.46.2.2 chs * Also, offset some to avoid PROM scribbles.
288 1.46.2.2 chs */
289 1.46.2.2 chs v = (caddr_t) KERNBASE;
290 1.46.2.2 chs msgbufaddr = (caddr_t)(v + MSGBUFOFF);
291 1.46.2.2 chs initmsgbuf(msgbufaddr, MSGBUFSIZE);
292 1.46.2.2 chs
293 1.46.2.2 chs /*
294 1.46.2.2 chs * Good {morning,afternoon,evening,night}.
295 1.46.2.2 chs */
296 1.46.2.2 chs printf(version);
297 1.46.2.2 chs identifycpu();
298 1.46.2.2 chs initfpu(); /* also prints FPU type */
299 1.46.2.2 chs
300 1.46.2.2 chs size = ptoa(physmem);
301 1.46.2.2 chs printf("real mem = %ldK (0x%lx)\n", (size >> 10), size);
302 1.46.2.2 chs
303 1.46.2.2 chs /*
304 1.46.2.2 chs * Find out how much space we need, allocate it,
305 1.46.2.2 chs * and then give everything true virtual addresses.
306 1.46.2.2 chs */
307 1.46.2.2 chs sz = (int)allocsys((caddr_t)0);
308 1.46.2.2 chs if ((v = (caddr_t)uvm_km_alloc(kernel_map, round_page(sz))) == 0)
309 1.46.2.2 chs panic("startup: no room for tables");
310 1.46.2.2 chs if (allocsys(v) - v != sz)
311 1.46.2.2 chs panic("startup: table size inconsistency");
312 1.46.2.2 chs
313 1.46.2.2 chs /*
314 1.46.2.2 chs * Now allocate buffers proper. They are different than the above
315 1.46.2.2 chs * in that they usually occupy more virtual memory than physical.
316 1.46.2.2 chs */
317 1.46.2.2 chs size = MAXBSIZE * nbuf;
318 1.46.2.2 chs if (uvm_map(kernel_map, (vm_offset_t *) &buffers, round_page(size),
319 1.46.2.2 chs NULL, UVM_UNKNOWN_OFFSET,
320 1.46.2.2 chs UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
321 1.46.2.2 chs UVM_ADV_NORMAL, 0)) != KERN_SUCCESS)
322 1.46.2.2 chs panic("startup: cannot allocate VM for buffers");
323 1.46.2.2 chs minaddr = (vm_offset_t)buffers;
324 1.46.2.2 chs if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
325 1.46.2.2 chs /* don't want to alloc more physical mem than needed */
326 1.46.2.2 chs bufpages = btoc(MAXBSIZE) * nbuf;
327 1.46.2.2 chs }
328 1.46.2.2 chs base = bufpages / nbuf;
329 1.46.2.2 chs residual = bufpages % nbuf;
330 1.46.2.2 chs for (i = 0; i < nbuf; i++) {
331 1.46.2.2 chs vm_size_t curbufsize;
332 1.46.2.2 chs vm_offset_t curbuf;
333 1.46.2.2 chs struct vm_page *pg;
334 1.46.2.2 chs
335 1.46.2.2 chs /*
336 1.46.2.2 chs * Each buffer has MAXBSIZE bytes of VM space allocated. Of
337 1.46.2.2 chs * that MAXBSIZE space, we allocate and map (base+1) pages
338 1.46.2.2 chs * for the first "residual" buffers, and then we allocate
339 1.46.2.2 chs * "base" pages for the rest.
340 1.46.2.2 chs */
341 1.46.2.2 chs curbuf = (vm_offset_t) buffers + (i * MAXBSIZE);
342 1.46.2.2 chs curbufsize = CLBYTES * ((i < residual) ? (base+1) : base);
343 1.46.2.2 chs
344 1.46.2.2 chs while (curbufsize) {
345 1.46.2.2 chs pg = uvm_pagealloc(NULL, 0, NULL, 0);
346 1.46.2.2 chs if (pg == NULL)
347 1.46.2.2 chs panic("cpu_startup: not enough memory for "
348 1.46.2.2 chs "buffer cache");
349 1.46.2.2 chs #if defined(PMAP_NEW)
350 1.46.2.2 chs pmap_kenter_pgs(curbuf, &pg, 1);
351 1.46.2.2 chs #else
352 1.46.2.2 chs pmap_enter(kernel_map->pmap, curbuf,
353 1.46.2.2 chs VM_PAGE_TO_PHYS(pg), VM_PROT_READ|VM_PROT_WRITE,
354 1.46.2.2 chs TRUE, VM_PROT_READ|VM_PROT_WRITE);
355 1.46.2.2 chs #endif
356 1.46.2.2 chs curbuf += PAGE_SIZE;
357 1.46.2.2 chs curbufsize -= PAGE_SIZE;
358 1.46.2.2 chs }
359 1.46.2.2 chs }
360 1.46.2.2 chs
361 1.46.2.2 chs /*
362 1.46.2.2 chs * Allocate a submap for exec arguments. This map effectively
363 1.46.2.2 chs * limits the number of processes exec'ing at any time.
364 1.46.2.2 chs */
365 1.46.2.2 chs exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
366 1.46.2.2 chs 16*NCARGS, TRUE, FALSE, NULL);
367 1.46.2.2 chs
368 1.46.2.2 chs /*
369 1.46.2.2 chs * We don't use a submap for physio, and use a separate map
370 1.46.2.2 chs * for DVMA allocations. Our vmapbuf just maps pages into
371 1.46.2.2 chs * the kernel map (any kernel mapping is OK) and then the
372 1.46.2.2 chs * device drivers clone the kernel mappings into DVMA space.
373 1.46.2.2 chs */
374 1.46.2.2 chs
375 1.46.2.2 chs /*
376 1.46.2.2 chs * Finally, allocate mbuf cluster submap.
377 1.46.2.2 chs */
378 1.46.2.2 chs mb_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
379 1.46.2.2 chs VM_MBUF_SIZE, FALSE, FALSE, NULL);
380 1.46.2.2 chs
381 1.46.2.2 chs /*
382 1.46.2.2 chs * Initialize callouts
383 1.46.2.2 chs */
384 1.46.2.2 chs callfree = callout;
385 1.46.2.2 chs for (i = 1; i < ncallout; i++)
386 1.46.2.2 chs callout[i-1].c_next = &callout[i];
387 1.46.2.2 chs callout[i-1].c_next = NULL;
388 1.46.2.2 chs
389 1.46.2.2 chs size = ptoa(uvmexp.free);
390 1.46.2.2 chs printf("avail mem = %ldK (0x%lx)\n", (size >> 10), size);
391 1.46.2.2 chs printf("using %d buffers containing %d bytes of memory\n",
392 1.46.2.2 chs nbuf, bufpages * CLBYTES);
393 1.46.2.2 chs
394 1.46.2.2 chs /*
395 1.46.2.2 chs * Tell the VM system that writing to kernel text isn't allowed.
396 1.46.2.2 chs * If we don't, we might end up COW'ing the text segment!
397 1.46.2.2 chs */
398 1.46.2.2 chs if (uvm_map_protect(kernel_map, (vm_offset_t) kernel_text,
399 1.46.2.2 chs m68k_trunc_page((vm_offset_t) etext),
400 1.46.2.2 chs UVM_PROT_READ|UVM_PROT_EXEC, TRUE) != KERN_SUCCESS)
401 1.46.2.2 chs panic("can't protect kernel text");
402 1.46.2.2 chs
403 1.46.2.2 chs /*
404 1.46.2.2 chs * Allocate a virtual page (for use by /dev/mem)
405 1.46.2.2 chs * This page is handed to pmap_enter() therefore
406 1.46.2.2 chs * it has to be in the normal kernel VA range.
407 1.46.2.2 chs */
408 1.46.2.2 chs vmmap = uvm_km_valloc_wait(kernel_map, NBPG);
409 1.46.2.2 chs
410 1.46.2.2 chs /*
411 1.46.2.2 chs * Create the DVMA maps.
412 1.46.2.2 chs */
413 1.46.2.2 chs dvma_init();
414 1.46.2.2 chs
415 1.46.2.2 chs /*
416 1.46.2.2 chs * Set up CPU-specific registers, cache, etc.
417 1.46.2.2 chs */
418 1.46.2.2 chs initcpu();
419 1.46.2.2 chs
420 1.46.2.2 chs /*
421 1.46.2.2 chs * Set up buffers, so they can be used to read disk labels.
422 1.46.2.2 chs */
423 1.46.2.2 chs bufinit();
424 1.46.2.2 chs }
425 1.46.2.2 chs
426 1.46.2.2 chs /*
427 1.46.2.2 chs * Set registers on exec.
428 1.46.2.2 chs */
429 1.46.2.2 chs void
430 1.46.2.2 chs setregs(p, pack, stack)
431 1.46.2.2 chs struct proc *p;
432 1.46.2.2 chs struct exec_package *pack;
433 1.46.2.2 chs u_long stack;
434 1.46.2.2 chs {
435 1.46.2.2 chs struct trapframe *tf = (struct trapframe *)p->p_md.md_regs;
436 1.46.2.2 chs
437 1.46.2.2 chs tf->tf_sr = PSL_USERSET;
438 1.46.2.2 chs tf->tf_pc = pack->ep_entry & ~1;
439 1.46.2.2 chs tf->tf_regs[D0] = 0;
440 1.46.2.2 chs tf->tf_regs[D1] = 0;
441 1.46.2.2 chs tf->tf_regs[D2] = 0;
442 1.46.2.2 chs tf->tf_regs[D3] = 0;
443 1.46.2.2 chs tf->tf_regs[D4] = 0;
444 1.46.2.2 chs tf->tf_regs[D5] = 0;
445 1.46.2.2 chs tf->tf_regs[D6] = 0;
446 1.46.2.2 chs tf->tf_regs[D7] = 0;
447 1.46.2.2 chs tf->tf_regs[A0] = 0;
448 1.46.2.2 chs tf->tf_regs[A1] = 0;
449 1.46.2.2 chs tf->tf_regs[A2] = (int)PS_STRINGS;
450 1.46.2.2 chs tf->tf_regs[A3] = 0;
451 1.46.2.2 chs tf->tf_regs[A4] = 0;
452 1.46.2.2 chs tf->tf_regs[A5] = 0;
453 1.46.2.2 chs tf->tf_regs[A6] = 0;
454 1.46.2.2 chs tf->tf_regs[SP] = stack;
455 1.46.2.2 chs
456 1.46.2.2 chs /* restore a null state frame */
457 1.46.2.2 chs p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0;
458 1.46.2.2 chs if (fputype)
459 1.46.2.2 chs m68881_restore(&p->p_addr->u_pcb.pcb_fpregs);
460 1.46.2.2 chs
461 1.46.2.2 chs p->p_md.md_flags = 0;
462 1.46.2.2 chs }
463 1.46.2.2 chs
464 1.46.2.2 chs /*
465 1.46.2.2 chs * Info for CTL_HW
466 1.46.2.2 chs */
467 1.46.2.2 chs char machine[16] = MACHINE; /* from <machine/param.h> */
468 1.46.2.2 chs char kernel_arch[16] = "sun3x"; /* XXX needs a sysctl node */
469 1.46.2.2 chs char cpu_model[120];
470 1.46.2.2 chs
471 1.46.2.2 chs /*
472 1.46.2.2 chs * XXX - Should empirically estimate the divisor...
473 1.46.2.2 chs * Note that the value of delay_divisor is roughly
474 1.46.2.2 chs * 2048 / cpuclock (where cpuclock is in MHz).
475 1.46.2.2 chs */
476 1.46.2.2 chs int delay_divisor = 62; /* assume the fastest (33 MHz) */
477 1.46.2.2 chs
478 1.46.2.2 chs void
479 1.46.2.2 chs identifycpu()
480 1.46.2.2 chs {
481 1.46.2.2 chs u_char machtype;
482 1.46.2.2 chs
483 1.46.2.2 chs machtype = identity_prom.idp_machtype;
484 1.46.2.2 chs if ((machtype & IDM_ARCH_MASK) != IDM_ARCH_SUN3X) {
485 1.46.2.2 chs printf("Bad IDPROM arch!\n");
486 1.46.2.2 chs sunmon_abort();
487 1.46.2.2 chs }
488 1.46.2.2 chs
489 1.46.2.2 chs cpu_machine_id = machtype;
490 1.46.2.2 chs switch (cpu_machine_id) {
491 1.46.2.2 chs
492 1.46.2.2 chs case SUN3X_MACH_80:
493 1.46.2.2 chs cpu_string = "80"; /* Hydra */
494 1.46.2.2 chs delay_divisor = 102; /* 20 MHz */
495 1.46.2.2 chs cpu_has_vme = FALSE;
496 1.46.2.2 chs break;
497 1.46.2.2 chs
498 1.46.2.2 chs case SUN3X_MACH_470:
499 1.46.2.2 chs cpu_string = "470"; /* Pegasus */
500 1.46.2.2 chs delay_divisor = 62; /* 33 MHz */
501 1.46.2.2 chs cpu_has_vme = TRUE;
502 1.46.2.2 chs break;
503 1.46.2.2 chs
504 1.46.2.2 chs default:
505 1.46.2.2 chs printf("unknown sun3x model\n");
506 1.46.2.2 chs sunmon_abort();
507 1.46.2.2 chs }
508 1.46.2.2 chs
509 1.46.2.2 chs /* Other stuff? (VAC, mc6888x version, etc.) */
510 1.46.2.2 chs /* Note: miniroot cares about the kernel_arch part. */
511 1.46.2.2 chs sprintf(cpu_model, "%s %s", kernel_arch, cpu_string);
512 1.46.2.2 chs
513 1.46.2.2 chs printf("Model: %s\n", cpu_model);
514 1.46.2.2 chs }
515 1.46.2.2 chs
516 1.46.2.2 chs /*
517 1.46.2.2 chs * machine dependent system variables.
518 1.46.2.2 chs */
519 1.46.2.2 chs int
520 1.46.2.2 chs cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
521 1.46.2.2 chs int *name;
522 1.46.2.2 chs u_int namelen;
523 1.46.2.2 chs void *oldp;
524 1.46.2.2 chs size_t *oldlenp;
525 1.46.2.2 chs void *newp;
526 1.46.2.2 chs size_t newlen;
527 1.46.2.2 chs struct proc *p;
528 1.46.2.2 chs {
529 1.46.2.2 chs int error;
530 1.46.2.2 chs dev_t consdev;
531 1.46.2.2 chs
532 1.46.2.2 chs /* all sysctl names at this level are terminal */
533 1.46.2.2 chs if (namelen != 1)
534 1.46.2.2 chs return (ENOTDIR); /* overloaded */
535 1.46.2.2 chs
536 1.46.2.2 chs switch (name[0]) {
537 1.46.2.2 chs case CPU_CONSDEV:
538 1.46.2.2 chs if (cn_tab != NULL)
539 1.46.2.2 chs consdev = cn_tab->cn_dev;
540 1.46.2.2 chs else
541 1.46.2.2 chs consdev = NODEV;
542 1.46.2.2 chs error = sysctl_rdstruct(oldp, oldlenp, newp,
543 1.46.2.2 chs &consdev, sizeof consdev);
544 1.46.2.2 chs break;
545 1.46.2.2 chs
546 1.46.2.2 chs #if 0 /* XXX - Not yet... */
547 1.46.2.2 chs case CPU_ROOT_DEVICE:
548 1.46.2.2 chs error = sysctl_rdstring(oldp, oldlenp, newp, root_device);
549 1.46.2.2 chs break;
550 1.46.2.2 chs
551 1.46.2.2 chs case CPU_BOOTED_KERNEL:
552 1.46.2.2 chs error = sysctl_rdstring(oldp, oldlenp, newp, booted_kernel);
553 1.46.2.2 chs break;
554 1.46.2.2 chs #endif
555 1.46.2.2 chs
556 1.46.2.2 chs default:
557 1.46.2.2 chs error = EOPNOTSUPP;
558 1.46.2.2 chs }
559 1.46.2.2 chs return (error);
560 1.46.2.2 chs }
561 1.46.2.2 chs
562 1.46.2.2 chs /* See: sig_machdep.c */
563 1.46.2.2 chs
564 1.46.2.2 chs /*
565 1.46.2.2 chs * Do a sync in preparation for a reboot.
566 1.46.2.2 chs * XXX - This could probably be common code.
567 1.46.2.2 chs * XXX - And now, most of it is in vfs_shutdown()
568 1.46.2.2 chs * XXX - Put waittime checks in there too?
569 1.46.2.2 chs */
570 1.46.2.2 chs int waittime = -1; /* XXX - Who else looks at this? -gwr */
571 1.46.2.2 chs static void
572 1.46.2.2 chs reboot_sync __P((void))
573 1.46.2.2 chs {
574 1.46.2.2 chs
575 1.46.2.2 chs /* Check waittime here to localize its use to this function. */
576 1.46.2.2 chs if (waittime >= 0)
577 1.46.2.2 chs return;
578 1.46.2.2 chs waittime = 0;
579 1.46.2.2 chs vfs_shutdown();
580 1.46.2.2 chs }
581 1.46.2.2 chs
582 1.46.2.2 chs /*
583 1.46.2.2 chs * Common part of the BSD and SunOS reboot system calls.
584 1.46.2.2 chs */
585 1.46.2.2 chs __dead void
586 1.46.2.2 chs cpu_reboot(howto, user_boot_string)
587 1.46.2.2 chs int howto;
588 1.46.2.2 chs char *user_boot_string;
589 1.46.2.2 chs {
590 1.46.2.2 chs /* Note: this string MUST be static! */
591 1.46.2.2 chs static char bootstr[128];
592 1.46.2.2 chs char *p;
593 1.46.2.2 chs
594 1.46.2.2 chs /* If system is cold, just halt. (early panic?) */
595 1.46.2.2 chs if (cold)
596 1.46.2.2 chs goto haltsys;
597 1.46.2.2 chs
598 1.46.2.2 chs /* Un-blank the screen if appropriate. */
599 1.46.2.2 chs cnpollc(1);
600 1.46.2.2 chs
601 1.46.2.2 chs if ((howto & RB_NOSYNC) == 0) {
602 1.46.2.2 chs reboot_sync();
603 1.46.2.2 chs /*
604 1.46.2.2 chs * If we've been adjusting the clock, the todr
605 1.46.2.2 chs * will be out of synch; adjust it now.
606 1.46.2.2 chs *
607 1.46.2.2 chs * XXX - However, if the kernel has been sitting in ddb,
608 1.46.2.2 chs * the time will be way off, so don't set the HW clock!
609 1.46.2.2 chs * XXX - Should do sanity check against HW clock. -gwr
610 1.46.2.2 chs */
611 1.46.2.2 chs /* resettodr(); */
612 1.46.2.2 chs }
613 1.46.2.2 chs
614 1.46.2.2 chs /* Disable interrupts. */
615 1.46.2.2 chs splhigh();
616 1.46.2.2 chs
617 1.46.2.2 chs /* Write out a crash dump if asked. */
618 1.46.2.2 chs if (howto & RB_DUMP)
619 1.46.2.2 chs dumpsys();
620 1.46.2.2 chs
621 1.46.2.2 chs /* run any shutdown hooks */
622 1.46.2.2 chs doshutdownhooks();
623 1.46.2.2 chs
624 1.46.2.2 chs if (howto & RB_HALT) {
625 1.46.2.2 chs haltsys:
626 1.46.2.2 chs printf("Kernel halted.\n");
627 1.46.2.2 chs #if 0
628 1.46.2.2 chs /*
629 1.46.2.2 chs * This calls the PROM monitor "exit_to_mon" function
630 1.46.2.2 chs * which appears to have problems... SunOS uses the
631 1.46.2.2 chs * "abort" function when you halt (bug work-around?)
632 1.46.2.2 chs * so we might as well do the same.
633 1.46.2.2 chs */
634 1.46.2.2 chs sunmon_halt(); /* provokes PROM monitor bug */
635 1.46.2.2 chs #else
636 1.46.2.2 chs sunmon_abort();
637 1.46.2.2 chs #endif
638 1.46.2.2 chs }
639 1.46.2.2 chs
640 1.46.2.2 chs /*
641 1.46.2.2 chs * Automatic reboot.
642 1.46.2.2 chs */
643 1.46.2.2 chs if (user_boot_string)
644 1.46.2.2 chs strncpy(bootstr, user_boot_string, sizeof(bootstr));
645 1.46.2.2 chs else {
646 1.46.2.2 chs /*
647 1.46.2.2 chs * Build our own boot string with an empty
648 1.46.2.2 chs * boot device/file and (maybe) some flags.
649 1.46.2.2 chs * The PROM will supply the device/file name.
650 1.46.2.2 chs */
651 1.46.2.2 chs p = bootstr;
652 1.46.2.2 chs *p = '\0';
653 1.46.2.2 chs if (howto & (RB_KDB|RB_ASKNAME|RB_SINGLE)) {
654 1.46.2.2 chs /* Append the boot flags. */
655 1.46.2.2 chs *p++ = ' ';
656 1.46.2.2 chs *p++ = '-';
657 1.46.2.2 chs if (howto & RB_KDB)
658 1.46.2.2 chs *p++ = 'd';
659 1.46.2.2 chs if (howto & RB_ASKNAME)
660 1.46.2.2 chs *p++ = 'a';
661 1.46.2.2 chs if (howto & RB_SINGLE)
662 1.46.2.2 chs *p++ = 's';
663 1.46.2.2 chs *p = '\0';
664 1.46.2.2 chs }
665 1.46.2.2 chs }
666 1.46.2.2 chs printf("Kernel rebooting...\n");
667 1.46.2.2 chs sunmon_reboot(bootstr);
668 1.46.2.2 chs for (;;) ;
669 1.46.2.2 chs /*NOTREACHED*/
670 1.46.2.2 chs }
671 1.46.2.2 chs
672 1.46.2.2 chs /*
673 1.46.2.2 chs * These variables are needed by /sbin/savecore
674 1.46.2.2 chs */
675 1.46.2.2 chs u_long dumpmag = 0x8fca0101; /* magic number */
676 1.46.2.2 chs int dumpsize = 0; /* pages */
677 1.46.2.2 chs long dumplo = 0; /* blocks */
678 1.46.2.2 chs
679 1.46.2.2 chs /*
680 1.46.2.2 chs * This is called by main to set dumplo, dumpsize.
681 1.46.2.2 chs * Dumps always skip the first CLBYTES of disk space
682 1.46.2.2 chs * in case there might be a disk label stored there.
683 1.46.2.2 chs * If there is extra space, put dump at the end to
684 1.46.2.2 chs * reduce the chance that swapping trashes it.
685 1.46.2.2 chs */
686 1.46.2.2 chs void
687 1.46.2.2 chs cpu_dumpconf()
688 1.46.2.2 chs {
689 1.46.2.2 chs int nblks; /* size of dump area */
690 1.46.2.2 chs int maj;
691 1.46.2.2 chs int (*getsize)__P((dev_t));
692 1.46.2.2 chs
693 1.46.2.2 chs /* Validate space in page zero for the kcore header. */
694 1.46.2.2 chs if (MSGBUFOFF < (sizeof(kcore_seg_t) + sizeof(cpu_kcore_hdr_t)))
695 1.46.2.2 chs panic("cpu_dumpconf: MSGBUFOFF too small");
696 1.46.2.2 chs
697 1.46.2.2 chs if (dumpdev == NODEV)
698 1.46.2.2 chs return;
699 1.46.2.2 chs
700 1.46.2.2 chs maj = major(dumpdev);
701 1.46.2.2 chs if (maj < 0 || maj >= nblkdev)
702 1.46.2.2 chs panic("dumpconf: bad dumpdev=0x%x", dumpdev);
703 1.46.2.2 chs getsize = bdevsw[maj].d_psize;
704 1.46.2.2 chs if (getsize == NULL)
705 1.46.2.2 chs return;
706 1.46.2.2 chs nblks = (*getsize)(dumpdev);
707 1.46.2.2 chs if (nblks <= ctod(1))
708 1.46.2.2 chs return;
709 1.46.2.2 chs
710 1.46.2.2 chs /* Position dump image near end of space, page aligned. */
711 1.46.2.2 chs dumpsize = physmem; /* pages */
712 1.46.2.2 chs dumplo = nblks - ctod(dumpsize);
713 1.46.2.2 chs dumplo &= ~(ctod(1)-1);
714 1.46.2.2 chs
715 1.46.2.2 chs /* If it does not fit, truncate it by moving dumplo. */
716 1.46.2.2 chs /* Note: Must force signed comparison. */
717 1.46.2.2 chs if (dumplo < ((long)ctod(1))) {
718 1.46.2.2 chs dumplo = ctod(1);
719 1.46.2.2 chs dumpsize = dtoc(nblks - dumplo);
720 1.46.2.2 chs }
721 1.46.2.2 chs }
722 1.46.2.2 chs
723 1.46.2.2 chs /* Note: gdb looks for "dumppcb" in a kernel crash dump. */
724 1.46.2.2 chs struct pcb dumppcb;
725 1.46.2.2 chs
726 1.46.2.2 chs /*
727 1.46.2.2 chs * Write a crash dump. The format while in swap is:
728 1.46.2.2 chs * kcore_seg_t cpu_hdr;
729 1.46.2.2 chs * cpu_kcore_hdr_t cpu_data;
730 1.46.2.2 chs * padding (NBPG-sizeof(kcore_seg_t))
731 1.46.2.2 chs * pagemap (2*NBPG)
732 1.46.2.2 chs * physical memory...
733 1.46.2.2 chs */
734 1.46.2.2 chs void
735 1.46.2.2 chs dumpsys()
736 1.46.2.2 chs {
737 1.46.2.2 chs struct bdevsw *dsw;
738 1.46.2.2 chs kcore_seg_t *kseg_p;
739 1.46.2.2 chs cpu_kcore_hdr_t *chdr_p;
740 1.46.2.2 chs struct sun3x_kcore_hdr *sh;
741 1.46.2.2 chs phys_ram_seg_t *crs_p;
742 1.46.2.2 chs char *vaddr;
743 1.46.2.2 chs vm_offset_t paddr;
744 1.46.2.2 chs int psize, todo, seg, segsz;
745 1.46.2.2 chs daddr_t blkno;
746 1.46.2.2 chs int error = 0;
747 1.46.2.2 chs
748 1.46.2.2 chs msgbufenabled = 0;
749 1.46.2.2 chs if (dumpdev == NODEV)
750 1.46.2.2 chs return;
751 1.46.2.2 chs
752 1.46.2.2 chs /*
753 1.46.2.2 chs * For dumps during autoconfiguration,
754 1.46.2.2 chs * if dump device has already configured...
755 1.46.2.2 chs */
756 1.46.2.2 chs if (dumpsize == 0)
757 1.46.2.2 chs cpu_dumpconf();
758 1.46.2.2 chs if (dumplo <= 0) {
759 1.46.2.2 chs printf("\ndump to dev %u,%u not possible\n", major(dumpdev),
760 1.46.2.2 chs minor(dumpdev));
761 1.46.2.2 chs return;
762 1.46.2.2 chs }
763 1.46.2.2 chs savectx(&dumppcb);
764 1.46.2.2 chs
765 1.46.2.2 chs dsw = &bdevsw[major(dumpdev)];
766 1.46.2.2 chs psize = (*(dsw->d_psize))(dumpdev);
767 1.46.2.2 chs if (psize == -1) {
768 1.46.2.2 chs printf("dump area unavailable\n");
769 1.46.2.2 chs return;
770 1.46.2.2 chs }
771 1.46.2.2 chs
772 1.46.2.2 chs printf("\ndumping to dev %u,%u offset %ld\n", major(dumpdev),
773 1.46.2.2 chs minor(dumpdev), dumplo);
774 1.46.2.2 chs
775 1.46.2.2 chs /*
776 1.46.2.2 chs * We put the dump header is in physical page zero,
777 1.46.2.2 chs * so there is no extra work here to write it out.
778 1.46.2.2 chs * All we do is initialize the header.
779 1.46.2.2 chs */
780 1.46.2.2 chs
781 1.46.2.2 chs /* Set pointers to all three parts. */
782 1.46.2.2 chs kseg_p = (kcore_seg_t *)KERNBASE;
783 1.46.2.2 chs chdr_p = (cpu_kcore_hdr_t *) (kseg_p + 1);
784 1.46.2.2 chs sh = &chdr_p->un._sun3x;
785 1.46.2.2 chs
786 1.46.2.2 chs /* Fill in kcore_seg_t part. */
787 1.46.2.2 chs CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
788 1.46.2.2 chs kseg_p->c_size = sizeof(*chdr_p);
789 1.46.2.2 chs
790 1.46.2.2 chs /* Fill in cpu_kcore_hdr_t part. */
791 1.46.2.2 chs strncpy(chdr_p->name, kernel_arch, sizeof(chdr_p->name));
792 1.46.2.2 chs chdr_p->page_size = NBPG;
793 1.46.2.2 chs chdr_p->kernbase = KERNBASE;
794 1.46.2.2 chs
795 1.46.2.2 chs /* Fill in the sun3x_kcore_hdr part. */
796 1.46.2.2 chs pmap_kcore_hdr(sh);
797 1.46.2.2 chs
798 1.46.2.2 chs /*
799 1.46.2.2 chs * Now dump physical memory. Note that physical memory
800 1.46.2.2 chs * might NOT be congiguous, so do it by segments.
801 1.46.2.2 chs */
802 1.46.2.2 chs
803 1.46.2.2 chs blkno = dumplo;
804 1.46.2.2 chs todo = dumpsize; /* pages */
805 1.46.2.2 chs vaddr = (char*)vmmap; /* Borrow /dev/mem VA */
806 1.46.2.2 chs
807 1.46.2.2 chs for (seg = 0; seg < SUN3X_NPHYS_RAM_SEGS; seg++) {
808 1.46.2.2 chs crs_p = &sh->ram_segs[seg];
809 1.46.2.2 chs paddr = crs_p->start;
810 1.46.2.2 chs segsz = crs_p->size;
811 1.46.2.2 chs /*
812 1.46.2.2 chs * Our header lives in the first little bit of
813 1.46.2.2 chs * physical memory (not written separately), so
814 1.46.2.2 chs * we have to adjust the first ram segment size
815 1.46.2.2 chs * and start address to reflect the stolen RAM.
816 1.46.2.2 chs * (Nothing interesing in that RAM anyway 8^).
817 1.46.2.2 chs */
818 1.46.2.2 chs if (seg == 0) {
819 1.46.2.2 chs int adj = sizeof(*kseg_p) + sizeof(*chdr_p);
820 1.46.2.2 chs crs_p->start += adj;
821 1.46.2.2 chs crs_p->size -= adj;
822 1.46.2.2 chs }
823 1.46.2.2 chs
824 1.46.2.2 chs while (todo && (segsz > 0)) {
825 1.46.2.2 chs
826 1.46.2.2 chs /* Print pages left after every 16. */
827 1.46.2.2 chs if ((todo & 0xf) == 0)
828 1.46.2.2 chs printf("\r%4d", todo);
829 1.46.2.2 chs
830 1.46.2.2 chs /* Make a temporary mapping for the page. */
831 1.46.2.2 chs pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC,
832 1.46.2.2 chs VM_PROT_READ, FALSE, 0);
833 1.46.2.2 chs error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
834 1.46.2.2 chs pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG);
835 1.46.2.2 chs if (error)
836 1.46.2.2 chs goto fail;
837 1.46.2.2 chs paddr += NBPG;
838 1.46.2.2 chs segsz -= NBPG;
839 1.46.2.2 chs blkno += btodb(NBPG);
840 1.46.2.2 chs todo--;
841 1.46.2.2 chs }
842 1.46.2.2 chs }
843 1.46.2.2 chs printf("\rdump succeeded\n");
844 1.46.2.2 chs return;
845 1.46.2.2 chs fail:
846 1.46.2.2 chs printf(" dump error=%d\n", error);
847 1.46.2.2 chs }
848 1.46.2.2 chs
849 1.46.2.2 chs static void
850 1.46.2.2 chs initcpu()
851 1.46.2.2 chs {
852 1.46.2.2 chs /* XXX: Enable RAM parity/ECC checking? */
853 1.46.2.2 chs /* XXX: parityenable(); */
854 1.46.2.2 chs
855 1.46.2.2 chs #ifdef HAVECACHE
856 1.46.2.2 chs cache_enable();
857 1.46.2.2 chs #endif
858 1.46.2.2 chs }
859 1.46.2.2 chs
860 1.46.2.2 chs /* straptrap() in trap.c */
861 1.46.2.2 chs
862 1.46.2.2 chs /* from hp300: badaddr() */
863 1.46.2.2 chs /* peek_byte(), peek_word() moved to bus_subr.c */
864 1.46.2.2 chs
865 1.46.2.2 chs /* XXX: parityenable() ? */
866 1.46.2.2 chs /* regdump() moved to regdump.c */
867 1.46.2.2 chs
868 1.46.2.2 chs /*
869 1.46.2.2 chs * cpu_exec_aout_makecmds():
870 1.46.2.2 chs * cpu-dependent a.out format hook for execve().
871 1.46.2.2 chs *
872 1.46.2.2 chs * Determine if the given exec package refers to something which we
873 1.46.2.2 chs * understand and, if so, set up the vmcmds for it.
874 1.46.2.2 chs */
875 1.46.2.2 chs int
876 1.46.2.2 chs cpu_exec_aout_makecmds(p, epp)
877 1.46.2.2 chs struct proc *p;
878 1.46.2.2 chs struct exec_package *epp;
879 1.46.2.2 chs {
880 1.46.2.2 chs return ENOEXEC;
881 1.46.2.2 chs }
882