traps.c (4b4193256c8d3bc3a5397b5cd9494c2ad386317d) traps.c (c22b0bcb1dd024cb9caad9230e3a387d8b061df5)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 */
5
6#include <linux/cpu.h>
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/sched/debug.h>
11#include <linux/sched/signal.h>
12#include <linux/signal.h>
13#include <linux/kdebug.h>
14#include <linux/uaccess.h>
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2012 Regents of the University of California
4 */
5
6#include <linux/cpu.h>
7#include <linux/kernel.h>
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/sched/debug.h>
11#include <linux/sched/signal.h>
12#include <linux/signal.h>
13#include <linux/kdebug.h>
14#include <linux/uaccess.h>
15#include <linux/kprobes.h>
15#include <linux/mm.h>
16#include <linux/module.h>
17#include <linux/irq.h>
18
19#include <asm/processor.h>
20#include <asm/ptrace.h>
21#include <asm/csr.h>
22

--- 117 unchanged lines hidden (view full) ---

140 if (get_kernel_nofault(insn, (bug_insn_t *)pc))
141 return 0;
142
143 return GET_INSN_LENGTH(insn);
144}
145
146asmlinkage __visible void do_trap_break(struct pt_regs *regs)
147{
16#include <linux/mm.h>
17#include <linux/module.h>
18#include <linux/irq.h>
19
20#include <asm/processor.h>
21#include <asm/ptrace.h>
22#include <asm/csr.h>
23

--- 117 unchanged lines hidden (view full) ---

141 if (get_kernel_nofault(insn, (bug_insn_t *)pc))
142 return 0;
143
144 return GET_INSN_LENGTH(insn);
145}
146
147asmlinkage __visible void do_trap_break(struct pt_regs *regs)
148{
149#ifdef CONFIG_KPROBES
150 if (kprobe_single_step_handler(regs))
151 return;
152
153 if (kprobe_breakpoint_handler(regs))
154 return;
155#endif
156
148 if (user_mode(regs))
149 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->epc);
150#ifdef CONFIG_KGDB
151 else if (notify_die(DIE_TRAP, "EBREAK", regs, 0, regs->cause, SIGTRAP)
152 == NOTIFY_STOP)
153 return;
154#endif
155 else if (report_bug(regs->epc, regs) == BUG_TRAP_TYPE_WARN)

--- 25 unchanged lines hidden ---
157 if (user_mode(regs))
158 force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->epc);
159#ifdef CONFIG_KGDB
160 else if (notify_die(DIE_TRAP, "EBREAK", regs, 0, regs->cause, SIGTRAP)
161 == NOTIFY_STOP)
162 return;
163#endif
164 else if (report_bug(regs->epc, regs) == BUG_TRAP_TYPE_WARN)

--- 25 unchanged lines hidden ---