Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa/hppa Pull change across from OpenBSD:



details:   https://anonhg.NetBSD.org/src/rev/0e8ddf2c5f96
branches:  trunk
changeset: 755296:0e8ddf2c5f96
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon May 31 19:40:21 2010 +0000

description:
Pull change across from OpenBSD:

Make single stepping a system call work.  Instead of single stepping
through the syscall gateway page, which doesn't work since that page is
shared between process, this makes us step over that bit by setting a
breakpoint on the instruction where the system call returns.

diffstat:

 sys/arch/hppa/hppa/trap.c |  30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diffs (68 lines):

diff -r 32d2f2108381 -r 0e8ddf2c5f96 sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Mon May 31 18:43:52 2010 +0000
+++ b/sys/arch/hppa/hppa/trap.c Mon May 31 19:40:21 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.90 2010/04/26 15:22:38 skrll Exp $  */
+/*     $NetBSD: trap.c,v 1.91 2010/05/31 19:40:21 skrll Exp $  */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.90 2010/04/26 15:22:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.91 2010/05/31 19:40:21 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -1052,28 +1052,25 @@
        ss_clear_breakpoints(l);
 
        /* We're continuing... */
-       /* Don't touch the syscall gateway page. */
-       /* XXX head */
-       if (sstep == 0 ||
-           (tf->tf_iioq_tail & ~PAGE_MASK) == SYSCALLGATE) {
-               tf->tf_ipsw &= ~PSW_T;
+       if (sstep == 0) {
                return 0;
        }
 
-       l->l_md.md_bpva = tf->tf_iioq_tail & ~HPPA_PC_PRIV_MASK;
-
        /*
-        * Insert two breakpoint instructions; the first one might be
-        * nullified.  Of course we need to save two instruction
-        * first.
+        * Don't touch the syscall gateway page.  Instead, insert a
+        * breakpoint where we're supposed to return.
         */
+       if ((tf->tf_iioq_tail & ~PAGE_MASK) == SYSCALLGATE)
+               l->l_md.md_bpva = tf->tf_r31 & ~HPPA_PC_PRIV_MASK;
+       else
+               l->l_md.md_bpva = tf->tf_iioq_tail & ~HPPA_PC_PRIV_MASK;
 
        error = ss_get_value(l, l->l_md.md_bpva, &l->l_md.md_bpsave[0]);
        if (error)
-               return (error);
+               return error;
        error = ss_get_value(l, l->l_md.md_bpva + 4, &l->l_md.md_bpsave[1]);
        if (error)
-               return (error);
+               return error;
 
        error = ss_put_value(l, l->l_md.md_bpva, SSBREAKPOINT);
        if (error)
@@ -1082,7 +1079,10 @@
        if (error)
                return error;
 
-       tf->tf_ipsw |= PSW_T;
+       if ((tf->tf_iioq_tail & ~PAGE_MASK) == SYSCALLGATE)
+               tf->tf_ipsw &= PSW_T;
+       else
+               tf->tf_ipsw |= PSW_T;
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index