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