diff options
| author | martin <martin@NetBSD.org> | 2022-06-10 17:34:22 +0000 |
|---|---|---|
| committer | martin <martin@NetBSD.org> | 2022-06-10 17:34:22 +0000 |
| commit | dbbb7aac217b4adf6399815840ad88ab75265f62 (patch) | |
| tree | 5812157bf82a11f85a84935f1c3cc1f8b4f48b8b /sys | |
| parent | a61cdb4e123b365f97ca0962cf15e340997a6aa9 (diff) | |
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 (limited to 'sys')
| -rw-r--r-- | sys/arch/hppa/hppa/trap.c | 8 | ||||
| -rw-r--r-- | sys/arch/hppa/include/ptrace.h | 9 |
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index 83a7778a410..f6aab7f2e6c 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -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); diff --git a/sys/arch/hppa/include/ptrace.h b/sys/arch/hppa/include/ptrace.h index 4b59e76a489..c82184eb849 100644 --- a/sys/arch/hppa/include/ptrace.h +++ b/sys/arch/hppa/include/ptrace.h @@ -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") |
