machdep.c revision 1.9 1 /* $NetBSD: machdep.c,v 1.9 1997/03/17 19:03:35 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> XXX: needs st_entry_t */
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 * XXX - Should be named: cpu_reboot maybe? -gwr
501 */
502 __dead void
503 boot(howto, user_boot_string)
504 int howto;
505 char *user_boot_string;
506 {
507 /* Note: this string MUST be static! */
508 static char bootstr[128];
509 char *p;
510
511 /* If system is cold, just halt. (early panic?) */
512 if (cold)
513 goto haltsys;
514
515 if ((howto & RB_NOSYNC) == 0) {
516 reboot_sync();
517 /*
518 * If we've been adjusting the clock, the todr
519 * will be out of synch; adjust it now.
520 *
521 * XXX - However, if the kernel has been sitting in ddb,
522 * the time will be way off, so don't set the HW clock!
523 * XXX - Should do sanity check against HW clock. -gwr
524 */
525 /* resettodr(); */
526 }
527
528 /* Disable interrupts. */
529 splhigh();
530
531 /* Write out a crash dump if asked. */
532 if (howto & RB_DUMP)
533 dumpsys();
534
535 /* run any shutdown hooks */
536 doshutdownhooks();
537
538 if (howto & RB_HALT) {
539 haltsys:
540 printf("Kernel halted.\n");
541 sunmon_halt();
542 }
543
544 /*
545 * Automatic reboot.
546 */
547 if (user_boot_string)
548 strncpy(bootstr, user_boot_string, sizeof(bootstr));
549 else {
550 /*
551 * Build our own boot string with an empty
552 * boot device/file and (maybe) some flags.
553 * The PROM will supply the device/file name.
554 */
555 p = bootstr;
556 *p = '\0';
557 if (howto & (RB_KDB|RB_ASKNAME|RB_SINGLE)) {
558 /* Append the boot flags. */
559 *p++ = ' ';
560 *p++ = '-';
561 if (howto & RB_KDB)
562 *p++ = 'd';
563 if (howto & RB_ASKNAME)
564 *p++ = 'a';
565 if (howto & RB_SINGLE)
566 *p++ = 's';
567 *p = '\0';
568 }
569 }
570 printf("Kernel rebooting...\n");
571 sunmon_reboot(bootstr);
572 for (;;) ;
573 /*NOTREACHED*/
574 }
575
576 /*
577 * These variables are needed by /sbin/savecore
578 */
579 u_long dumpmag = 0x8fca0101; /* magic number */
580 int dumpsize = 0; /* pages */
581 long dumplo = 0; /* blocks */
582
583 /*
584 * This is called by cpu_startup to set dumplo, dumpsize.
585 * Dumps always skip the first CLBYTES of disk space
586 * in case there might be a disk label stored there.
587 * If there is extra space, put dump at the end to
588 * reduce the chance that swapping trashes it.
589 */
590 void
591 dumpconf()
592 {
593 int nblks; /* size of dump area */
594 int maj;
595 int (*getsize)__P((dev_t));
596
597 if (dumpdev == NODEV)
598 return;
599
600 maj = major(dumpdev);
601 if (maj < 0 || maj >= nblkdev)
602 panic("dumpconf: bad dumpdev=0x%x", dumpdev);
603 getsize = bdevsw[maj].d_psize;
604 if (getsize == NULL)
605 return;
606 nblks = (*getsize)(dumpdev);
607 if (nblks <= ctod(1))
608 return;
609
610 /* Position dump image near end of space, page aligned. */
611 dumpsize = physmem; /* pages */
612 dumplo = nblks - ctod(dumpsize);
613 dumplo &= ~(ctod(1)-1);
614
615 /* If it does not fit, truncate it by moving dumplo. */
616 /* Note: Must force signed comparison. */
617 if (dumplo < ((long)ctod(1))) {
618 dumplo = ctod(1);
619 dumpsize = dtoc(nblks - dumplo);
620 }
621 }
622
623 struct pcb dumppcb;
624 extern vm_offset_t avail_start;
625
626 /*
627 * Write a crash dump. The format while in swap is:
628 * kcore_seg_t cpu_hdr;
629 * cpu_kcore_hdr_t cpu_data;
630 * padding (NBPG-sizeof(kcore_seg_t))
631 * pagemap (2*NBPG)
632 * physical memory...
633 */
634 void
635 dumpsys()
636 {
637 struct bdevsw *dsw;
638 char *vaddr;
639 vm_offset_t paddr;
640 int psize, todo, chunk;
641 daddr_t blkno;
642 int error = 0;
643
644 msgbufmapped = 0;
645 if (dumpdev == NODEV)
646 return;
647
648 /*
649 * For dumps during autoconfiguration,
650 * if dump device has already configured...
651 */
652 if (dumpsize == 0)
653 dumpconf();
654 if (dumplo <= 0)
655 return;
656 savectx(&dumppcb);
657
658 dsw = &bdevsw[major(dumpdev)];
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 %x, offset %d\n",
666 (int) dumpdev, (int) dumplo);
667
668 /*
669 * Write the dump header, including MMU state.
670 */
671 blkno = dumplo;
672 todo = dumpsize; /* pages */
673
674 /*
675 * Now dump physical memory. Have to do it in two chunks.
676 * The first chunk is "unmanaged" (by the VM code) and its
677 * range of physical addresses is not allow in pmap_enter.
678 * However, that segment is mapped linearly, so we can just
679 * use the virtual mappings already in place. The second
680 * chunk is done the normal way, using pmap_enter.
681 *
682 * Note that vaddr==(paddr+KERNBASE) for paddr=0 through etext.
683 */
684
685 /* Do the first chunk (0 <= PA < avail_start) */
686 paddr = 0;
687 chunk = btoc(avail_start);
688 if (chunk > todo)
689 chunk = todo;
690 do {
691 if ((todo & 0xf) == 0)
692 printf("\r%4d", todo);
693 vaddr = (char*)(paddr + KERNBASE);
694 error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
695 if (error)
696 goto fail;
697 paddr += NBPG;
698 blkno += btodb(NBPG);
699 --todo;
700 } while (--chunk > 0);
701
702 /* Do the second chunk (avail_start <= PA < dumpsize) */
703 vaddr = (char*)vmmap; /* Borrow /dev/mem VA */
704 do {
705 if ((todo & 0xf) == 0)
706 printf("\r%4d", todo);
707 pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC,
708 VM_PROT_READ, FALSE);
709 error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
710 pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG);
711 if (error)
712 goto fail;
713 paddr += NBPG;
714 blkno += btodb(NBPG);
715 } while (--todo > 0);
716
717 printf("\rdump succeeded\n");
718 return;
719 fail:
720 printf(" dump error=%d\n", error);
721 }
722
723 static void
724 initcpu()
725 {
726 /* XXX: Enable RAM parity/ECC checking? */
727 /* XXX: parityenable(); */
728
729 #ifdef HAVECACHE
730 cache_enable();
731 #endif
732 }
733
734 /* straptrap() in trap.c */
735
736 /* from hp300: badaddr() */
737 /* peek_byte(), peek_word() moved to autoconf.c */
738
739 /* XXX: parityenable() ? */
740 /* regdump() moved to regdump.c */
741
742 /*
743 * cpu_exec_aout_makecmds():
744 * cpu-dependent a.out format hook for execve().
745 *
746 * Determine if the given exec package refers to something which we
747 * understand and, if so, set up the vmcmds for it.
748 */
749 int
750 cpu_exec_aout_makecmds(p, epp)
751 struct proc *p;
752 struct exec_package *epp;
753 {
754 int error = ENOEXEC;
755
756 #ifdef COMPAT_SUNOS
757 extern sunos_exec_aout_makecmds
758 __P((struct proc *, struct exec_package *));
759 if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
760 return 0;
761 #endif
762 return error;
763 }
764