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