Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 Rework the way the nested task and trace ...



details:   https://anonhg.NetBSD.org/src/rev/94676859e81f
branches:  trunk
changeset: 500250:94676859e81f
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Fri Dec 08 23:14:04 2000 +0000

description:
Rework the way the nested task and trace flags are handled when entering the
old (lcall) syscall gate.  This speeds up that path a little.

diffstat:

 sys/arch/i386/i386/locore.s |   6 +-----
 sys/arch/i386/i386/trap.c   |  23 +++++++++++++++--------
 2 files changed, 16 insertions(+), 13 deletions(-)

diffs (78 lines):

diff -r 60ac54edd7bb -r 94676859e81f sys/arch/i386/i386/locore.s
--- a/sys/arch/i386/i386/locore.s       Fri Dec 08 23:11:40 2000 +0000
+++ b/sys/arch/i386/i386/locore.s       Fri Dec 08 23:14:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: locore.s,v 1.227 2000/11/21 21:13:23 jdolecek Exp $    */
+/*     $NetBSD: locore.s,v 1.228 2000/12/08 23:14:04 mycroft Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -2346,10 +2346,6 @@
        /* Set eflags in trap frame. */
        pushfl
        popl    8(%esp)
-       /* Turn off trace flag and nested task. */
-       pushfl
-       andb    $~((PSL_T|PSL_NT)>>8),1(%esp)
-       popfl
        pushl   $7              # size of instruction for restart
        jmp     syscall1
 
diff -r 60ac54edd7bb -r 94676859e81f sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Fri Dec 08 23:11:40 2000 +0000
+++ b/sys/arch/i386/i386/trap.c Fri Dec 08 23:14:04 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.144 2000/12/08 22:32:09 mycroft Exp $       */
+/*     $NetBSD: trap.c,v 1.145 2000/12/08 23:14:05 mycroft Exp $       */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -192,6 +192,8 @@
 int    trapdebug = 0;
 #endif
 
+#define        IDTVEC(name)    __CONCAT(X, name)
+
 /*
  * trap(frame):
  *     Exception, fault, and trap interface to BSD kernel. This
@@ -210,7 +212,8 @@
        u_quad_t sticks;
        struct pcb *pcb = NULL;
        extern char fusubail[],
-                   resume_iret[], resume_pop_ds[], resume_pop_es[];
+                   resume_iret[], resume_pop_ds[], resume_pop_es[],
+                   IDTVEC(osyscall)[];
        struct trapframe *vframe;
        int resume;
 
@@ -269,6 +272,7 @@
        case T_PROTFLT:
        case T_SEGNPFLT:
        case T_ALIGNFLT:
+       case T_TSSFLT:
                /* Check for copyin/copyout fault. */
                pcb = &p->p_addr->u_pcb;
                if (pcb->pcb_onfault != 0) {
@@ -472,12 +476,15 @@
                break;
        }
 
-#if !defined(DDB) && !defined(KGDB)
-       /* XXX need to deal with this when DDB is present, too */
-       case T_TRCTRAP: /* kernel trace trap; someone single stepping lcall's */
-                       /* syscall has to turn off the trace bit itself */
-               return;
-#endif
+       case T_TRCTRAP:
+               /* Check whether they single-stepped into a lcall. */
+               if (frame.tf_eip == (int)IDTVEC(osyscall))
+                       return;
+               if (frame.tf_eip == (int)IDTVEC(osyscall) + 1) {
+                       frame.tf_eflags &= ~PSL_T;
+                       return;
+               }
+               goto we_re_toast;
 
        case T_BPTFLT|T_USER:           /* bpt instruction fault */
        case T_TRCTRAP|T_USER:          /* trace trap */



Home | Main Index | Thread Index | Old Index