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