Source-Changes-HG archive

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

[src/netbsd-9]: src/sys/arch/hppa Pull up following revision(s) (requested by...



details:   https://anonhg.NetBSD.org/src/rev/ff666cedd4f4
branches:  netbsd-9
changeset: 366709:ff666cedd4f4
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Jun 10 17:34:22 2022 +0000

description:
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

diffstat:

 sys/arch/hppa/hppa/trap.c      |  8 ++++----
 sys/arch/hppa/include/ptrace.h |  9 +++++++--
 2 files changed, 11 insertions(+), 6 deletions(-)

diffs (56 lines):

diff -r 40d003963f90 -r ff666cedd4f4 sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Fri Jun 10 17:16:54 2022 +0000
+++ b/sys/arch/hppa/hppa/trap.c Fri Jun 10 17:34:22 2022 +0000
@@ -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 @@
        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);
diff -r 40d003963f90 -r ff666cedd4f4 sys/arch/hppa/include/ptrace.h
--- a/sys/arch/hppa/include/ptrace.h    Fri Jun 10 17:16:54 2022 +0000
+++ b/sys/arch/hppa/include/ptrace.h    Fri Jun 10 17:34:22 2022 +0000
@@ -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")



Home | Main Index | Thread Index | Old Index