Merge branch 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / arch / tile / include / asm / kprobes.h
CommitLineData
3fa17c39
TL
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
7d134b2c
LR
20#include <asm-generic/kprobes.h>
21
22#ifdef CONFIG_KPROBES
23
3fa17c39
TL
24#include <linux/types.h>
25#include <linux/ptrace.h>
26#include <linux/percpu.h>
3fa17c39
TL
27#include <arch/opcode.h>
28
29#define __ARCH_WANT_KPROBES_INSN_SLOT
30#define MAX_INSN_SIZE 2
31
32#define kretprobe_blacklist_size 0
33
34typedef tile_bundle_bits kprobe_opcode_t;
35
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)))
40
41struct kprobe;
42
43/* Architecture specific copy of original instruction. */
44struct arch_specific_insn {
45 kprobe_opcode_t *insn;
46};
47
48struct prev_kprobe {
49 struct kprobe *kp;
50 unsigned long status;
51 unsigned long saved_pc;
52};
53
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))
58
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)
63
64/* per-cpu kprobe control block. */
65struct 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];
72};
73
74extern tile_bundle_bits breakpoint2_insn;
75extern tile_bundle_bits breakpoint_insn;
76
77void arch_remove_kprobe(struct kprobe *);
78
79extern int kprobe_exceptions_notify(struct notifier_block *self,
80 unsigned long val, void *data);
81
7d134b2c 82#endif /* CONFIG_KPROBES */
3fa17c39 83#endif /* _ASM_TILE_KPROBES_H */