Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Fix the problem that single-step tracing of a trap ...



details:   https://anonhg.NetBSD.org/src/rev/36f31a4c423f
branches:  trunk
changeset: 477644:36f31a4c423f
user:      itohy <itohy%NetBSD.org@localhost>
date:      Tue Oct 26 00:20:34 1999 +0000

description:
Fix the problem that single-step tracing of a trap instruction
drops the system into kernel debugger.

diffstat:

 sys/arch/atari/atari/genassym.cf     |   3 ++-
 sys/arch/atari/atari/locore.s        |  14 +++++++++++---
 sys/arch/atari/atari/trap.c          |  22 +++++++++-------------
 sys/arch/hp300/hp300/genassym.cf     |   3 ++-
 sys/arch/hp300/hp300/locore.s        |  14 +++++++++++---
 sys/arch/hp300/hp300/trap.c          |   9 +++++----
 sys/arch/mvme68k/mvme68k/genassym.cf |   3 ++-
 sys/arch/mvme68k/mvme68k/locore.s    |  14 +++++++++++---
 sys/arch/mvme68k/mvme68k/trap.c      |   9 +++++----
 sys/arch/next68k/next68k/genassym.cf |   3 ++-
 sys/arch/next68k/next68k/locore.s    |  14 +++++++++++---
 sys/arch/next68k/next68k/trap.c      |   9 +++++----
 sys/arch/sun3/sun3/genassym.c        |   3 ++-
 sys/arch/sun3/sun3/locore.s          |  15 ++++++++++++---
 sys/arch/sun3/sun3/trap.c            |  11 ++++++-----
 sys/arch/sun3/sun3x/genassym.c       |   3 ++-
 sys/arch/sun3/sun3x/locore.s         |  15 ++++++++++++---
 sys/arch/x68k/x68k/genassym.cf       |   3 ++-
 sys/arch/x68k/x68k/locore.s          |  20 ++++++++++++++------
 sys/arch/x68k/x68k/trap.c            |   9 +++++----
 20 files changed, 131 insertions(+), 65 deletions(-)

diffs (truncated from 604 to 300 lines):

diff -r 87dadc042664 -r 36f31a4c423f sys/arch/atari/atari/genassym.cf
--- a/sys/arch/atari/atari/genassym.cf  Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/atari/atari/genassym.cf  Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.12 1999/05/06 14:16:07 kleink Exp $
+#      $NetBSD: genassym.cf,v 1.13 1999/10/26 00:20:34 itohy Exp $
 
 #-
 # Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -130,6 +130,7 @@
 define PSL_LOWIPL              PSL_LOWIPL
 define PSL_HIGHIPL             PSL_HIGHIPL
 define PSL_USER                PSL_USER
+define PSL_TS                  PSL_T | PSL_S
 define SPL1                    PSL_S | PSL_IPL1
 define SPL2                    PSL_S | PSL_IPL2
 define SPL3                    PSL_S | PSL_IPL3
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/atari/atari/locore.s
--- a/sys/arch/atari/atari/locore.s     Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/atari/atari/locore.s     Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.63 1999/09/17 19:59:40 thorpej Exp $      */
+/*     $NetBSD: locore.s,v 1.64 1999/10/26 00:20:34 itohy Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -435,9 +435,17 @@
        clrl    sp@-                    | stack adjust count
        moveml  #0xFFFF,sp@-
        moveq   #T_TRACE,d0
+
+       | Check PSW and see what happen.
+       |   T=0 S=0     (should not happen)
+       |   T=1 S=0     trace trap from user mode
+       |   T=0 S=1     trace trap on a trap instruction
+       |   T=1 S=1     trace trap from system mode (kernel breakpoint)
+
        movw    sp@(FR_HW),d1           | get PSW
-       andw    #PSL_S,d1               | from system mode?
-       jne     kbrkpt                  | yes, kernel breakpoint
+       notw    d1                      | XXX no support for T0 on 680[234]0
+       andw    #PSL_TS,d1              | from system mode (T=1, S=1)?
+       jeq     kbrkpt                  | yes, kernel breakpoint
        jra     fault                   | no, user-mode fault
 
 /*
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/atari/atari/trap.c
--- a/sys/arch/atari/atari/trap.c       Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/atari/atari/trap.c       Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.44 1999/07/08 18:05:26 thorpej Exp $        */
+/*     $NetBSD: trap.c,v 1.45 1999/10/26 00:20:35 itohy Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -375,14 +375,6 @@
                sticks = p->p_sticks;
                p->p_md.md_regs = frame.f_regs;
        }
-
-#ifdef DDB
-       if (type == T_TRACE || type == T_BREAKPOINT) {
-               if (kdb_trap(type, (db_regs_t *)&frame))
-                       return;
-       }
-#endif
-
        switch (type) {
 #ifdef DEBUG
        dopanic:
@@ -516,14 +508,15 @@
         * NetBSD and HP-UX traps 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:
        case T_TRAP15:
                frame.f_sr &= ~PSL_T;
-               i = SIGTRAP;
-               break;
+               return;
+
        case T_TRACE|T_USER:
-       case T_TRAP15|T_USER:
 #ifdef COMPAT_SUNOS
                /*
                 * SunOS uses Trap #2 for a "CPU cache flush".
@@ -535,6 +528,9 @@
                        return;
                }
 #endif
+               /* FALLTHROUGH */
+       case T_TRACE:           /* tracing a trap instruction */
+       case T_TRAP15|T_USER:
                frame.f_sr &= ~PSL_T;
                i = SIGTRAP;
                break;
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/hp300/hp300/genassym.cf
--- a/sys/arch/hp300/hp300/genassym.cf  Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/hp300/hp300/genassym.cf  Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.17 1999/07/31 20:50:48 thorpej Exp $
+#      $NetBSD: genassym.cf,v 1.18 1999/10/26 00:20:38 itohy Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -168,6 +168,7 @@
 define PSL_LOWIPL              PSL_LOWIPL
 define PSL_HIGHIPL             PSL_HIGHIPL
 define PSL_USER                PSL_USER
+define PSL_TS                  PSL_T | PSL_S
 define SPL1                    PSL_S | PSL_IPL1
 define SPL2                    PSL_S | PSL_IPL2
 define SPL3                    PSL_S | PSL_IPL3
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/hp300/hp300/locore.s
--- a/sys/arch/hp300/hp300/locore.s     Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/hp300/hp300/locore.s     Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.102 1999/10/24 19:12:44 thorpej Exp $     */
+/*     $NetBSD: locore.s,v 1.103 1999/10/26 00:20:38 itohy Exp $       */
 
 /*
  * Copyright (c) 1994, 1995 Gordon W. Ross
@@ -865,9 +865,17 @@
        clrl    %sp@-                   | stack adjust count
        moveml  #0xFFFF,%sp@-
        moveq   #T_TRACE,%d0
+
+       | Check PSW and see what happen.
+       |   T=0 S=0     (should not happen)
+       |   T=1 S=0     trace trap from user mode
+       |   T=0 S=1     trace trap on a trap instruction
+       |   T=1 S=1     trace trap from system mode (kernel breakpoint)
+
        movw    %sp@(FR_HW),%d1         | get PSW
-       andw    #PSL_S,%d1              | from system mode?
-       jne     Lkbrkpt                 | yes, kernel breakpoint
+       notw    %d1                     | XXX no support for T0 on 680[234]0
+       andw    #PSL_TS,%d1             | from system mode (T=1, S=1)?
+       jeq     Lkbrkpt                 | yes, kernel breakpoint
        jra     _ASM_LABEL(fault)       | no, user-mode fault
 
 /*
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/hp300/hp300/trap.c
--- a/sys/arch/hp300/hp300/trap.c       Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/hp300/hp300/trap.c       Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.72 1999/07/08 18:05:27 thorpej Exp $        */
+/*     $NetBSD: trap.c,v 1.73 1999/10/26 00:20:38 itohy Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -485,10 +485,9 @@
         * SUN 3.x traps get passed through as T_TRAP15 and are not really
         * supported yet.
         *
-        * XXX: We should never get kernel-mode T_TRACE or T_TRAP15
+        * 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:          /* kernel breakpoint */
 #ifdef DEBUG
                printf("unexpected kernel trace trap, type = %d\n", type);
@@ -498,7 +497,6 @@
                return;
 
        case T_TRACE|T_USER:    /* user trace trap */
-       case T_TRAP15|T_USER:   /* SUN user trace trap */
 #ifdef COMPAT_SUNOS
                /*
                 * SunOS uses Trap #2 for a "CPU cache flush".
@@ -510,6 +508,9 @@
                        return;
                }
 #endif
+               /* FALLTHROUGH */
+       case T_TRACE:           /* tracing a trap instruction */
+       case T_TRAP15|T_USER:   /* SUN user trace trap */
                frame.f_sr &= ~PSL_T;
                i = SIGTRAP;
                break;
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/mvme68k/mvme68k/genassym.cf
--- a/sys/arch/mvme68k/mvme68k/genassym.cf      Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/mvme68k/mvme68k/genassym.cf      Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.14 1999/05/06 14:16:08 kleink Exp $
+#      $NetBSD: genassym.cf,v 1.15 1999/10/26 00:20:38 itohy Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -151,6 +151,7 @@
 define PSL_LOWIPL              PSL_LOWIPL
 define PSL_HIGHIPL             PSL_HIGHIPL
 define PSL_USER                PSL_USER
+define PSL_TS                  PSL_T | PSL_S
 define SPL1                    PSL_S | PSL_IPL1
 define SPL2                    PSL_S | PSL_IPL2
 define SPL3                    PSL_S | PSL_IPL3
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/mvme68k/mvme68k/locore.s
--- a/sys/arch/mvme68k/mvme68k/locore.s Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/mvme68k/mvme68k/locore.s Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.55 1999/09/18 09:35:44 scw Exp $  */
+/*     $NetBSD: locore.s,v 1.56 1999/10/26 00:20:39 itohy Exp $        */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -908,9 +908,17 @@
        clrl    sp@-                    | stack adjust count
        moveml  #0xFFFF,sp@-
        moveq   #T_TRACE,d0
+
+       | Check PSW and see what happen.
+       |   T=0 S=0     (should not happen)
+       |   T=1 S=0     trace trap from user mode
+       |   T=0 S=1     trace trap on a trap instruction
+       |   T=1 S=1     trace trap from system mode (kernel breakpoint)
+
        movw    sp@(FR_HW),d1           | get PSW
-       andw    #PSL_S,d1               | from system mode?
-       jne     Lkbrkpt                 | yes, kernel breakpoint
+       notw    d1                      | XXX no support for T0 on 680[234]0
+       andw    #PSL_TS,d1              | from system mode (T=1, S=1)?
+       jeq     Lkbrkpt                 | yes, kernel breakpoint
        jra     _ASM_LABEL(fault)       | no, user-mode fault
 
 /*
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/mvme68k/mvme68k/trap.c
--- a/sys/arch/mvme68k/mvme68k/trap.c   Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/mvme68k/mvme68k/trap.c   Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.32 1999/08/03 10:52:06 dbj Exp $    */
+/*     $NetBSD: trap.c,v 1.33 1999/10/26 00:20:39 itohy Exp $  */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -490,10 +490,9 @@
         * SUN 3.x traps get passed through as T_TRAP15 and are not really
         * supported yet.
         *
-        * XXX: We should never get kernel-mode T_TRACE or T_TRAP15
+        * 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:          /* kernel breakpoint */
 #ifdef DEBUG
                printf("unexpected kernel trace trap, type = %d\n", type);
@@ -503,7 +502,6 @@
                return;
 
        case T_TRACE|T_USER:    /* user trace trap */
-       case T_TRAP15|T_USER:   /* SUN user trace trap */
 #ifdef COMPAT_SUNOS
                /*
                 * SunOS uses Trap #2 for a "CPU cache flush".
@@ -515,6 +513,9 @@
                        return;
                }
 #endif
+               /* FALLTHROUGH */
+       case T_TRACE:           /* tracing a trap instruction */
+       case T_TRAP15|T_USER:   /* SUN user trace trap */
                frame.f_sr &= ~PSL_T;
                i = SIGTRAP;
                break;
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/next68k/next68k/genassym.cf
--- a/sys/arch/next68k/next68k/genassym.cf      Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/next68k/next68k/genassym.cf      Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: genassym.cf,v 1.8 1999/05/06 14:16:08 kleink Exp $
+#      $NetBSD: genassym.cf,v 1.9 1999/10/26 00:20:39 itohy Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -147,6 +147,7 @@
 define PSL_LOWIPL              PSL_LOWIPL
 define PSL_HIGHIPL             PSL_HIGHIPL
 define PSL_USER                PSL_USER
+define PSL_TS                  PSL_T | PSL_S
 define SPL1                    PSL_S | PSL_IPL1
 define SPL2                    PSL_S | PSL_IPL2
 define SPL3                    PSL_S | PSL_IPL3
diff -r 87dadc042664 -r 36f31a4c423f sys/arch/next68k/next68k/locore.s
--- a/sys/arch/next68k/next68k/locore.s Mon Oct 25 23:48:07 1999 +0000
+++ b/sys/arch/next68k/next68k/locore.s Tue Oct 26 00:20:34 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.19 1999/09/17 20:04:44 thorpej Exp $      */
+/*     $NetBSD: locore.s,v 1.20 1999/10/26 00:20:39 itohy Exp $        */
 
 /*
  * Copyright (c) 1998 Darrin B. Jewell
@@ -825,9 +825,17 @@
        clrl    sp@-                    | stack adjust count
        moveml  #0xFFFF,sp@-
        moveq   #T_TRACE,d0



Home | Main Index | Thread Index | Old Index