• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * arch/tile/include/asm/kprobes.h
3  *
4  * Copyright 2012 Tilera Corporation. All Rights Reserved.
5  *
6  *   This program is free software; you can redistribute it and/or
7  *   modify it under the terms of the GNU General Public License
8  *   as published by the Free Software Foundation, version 2.
9  *
10  *   This program is distributed in the hope that it will be useful, but
11  *   WITHOUT ANY WARRANTY; without even the implied warranty of
12  *   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13  *   NON INFRINGEMENT.  See the GNU General Public License for
14  *   more details.
15  */
16 
17 #ifndef _ASM_TILE_KPROBES_H
18 #define _ASM_TILE_KPROBES_H
19 
20 #include <linux/types.h>
21 #include <linux/ptrace.h>
22 #include <linux/percpu.h>
23 
24 #include <arch/opcode.h>
25 
26 #define __ARCH_WANT_KPROBES_INSN_SLOT
27 #define MAX_INSN_SIZE			2
28 
29 #define kretprobe_blacklist_size 0
30 
31 typedef tile_bundle_bits kprobe_opcode_t;
32 
33 #define flush_insn_slot(p)						\
34 	flush_icache_range((unsigned long)p->addr,			\
35 			   (unsigned long)p->addr +			\
36 			   (MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))
37 
38 struct kprobe;
39 
40 /* Architecture specific copy of original instruction. */
41 struct arch_specific_insn {
42 	kprobe_opcode_t *insn;
43 };
44 
45 struct prev_kprobe {
46 	struct kprobe *kp;
47 	unsigned long status;
48 	unsigned long saved_pc;
49 };
50 
51 #define MAX_JPROBES_STACK_SIZE 128
52 #define MAX_JPROBES_STACK_ADDR \
53 	(((unsigned long)current_thread_info()) + THREAD_SIZE - 32 \
54 		- sizeof(struct pt_regs))
55 
56 #define MIN_JPROBES_STACK_SIZE(ADDR)					\
57 	((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR)	\
58 		? MAX_JPROBES_STACK_ADDR - (ADDR)			\
59 		: MAX_JPROBES_STACK_SIZE)
60 
61 /* per-cpu kprobe control block. */
62 struct kprobe_ctlblk {
63 	unsigned long kprobe_status;
64 	unsigned long kprobe_saved_pc;
65 	unsigned long jprobe_saved_sp;
66 	struct prev_kprobe prev_kprobe;
67 	struct pt_regs jprobe_saved_regs;
68 	char jprobes_stack[MAX_JPROBES_STACK_SIZE];
69 };
70 
71 extern tile_bundle_bits breakpoint2_insn;
72 extern tile_bundle_bits breakpoint_insn;
73 
74 void arch_remove_kprobe(struct kprobe *);
75 
76 extern int kprobe_exceptions_notify(struct notifier_block *self,
77 			     unsigned long val, void *data);
78 
79 #endif /* _ASM_TILE_KPROBES_H */
80