machdep.c revision 1.13 1 /* $NetBSD: machdep.c,v 1.13 1997/04/04 20:49:06 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 cluster submap.
324 */
325 mb_map = kmem_suballoc(kernel_map, (vm_offset_t *)&mbutl, &maxaddr,
326 VM_MBUF_SIZE, FALSE);
327
328 /*
329 * Initialize callouts
330 */
331 callfree = callout;
332 for (i = 1; i < ncallout; i++)
333 callout[i-1].c_next = &callout[i];
334 callout[i-1].c_next = NULL;
335
336 printf("avail mem = %d\n", (int) ptoa(cnt.v_free_count));
337 printf("using %d buffers containing %d bytes of memory\n",
338 nbuf, bufpages * CLBYTES);
339
340 /*
341 * Tell the VM system that writing to kernel text isn't allowed.
342 * If we don't, we might end up COW'ing the text segment!
343 */
344 if (vm_map_protect(kernel_map, (vm_offset_t) kernel_text,
345 trunc_page((vm_offset_t) etext),
346 VM_PROT_READ|VM_PROT_EXECUTE, TRUE)
347 != KERN_SUCCESS)
348 panic("can't protect kernel text");
349
350 /*
351 * Allocate a virtual page (for use by /dev/mem)
352 * This page is handed to pmap_enter() therefore
353 * it has to be in the normal kernel VA range.
354 */
355 vmmap = kmem_alloc_wait(kernel_map, NBPG);
356
357 /*
358 * Create the DVMA maps.
359 */
360 dvma_init();
361
362 /*
363 * Set up CPU-specific registers, cache, etc.
364 */
365 initcpu();
366
367 /*
368 * Set up buffers, so they can be used to read disk labels.
369 */
370 bufinit();
371
372 /*
373 * Configure the system.
374 */
375 configure();
376 }
377
378 /*
379 * Set registers on exec.
380 * XXX Should clear registers except sp, pc,
381 * but would break init; should be fixed soon.
382 */
383 void
384 setregs(p, pack, stack, retval)
385 register struct proc *p;
386 struct exec_package *pack;
387 u_long stack;
388 register_t *retval;
389 {
390 struct trapframe *tf = (struct trapframe *)p->p_md.md_regs;
391
392 tf->tf_pc = pack->ep_entry & ~1;
393 tf->tf_regs[SP] = stack;
394 tf->tf_regs[A2] = (int)PS_STRINGS;
395
396 /* restore a null state frame */
397 p->p_addr->u_pcb.pcb_fpregs.fpf_null = 0;
398 if (fputype) {
399 m68881_restore(&p->p_addr->u_pcb.pcb_fpregs);
400 }
401 p->p_md.md_flags = 0;
402 /* XXX - HPUX sigcode hack would go here... */
403 }
404
405 /*
406 * Info for CTL_HW
407 */
408 char machine[] = "sun3x"; /* cpu "architecture" */
409 char cpu_model[120];
410 extern long hostid;
411
412 void
413 identifycpu()
414 {
415 /*
416 * actual identification done earlier because i felt like it,
417 * and i believe i will need the info to deal with some VAC, and awful
418 * framebuffer placement problems. could be moved later.
419 */
420 strcpy(cpu_model, "Sun 3/");
421
422 /* should eventually include whether it has a VAC, mc6888x version, etc */
423 strcat(cpu_model, cpu_string);
424
425 printf("Model: %s (hostid %x)\n", cpu_model, (int) hostid);
426 }
427
428 /*
429 * machine dependent system variables.
430 */
431 int
432 cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
433 int *name;
434 u_int namelen;
435 void *oldp;
436 size_t *oldlenp;
437 void *newp;
438 size_t newlen;
439 struct proc *p;
440 {
441 int error;
442 dev_t consdev;
443
444 /* all sysctl names at this level are terminal */
445 if (namelen != 1)
446 return (ENOTDIR); /* overloaded */
447
448 switch (name[0]) {
449 case CPU_CONSDEV:
450 if (cn_tab != NULL)
451 consdev = cn_tab->cn_dev;
452 else
453 consdev = NODEV;
454 error = sysctl_rdstruct(oldp, oldlenp, newp,
455 &consdev, sizeof consdev);
456 break;
457
458 #if 0 /* XXX - Not yet... */
459 case CPU_ROOT_DEVICE:
460 error = sysctl_rdstring(oldp, oldlenp, newp, root_device);
461 break;
462
463 case CPU_BOOTED_KERNEL:
464 error = sysctl_rdstring(oldp, oldlenp, newp, booted_kernel);
465 break;
466 #endif
467
468 default:
469 error = EOPNOTSUPP;
470 }
471 return (error);
472 }
473
474 /* See: sig_machdep.c */
475
476 /*
477 * Do a sync in preparation for a reboot.
478 * XXX - This could probably be common code.
479 * XXX - And now, most of it is in vfs_shutdown()
480 * XXX - Put waittime checks in there too?
481 */
482 int waittime = -1; /* XXX - Who else looks at this? -gwr */
483 static void
484 reboot_sync __P((void))
485 {
486
487 /* Check waittime here to localize its use to this function. */
488 if (waittime >= 0)
489 return;
490 waittime = 0;
491 vfs_shutdown();
492 }
493
494 /*
495 * Common part of the BSD and SunOS reboot system calls.
496 */
497 __dead void
498 cpu_reboot(howto, user_boot_string)
499 int howto;
500 char *user_boot_string;
501 {
502 /* Note: this string MUST be static! */
503 static char bootstr[128];
504 char *p;
505
506 /* If system is cold, just halt. (early panic?) */
507 if (cold)
508 goto haltsys;
509
510 if ((howto & RB_NOSYNC) == 0) {
511 reboot_sync();
512 /*
513 * If we've been adjusting the clock, the todr
514 * will be out of synch; adjust it now.
515 *
516 * XXX - However, if the kernel has been sitting in ddb,
517 * the time will be way off, so don't set the HW clock!
518 * XXX - Should do sanity check against HW clock. -gwr
519 */
520 /* resettodr(); */
521 }
522
523 /* Disable interrupts. */
524 splhigh();
525
526 /* Write out a crash dump if asked. */
527 if (howto & RB_DUMP)
528 dumpsys();
529
530 /* run any shutdown hooks */
531 doshutdownhooks();
532
533 if (howto & RB_HALT) {
534 haltsys:
535 printf("Kernel halted.\n");
536 sunmon_halt();
537 }
538
539 /*
540 * Automatic reboot.
541 */
542 if (user_boot_string)
543 strncpy(bootstr, user_boot_string, sizeof(bootstr));
544 else {
545 /*
546 * Build our own boot string with an empty
547 * boot device/file and (maybe) some flags.
548 * The PROM will supply the device/file name.
549 */
550 p = bootstr;
551 *p = '\0';
552 if (howto & (RB_KDB|RB_ASKNAME|RB_SINGLE)) {
553 /* Append the boot flags. */
554 *p++ = ' ';
555 *p++ = '-';
556 if (howto & RB_KDB)
557 *p++ = 'd';
558 if (howto & RB_ASKNAME)
559 *p++ = 'a';
560 if (howto & RB_SINGLE)
561 *p++ = 's';
562 *p = '\0';
563 }
564 }
565 printf("Kernel rebooting...\n");
566 sunmon_reboot(bootstr);
567 for (;;) ;
568 /*NOTREACHED*/
569 }
570
571 /*
572 * These variables are needed by /sbin/savecore
573 */
574 u_long dumpmag = 0x8fca0101; /* magic number */
575 int dumpsize = 0; /* pages */
576 long dumplo = 0; /* blocks */
577
578 /*
579 * This is called by main to set dumplo, dumpsize.
580 * Dumps always skip the first CLBYTES of disk space
581 * in case there might be a disk label stored there.
582 * If there is extra space, put dump at the end to
583 * reduce the chance that swapping trashes it.
584 */
585 void
586 cpu_dumpconf()
587 {
588 int nblks; /* size of dump area */
589 int maj;
590 int (*getsize)__P((dev_t));
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 cpu_ram_seg_t *crs_p;
636 char *vaddr;
637 vm_offset_t paddr;
638 int psize, todo, seg, segsz;
639 daddr_t blkno;
640 int error = 0;
641
642 msgbufmapped = 0;
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 return;
654 savectx(&dumppcb);
655
656 dsw = &bdevsw[major(dumpdev)];
657 psize = (*(dsw->d_psize))(dumpdev);
658 if (psize == -1) {
659 printf("dump area unavailable\n");
660 return;
661 }
662
663 printf("\ndumping to dev %x, offset %d\n",
664 (int) dumpdev, (int) dumplo);
665
666 /*
667 * We put the dump header is in physical page zero,
668 * so there is no extra work here to write it out.
669 */
670 kseg_p = (kcore_seg_t *)KERNBASE;
671 chdr_p = (cpu_kcore_hdr_t *) (kseg_p + 1);
672 CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
673 kseg_p->c_size = sizeof(*chdr_p);
674 pmap_set_kcore_hdr(chdr_p);
675
676 /*
677 * Now dump physical memory. Note that physical memory
678 * might NOT be congiguous, so do it by segments.
679 */
680
681 blkno = dumplo;
682 todo = dumpsize; /* pages */
683 vaddr = (char*)vmmap; /* Borrow /dev/mem VA */
684
685 for (seg = 0; seg < NPHYS_RAM_SEGS; seg++) {
686 crs_p = &chdr_p->ram_segs[seg];
687 paddr = crs_p->start;
688 segsz = crs_p->size;
689 /*
690 * Our header lives in the first little bit of
691 * physical memory (not written separately), so
692 * we have to adjust the first ram segment size
693 * and start address to reflect the stolen RAM.
694 * (Nothing interesing in that RAM anyway 8^).
695 */
696 if (seg == 0) {
697 int adj = sizeof(*kseg_p) + sizeof(*chdr_p);
698 crs_p->start += adj;
699 crs_p->size -= adj;
700 }
701
702 while (todo && (segsz > 0)) {
703
704 /* Print pages left after every 16. */
705 if ((todo & 0xf) == 0)
706 printf("\r%4d", todo);
707
708 /* Make a temporary mapping for the page. */
709 pmap_enter(pmap_kernel(), vmmap, paddr | PMAP_NC,
710 VM_PROT_READ, FALSE);
711 error = (*dsw->d_dump)(dumpdev, blkno, vaddr, NBPG);
712 pmap_remove(pmap_kernel(), vmmap, vmmap + NBPG);
713 if (error)
714 goto fail;
715 paddr += NBPG;
716 segsz -= NBPG;
717 blkno += btodb(NBPG);
718 todo--;
719 }
720 }
721 printf("\rdump succeeded\n");
722 return;
723 fail:
724 printf(" dump error=%d\n", error);
725 }
726
727 static void
728 initcpu()
729 {
730 /* XXX: Enable RAM parity/ECC checking? */
731 /* XXX: parityenable(); */
732
733 #ifdef HAVECACHE
734 cache_enable();
735 #endif
736 }
737
738 /* straptrap() in trap.c */
739
740 /* from hp300: badaddr() */
741 /* peek_byte(), peek_word() moved to autoconf.c */
742
743 /* XXX: parityenable() ? */
744 /* regdump() moved to regdump.c */
745
746 /*
747 * cpu_exec_aout_makecmds():
748 * cpu-dependent a.out format hook for execve().
749 *
750 * Determine if the given exec package refers to something which we
751 * understand and, if so, set up the vmcmds for it.
752 */
753 int
754 cpu_exec_aout_makecmds(p, epp)
755 struct proc *p;
756 struct exec_package *epp;
757 {
758 int error = ENOEXEC;
759
760 #ifdef COMPAT_SUNOS
761 extern sunos_exec_aout_makecmds
762 __P((struct proc *, struct exec_package *));
763 if ((error = sunos_exec_aout_makecmds(p, epp)) == 0)
764 return 0;
765 #endif
766 return error;
767 }
768