.. | .. |
---|
154 | 154 | return 0; |
---|
155 | 155 | } |
---|
156 | 156 | |
---|
157 | | -static struct undef_hook kgdb_brkpt_hook = { |
---|
| 157 | +static struct undef_hook kgdb_brkpt_arm_hook = { |
---|
158 | 158 | .instr_mask = 0xffffffff, |
---|
159 | 159 | .instr_val = KGDB_BREAKINST, |
---|
160 | | - .cpsr_mask = MODE_MASK, |
---|
| 160 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
---|
161 | 161 | .cpsr_val = SVC_MODE, |
---|
162 | 162 | .fn = kgdb_brk_fn |
---|
163 | 163 | }; |
---|
164 | 164 | |
---|
165 | | -static struct undef_hook kgdb_compiled_brkpt_hook = { |
---|
| 165 | +static struct undef_hook kgdb_brkpt_thumb_hook = { |
---|
| 166 | + .instr_mask = 0xffff, |
---|
| 167 | + .instr_val = KGDB_BREAKINST & 0xffff, |
---|
| 168 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
---|
| 169 | + .cpsr_val = PSR_T_BIT | SVC_MODE, |
---|
| 170 | + .fn = kgdb_brk_fn |
---|
| 171 | +}; |
---|
| 172 | + |
---|
| 173 | +static struct undef_hook kgdb_compiled_brkpt_arm_hook = { |
---|
166 | 174 | .instr_mask = 0xffffffff, |
---|
167 | 175 | .instr_val = KGDB_COMPILED_BREAK, |
---|
168 | | - .cpsr_mask = MODE_MASK, |
---|
| 176 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
---|
169 | 177 | .cpsr_val = SVC_MODE, |
---|
170 | 178 | .fn = kgdb_compiled_brk_fn |
---|
171 | 179 | }; |
---|
172 | 180 | |
---|
173 | | -static void kgdb_call_nmi_hook(void *ignored) |
---|
174 | | -{ |
---|
175 | | - kgdb_nmicallback(raw_smp_processor_id(), get_irq_regs()); |
---|
176 | | -} |
---|
177 | | - |
---|
178 | | -void kgdb_roundup_cpus(unsigned long flags) |
---|
179 | | -{ |
---|
180 | | - local_irq_enable(); |
---|
181 | | - smp_call_function(kgdb_call_nmi_hook, NULL, 0); |
---|
182 | | - local_irq_disable(); |
---|
183 | | -} |
---|
| 181 | +static struct undef_hook kgdb_compiled_brkpt_thumb_hook = { |
---|
| 182 | + .instr_mask = 0xffff, |
---|
| 183 | + .instr_val = KGDB_COMPILED_BREAK & 0xffff, |
---|
| 184 | + .cpsr_mask = PSR_T_BIT | MODE_MASK, |
---|
| 185 | + .cpsr_val = PSR_T_BIT | SVC_MODE, |
---|
| 186 | + .fn = kgdb_compiled_brk_fn |
---|
| 187 | +}; |
---|
184 | 188 | |
---|
185 | 189 | static int __kgdb_notify(struct die_args *args, unsigned long cmd) |
---|
186 | 190 | { |
---|
.. | .. |
---|
222 | 226 | if (ret != 0) |
---|
223 | 227 | return ret; |
---|
224 | 228 | |
---|
225 | | - register_undef_hook(&kgdb_brkpt_hook); |
---|
226 | | - register_undef_hook(&kgdb_compiled_brkpt_hook); |
---|
| 229 | + register_undef_hook(&kgdb_brkpt_arm_hook); |
---|
| 230 | + register_undef_hook(&kgdb_brkpt_thumb_hook); |
---|
| 231 | + register_undef_hook(&kgdb_compiled_brkpt_arm_hook); |
---|
| 232 | + register_undef_hook(&kgdb_compiled_brkpt_thumb_hook); |
---|
227 | 233 | |
---|
228 | 234 | return 0; |
---|
229 | 235 | } |
---|
.. | .. |
---|
236 | 242 | */ |
---|
237 | 243 | void kgdb_arch_exit(void) |
---|
238 | 244 | { |
---|
239 | | - unregister_undef_hook(&kgdb_brkpt_hook); |
---|
240 | | - unregister_undef_hook(&kgdb_compiled_brkpt_hook); |
---|
| 245 | + unregister_undef_hook(&kgdb_brkpt_arm_hook); |
---|
| 246 | + unregister_undef_hook(&kgdb_brkpt_thumb_hook); |
---|
| 247 | + unregister_undef_hook(&kgdb_compiled_brkpt_arm_hook); |
---|
| 248 | + unregister_undef_hook(&kgdb_compiled_brkpt_thumb_hook); |
---|
241 | 249 | unregister_die_notifier(&kgdb_notifier); |
---|
242 | 250 | } |
---|
243 | 251 | |
---|
.. | .. |
---|
248 | 256 | /* patch_text() only supports int-sized breakpoints */ |
---|
249 | 257 | BUILD_BUG_ON(sizeof(int) != BREAK_INSTR_SIZE); |
---|
250 | 258 | |
---|
251 | | - err = probe_kernel_read(bpt->saved_instr, (char *)bpt->bpt_addr, |
---|
| 259 | + err = copy_from_kernel_nofault(bpt->saved_instr, (char *)bpt->bpt_addr, |
---|
252 | 260 | BREAK_INSTR_SIZE); |
---|
253 | 261 | if (err) |
---|
254 | 262 | return err; |
---|
.. | .. |
---|
274 | 282 | * and we handle the normal undef case within the do_undefinstr |
---|
275 | 283 | * handler. |
---|
276 | 284 | */ |
---|
277 | | -struct kgdb_arch arch_kgdb_ops = { |
---|
| 285 | +const struct kgdb_arch arch_kgdb_ops = { |
---|
278 | 286 | #ifndef __ARMEB__ |
---|
279 | 287 | .gdb_bpt_instr = {0xfe, 0xde, 0xff, 0xe7} |
---|
280 | 288 | #else /* ! __ARMEB__ */ |
---|