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