Module Name:    src
Committed By:   martin
Date:           Fri Jun 10 17:34:22 UTC 2022

Modified Files:
        src/sys/arch/hppa/hppa [netbsd-9]: trap.c
        src/sys/arch/hppa/include [netbsd-9]: ptrace.h

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1468):

        sys/arch/hppa/hppa/trap.c: revision 1.120
        sys/arch/hppa/include/ptrace.h: revision 1.11-1.12 (via patch)

Define a PTRACE_ILLEGAL_ASM

Match up PTRACE_BREAKPOINT_ASM with PTRACE_BREAKPOINT which is the
gdb breakpoint instruction.

Only report the SSBREAKPOINT break instruction as SIGTRAP/TRAP_TRACE. All
other break instructions will be reported as SIGTRAP/TRAP_BRKPT
This fixes a mistake I made back in 2008.

PR/56866: hppa: kernel gets confused between actual breakpoints and
single-step breakpoints


To generate a diff of this commit:
cvs rdiff -u -r1.111.4.2 -r1.111.4.3 src/sys/arch/hppa/hppa/trap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/hppa/include/ptrace.h

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.111.4.2 src/sys/arch/hppa/hppa/trap.c:1.111.4.3
--- src/sys/arch/hppa/hppa/trap.c:1.111.4.2	Fri Jun 10 16:28:16 2022
+++ src/sys/arch/hppa/hppa/trap.c	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.111.4.2 2022/06/10 16:28:16 martin Exp $	*/
+/*	$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin 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.111.4.2 2022/06/10 16:28:16 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111.4.3 2022/06/10 17:34:22 martin Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -775,13 +775,13 @@ do_onfault:
 	case T_DBREAK | T_USER:
 		KSI_INIT_TRAP(&ksi);
 		ksi.ksi_signo = SIGTRAP;
-		ksi.ksi_code = TRAP_TRACE;
+		ksi.ksi_code = TRAP_BRKPT;
 		ksi.ksi_trap = trapnum;
 		ksi.ksi_addr = (void *)(frame->tf_iioq_head & ~HPPA_PC_PRIV_MASK);
 #ifdef PTRACE
 		ss_clear_breakpoints(l);
 		if (opcode == SSBREAKPOINT)
-			ksi.ksi_code = TRAP_BRKPT;
+			ksi.ksi_code = TRAP_TRACE;
 #endif
 		/* pass to user debugger */
 		trapsignal(l, &ksi);

Index: src/sys/arch/hppa/include/ptrace.h
diff -u src/sys/arch/hppa/include/ptrace.h:1.9 src/sys/arch/hppa/include/ptrace.h:1.9.2.1
--- src/sys/arch/hppa/include/ptrace.h:1.9	Tue Jun 18 21:18:12 2019
+++ src/sys/arch/hppa/include/ptrace.h	Fri Jun 10 17:34:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.9 2019/06/18 21:18:12 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.9.2.1 2022/06/10 17:34:22 martin Exp $	*/
 
 /*	$OpenBSD: ptrace.h,v 1.2 1998/12/01 03:05:44 mickey Exp $	*/
 
@@ -58,6 +58,11 @@
 #define PTRACE_REG_SP(r)	(r)->r_regs[30]
 #define PTRACE_REG_INTRV(r)	(r)->r_regs[28]
 
+#define HPPA_BREAK_GDB		4
+#define HPPA_BREAK_GDB_SS	8
+
 #define PTRACE_BREAKPOINT	((const uint8_t[]) { 0x00, 0x01, 0x00, 0x04 })
-#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_KERNEL), "i" (HPPA_BREAK_SS) : "memory")
+#define PTRACE_BREAKPOINT_ASM	__asm __volatile("break	%0, %1" :: "i" (HPPA_BREAK_GDB), "i" (HPPA_BREAK_GDB_SS) : "memory")
 #define PTRACE_BREAKPOINT_SIZE	4
+
+#define PTRACE_ILLEGAL_ASM	__asm __volatile (".word 0x000ff000" : : : "memory")

Reply via email to