LoongArch: Add uprobes support
[linux-2.6-microblaze.git] / arch / loongarch / kernel / traps.c
index e56df45..8fb5e7a 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/tlb.h>
 #include <asm/types.h>
 #include <asm/unwind.h>
+#include <asm/uprobes.h>
 
 #include "access-helper.h"
 
@@ -689,7 +690,6 @@ asmlinkage void noinstr do_bp(struct pt_regs *regs)
        if (regs->csr_prmd & CSR_PRMD_PIE)
                local_irq_enable();
 
-       current->thread.trap_nr = read_csr_excode();
        if (__get_inst(&opcode, (u32 *)era, user))
                goto out_sigsegv;
 
@@ -711,18 +711,17 @@ asmlinkage void noinstr do_bp(struct pt_regs *regs)
                else
                        break;
        case BRK_UPROBE_BP:
-               if (notify_die(DIE_UPROBE, "Uprobe", regs, bcode,
-                              current->thread.trap_nr, SIGTRAP) == NOTIFY_STOP)
+               if (uprobe_breakpoint_handler(regs))
                        goto out;
                else
                        break;
        case BRK_UPROBE_XOLBP:
-               if (notify_die(DIE_UPROBE_XOL, "Uprobe_XOL", regs, bcode,
-                              current->thread.trap_nr, SIGTRAP) == NOTIFY_STOP)
+               if (uprobe_singlestep_handler(regs))
                        goto out;
                else
                        break;
        default:
+               current->thread.trap_nr = read_csr_excode();
                if (notify_die(DIE_TRAP, "Break", regs, bcode,
                               current->thread.trap_nr, SIGTRAP) == NOTIFY_STOP)
                        goto out;