2 * arch/tile/include/asm/kprobes.h
4 * Copyright 2012 Tilera Corporation. All Rights Reserved.
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.
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
17 #ifndef _ASM_TILE_KPROBES_H
18 #define _ASM_TILE_KPROBES_H
20 #include <asm-generic/kprobes.h>
24 #include <linux/types.h>
25 #include <linux/ptrace.h>
26 #include <linux/percpu.h>
27 #include <arch/opcode.h>
29 #define __ARCH_WANT_KPROBES_INSN_SLOT
30 #define MAX_INSN_SIZE 2
32 #define kretprobe_blacklist_size 0
34 typedef tile_bundle_bits kprobe_opcode_t
;
36 #define flush_insn_slot(p) \
37 flush_icache_range((unsigned long)p->addr, \
38 (unsigned long)p->addr + \
39 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t)))
43 /* Architecture specific copy of original instruction. */
44 struct arch_specific_insn
{
45 kprobe_opcode_t
*insn
;
51 unsigned long saved_pc
;
54 #define MAX_JPROBES_STACK_SIZE 128
55 #define MAX_JPROBES_STACK_ADDR \
56 (((unsigned long)current_thread_info()) + THREAD_SIZE - 32 \
57 - sizeof(struct pt_regs))
59 #define MIN_JPROBES_STACK_SIZE(ADDR) \
60 ((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
61 ? MAX_JPROBES_STACK_ADDR - (ADDR) \
62 : MAX_JPROBES_STACK_SIZE)
64 /* per-cpu kprobe control block. */
65 struct kprobe_ctlblk
{
66 unsigned long kprobe_status
;
67 unsigned long kprobe_saved_pc
;
68 unsigned long jprobe_saved_sp
;
69 struct prev_kprobe prev_kprobe
;
70 struct pt_regs jprobe_saved_regs
;
71 char jprobes_stack
[MAX_JPROBES_STACK_SIZE
];
74 extern tile_bundle_bits breakpoint2_insn
;
75 extern tile_bundle_bits breakpoint_insn
;
77 void arch_remove_kprobe(struct kprobe
*);
79 extern int kprobe_exceptions_notify(struct notifier_block
*self
,
80 unsigned long val
, void *data
);
82 #endif /* CONFIG_KPROBES */
83 #endif /* _ASM_TILE_KPROBES_H */