diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2008-07-23 12:30:15 -0400 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2008-07-23 12:30:15 -0400 |
commit | 17ce452f7ea3df760b7f9f42453b6f6acd765217 (patch) | |
tree | a53c70b553363ce404ff49cb49ccc532cf4c7e78 /include/asm-powerpc | |
parent | 5cbad0ebf45c5417104b383dc0e34f64fa7f2473 (diff) |
kgdb, powerpc: arch specific powerpc kgdb support
This patch removes the old kgdb reminants from ARCH=powerpc and
implements the new style arch specific stub for the common kgdb core
interface.
It is possible to have xmon and kgdb in the same kernel, but you
cannot use both at the same time because there is only one set of
debug hooks.
The arch specific kgdb implementation saves the previous state of the
debug hooks and restores them if you unconfigure the kgdb I/O driver.
Kgdb should have no impact on a kernel that has no kgdb I/O driver
configured.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'include/asm-powerpc')
-rw-r--r-- | include/asm-powerpc/kgdb.h | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/include/asm-powerpc/kgdb.h b/include/asm-powerpc/kgdb.h index b617dac82969..1399caf719ae 100644 --- a/include/asm-powerpc/kgdb.h +++ b/include/asm-powerpc/kgdb.h | |||
@@ -1,57 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | * kgdb.h: Defines and declarations for serial line source level | 2 | * include/asm-powerpc/kgdb.h |
3 | * remote debugging of the Linux kernel using gdb. | ||
4 | * | 3 | * |
4 | * The PowerPC (32/64) specific defines / externs for KGDB. Based on | ||
5 | * the previous 32bit and 64bit specific files, which had the following | ||
6 | * copyrights: | ||
7 | * | ||
8 | * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com) | ||
9 | * PPC Mods (C) 2004 Tom Rini (trini@mvista.com) | ||
10 | * PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com) | ||
5 | * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu) | 11 | * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu) |
6 | * | 12 | * |
13 | * | ||
7 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | 14 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) |
15 | * Author: Tom Rini <trini@kernel.crashing.org> | ||
16 | * | ||
17 | * 2006 (c) MontaVista Software, Inc. This file is licensed under | ||
18 | * the terms of the GNU General Public License version 2. This program | ||
19 | * is licensed "as is" without any warranty of any kind, whether express | ||
20 | * or implied. | ||
8 | */ | 21 | */ |
9 | #ifdef __KERNEL__ | 22 | #ifdef __KERNEL__ |
10 | #ifndef _PPC_KGDB_H | 23 | #ifndef __POWERPC_KGDB_H__ |
11 | #define _PPC_KGDB_H | 24 | #define __POWERPC_KGDB_H__ |
12 | 25 | ||
13 | #ifndef __ASSEMBLY__ | 26 | #ifndef __ASSEMBLY__ |
14 | 27 | ||
15 | /* Things specific to the gen550 backend. */ | 28 | #define BREAK_INSTR_SIZE 4 |
16 | struct uart_port; | 29 | #define BUFMAX ((NUMREGBYTES * 2) + 512) |
17 | 30 | #define OUTBUFMAX ((NUMREGBYTES * 2) + 512) | |
18 | extern void gen550_progress(char *, unsigned short); | 31 | static inline void arch_kgdb_breakpoint(void) |
19 | extern void gen550_kgdb_map_scc(void); | 32 | { |
20 | extern void gen550_init(int, struct uart_port *); | 33 | asm(".long 0x7d821008"); /* twge r2, r2 */ |
21 | 34 | } | |
22 | /* Things specific to the pmac backend. */ | 35 | #define CACHE_FLUSH_IS_SAFE 1 |
23 | extern void zs_kgdb_hook(int tty_num); | ||
24 | |||
25 | /* To init the kgdb engine. (called by serial hook)*/ | ||
26 | extern void set_debug_traps(void); | ||
27 | |||
28 | /* To enter the debugger explicitly. */ | ||
29 | extern void breakpoint(void); | ||
30 | |||
31 | /* For taking exceptions | ||
32 | * these are defined in traps.c | ||
33 | */ | ||
34 | extern int (*debugger)(struct pt_regs *regs); | ||
35 | extern int (*debugger_bpt)(struct pt_regs *regs); | ||
36 | extern int (*debugger_sstep)(struct pt_regs *regs); | ||
37 | extern int (*debugger_iabr_match)(struct pt_regs *regs); | ||
38 | extern int (*debugger_dabr_match)(struct pt_regs *regs); | ||
39 | extern void (*debugger_fault_handler)(struct pt_regs *regs); | ||
40 | |||
41 | /* What we bring to the party */ | ||
42 | int kgdb_bpt(struct pt_regs *regs); | ||
43 | int kgdb_sstep(struct pt_regs *regs); | ||
44 | void kgdb(struct pt_regs *regs); | ||
45 | int kgdb_iabr_match(struct pt_regs *regs); | ||
46 | int kgdb_dabr_match(struct pt_regs *regs); | ||
47 | 36 | ||
37 | /* The number bytes of registers we have to save depends on a few | ||
38 | * things. For 64bit we default to not including vector registers and | ||
39 | * vector state registers. */ | ||
40 | #ifdef CONFIG_PPC64 | ||
48 | /* | 41 | /* |
49 | * external low-level support routines (ie macserial.c) | 42 | * 64 bit (8 byte) registers: |
43 | * 32 gpr, 32 fpr, nip, msr, link, ctr | ||
44 | * 32 bit (4 byte) registers: | ||
45 | * ccr, xer, fpscr | ||
50 | */ | 46 | */ |
51 | extern void kgdb_interruptible(int); /* control interrupts from serial */ | 47 | #define NUMREGBYTES ((68 * 8) + (3 * 4)) |
52 | extern void putDebugChar(char); /* write a single character */ | 48 | #define NUMCRITREGBYTES 184 |
53 | extern char getDebugChar(void); /* read and return a single char */ | 49 | #else /* CONFIG_PPC32 */ |
54 | 50 | /* On non-E500 family PPC32 we determine the size by picking the last | |
51 | * register we need, but on E500 we skip sections so we list what we | ||
52 | * need to store, and add it up. */ | ||
53 | #ifndef CONFIG_E500 | ||
54 | #define MAXREG (PT_FPSCR+1) | ||
55 | #else | ||
56 | /* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/ | ||
57 | #define MAXREG ((32*2)+6+2+1) | ||
58 | #endif | ||
59 | #define NUMREGBYTES (MAXREG * sizeof(int)) | ||
60 | /* CR/LR, R1, R2, R13-R31 inclusive. */ | ||
61 | #define NUMCRITREGBYTES (23 * sizeof(int)) | ||
62 | #endif /* 32/64 */ | ||
55 | #endif /* !(__ASSEMBLY__) */ | 63 | #endif /* !(__ASSEMBLY__) */ |
56 | #endif /* !(_PPC_KGDB_H) */ | 64 | #endif /* !__POWERPC_KGDB_H__ */ |
57 | #endif /* __KERNEL__ */ | 65 | #endif /* __KERNEL__ */ |