Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  Kernel Probes (KProbes)
0004  *  include/asm-mips/kprobes.h
0005  *
0006  *  Copyright 2006 Sony Corp.
0007  *  Copyright 2010 Cavium Networks
0008  */
0009 
0010 #ifndef _ASM_KPROBES_H
0011 #define _ASM_KPROBES_H
0012 
0013 #include <asm-generic/kprobes.h>
0014 
0015 #ifdef CONFIG_KPROBES
0016 #include <linux/ptrace.h>
0017 #include <linux/types.h>
0018 
0019 #include <asm/cacheflush.h>
0020 #include <asm/kdebug.h>
0021 #include <asm/inst.h>
0022 
0023 #define  __ARCH_WANT_KPROBES_INSN_SLOT
0024 
0025 struct kprobe;
0026 struct pt_regs;
0027 
0028 typedef union mips_instruction kprobe_opcode_t;
0029 
0030 #define MAX_INSN_SIZE 2
0031 
0032 #define flush_insn_slot(p)                      \
0033 do {                                    \
0034     if (p->addr)                            \
0035         flush_icache_range((unsigned long)p->addr,      \
0036                (unsigned long)p->addr +         \
0037                (MAX_INSN_SIZE * sizeof(kprobe_opcode_t)));  \
0038 } while (0)
0039 
0040 
0041 #define kretprobe_blacklist_size 0
0042 
0043 void arch_remove_kprobe(struct kprobe *p);
0044 int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
0045 
0046 /* Architecture specific copy of original instruction*/
0047 struct arch_specific_insn {
0048     /* copy of the original instruction */
0049     kprobe_opcode_t *insn;
0050 };
0051 
0052 struct prev_kprobe {
0053     struct kprobe *kp;
0054     unsigned long status;
0055     unsigned long old_SR;
0056     unsigned long saved_SR;
0057     unsigned long saved_epc;
0058 };
0059 
0060 #define SKIP_DELAYSLOT 0x0001
0061 
0062 /* per-cpu kprobe control block */
0063 struct kprobe_ctlblk {
0064     unsigned long kprobe_status;
0065     unsigned long kprobe_old_SR;
0066     unsigned long kprobe_saved_SR;
0067     unsigned long kprobe_saved_epc;
0068     /* Per-thread fields, used while emulating branches */
0069     unsigned long flags;
0070     unsigned long target_epc;
0071     struct prev_kprobe prev_kprobe;
0072 };
0073 
0074 extern int kprobe_exceptions_notify(struct notifier_block *self,
0075                     unsigned long val, void *data);
0076 
0077 #endif /* CONFIG_KPROBES */
0078 #endif /* _ASM_KPROBES_H */