machdep.c revision 1.11 1 /* $NetBSD: machdep.c,v 1.11 1997/03/26 22:43:10 gwr 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 <sys/param.h>
45 #include <sys/systm.h>
46 #include <sys/kernel.h>
47 #include <sys/map.h>
48 #include <sys/proc.h>
49 #include <sys/buf.h>
50 #include <sys/reboot.h>
51 #include <sys/conf.h>
52 #include <sys/file.h>
53 #include <sys/clist.h>
54 #include <sys/callout.h>
55 #include <sys/malloc.h>
56 #include <sys/mbuf.h>
57 #include <sys/msgbuf.h>
58 #include <sys/ioctl.h>
59 #include <sys/tty.h>
60 #include <sys/mount.h>
61 #include <sys/user.h>
62 #include <sys/exec.h>
63 #include <sys/core.h>
64 #include <sys/kcore.h>
65 #include <sys/vnode.h>
66 #include <sys/sysctl.h>
67 #include <sys/syscallargs.h>
68 #ifdef SYSVMSG
69 #include <sys/msg.h>
70 #endif
71 #ifdef SYSVSEM
72 #include <sys/sem.h>
73 #endif
74 #ifdef SYSVSHM
75 #include <sys/shm.h>
76 #endif
77 #ifdef KGDB
78 #include <sys/kgdb.h>
79 #endif
80
81 #include <vm/vm.h>
82 #include <vm/vm_map.h>
83 #include <vm/vm_kern.h>
84 #include <vm/vm_page.h>
85
86 #include <dev/cons.h>
87
88 #include <machine/cpu.h>
89 #include <machine/reg.h>
90 #include <machine/psl.h>
91 #include <machine/pte.h>
92 #include <machine/dvma.h>
93 #include <machine/kcore.h>
94 #include <machine/db_machdep.h>
95 #include <machine/machdep.h>
96
97 extern char *cpu_string;
98 extern char version[];
99
100 /* Defined in locore.s */
101 extern char kernel_text[];
102 /* Defined by the linker */
103 extern char etext[];
104
105 int physmem;
106 int fputype;
107 int msgbufmapped;
108
109 vm_offset_t vmmap;
110
111 /*
112 * safepri is a safe priority for sleep to set for a spin-wait
113 * during autoconfiguration or after a panic.
114 */
115 int safepri = PSL_LOWIPL;
116
117 /*
118 * Declare these as initialized data so we can patch them.
119 */
120 int nswbuf = 0;
121 #ifdef NBUF
122 int nbuf = NBUF;
123 #else
124 int nbuf = 0;
125 #endif
126 #ifdef BUFPAGES
127 int bufpages = BUFPAGES;
128 #else
129 int bufpages = 0;
130 #endif
131
132 static void identifycpu __P((void));
133 static void initcpu __P((void));
134
135 /*
136 * Console initialization: called early on from main,
137 * before vm init or startup. Do enough configuration
138 * to choose and initialize a console.
139 */
140 void
141 consinit()
142 {
143 cninit(); /* See dev/zs.c */
144
145 #ifdef KGDB
146 /* XXX - Ask on console for kgdb_dev? */
147 /* Note: this will just return if kgdb_dev<0 */
148 if (boothowto & RB_KDB)
149 kgdb_connect(1);
150 #endif
151 #ifdef DDB
152 /* Now that we have a console, we can stop in DDB. */
153 db_machine_init();
154 ddb_init();
155 if (boothowto & RB_KDB)
156 Debugger();
157 #endif DDB
158 }
159
160 /*
161 * allocsys() - Private routine used by cpu_startup() below.
162 *
163 * Allocate space for system data structures. We are given
164 * a starting virtual address and we return a final virtual
165 * address; along the way we set each data structure pointer.
166 *
167 * We call allocsys() with 0 to find out how much space we want,
168 * allocate that much and fill it with zeroes, and then call
169 * allocsys() again with the correct base virtual address.
170 */
171 #define valloc(name, type, num) \
172 v = (caddr_t)(((name) = (type *)v) + (num))
173 static caddr_t allocsys __P((caddr_t));
174 static caddr_t
175 allocsys(v)
176 register caddr_t v;
177 {
178
179 #ifdef REAL_CLISTS
180 valloc(cfree, struct cblock, nclist);
181 #endif
182 valloc(callout, struct callout, ncallout);
183 valloc(swapmap, struct map, nswapmap = maxproc * 2);
184 #ifdef SYSVSHM
185 valloc(shmsegs, struct shmid_ds, shminfo.shmmni);
186 #endif
187 #ifdef SYSVSEM
188 valloc(sema, struct semid_ds, seminfo.semmni);
189 valloc(sem, struct sem, seminfo.semmns);
190 /* This is pretty disgusting! */
191 valloc(semu, int, (seminfo.semmnu * seminfo.semusz) / sizeof(int));
192 #endif
193 #ifdef SYSVMSG
194 valloc(msgpool, char, msginfo.msgmax);
195 valloc(msgmaps, struct msgmap, msginfo.msgseg);
196 valloc(msghdrs, struct msg, msginfo.msgtql);
197 valloc(msqids, struct msqid_ds, msginfo.msgmni);
198 #endif
199
200 /*
201 * Determine how many buffers to allocate. We allocate
202 * the BSD standard of use 10% of memory for the first 2 Meg,
203 * 5% of remaining. Insure a minimum of 16 buffers.
204 * Allocate 1/2 as many swap buffer headers as file i/o buffers.
205 */
206 if (bufpages == 0) {
207 /* We always have more than 2MB of memory. */
208 bufpages = ((btoc(2 * 1024 * 1024) + physmem) /
209 (20 * CLSIZE));
210 }
211 if (nbuf == 0) {
212 nbuf = bufpages;
213 if (nbuf < 16)
214 nbuf = 16;
215 }
216 if (nswbuf == 0) {
217 nswbuf = (nbuf / 2) &~ 1; /* force even */
218 if (nswbuf > 256)
219 nswbuf = 256; /* sanity */
220 }
221 valloc(swbuf, struct buf, nswbuf);
222 valloc(buf, struct buf, nbuf);
223 return v;
224 }
225 #undef valloc
226
227 /*
228 * cpu_startup: allocate memory for variable-sized tables,
229 * initialize cpu, and do autoconfiguration.
230 *
231 * This is called early in init_main.c:main(), after the
232 * kernel memory allocator is ready for use, but before
233 * the creation of processes 1,2, and mountroot, etc.
234 */
235 void
236 cpu_startup()
237 {
238 caddr_t v;
239 int sz, i;
240 vm_size_t size;
241 int base, residual;
242 vm_offset_t minaddr, maxaddr;
243
244 /*
245 * Initialize message buffer (for kernel printf).
246 * This is put in physical page zero so it will
247 * always be in the same place after a reboot.
248 * Its mapping was prepared in pmap_bootstrap().
249 * Also, offset some to avoid PROM scribbles.
250 */
251 v = (caddr_t) KERNBASE;
252 msgbufp = (struct msgbuf *)(v + 0x1000);
253 msgbufmapped = 1;
254
255 /*
256 * Good {morning,afternoon,evening,night}.
257 */
258 printf(version);
259 identifycpu();
260 initfpu(); /* also prints FPU type */
261
262 printf("real mem = %d\n", ctob(physmem));
263
264 /*
265 * Find out how much space we need, allocate it,
266 * and then give everything true virtual addresses.
267 */
268 sz = (int)allocsys((caddr_t)0);
269 if ((v = (caddr_t)kmem_alloc(kernel_map, round_page(sz))) == 0)
270 panic("startup: no room for tables");
271 if (allocsys(v) - v != sz)
272 panic("startup: table size inconsistency");
273
274 /*
275 * Now allocate buffers proper. They are different than the above
276 * in that they usually occupy more virtual memory than physical.
277 */
278 size = MAXBSIZE * nbuf;
279 buffer_map = kmem_suballoc(kernel_map, (vm_offset_t *)&buffers,
280 &maxaddr, size, TRUE);
281 minaddr = (vm_offset_t)buffers;
282 if (vm_map_find(buffer_map, vm_object_allocate(size), (vm_offset_t)0,
283 &minaddr, size, FALSE) != KERN_SUCCESS)
284 panic("startup: cannot allocate buffers");
285 if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
286 /* don't want to alloc more physical mem than needed */
287 bufpages = btoc(MAXBSIZE) * nbuf;
288 }
289 base = bufpages / nbuf;
290 residual = bufpages % nbuf;
291 for (i = 0; i < nbuf; i++) {
292 vm_size_t curbufsize;
293 vm_offset_t curbuf;
294
295 /*
296 * First <residual> buffers get (base+1) physical pages
297 * allocated for them. The rest get (base) physical pages.
298 *
299 * The rest of each buffer occupies virtual space,
300 * but has no physical memory allocated for it.
301 */
302 curbuf = (vm_offset_t)buffers + i * MAXBSIZE;
303 curbufsize = CLBYTES * (i < residual ? base+1 : base);
304 vm_map_pageable(buffer_map, curbuf, curbuf+curbufsize, FALSE);
305 vm_map_simplify(buffer_map, curbuf);
306 }
307
308 /*
309 * Allocate a submap for exec arguments. This map effectively
310 * limits the number of processes exec'ing at any time.
311 */
312 exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr,
313 16*NCARGS, TRUE);
314
315 /*
316 * We don't use a submap for physio, and use a separate map
317 * for DVMA allocations. Our vmapbuf just maps pages into
318 * the kernel map (any kernel mapping is OK) and then the
319 * device drivers clone the kernel mappings into DVMA space.
320 */
321
322 /*
323 * Finally, allocate mbuf pool. Since mclrefcnt is an off-size
324 * we use the more space efficient malloc in place of kmem_alloc.
325 */
326 mclrefcnt = (char *)malloc(NMBCLUSTERS+CLBYTES/MCLBYTES,
327 M_MBUF, M_NOWAIT);
328 bzero(mclrefcnt, NMBCLUSTERS+CLBYTES/MCLBYTES);
329 mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
330 VM_MBUF_SIZE, FALSE);
331
332 /*
333 * Initialize callouts
334 */
335 callfree = callout;
336 for (i = 1; i < ncallout; i++)
337 callout[i-1].c_next = &callout[i];
338 callout[i-1].c_next = NULL;
339
340 printf("avail mem = %d\n", (int) ptoa(cnt.v_free_count));
341 printf("using %d buffers containing %d bytes of memory\n",
342 nbuf, bufpages * CLBYTES);
343
344 /*
345 * Tell the VM system that writing to kernel text isn't allowed.
346 * If we don't, we might end up COW'ing the text segment!
347 */
348 if (vm_map_protect(kernel_map, (vm_offset_t) kernel_text,
349 trunc_page((vm_offset_t) etext),
350 VM_PROT_READ|VM_PROT_EXECUTE, TRUE)
351 != KERN_SUCCESS)
352 panic("can't protect kernel text");
353
354 /*
355 * Allocate a virtual page (for use by /dev/mem)
356 * This page is handed to pmap_enter() therefore
357 * it has to be in the normal kernel VA range.
358 */
359 vmmap = kmem_alloc_wait(kernel_map, NBPG);
360
361 /*
362 * Create the DVMA maps.
363 */
364 dvma_init();
365
366 /*
367 * Set up CPU-specific registers, cache, etc.
368 */
369 initcpu();
370
371 /*
372 * Set up buffers, so they can be used to read disk labels.
373 */
374 bufinit();
375
376 /*
377 * Configure the system.
378 */
379 configure();
380 }
381
382 /*
383 * Set registers on exec.
384 * XXX Should clear registers except sp, pc,
385 * but would break init; should be fixed soon.
386 */
387 void
388 setregs(p, pack, stack, retval)
389 register struct proc *p;
390 struct exec_package *pack;
391 u_long stack;
392 register_t *retval;
393 {
394 struct trapframe *tf = (struct trapframe *)p->p_md.md_regs;
395
396 tf->tf_pc = pack->ep_entry & ~1;
397 tf->tf_regs[SP] = stack;
398 tf->tf_regs[A2] = (int)PS_STRINGS;
399
400 /* restore a null state frame */
401 p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0;
402 if (fputype) {
403 m68881_restore(&p->p_addr->u_pcb.pcb_fpregs);
404 }
405 p->p_md.md_flags = 0;
406 /* XXX - HPUX sigcode hack would go here... */
407 }
408
409 /*
410 * Info for CTL_HW
411 */
412 char machine[] = "sun3x"; /* cpu "architecture" */
413 char cpu_model[120];
414 extern long hostid;
415
416 void
417 identifycpu()
418 {
419 /*
420 * actual identification done earlier because i felt like it,
421 * and i believe i will need the info to deal with some VAC, and awful
422 * framebuffer placement problems. could be moved later.
423 */
424 strcpy(cpu_model, "Sun 3/");
425
426 /* should eventually include whether it has a VAC, mc6888x version, etc */
427 strcat(cpu_model, cpu_string);
428
429 printf("Model: %s (hostid %x)\n", cpu_model, (int) hostid);
430 }
431
432 /*
433 * machine dependent system variables.
434 */
435 int
436 cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
437 int *name;
438 u_int namelen;
439 void *oldp;
440 size_t *oldlenp;
441 void *newp;
442 size_t newlen;
443 struct proc *p;
444 {
445 int error;
446 dev_t consdev;
447
448 /* all sysctl names at this level are terminal */
449 if (namelen != 1)
450 return (ENOTDIR); /* overloaded */
451
452 switch (name[0]) {
453 case CPU_CONSDEV:
454 if (cn_tab != NULL)
455 consdev = cn_tab->cn_dev;
456 else
457 consdev = NODEV;
458 error = sysctl_rdstruct(oldp, oldlenp, newp,
459 &consdev, sizeof consdev);
460 break;
461
462 #if 0 /* XXX - Not yet... */
463 case CPU_ROOT_DEVICE:
464 error = sysctl_rdstring(oldp, oldlenp, newp, root_device);
465 break;
466
467 case CPU_BOOTED_KERNEL:
468 error = sysctl_rdstring(oldp, oldlenp, newp, booted_kernel);
469 break;
470 #endif
471
472 default:
473 error = EOPNOTSUPP;
474 }
475 return (error);
476 }
477
478 /* See: sig_machdep.c */
479
480 /*
481 * Do a sync in preparation for a reboot.
482 * XXX - This could probably be common code.
483 * XXX - And now, most of it is in vfs_shutdown()
484 * XXX - Put waittime checks in there too?
485 */
486 int waittime = -1; /* XXX - Who else looks at this? -gwr */
487 static void
488 reboot_sync __P((void))
489 {
490
491 /* Check waittime here to localize its use to this function. */
492 if (waittime >= 0)
493 return;
494 waittime = 0;
495 vfs_shutdown();
496 }
497
498 /*
499 * Common part of the BSD and SunOS reboot system calls.
500 */
501 __dead void
502 cpu_reboot(howto, user_boot_string)
503 int howto;
504 char *user_boot_string;
505 {
506 /* Note: this string MUST be static! */
507 static char bootstr[128];
508 char *p;
509
510 /* If system is cold, just halt. (early panic?) */
511 if (cold)
512 goto haltsys;
513
514 if ((howto & RB_NOSYNC) == 0) {
515 reboot_sync();
516 /*
517 * If we've been adjusting the clock, the todr
518 * will be out of synch; adjust it now.
519 *
520 * XXX - However, if the kernel has been sitting in ddb,
521 * the time will be way off, so don't set the HW clock!
522 * XXX - Should do sanity check against HW clock. -gwr
523 */
524 /* resettodr(); */
525 }
526
527 /* Disable interrupts. */
528 splhigh();
529
530 /* Write out a crash dump if asked. */
531 if (howto & RB_DUMP)
532 dumpsys();
533
534 /* run any shutdown hooks */
535 doshutdownhooks();
536
537 if (howto & RB_HALT) {
538 haltsys:
539 printf("Kernel halted.\n");
540 sunmon_halt();
541 }
542
543 /*
544 * Automatic reboot.
545 */
546 if (user_boot_string)
547 strncpy(bootstr, user_boot_string, sizeof(bootstr));
548 else {
549 /*
550 * Build our own boot string with an empty
551 * boot device/file and (maybe) some flags.
552 * The PROM will supply the device/file name.
553 */
554 p = bootstr;
555 *p = '\0';
556 if (howto & (RB_KDB|RB_ASKNAME|RB_SINGLE)) {
557 /* Append the boot flags. */
558 *p++ = ' ';
559 *p++ = '-';
560 if (howto & RB_KDB)
561 *p++ = 'd';
562 if (howto & RB_ASKNAME)
563 *p++ = 'a';
564 if (howto & RB_SINGLE)
565 *p++ = 's';
566 *p = '\0';
567 }
568 }
569 printf("Kernel rebooting...\n");
570 sunmon_reboot(bootstr);
571 for (;;) ;
572 /*NOTREACHED*/
573 }
574
575 /*
576 * These variables are needed by /sbin/savecore
577 */
578 u_long dumpmag = 0x8fca0101; /* magic number */
579 int dumpsize = 0; /* pages */
580 long dumplo = 0; /* blocks */
581
582 /*
583 * This is called by main to set dumplo, dumpsize.
584 * Dumps always skip the first CLBYTES of disk space
585 * in case there might be a disk label stored there.
586 * If there is extra space, put dump at the end to
587 * reduce the chance that swapping trashes it.
588 */
589 void
590 cpu_dumpconf()
591 {
592 int nblks; /* size of dump area */
593 int maj;
594 int (*getsize)__P((dev_t));
595
596 if (dumpdev == NODEV)
597 return;
598
599 maj = major(dumpdev);
600 if (maj < 0 || maj >= nblkdev)
601 panic("dumpconf: bad dumpdev=0x%x", dumpdev);
602 getsize = bdevsw[maj].d_psize;
603 if (getsize == NULL)
604 return;
605 nblks = (*getsize)(dumpdev);
606 if (nblks <= ctod(1))
607 return;
608
609 /* Position dump image near end of space, page aligned. */
610 dumpsize = physmem; /* pages */
611 dumplo = nblks - ctod(dumpsize);
612 dumplo &= ~(ctod(1)-1);
613
614 /* If it does not fit, truncate it by moving dumplo. */
615 /* Note: Must force signed comparison. */
616 if (dumplo < ((long)ctod(1))) {
617 dumplo = ctod(1);
618 dumpsize = dtoc(nblks - dumplo);
619 }
620 }
621
622 struct pcb dumppcb;
623
624 /*
625 * Write a crash dump. The format while in swap is:
626 * kcore_seg_t cpu_hdr;
627 * cpu_kcore_hdr_t cpu_data;
628 * padding (NBPG-sizeof(kcore_seg_t))
629 * pagemap (2*NBPG)
630 * physical memory...
631 */
632 void
633 dumpsys()
634 {
635 struct bdevsw *dsw;
636 kcore_seg_t *kseg_p;
637 cpu_kcore_hdr_t *chdr_p;
638 cpu_ram_seg_t *crs_p;
639 char *vaddr;
640 vm_offset_t paddr;
641 int psize, todo, seg, segsz;
642 daddr_t blkno;
643 int error = 0;
644
645 msgbufmapped = 0;
646 if (dumpdev == NODEV)
647 return;
648
649 /*
650 * For dumps during autoconfiguration,
651 * if dump device has already configured...
652 */
653 if (dumpsize == 0)
654 cpu_dumpconf();
655 if (dumplo <= 0)
656 return;
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 %x, offset %d\n",
667 (int) dumpdev, (int) 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 */
673 kseg_p = (kcore_seg_t *)KERNBASE;
674 chdr_p = (cpu_kcore_hdr_t *) (kseg_p + 1);
675 CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
676 kseg_p->c_size = sizeof(*chdr_p);
677 pmap_set_kcore_hdr(chdr_p);
678
679 /*
680 * Now dump physical memory. Note that physical memory
681 * might NOT be congiguous, so do it by segments.
682 */
683
684 blkno = dumplo;
685 todo = dumpsize; /* pages */
686 vaddr = (char*)vmmap; /* Borrow /dev/mem VA */
687
688 for (seg = 0; seg < NPHYS_RAM_SEGS; seg++) {
689 crs_p = &chdr_p->ram_segs[seg];
690 paddr = crs_p->start;
691 segsz = crs_p->size;
692 /*
693 * Our header lives in the first little bit of
694 * physical memory (not written separately), so
695 * we have to adjust the first ram segment size
696 * and start address to reflect the stolen RAM.
697 * (Nothing interesing in that RAM anyway 8^).
698 */
699 if (seg == 0) {
700 int adj = sizeof(*kseg_p) + sizeof(*chdr_p);
701 crs_p->start += adj;
702 crs_p->size -= adj;
703 }
704
705 while (todo && (segsz > 0)) {
706
707 /* Print pages left after every 16. */
708 if ((todo & 0xf) == 0)
709 printf("\r%4d", todo);
710
711 /* Make a temporary mapping for the page. */
712 pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC,
713 VM_PROT_READ, FALSE);
714 error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
715 pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG);
716 if (error)
717 goto fail;
718 paddr += NBPG;
719 segsz -= NBPG;
720 blkno += btodb(NBPG);
721 todo--;
722 }
723 }
724 printf("\rdump succeeded\n");
725 return;
726 fail:
727 printf(" dump error=%d\n", error);
728 }
729
730 static void
731 initcpu()
732 {
733 /* XXX: Enable RAM parity/ECC checking? */
734 /* XXX: parityenable(); */
735
736 #ifdef HAVECACHE
737 cache_enable();
738 #endif
739 }
740
741 /* straptrap() in trap.c */
742
743 /* from hp300: badaddr() */
744 /* peek_byte(), peek_word() moved to autoconf.c */
745
746 /* XXX: parityenable() ? */
747 /* regdump() moved to regdump.c */
748
749 /*
750 * cpu_exec_aout_makecmds():
751 * cpu-dependent a.out format hook for execve().
752 *
753 * Determine if the given exec package refers to something which we
754 * understand and, if so, set up the vmcmds for it.
755 */
756 int
757 cpu_exec_aout_makecmds(p, epp)
758 struct proc *p;
759 struct exec_package *epp;
760 {
761 int error = ENOEXEC;
762
763 #ifdef COMPAT_SUNOS
764 extern sunos_exec_aout_makecmds
765 __P((struct proc *, struct exec_package *));
766 if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
767 return 0;
768 #endif
769 return error;
770 }
771