Module Name:    src
Committed By:   skrll
Date:           Mon May 31 19:40:21 UTC 2010

Modified Files:
        src/sys/arch/hppa/hppa: trap.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/sys/arch/hppa/hppa/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.90 src/sys/arch/hppa/hppa/trap.c:1.91
--- src/sys/arch/hppa/hppa/trap.c:1.90	Mon Apr 26 15:22:38 2010
+++ src/sys/arch/hppa/hppa/trap.c	Mon May 31 19:40:21 2010
@@ -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;
 }

Reply via email to