.. | .. |
---|
16 | 16 | #include <linux/linkage.h> |
---|
17 | 17 | #include <linux/init.h> |
---|
18 | 18 | #include <linux/atomic.h> |
---|
| 19 | +#include <linux/kprobes.h> |
---|
19 | 20 | #ifdef CONFIG_HAVE_ARCH_KGDB |
---|
20 | 21 | #include <asm/kgdb.h> |
---|
21 | 22 | #endif |
---|
.. | .. |
---|
177 | 178 | struct pt_regs *regs); |
---|
178 | 179 | |
---|
179 | 180 | /** |
---|
| 181 | + * kgdb_arch_handle_qxfer_pkt - Handle architecture specific GDB XML |
---|
| 182 | + * packets. |
---|
| 183 | + * @remcom_in_buffer: The buffer of the packet we have read. |
---|
| 184 | + * @remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into. |
---|
| 185 | + */ |
---|
| 186 | + |
---|
| 187 | +extern void |
---|
| 188 | +kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer, |
---|
| 189 | + char *remcom_out_buffer); |
---|
| 190 | + |
---|
| 191 | +/** |
---|
| 192 | + * kgdb_call_nmi_hook - Call kgdb_nmicallback() on the current CPU |
---|
| 193 | + * @ignored: This parameter is only here to match the prototype. |
---|
| 194 | + * |
---|
| 195 | + * If you're using the default implementation of kgdb_roundup_cpus() |
---|
| 196 | + * this function will be called per CPU. If you don't implement |
---|
| 197 | + * kgdb_call_nmi_hook() a default will be used. |
---|
| 198 | + */ |
---|
| 199 | + |
---|
| 200 | +extern void kgdb_call_nmi_hook(void *ignored); |
---|
| 201 | + |
---|
| 202 | +/** |
---|
180 | 203 | * kgdb_roundup_cpus - Get other CPUs into a holding pattern |
---|
181 | | - * @flags: Current IRQ state |
---|
182 | 204 | * |
---|
183 | 205 | * On SMP systems, we need to get the attention of the other CPUs |
---|
184 | 206 | * and get them into a known state. This should do what is needed |
---|
185 | 207 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
---|
186 | | - * the NMI approach is not used for rounding up all the CPUs. For example, |
---|
187 | | - * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
---|
188 | | - * this case, we have to make sure that interrupts are enabled before |
---|
189 | | - * calling smp_call_function(). The argument to this function is |
---|
190 | | - * the flags that will be used when restoring the interrupts. There is |
---|
191 | | - * local_irq_save() call before kgdb_roundup_cpus(). |
---|
| 208 | + * the NMI approach is not used for rounding up all the CPUs. Normally |
---|
| 209 | + * those architectures can just not implement this and get the default. |
---|
192 | 210 | * |
---|
193 | 211 | * On non-SMP systems, this is not called. |
---|
194 | 212 | */ |
---|
195 | | -extern void kgdb_roundup_cpus(unsigned long flags); |
---|
| 213 | +extern void kgdb_roundup_cpus(void); |
---|
196 | 214 | |
---|
197 | 215 | /** |
---|
198 | 216 | * kgdb_arch_set_pc - Generic call back to the program counter |
---|
.. | .. |
---|
263 | 281 | * @write_char: Pointer to a function that will write one char. |
---|
264 | 282 | * @flush: Pointer to a function that will flush any pending writes. |
---|
265 | 283 | * @init: Pointer to a function that will initialize the device. |
---|
| 284 | + * @deinit: Pointer to a function that will deinit the device. Implies that |
---|
| 285 | + * this I/O driver is temporary and expects to be replaced. Called when |
---|
| 286 | + * an I/O driver is replaced or explicitly unregistered. |
---|
266 | 287 | * @pre_exception: Pointer to a function that will do any prep work for |
---|
267 | 288 | * the I/O driver. |
---|
268 | 289 | * @post_exception: Pointer to a function that will do any cleanup work |
---|
269 | 290 | * for the I/O driver. |
---|
270 | | - * @is_console: 1 if the end device is a console 0 if the I/O device is |
---|
271 | | - * not a console |
---|
| 291 | + * @cons: valid if the I/O device is a console; else NULL. |
---|
272 | 292 | */ |
---|
273 | 293 | struct kgdb_io { |
---|
274 | 294 | const char *name; |
---|
.. | .. |
---|
276 | 296 | void (*write_char) (u8); |
---|
277 | 297 | void (*flush) (void); |
---|
278 | 298 | int (*init) (void); |
---|
| 299 | + void (*deinit) (void); |
---|
279 | 300 | void (*pre_exception) (void); |
---|
280 | 301 | void (*post_exception) (void); |
---|
281 | | - int is_console; |
---|
| 302 | + struct console *cons; |
---|
282 | 303 | }; |
---|
283 | 304 | |
---|
284 | | -extern struct kgdb_arch arch_kgdb_ops; |
---|
| 305 | +extern const struct kgdb_arch arch_kgdb_ops; |
---|
285 | 306 | |
---|
286 | 307 | extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs); |
---|
287 | 308 | |
---|
.. | .. |
---|
292 | 313 | #else |
---|
293 | 314 | static inline int kgdb_register_nmi_console(void) { return 0; } |
---|
294 | 315 | static inline int kgdb_unregister_nmi_console(void) { return 0; } |
---|
295 | | -static inline bool kgdb_nmi_poll_knock(void) { return 1; } |
---|
| 316 | +static inline bool kgdb_nmi_poll_knock(void) { return true; } |
---|
296 | 317 | #endif |
---|
297 | 318 | |
---|
298 | 319 | extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops); |
---|
.. | .. |
---|
305 | 326 | |
---|
306 | 327 | extern int kgdb_isremovedbreak(unsigned long addr); |
---|
307 | 328 | extern void kgdb_schedule_breakpoint(void); |
---|
| 329 | +extern int kgdb_has_hit_break(unsigned long addr); |
---|
308 | 330 | |
---|
309 | 331 | extern int |
---|
310 | 332 | kgdb_handle_exception(int ex_vector, int signo, int err_code, |
---|
.. | .. |
---|
314 | 336 | atomic_t *snd_rdy); |
---|
315 | 337 | extern void gdbstub_exit(int status); |
---|
316 | 338 | |
---|
| 339 | +/* |
---|
| 340 | + * kgdb and kprobes both use the same (kprobe) blocklist (which makes sense |
---|
| 341 | + * given they are both typically hooked up to the same trap meaning on most |
---|
| 342 | + * architectures one cannot be used to debug the other) |
---|
| 343 | + * |
---|
| 344 | + * However on architectures where kprobes is not (yet) implemented we permit |
---|
| 345 | + * breakpoints everywhere rather than blocking everything by default. |
---|
| 346 | + */ |
---|
| 347 | +static inline bool kgdb_within_blocklist(unsigned long addr) |
---|
| 348 | +{ |
---|
| 349 | +#ifdef CONFIG_KGDB_HONOUR_BLOCKLIST |
---|
| 350 | + return within_kprobe_blacklist(addr); |
---|
| 351 | +#else |
---|
| 352 | + return false; |
---|
| 353 | +#endif |
---|
| 354 | +} |
---|
| 355 | + |
---|
317 | 356 | extern int kgdb_single_step; |
---|
318 | 357 | extern atomic_t kgdb_active; |
---|
319 | 358 | #define in_dbg_master() \ |
---|
320 | 359 | (irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active))) |
---|
321 | 360 | extern bool dbg_is_early; |
---|
322 | 361 | extern void __init dbg_late_init(void); |
---|
| 362 | +extern void kgdb_panic(const char *msg); |
---|
| 363 | +extern void kgdb_free_init_mem(void); |
---|
323 | 364 | #else /* ! CONFIG_KGDB */ |
---|
324 | 365 | #define in_dbg_master() (0) |
---|
325 | 366 | #define dbg_late_init() |
---|
| 367 | +static inline void kgdb_panic(const char *msg) {} |
---|
| 368 | +static inline void kgdb_free_init_mem(void) { } |
---|
326 | 369 | #endif /* ! CONFIG_KGDB */ |
---|
327 | 370 | #endif /* _KGDB_H_ */ |
---|