Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #ifndef _KDBPRIVATE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #define _KDBPRIVATE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Kernel Debugger Architecture Independent Private Headers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Copyright (c) 2009 Wind River Systems, Inc.  All Rights Reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/kgdb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "../debug_core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) /* Kernel Debugger Command codes.  Must not overlap with error codes. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define KDB_CMD_GO	(-1001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define KDB_CMD_CPU	(-1002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define KDB_CMD_SS	(-1003)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define KDB_CMD_KGDB (-1005)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) /* Internal debug flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define KDB_DEBUG_FLAG_BP	0x0002	/* Breakpoint subsystem debug */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define KDB_DEBUG_FLAG_BB_SUMM	0x0004	/* Basic block analysis, summary only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define KDB_DEBUG_FLAG_AR	0x0008	/* Activation record, generic */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #define KDB_DEBUG_FLAG_ARA	0x0010	/* Activation record, arch specific */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define KDB_DEBUG_FLAG_BB	0x0020	/* All basic block analysis */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define KDB_DEBUG_FLAG_STATE	0x0040	/* State flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define KDB_DEBUG_FLAG_MASK	0xffff	/* All debug flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define KDB_DEBUG_FLAG_SHIFT	16	/* Shift factor for dbflags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define KDB_DEBUG(flag)	(kdb_flags & \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	(KDB_DEBUG_FLAG_##flag << KDB_DEBUG_FLAG_SHIFT))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define KDB_DEBUG_STATE(text, value) if (KDB_DEBUG(STATE)) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		kdb_print_state(text, value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #if BITS_PER_LONG == 32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define KDB_PLATFORM_ENV	"BYTESPERWORD=4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define kdb_machreg_fmt		"0x%lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define kdb_machreg_fmt0	"0x%08lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) #define kdb_bfd_vma_fmt		"0x%lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define kdb_bfd_vma_fmt0	"0x%08lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define kdb_elfw_addr_fmt	"0x%x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define kdb_elfw_addr_fmt0	"0x%08x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define kdb_f_count_fmt		"%d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #elif BITS_PER_LONG == 64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define KDB_PLATFORM_ENV	"BYTESPERWORD=8"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) #define kdb_machreg_fmt		"0x%lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) #define kdb_machreg_fmt0	"0x%016lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #define kdb_bfd_vma_fmt		"0x%lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define kdb_bfd_vma_fmt0	"0x%016lx"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #define kdb_elfw_addr_fmt	"0x%x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) #define kdb_elfw_addr_fmt0	"0x%016x"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) #define kdb_f_count_fmt		"%ld"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * KDB_MAXBPT describes the total number of breakpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * supported by this architecure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) #define KDB_MAXBPT	16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) /* Symbol table format returned by kallsyms. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) typedef struct __ksymtab {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		unsigned long value;	/* Address of symbol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		const char *mod_name;	/* Module containing symbol or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 					 * "kernel" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		unsigned long mod_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		unsigned long mod_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		const char *sec_name;	/* Section containing symbol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		unsigned long sec_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		unsigned long sec_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		const char *sym_name;	/* Full symbol name, including
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 					 * any version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 		unsigned long sym_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 		unsigned long sym_end;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		} kdb_symtab_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) extern int kallsyms_symbol_next(char *prefix_name, int flag, int buf_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) extern int kallsyms_symbol_complete(char *prefix_name, int max_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /* Exported Symbols for kernel loadable modules to use. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) extern int kdb_getarea_size(void *, unsigned long, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) extern int kdb_putarea_size(unsigned long, void *, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94)  * Like get_user and put_user, kdb_getarea and kdb_putarea take variable
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95)  * names, not pointers.  The underlying *_size functions take pointers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #define kdb_getarea(x, addr) kdb_getarea_size(&(x), addr, sizeof((x)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) #define kdb_putarea(addr, x) kdb_putarea_size(addr, &(x), sizeof((x)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) extern int kdb_getphysword(unsigned long *word,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			unsigned long addr, size_t size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) extern int kdb_getword(unsigned long *, unsigned long, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) extern int kdb_putword(unsigned long, unsigned long, size_t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) extern int kdbgetularg(const char *, unsigned long *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) extern int kdbgetu64arg(const char *, u64 *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) extern char *kdbgetenv(const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) extern int kdbgetaddrarg(int, const char **, int*, unsigned long *,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			 long *, char **);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) extern int kdbgetsymval(const char *, kdb_symtab_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) extern int kdbnearsym(unsigned long, kdb_symtab_t *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) extern void kdbnearsym_cleanup(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) extern char *kdb_strdup(const char *str, gfp_t type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) extern void kdb_symbol_print(unsigned long, const kdb_symtab_t *, unsigned int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) /* Routine for debugging the debugger state. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) extern void kdb_print_state(const char *, int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) extern int kdb_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) #define KDB_STATE_KDB		0x00000001	/* Cpu is inside kdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define KDB_STATE_LEAVING	0x00000002	/* Cpu is leaving kdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define KDB_STATE_CMD		0x00000004	/* Running a kdb command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define KDB_STATE_KDB_CONTROL	0x00000008	/* This cpu is under
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 						 * kdb control */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define KDB_STATE_HOLD_CPU	0x00000010	/* Hold this cpu inside kdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define KDB_STATE_DOING_SS	0x00000020	/* Doing ss command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define KDB_STATE_SSBPT		0x00000080	/* Install breakpoint
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 						 * after one ss, independent of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 						 * DOING_SS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #define KDB_STATE_REENTRY	0x00000100	/* Valid re-entry into kdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) #define KDB_STATE_SUPPRESS	0x00000200	/* Suppress error messages */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) #define KDB_STATE_PAGER		0x00000400	/* pager is available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) #define KDB_STATE_GO_SWITCH	0x00000800	/* go is switching
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 						 * back to initial cpu */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) #define KDB_STATE_WAIT_IPI	0x00002000	/* Waiting for kdb_ipi() NMI */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) #define KDB_STATE_RECURSE	0x00004000	/* Recursive entry to kdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) #define KDB_STATE_IP_ADJUSTED	0x00008000	/* Restart IP has been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 						 * adjusted */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #define KDB_STATE_GO1		0x00010000	/* go only releases one cpu */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) #define KDB_STATE_KEYBOARD	0x00020000	/* kdb entered via
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 						 * keyboard on this cpu */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) #define KDB_STATE_KEXEC		0x00040000	/* kexec issued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #define KDB_STATE_DOING_KGDB	0x00080000	/* kgdb enter now issued */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) #define KDB_STATE_KGDB_TRANS	0x00200000	/* Transition to kgdb */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #define KDB_STATE_ARCH		0xff000000	/* Reserved for arch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 						 * specific use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) #define KDB_STATE(flag) (kdb_state & KDB_STATE_##flag)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) #define KDB_STATE_SET(flag) ((void)(kdb_state |= KDB_STATE_##flag))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) #define KDB_STATE_CLEAR(flag) ((void)(kdb_state &= ~KDB_STATE_##flag))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) extern int kdb_nextline; /* Current number of lines displayed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) typedef struct _kdb_bp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	unsigned long	bp_addr;	/* Address breakpoint is present at */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	unsigned int	bp_free:1;	/* This entry is available */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	unsigned int	bp_enabled:1;	/* Breakpoint is active in register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	unsigned int	bp_type:4;	/* Uses hardware register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	unsigned int	bp_installed:1;	/* Breakpoint is installed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	unsigned int	bp_delay:1;	/* Do delayed bp handling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	unsigned int	bp_delayed:1;	/* Delayed breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	unsigned int	bph_length;	/* HW break length */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) } kdb_bp_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) #ifdef CONFIG_KGDB_KDB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) extern kdb_bp_t kdb_breakpoints[/* KDB_MAXBPT */];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /* The KDB shell command table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) typedef struct _kdbtab {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 	char    *cmd_name;		/* Command name */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	kdb_func_t cmd_func;		/* Function to execute command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	char    *cmd_usage;		/* Usage String for this command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	char    *cmd_help;		/* Help message for this command */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	short    cmd_minlen;		/* Minimum legal # command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 					 * chars required */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	kdb_cmdflags_t cmd_flags;	/* Command behaviour flags */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) } kdbtab_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) extern int kdb_bt(int, const char **);	/* KDB display back trace */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) /* KDB breakpoint management functions */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) extern void kdb_initbptab(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) extern void kdb_bp_install(struct pt_regs *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) extern void kdb_bp_remove(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) typedef enum {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	KDB_DB_BPT,	/* Breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	KDB_DB_SS,	/* Single-step trap */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	KDB_DB_SSBPT,	/* Single step over breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	KDB_DB_NOBPT	/* Spurious breakpoint */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) } kdb_dbtrap_t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) extern int kdb_main_loop(kdb_reason_t, kdb_reason_t,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			 int, kdb_dbtrap_t, struct pt_regs *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) /* Miscellaneous functions and data areas */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) extern int kdb_grepping_flag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) #define KDB_GREPPING_FLAG_SEARCH 0x8000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) extern char kdb_grep_string[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) #define KDB_GREP_STRLEN 256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) extern int kdb_grep_leading;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) extern int kdb_grep_trailing;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) extern char *kdb_cmds[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) extern unsigned long kdb_task_state_string(const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) extern char kdb_task_state_char (const struct task_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) extern unsigned long kdb_task_state(const struct task_struct *p,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 				    unsigned long mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) extern void kdb_ps_suppressed(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) extern void kdb_ps1(const struct task_struct *p);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) extern void kdb_print_nameval(const char *name, unsigned long val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) extern void kdb_send_sig(struct task_struct *p, int sig);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) extern void kdb_meminfo_proc_show(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) extern char kdb_getchar(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) extern char *kdb_getstr(char *, size_t, const char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) extern void kdb_gdb_state_pass(char *buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* Defines for kdb_symbol_print */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) #define KDB_SP_SPACEB	0x0001		/* Space before string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) #define KDB_SP_SPACEA	0x0002		/* Space after string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) #define KDB_SP_PAREN	0x0004		/* Parenthesis around string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) #define KDB_SP_VALUE	0x0008		/* Print the value of the address */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) #define KDB_SP_SYMSIZE	0x0010		/* Print the size of the symbol */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) #define KDB_SP_NEWLINE	0x0020		/* Newline after string */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) #define KDB_SP_DEFAULT (KDB_SP_VALUE|KDB_SP_PAREN)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) #define KDB_TSK(cpu) kgdb_info[cpu].task
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) #define KDB_TSKREGS(cpu) kgdb_info[cpu].debuggerinfo
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) extern struct task_struct *kdb_curr_task(int);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) #define kdb_task_has_cpu(p) (task_curr(p))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) #define GFP_KDB (in_dbg_master() ? GFP_ATOMIC : GFP_KERNEL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) extern void *debug_kmalloc(size_t size, gfp_t flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) extern void debug_kfree(void *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) extern void debug_kusage(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) extern struct task_struct *kdb_current_task;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) extern struct pt_regs *kdb_current_regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) #ifdef CONFIG_KDB_KEYBOARD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) extern void kdb_kbd_cleanup_state(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #else /* ! CONFIG_KDB_KEYBOARD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) #define kdb_kbd_cleanup_state()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) #endif /* ! CONFIG_KDB_KEYBOARD */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #ifdef CONFIG_MODULES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) extern struct list_head *kdb_modules;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) #endif /* CONFIG_MODULES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) extern char kdb_prompt_str[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) #define	KDB_WORD_SIZE	((int)sizeof(unsigned long))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) #endif /* CONFIG_KGDB_KDB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) #endif	/* !_KDBPRIVATE_H */