diff options
Diffstat (limited to 'arch/mips/kernel/kprobes.c')
-rw-r--r-- | arch/mips/kernel/kprobes.c | 67 |
1 files changed, 9 insertions, 58 deletions
diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c index 212f46f2014e..f5c8bce70db2 100644 --- a/arch/mips/kernel/kprobes.c +++ b/arch/mips/kernel/kprobes.c | |||
@@ -32,7 +32,8 @@ | |||
32 | #include <asm/ptrace.h> | 32 | #include <asm/ptrace.h> |
33 | #include <asm/branch.h> | 33 | #include <asm/branch.h> |
34 | #include <asm/break.h> | 34 | #include <asm/break.h> |
35 | #include <asm/inst.h> | 35 | |
36 | #include "probes-common.h" | ||
36 | 37 | ||
37 | static const union mips_instruction breakpoint_insn = { | 38 | static const union mips_instruction breakpoint_insn = { |
38 | .b_format = { | 39 | .b_format = { |
@@ -55,63 +56,7 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); | |||
55 | 56 | ||
56 | static int __kprobes insn_has_delayslot(union mips_instruction insn) | 57 | static int __kprobes insn_has_delayslot(union mips_instruction insn) |
57 | { | 58 | { |
58 | switch (insn.i_format.opcode) { | 59 | return __insn_has_delay_slot(insn); |
59 | |||
60 | /* | ||
61 | * This group contains: | ||
62 | * jr and jalr are in r_format format. | ||
63 | */ | ||
64 | case spec_op: | ||
65 | switch (insn.r_format.func) { | ||
66 | case jr_op: | ||
67 | case jalr_op: | ||
68 | break; | ||
69 | default: | ||
70 | goto insn_ok; | ||
71 | } | ||
72 | |||
73 | /* | ||
74 | * This group contains: | ||
75 | * bltz_op, bgez_op, bltzl_op, bgezl_op, | ||
76 | * bltzal_op, bgezal_op, bltzall_op, bgezall_op. | ||
77 | */ | ||
78 | case bcond_op: | ||
79 | |||
80 | /* | ||
81 | * These are unconditional and in j_format. | ||
82 | */ | ||
83 | case jal_op: | ||
84 | case j_op: | ||
85 | |||
86 | /* | ||
87 | * These are conditional and in i_format. | ||
88 | */ | ||
89 | case beq_op: | ||
90 | case beql_op: | ||
91 | case bne_op: | ||
92 | case bnel_op: | ||
93 | case blez_op: | ||
94 | case blezl_op: | ||
95 | case bgtz_op: | ||
96 | case bgtzl_op: | ||
97 | |||
98 | /* | ||
99 | * These are the FPA/cp1 branch instructions. | ||
100 | */ | ||
101 | case cop1_op: | ||
102 | |||
103 | #ifdef CONFIG_CPU_CAVIUM_OCTEON | ||
104 | case lwc2_op: /* This is bbit0 on Octeon */ | ||
105 | case ldc2_op: /* This is bbit032 on Octeon */ | ||
106 | case swc2_op: /* This is bbit1 on Octeon */ | ||
107 | case sdc2_op: /* This is bbit132 on Octeon */ | ||
108 | #endif | ||
109 | return 1; | ||
110 | default: | ||
111 | break; | ||
112 | } | ||
113 | insn_ok: | ||
114 | return 0; | ||
115 | } | 60 | } |
116 | 61 | ||
117 | /* | 62 | /* |
@@ -161,6 +106,12 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) | |||
161 | goto out; | 106 | goto out; |
162 | } | 107 | } |
163 | 108 | ||
109 | if (__insn_is_compact_branch(insn)) { | ||
110 | pr_notice("Kprobes for compact branches are not supported\n"); | ||
111 | ret = -EINVAL; | ||
112 | goto out; | ||
113 | } | ||
114 | |||
164 | /* insn: must be on special executable page on mips. */ | 115 | /* insn: must be on special executable page on mips. */ |
165 | p->ainsn.insn = get_insn_slot(); | 116 | p->ainsn.insn = get_insn_slot(); |
166 | if (!p->ainsn.insn) { | 117 | if (!p->ainsn.insn) { |