xref: /linux-6.15/include/linux/kgdb.h (revision a029a219)
1dc7d5527SJason Wessel /*
2dc7d5527SJason Wessel  * This provides the callbacks and functions that KGDB needs to share between
3dc7d5527SJason Wessel  * the core, I/O and arch-specific portions.
4dc7d5527SJason Wessel  *
5dc7d5527SJason Wessel  * Author: Amit Kale <[email protected]> and
6dc7d5527SJason Wessel  *         Tom Rini <[email protected]>
7dc7d5527SJason Wessel  *
8dc7d5527SJason Wessel  * 2001-2004 (c) Amit S. Kale and 2003-2005 (c) MontaVista Software, Inc.
9dc7d5527SJason Wessel  * This file is licensed under the terms of the GNU General Public License
10dc7d5527SJason Wessel  * version 2. This program is licensed "as is" without any warranty of any
11dc7d5527SJason Wessel  * kind, whether express or implied.
12dc7d5527SJason Wessel  */
13dc7d5527SJason Wessel #ifndef _KGDB_H_
14dc7d5527SJason Wessel #define _KGDB_H_
15dc7d5527SJason Wessel 
16dc7d5527SJason Wessel #include <linux/linkage.h>
17dc7d5527SJason Wessel #include <linux/init.h>
1860063497SArun Sharma #include <linux/atomic.h>
19f2d10ff4SDaniel Thompson #include <linux/kprobes.h>
20dcc78711SJason Wessel #ifdef CONFIG_HAVE_ARCH_KGDB
21dc7d5527SJason Wessel #include <asm/kgdb.h>
22dcc78711SJason Wessel #endif
23dc7d5527SJason Wessel 
24dcc78711SJason Wessel #ifdef CONFIG_KGDB
25dc7d5527SJason Wessel struct pt_regs;
26dc7d5527SJason Wessel 
27e3e2aaf7SJason Wessel /**
28e3e2aaf7SJason Wessel  *	kgdb_skipexception - (optional) exit kgdb_handle_exception early
29dc7d5527SJason Wessel  *	@exception: Exception vector number
30dc7d5527SJason Wessel  *	@regs: Current &struct pt_regs.
31dc7d5527SJason Wessel  *
32e3e2aaf7SJason Wessel  *	On some architectures it is required to skip a breakpoint
33e3e2aaf7SJason Wessel  *	exception when it occurs after a breakpoint has been removed.
34b11e1ecaSRandy Dunlap  *	This can be implemented in the architecture specific portion of kgdb.
35dc7d5527SJason Wessel  */
36dc7d5527SJason Wessel extern int kgdb_skipexception(int exception, struct pt_regs *regs);
37dc7d5527SJason Wessel 
38dc7d5527SJason Wessel struct tasklet_struct;
39dc7d5527SJason Wessel struct task_struct;
40dc7d5527SJason Wessel struct uart_port;
41dc7d5527SJason Wessel 
42e3e2aaf7SJason Wessel /**
43e3e2aaf7SJason Wessel  *	kgdb_breakpoint - compiled in breakpoint
44e3e2aaf7SJason Wessel  *
45b11e1ecaSRandy Dunlap  *	This will be implemented as a static inline per architecture.  This
46e3e2aaf7SJason Wessel  *	function is called by the kgdb core to execute an architecture
47e3e2aaf7SJason Wessel  *	specific trap to cause kgdb to enter the exception processing.
48e3e2aaf7SJason Wessel  *
49e3e2aaf7SJason Wessel  */
50dc7d5527SJason Wessel void kgdb_breakpoint(void);
51dc7d5527SJason Wessel 
52dc7d5527SJason Wessel extern int kgdb_connected;
53f503b5aeSJason Wessel extern int kgdb_io_module_registered;
54dc7d5527SJason Wessel 
55dc7d5527SJason Wessel extern atomic_t			kgdb_setting_breakpoint;
56dc7d5527SJason Wessel extern atomic_t			kgdb_cpu_doing_single_step;
57dc7d5527SJason Wessel 
58dc7d5527SJason Wessel extern struct task_struct	*kgdb_usethread;
59dc7d5527SJason Wessel extern struct task_struct	*kgdb_contthread;
60dc7d5527SJason Wessel 
61dc7d5527SJason Wessel enum kgdb_bptype {
62dc7d5527SJason Wessel 	BP_BREAKPOINT = 0,
63dc7d5527SJason Wessel 	BP_HARDWARE_BREAKPOINT,
64dc7d5527SJason Wessel 	BP_WRITE_WATCHPOINT,
65dc7d5527SJason Wessel 	BP_READ_WATCHPOINT,
663751d3e8SJason Wessel 	BP_ACCESS_WATCHPOINT,
673751d3e8SJason Wessel 	BP_POKE_BREAKPOINT,
68dc7d5527SJason Wessel };
69dc7d5527SJason Wessel 
70dc7d5527SJason Wessel enum kgdb_bpstate {
71dc7d5527SJason Wessel 	BP_UNDEFINED = 0,
72dc7d5527SJason Wessel 	BP_REMOVED,
73dc7d5527SJason Wessel 	BP_SET,
74dc7d5527SJason Wessel 	BP_ACTIVE
75dc7d5527SJason Wessel };
76dc7d5527SJason Wessel 
77dc7d5527SJason Wessel struct kgdb_bkpt {
78dc7d5527SJason Wessel 	unsigned long		bpt_addr;
79dc7d5527SJason Wessel 	unsigned char		saved_instr[BREAK_INSTR_SIZE];
80dc7d5527SJason Wessel 	enum kgdb_bptype	type;
81dc7d5527SJason Wessel 	enum kgdb_bpstate	state;
82dc7d5527SJason Wessel };
83dc7d5527SJason Wessel 
84534af108SJason Wessel struct dbg_reg_def_t {
85534af108SJason Wessel 	char *name;
86534af108SJason Wessel 	int size;
87534af108SJason Wessel 	int offset;
88534af108SJason Wessel };
89534af108SJason Wessel 
90534af108SJason Wessel #ifndef DBG_MAX_REG_NUM
91534af108SJason Wessel #define DBG_MAX_REG_NUM 0
92534af108SJason Wessel #else
93534af108SJason Wessel extern struct dbg_reg_def_t dbg_reg_def[];
94534af108SJason Wessel extern char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs);
95534af108SJason Wessel extern int dbg_set_reg(int regno, void *mem, struct pt_regs *regs);
96534af108SJason Wessel #endif
97dc7d5527SJason Wessel #ifndef KGDB_MAX_BREAKPOINTS
98dc7d5527SJason Wessel # define KGDB_MAX_BREAKPOINTS	1000
99dc7d5527SJason Wessel #endif
100dc7d5527SJason Wessel 
101dc7d5527SJason Wessel #define KGDB_HW_BREAKPOINT	1
102dc7d5527SJason Wessel 
103dc7d5527SJason Wessel /*
104dc7d5527SJason Wessel  * Functions each KGDB-supporting architecture must provide:
105dc7d5527SJason Wessel  */
106dc7d5527SJason Wessel 
107e3e2aaf7SJason Wessel /**
108220a31b0SZhen Lei  *	kgdb_arch_init - Perform any architecture specific initialization.
109dc7d5527SJason Wessel  *
110220a31b0SZhen Lei  *	This function will handle the initialization of any architecture
111dc7d5527SJason Wessel  *	specific callbacks.
112dc7d5527SJason Wessel  */
113dc7d5527SJason Wessel extern int kgdb_arch_init(void);
114dc7d5527SJason Wessel 
115e3e2aaf7SJason Wessel /**
116dc7d5527SJason Wessel  *	kgdb_arch_exit - Perform any architecture specific uninitalization.
117dc7d5527SJason Wessel  *
118dc7d5527SJason Wessel  *	This function will handle the uninitalization of any architecture
119dc7d5527SJason Wessel  *	specific callbacks, for dynamic registration and unregistration.
120dc7d5527SJason Wessel  */
121dc7d5527SJason Wessel extern void kgdb_arch_exit(void);
122dc7d5527SJason Wessel 
123e3e2aaf7SJason Wessel /**
124dc7d5527SJason Wessel  *	pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs
125dc7d5527SJason Wessel  *	@gdb_regs: A pointer to hold the registers in the order GDB wants.
126dc7d5527SJason Wessel  *	@regs: The &struct pt_regs of the current process.
127dc7d5527SJason Wessel  *
128dc7d5527SJason Wessel  *	Convert the pt_regs in @regs into the format for registers that
129dc7d5527SJason Wessel  *	GDB expects, stored in @gdb_regs.
130dc7d5527SJason Wessel  */
131dc7d5527SJason Wessel extern void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs);
132dc7d5527SJason Wessel 
133e3e2aaf7SJason Wessel /**
134dc7d5527SJason Wessel  *	sleeping_thread_to_gdb_regs - Convert ptrace regs to GDB regs
135dc7d5527SJason Wessel  *	@gdb_regs: A pointer to hold the registers in the order GDB wants.
136dc7d5527SJason Wessel  *	@p: The &struct task_struct of the desired process.
137dc7d5527SJason Wessel  *
138dc7d5527SJason Wessel  *	Convert the register values of the sleeping process in @p to
139dc7d5527SJason Wessel  *	the format that GDB expects.
140dc7d5527SJason Wessel  *	This function is called when kgdb does not have access to the
141dc7d5527SJason Wessel  *	&struct pt_regs and therefore it should fill the gdb registers
142dc7d5527SJason Wessel  *	@gdb_regs with what has	been saved in &struct thread_struct
143dc7d5527SJason Wessel  *	thread field during switch_to.
144dc7d5527SJason Wessel  */
145dc7d5527SJason Wessel extern void
146dc7d5527SJason Wessel sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p);
147dc7d5527SJason Wessel 
148e3e2aaf7SJason Wessel /**
149dc7d5527SJason Wessel  *	gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs.
150dc7d5527SJason Wessel  *	@gdb_regs: A pointer to hold the registers we've received from GDB.
151dc7d5527SJason Wessel  *	@regs: A pointer to a &struct pt_regs to hold these values in.
152dc7d5527SJason Wessel  *
153dc7d5527SJason Wessel  *	Convert the GDB regs in @gdb_regs into the pt_regs, and store them
154dc7d5527SJason Wessel  *	in @regs.
155dc7d5527SJason Wessel  */
156dc7d5527SJason Wessel extern void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs);
157dc7d5527SJason Wessel 
158e3e2aaf7SJason Wessel /**
159dc7d5527SJason Wessel  *	kgdb_arch_handle_exception - Handle architecture specific GDB packets.
160dc7d5527SJason Wessel  *	@vector: The error vector of the exception that happened.
161dc7d5527SJason Wessel  *	@signo: The signal number of the exception that happened.
162dc7d5527SJason Wessel  *	@err_code: The error code of the exception that happened.
163dc7d5527SJason Wessel  *	@remcom_in_buffer: The buffer of the packet we have read.
164dc7d5527SJason Wessel  *	@remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
165dc7d5527SJason Wessel  *	@regs: The &struct pt_regs of the current process.
166dc7d5527SJason Wessel  *
167dc7d5527SJason Wessel  *	This function MUST handle the 'c' and 's' command packets,
168dc7d5527SJason Wessel  *	as well packets to set / remove a hardware breakpoint, if used.
169dc7d5527SJason Wessel  *	If there are additional packets which the hardware needs to handle,
170dc7d5527SJason Wessel  *	they are handled here.  The code should return -1 if it wants to
171dc7d5527SJason Wessel  *	process more packets, and a %0 or %1 if it wants to exit from the
172dc7d5527SJason Wessel  *	kgdb callback.
173dc7d5527SJason Wessel  */
174dc7d5527SJason Wessel extern int
175dc7d5527SJason Wessel kgdb_arch_handle_exception(int vector, int signo, int err_code,
176dc7d5527SJason Wessel 			   char *remcom_in_buffer,
177dc7d5527SJason Wessel 			   char *remcom_out_buffer,
178dc7d5527SJason Wessel 			   struct pt_regs *regs);
179dc7d5527SJason Wessel 
180e3e2aaf7SJason Wessel /**
1818c080d3aSVincent Chen  *	kgdb_arch_handle_qxfer_pkt - Handle architecture specific GDB XML
1828c080d3aSVincent Chen  *				     packets.
1838c080d3aSVincent Chen  *	@remcom_in_buffer: The buffer of the packet we have read.
1848c080d3aSVincent Chen  *	@remcom_out_buffer: The buffer of %BUFMAX bytes to write a packet into.
1858c080d3aSVincent Chen  */
1868c080d3aSVincent Chen 
1878c080d3aSVincent Chen extern void
1888c080d3aSVincent Chen kgdb_arch_handle_qxfer_pkt(char *remcom_in_buffer,
1898c080d3aSVincent Chen 			   char *remcom_out_buffer);
1908c080d3aSVincent Chen 
1918c080d3aSVincent Chen /**
1923cd99ac3SDouglas Anderson  *	kgdb_call_nmi_hook - Call kgdb_nmicallback() on the current CPU
1933cd99ac3SDouglas Anderson  *	@ignored: This parameter is only here to match the prototype.
1943cd99ac3SDouglas Anderson  *
1953cd99ac3SDouglas Anderson  *	If you're using the default implementation of kgdb_roundup_cpus()
1963cd99ac3SDouglas Anderson  *	this function will be called per CPU.  If you don't implement
1973cd99ac3SDouglas Anderson  *	kgdb_call_nmi_hook() a default will be used.
1983cd99ac3SDouglas Anderson  */
1993cd99ac3SDouglas Anderson 
2003cd99ac3SDouglas Anderson extern void kgdb_call_nmi_hook(void *ignored);
2013cd99ac3SDouglas Anderson 
2023cd99ac3SDouglas Anderson /**
203dc7d5527SJason Wessel  *	kgdb_roundup_cpus - Get other CPUs into a holding pattern
204dc7d5527SJason Wessel  *
205dc7d5527SJason Wessel  *	On SMP systems, we need to get the attention of the other CPUs
206b11e1ecaSRandy Dunlap  *	and get them into a known state.  This should do what is needed
207dc7d5527SJason Wessel  *	to get the other CPUs to call kgdb_wait(). Note that on some arches,
2083cd99ac3SDouglas Anderson  *	the NMI approach is not used for rounding up all the CPUs.  Normally
2093cd99ac3SDouglas Anderson  *	those architectures can just not implement this and get the default.
210dc7d5527SJason Wessel  *
211dc7d5527SJason Wessel  *	On non-SMP systems, this is not called.
212dc7d5527SJason Wessel  */
2139ef7fa50SDouglas Anderson extern void kgdb_roundup_cpus(void);
214dc7d5527SJason Wessel 
21584c08fd6SJason Wessel /**
21684c08fd6SJason Wessel  *	kgdb_arch_set_pc - Generic call back to the program counter
21784c08fd6SJason Wessel  *	@regs: Current &struct pt_regs.
21884c08fd6SJason Wessel  *  @pc: The new value for the program counter
21984c08fd6SJason Wessel  *
22084c08fd6SJason Wessel  *	This function handles updating the program counter and requires an
22184c08fd6SJason Wessel  *	architecture specific implementation.
22284c08fd6SJason Wessel  */
22384c08fd6SJason Wessel extern void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc);
22484c08fd6SJason Wessel 
22584c08fd6SJason Wessel 
226dc7d5527SJason Wessel /* Optional functions. */
227dc7d5527SJason Wessel extern int kgdb_validate_break_address(unsigned long addr);
22898b54aa1SJason Wessel extern int kgdb_arch_set_breakpoint(struct kgdb_bkpt *bpt);
22998b54aa1SJason Wessel extern int kgdb_arch_remove_breakpoint(struct kgdb_bkpt *bpt);
230dc7d5527SJason Wessel 
231e3e2aaf7SJason Wessel /**
232220a31b0SZhen Lei  *	kgdb_arch_late - Perform any architecture specific initialization.
2330b4b3827SJason Wessel  *
234220a31b0SZhen Lei  *	This function will handle the late initialization of any
2350b4b3827SJason Wessel  *	architecture specific callbacks.  This is an optional function for
2360b4b3827SJason Wessel  *	handling things like late initialization of hw breakpoints.  The
2370b4b3827SJason Wessel  *	default implementation does nothing.
2380b4b3827SJason Wessel  */
2390b4b3827SJason Wessel extern void kgdb_arch_late(void);
2400b4b3827SJason Wessel 
2410b4b3827SJason Wessel 
2420b4b3827SJason Wessel /**
243dc7d5527SJason Wessel  * struct kgdb_arch - Describe architecture specific values.
244dc7d5527SJason Wessel  * @gdb_bpt_instr: The instruction to trigger a breakpoint.
245dc7d5527SJason Wessel  * @flags: Flags for the breakpoint, currently just %KGDB_HW_BREAKPOINT.
246dc7d5527SJason Wessel  * @set_breakpoint: Allow an architecture to specify how to set a software
247dc7d5527SJason Wessel  * breakpoint.
248dc7d5527SJason Wessel  * @remove_breakpoint: Allow an architecture to specify how to remove a
249dc7d5527SJason Wessel  * software breakpoint.
250dc7d5527SJason Wessel  * @set_hw_breakpoint: Allow an architecture to specify how to set a hardware
251dc7d5527SJason Wessel  * breakpoint.
252dc7d5527SJason Wessel  * @remove_hw_breakpoint: Allow an architecture to specify how to remove a
253dc7d5527SJason Wessel  * hardware breakpoint.
254d7ba979dSDongdong Deng  * @disable_hw_break: Allow an architecture to specify how to disable
255d7ba979dSDongdong Deng  * hardware breakpoints for a single cpu.
256dc7d5527SJason Wessel  * @remove_all_hw_break: Allow an architecture to specify how to remove all
257dc7d5527SJason Wessel  * hardware breakpoints.
258dc7d5527SJason Wessel  * @correct_hw_break: Allow an architecture to specify how to correct the
259dc7d5527SJason Wessel  * hardware debug registers.
260dc7d5527SJason Wessel  */
261dc7d5527SJason Wessel struct kgdb_arch {
262dc7d5527SJason Wessel 	unsigned char		gdb_bpt_instr[BREAK_INSTR_SIZE];
263dc7d5527SJason Wessel 	unsigned long		flags;
264dc7d5527SJason Wessel 
265dc7d5527SJason Wessel 	int	(*set_breakpoint)(unsigned long, char *);
266dc7d5527SJason Wessel 	int	(*remove_breakpoint)(unsigned long, char *);
267dc7d5527SJason Wessel 	int	(*set_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
268dc7d5527SJason Wessel 	int	(*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype);
269d7ba979dSDongdong Deng 	void	(*disable_hw_break)(struct pt_regs *regs);
270dc7d5527SJason Wessel 	void	(*remove_all_hw_break)(void);
271dc7d5527SJason Wessel 	void	(*correct_hw_break)(void);
272dc7d5527SJason Wessel };
273dc7d5527SJason Wessel 
274e3e2aaf7SJason Wessel /**
275dc7d5527SJason Wessel  * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB.
276dc7d5527SJason Wessel  * @name: Name of the I/O driver.
277dc7d5527SJason Wessel  * @read_char: Pointer to a function that will return one char.
278dc7d5527SJason Wessel  * @write_char: Pointer to a function that will write one char.
279dc7d5527SJason Wessel  * @flush: Pointer to a function that will flush any pending writes.
280dc7d5527SJason Wessel  * @init: Pointer to a function that will initialize the device.
28122099562SDouglas Anderson  * @deinit: Pointer to a function that will deinit the device. Implies that
28222099562SDouglas Anderson  * this I/O driver is temporary and expects to be replaced. Called when
28322099562SDouglas Anderson  * an I/O driver is replaced or explicitly unregistered.
284dc7d5527SJason Wessel  * @pre_exception: Pointer to a function that will do any prep work for
285dc7d5527SJason Wessel  * the I/O driver.
286dc7d5527SJason Wessel  * @post_exception: Pointer to a function that will do any cleanup work
287dc7d5527SJason Wessel  * for the I/O driver.
2885946d1f5SSumit Garg  * @cons: valid if the I/O device is a console; else NULL.
289dc7d5527SJason Wessel  */
290dc7d5527SJason Wessel struct kgdb_io {
291dc7d5527SJason Wessel 	const char		*name;
292dc7d5527SJason Wessel 	int			(*read_char) (void);
293dc7d5527SJason Wessel 	void			(*write_char) (u8);
294dc7d5527SJason Wessel 	void			(*flush) (void);
295dc7d5527SJason Wessel 	int			(*init) (void);
29622099562SDouglas Anderson 	void			(*deinit) (void);
297dc7d5527SJason Wessel 	void			(*pre_exception) (void);
298dc7d5527SJason Wessel 	void			(*post_exception) (void);
2995946d1f5SSumit Garg 	struct console		*cons;
300dc7d5527SJason Wessel };
301dc7d5527SJason Wessel 
302cc028297SChristophe Leroy extern const struct kgdb_arch		arch_kgdb_ops;
303dc7d5527SJason Wessel 
304107bcc6dSBjorn Helgaas extern unsigned long kgdb_arch_pc(int exception, struct pt_regs *regs);
305688b744dSHarvey Harrison 
306dc7d5527SJason Wessel extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
307dc7d5527SJason Wessel extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
30853197fc4SJason Wessel extern struct kgdb_io *dbg_io_ops;
309dc7d5527SJason Wessel 
310688b744dSHarvey Harrison extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
31155751145SJason Wessel extern char *kgdb_mem2hex(char *mem, char *buf, int count);
312dc7d5527SJason Wessel extern int kgdb_hex2mem(char *buf, char *mem, int count);
313dc7d5527SJason Wessel 
314dc7d5527SJason Wessel extern int kgdb_isremovedbreak(unsigned long addr);
315def0aa21SVincent Chen extern int kgdb_has_hit_break(unsigned long addr);
316dc7d5527SJason Wessel 
317dc7d5527SJason Wessel extern int
318dc7d5527SJason Wessel kgdb_handle_exception(int ex_vector, int signo, int err_code,
319dc7d5527SJason Wessel 		      struct pt_regs *regs);
320dc7d5527SJason Wessel extern int kgdb_nmicallback(int cpu, void *regs);
321fc8b1374SMike Travis extern int kgdb_nmicallin(int cpu, int trapnr, void *regs, int err_code,
322fc8b1374SMike Travis 			  atomic_t *snd_rdy);
323d57f078bSDavid Howells extern void gdbstub_exit(int status);
324dc7d5527SJason Wessel 
325f2d10ff4SDaniel Thompson /*
326f2d10ff4SDaniel Thompson  * kgdb and kprobes both use the same (kprobe) blocklist (which makes sense
327f2d10ff4SDaniel Thompson  * given they are both typically hooked up to the same trap meaning on most
328f2d10ff4SDaniel Thompson  * architectures one cannot be used to debug the other)
329f2d10ff4SDaniel Thompson  *
330f2d10ff4SDaniel Thompson  * However on architectures where kprobes is not (yet) implemented we permit
331f2d10ff4SDaniel Thompson  * breakpoints everywhere rather than blocking everything by default.
332f2d10ff4SDaniel Thompson  */
kgdb_within_blocklist(unsigned long addr)333f2d10ff4SDaniel Thompson static inline bool kgdb_within_blocklist(unsigned long addr)
334f2d10ff4SDaniel Thompson {
335f2d10ff4SDaniel Thompson #ifdef CONFIG_KGDB_HONOUR_BLOCKLIST
336f2d10ff4SDaniel Thompson 	return within_kprobe_blacklist(addr);
337f2d10ff4SDaniel Thompson #else
338f2d10ff4SDaniel Thompson 	return false;
339f2d10ff4SDaniel Thompson #endif
340f2d10ff4SDaniel Thompson }
341f2d10ff4SDaniel Thompson 
342dc7d5527SJason Wessel extern int			kgdb_single_step;
343dc7d5527SJason Wessel extern atomic_t			kgdb_active;
344dcc78711SJason Wessel #define in_dbg_master() \
3453fec4aecSDaniel Thompson 	(irqs_disabled() && (smp_processor_id() == atomic_read(&kgdb_active)))
3460b4b3827SJason Wessel extern bool dbg_is_early;
3470b4b3827SJason Wessel extern void __init dbg_late_init(void);
3487d92bda2SDouglas Anderson extern void kgdb_panic(const char *msg);
349d54ce615SSumit Garg extern void kgdb_free_init_mem(void);
350dcc78711SJason Wessel #else /* ! CONFIG_KGDB */
351dcc78711SJason Wessel #define in_dbg_master() (0)
3520b4b3827SJason Wessel #define dbg_late_init()
kgdb_panic(const char * msg)3537d92bda2SDouglas Anderson static inline void kgdb_panic(const char *msg) {}
kgdb_free_init_mem(void)354d54ce615SSumit Garg static inline void kgdb_free_init_mem(void) { }
kgdb_nmicallback(int cpu,void * regs)355*8117f948SDouglas Anderson static inline int kgdb_nmicallback(int cpu, void *regs) { return 1; }
356dcc78711SJason Wessel #endif /* ! CONFIG_KGDB */
357dc7d5527SJason Wessel #endif /* _KGDB_H_ */
358