summaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/traps.c
diff options
context:
space:
mode:
authorVincent Chen <vincent.chen@sifive.com>2020-04-16 10:38:05 +0800
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-05-18 11:38:10 -0700
commitfe89bd2be8667d4d876329dd534dd59158e33b1f (patch)
tree10a9128ca4f1c4772ce114d88160b499f018a11a /arch/riscv/kernel/traps.c
parentf83b04d36e52cc3d941120ec859374fcda36eb31 (diff)
downloadlinux-stable-fe89bd2be8667d4d876329dd534dd59158e33b1f.tar.gz
linux-stable-fe89bd2be8667d4d876329dd534dd59158e33b1f.tar.bz2
linux-stable-fe89bd2be8667d4d876329dd534dd59158e33b1f.zip
riscv: Add KGDB support
The skeleton of RISC-V KGDB port. Signed-off-by: Vincent Chen <vincent.chen@sifive.com> Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to 'arch/riscv/kernel/traps.c')
-rw-r--r--arch/riscv/kernel/traps.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/kernel/traps.c b/arch/riscv/kernel/traps.c
index 7f58fa53033f..5080fdf8c296 100644
--- a/arch/riscv/kernel/traps.c
+++ b/arch/riscv/kernel/traps.c
@@ -147,6 +147,11 @@ asmlinkage __visible void do_trap_break(struct pt_regs *regs)
{
if (user_mode(regs))
force_sig_fault(SIGTRAP, TRAP_BRKPT, (void __user *)regs->epc);
+#ifdef CONFIG_KGDB
+ else if (notify_die(DIE_TRAP, "EBREAK", regs, 0, regs->cause, SIGTRAP)
+ == NOTIFY_STOP)
+ return;
+#endif
else if (report_bug(regs->epc, regs) == BUG_TRAP_TYPE_WARN)
regs->epc += get_break_insn_length(regs->epc);
else