Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/luna68k/luna68k Make consistent with other m68k por...



details:   https://anonhg.NetBSD.org/src/rev/e8396ffeb862
branches:  trunk
changeset: 480236:e8396ffeb862
user:      nisimura <nisimura%NetBSD.org@localhost>
date:      Fri Jan 07 09:09:35 2000 +0000

description:
Make consistent with other m68k ports fixing updates.

diffstat:

 sys/arch/luna68k/luna68k/trap.c |  101 ++++++++++++++++++++++-----------------
 1 files changed, 56 insertions(+), 45 deletions(-)

diffs (208 lines):

diff -r 8826d7cc7d03 -r e8396ffeb862 sys/arch/luna68k/luna68k/trap.c
--- a/sys/arch/luna68k/luna68k/trap.c   Fri Jan 07 08:12:15 2000 +0000
+++ b/sys/arch/luna68k/luna68k/trap.c   Fri Jan 07 09:09:35 2000 +0000
@@ -1,5 +1,4 @@
-/* $NetBSD: trap.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $ */
-/*     $NetBSD: trap.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $        */
+/* $NetBSD: trap.c,v 1.2 2000/01/07 09:09:35 nisimura Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +44,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.1 2000/01/05 08:49:04 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2 2000/01/07 09:09:35 nisimura Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -57,10 +56,8 @@
 #include <sys/proc.h>
 #include <sys/acct.h>
 #include <sys/kernel.h>
-#include <sys/signalvar.h>
 #include <sys/resourcevar.h>
 #include <sys/syscall.h>
-#include <sys/syslog.h>
 #include <sys/user.h>
 #ifdef KTRACE
 #include <sys/ktrace.h>
@@ -242,11 +239,8 @@
        struct frame frame;
 {
        extern char fubail[], subail[];
-#ifdef DDB
-       extern char trap0[], trap1[], trap2[], trap12[], trap15[], illinst[];
-#endif
        struct proc *p;
-       int i;
+       int i, s;
        u_int ucode;
        u_quad_t sticks = 0 /* XXX initializer works around compiler bug */;
 
@@ -272,12 +266,33 @@
        default:
        dopanic:
                printf("trap type %d, code = 0x%x, v = 0x%x\n", type, code, v);
-#ifdef DDB
-               if (kdb_trap(type, (db_regs_t *)&frame))
-                       return;
-#endif
                printf("%s program counter = 0x%x\n",
                    (type & T_USER) ? "user" : "kernel", frame.f_pc);
+               /*
+                * Let the kernel debugger see the trap frame that
+                * caused us to panic.  This is a convenience so
+                * one can see registers at the point of failure.
+                */
+               s = splhigh();
+#ifdef KGDB
+               /* If connected, step or cont returns 1 */
+               if (kgdb_trap(type, &frame))
+                       goto kgdb_cont;
+#endif
+#ifdef DDB
+               (void)kdb_trap(type, (db_regs_t *)&frame);
+#endif
+#ifdef KGDB
+       kgdb_cont:
+#endif
+               splx(s);
+               if (panicstr) {
+                       printf("trap during panic!\n");
+#ifdef DEBUG
+                       /* XXX should be a machine-dependent hook */
+                       printf("(press a key)\n"); (void)cngetc();
+#endif
+               }
                regdump((struct trapframe *)&frame, 128);
                type &= ~T_USER;
                if ((u_int)type < trap_types)
@@ -396,34 +411,30 @@
         * XXX: Trace traps are a nightmare.
         *
         *      HP-UX uses trap #1 for breakpoints,
-        *      HPBSD uses trap #2,
+        *      NetBSD/m68k uses trap #2,
         *      SUN 3.x uses trap #15,
-        *      KGDB uses trap #15 (for kernel breakpoints; handled elsewhere).
+        *      DDB and KGDB uses trap #15 (for kernel breakpoints;
+        *      handled elsewhere).
         *
-        * HPBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
+        * NetBSD and HP-UX traps both get mapped by locore.s into T_TRACE.
         * SUN 3.x traps get passed through as T_TRAP15 and are not really
         * supported yet.
+        *
+        * XXX: We should never get kernel-mode T_TRAP15
+        * XXX: because locore.s now gives them special treatment.
         */
-       case T_TRACE:           /* kernel trace trap */
-       case T_TRAP15:          /* SUN trace trap */
-#ifdef DDB
-               if (type == T_TRAP15 ||
-                   ((caddr_t)frame.f_pc != trap0 &&
-                    (caddr_t)frame.f_pc != trap1 &&
-                    (caddr_t)frame.f_pc != trap2 &&
-                    (caddr_t)frame.f_pc != trap12 &&
-                    (caddr_t)frame.f_pc != trap15 &&
-                    (caddr_t)frame.f_pc != illinst)) {
-                       if (kdb_trap(type, (db_regs_t *)&frame))
-                               return;
-               }
+       case T_TRAP15:          /* kernel breakpoint */
+#ifdef DEBUG
+               printf("unexpected kernel trace trap, type = %d\n", type);
+               printf("program counter = 0x%x\n", frame.f_pc);
 #endif
                frame.f_sr &= ~PSL_T;
-               i = SIGTRAP;
-               break;
+               return;
 
        case T_TRACE|T_USER:    /* user trace trap */
-       case T_TRAP15|T_USER:   /* SUN user trace trap */
+               /* FALLTHROUGH */
+       case T_TRACE:
+       case T_TRAP15|T_USER:
                frame.f_sr &= ~PSL_T;
                i = SIGTRAP;
                break;
@@ -527,7 +538,7 @@
 #ifdef DEBUG
                if (rv && MDB_ISPID(p->p_pid))
                        printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
-                              map, va, ftype, rv);
+                           map, va, ftype, rv);
 #endif
                /*
                 * If this was a stack access we keep track of the maximum
@@ -561,7 +572,7 @@
                        if (p->p_addr->u_pcb.pcb_onfault)
                                goto copyfault;
                        printf("uvm_fault(%p, 0x%lx, 0, 0x%x) -> 0x%x\n",
-                              map, va, ftype, rv);
+                           map, va, ftype, rv);
                        printf("  type %x, code [mmu,,ssw]: %x\n",
                               type, code);
                        goto dopanic;
@@ -569,9 +580,9 @@
                ucode = v;
                if (rv == KERN_RESOURCE_SHORTAGE) {
                        printf("UVM: pid %d (%s), uid %d killed: out of swap\n",
-                               p->p_pid, p->p_comm,
-                               p->p_cred && p->p_ucred ?
-                               p->p_ucred->cr_uid : -1);
+                           p->p_pid, p->p_comm,
+                           p->p_cred && p->p_ucred ?
+                           p->p_ucred->cr_uid : -1);
                        i = SIGKILL;
                } else {
                        i = SIGSEGV;
@@ -579,8 +590,7 @@
                break;
            }
        }
-       if (i)
-               trapsignal(p, i, ucode);
+       trapsignal(p, i, ucode);
        if ((type & T_USER) == 0)
                return;
 out:
@@ -615,6 +625,7 @@
        int err = 0;
        u_int fa;
        caddr_t oonfault = p->p_addr->u_pcb.pcb_onfault;
+       paddr_t pa;
 
 #ifdef DEBUG
        if ((mmudebug & MDB_WBFOLLOW) || MDB_ISPID(p->p_pid)) {
@@ -652,11 +663,12 @@
                 */
                if (docachepush) {
                        pmap_enter(pmap_kernel(), (vaddr_t)vmmap,
-                          trunc_page(f->f_fa), VM_PROT_WRITE, TRUE,
-                          VM_PROT_WRITE);
+                           trunc_page(f->f_fa), VM_PROT_WRITE,
+                           VM_PROT_WRITE|PMAP_WIRED);
                        fa = (u_int)&vmmap[(f->f_fa & PGOFSET) & ~0xF];
                        bcopy((caddr_t)&f->f_pd0, (caddr_t)fa, 16);
-                       DCFL(pmap_extract(pmap_kernel(), (paddr_t)fa));
+                       (void) pmap_extract(pmap_kernel(), (vaddr_t)fa, &pa);
+                       DCFL(pa);
                        pmap_remove(pmap_kernel(), (vaddr_t)vmmap,
                                    (vaddr_t)&vmmap[NBPG]);
                } else
@@ -877,9 +889,8 @@
        printf(" writeback #%d: VA %x, data %x, SZ=%s, TT=%s, TM=%s\n",
               num, a, d, f7sz[(s & SSW4_SZMASK) >> 5],
               f7tt[(s & SSW4_TTMASK) >> 3], f7tm[s & SSW4_TMMASK]);
-       printf("               PA ");
-       pa = pmap_extract(p->p_vmspace->vm_map.pmap, (paddr_t)a);
-       if (pa == 0)
+       printf("               PA ");
+       if (pmap_extract(p->p_vmspace->vm_map.pmap, (vaddr_t)a, &pa) == FALSE)
                printf("<invalid address>");
        else
                printf("%lx, current value %lx", pa, fuword((caddr_t)a));



Home | Main Index | Thread Index | Old Index