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