Skip to content

Commit ccbed90

Browse files
chleroympe
authored andcommitted
powerpc/ptrace: move ptrace_triggered() into hw_breakpoint.c
ptrace_triggered() is declared in asm/hw_breakpoint.h and only needed when CONFIG_HW_BREAKPOINT is set, so move it into hw_breakpoint.c Signed-off-by: Christophe Leroy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/8402c516023da1371953a65af7df2008758ea0c4.1582848567.git.christophe.leroy@c-s.fr
1 parent da529d4 commit ccbed90

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

arch/powerpc/kernel/hw_breakpoint.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,3 +429,19 @@ void hw_breakpoint_pmu_read(struct perf_event *bp)
429429
{
430430
/* TODO */
431431
}
432+
433+
void ptrace_triggered(struct perf_event *bp,
434+
struct perf_sample_data *data, struct pt_regs *regs)
435+
{
436+
struct perf_event_attr attr;
437+
438+
/*
439+
* Disable the breakpoint request here since ptrace has defined a
440+
* one-shot behaviour for breakpoint exceptions in PPC64.
441+
* The SIGTRAP signal is generated automatically for us in do_dabr().
442+
* We don't have to do anything about that here
443+
*/
444+
attr = bp->attr;
445+
attr.disabled = true;
446+
modify_user_hw_breakpoint(bp, &attr);
447+
}

arch/powerpc/kernel/ptrace/ptrace.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include <linux/regset.h>
1919
#include <linux/tracehook.h>
2020
#include <linux/audit.h>
21-
#include <linux/hw_breakpoint.h>
2221
#include <linux/context_tracking.h>
2322
#include <linux/syscalls.h>
2423

@@ -31,24 +30,6 @@
3130

3231
#include "ptrace-decl.h"
3332

34-
#ifdef CONFIG_HAVE_HW_BREAKPOINT
35-
void ptrace_triggered(struct perf_event *bp,
36-
struct perf_sample_data *data, struct pt_regs *regs)
37-
{
38-
struct perf_event_attr attr;
39-
40-
/*
41-
* Disable the breakpoint request here since ptrace has defined a
42-
* one-shot behaviour for breakpoint exceptions in PPC64.
43-
* The SIGTRAP signal is generated automatically for us in do_dabr().
44-
* We don't have to do anything about that here
45-
*/
46-
attr = bp->attr;
47-
attr.disabled = true;
48-
modify_user_hw_breakpoint(bp, &attr);
49-
}
50-
#endif /* CONFIG_HAVE_HW_BREAKPOINT */
51-
5233
/*
5334
* Called by kernel/ptrace.c when detaching..
5435
*

0 commit comments

Comments
 (0)