diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-23 14:59:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-23 14:59:37 -0400 |
commit | 0f6e38a6381446eff5175b77d1094834a633a90f (patch) | |
tree | e5295c372b6a73fa84b4d14b86ea9fa626d3f030 /include | |
parent | e669e8179d364bb11ed51504e1a1c60830bff4c5 (diff) | |
parent | 3b216c9ed347924efb5e7a66b3257c40a5596d30 (diff) |
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb
* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
kgdb: kgdboc console poll hooks for mpsc uart
kgdb: kgdboc console poll hooks for cpm uart
kgdb, powerpc: arch specific powerpc kgdb support
kgdb: support for ARCH=arm
kgdb: remove unused HAVE_ARCH_KGDB_SHADOW_INFO config variable
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/kgdb.h | 104 | ||||
-rw-r--r-- | include/asm-arm/traps.h | 2 | ||||
-rw-r--r-- | include/asm-powerpc/kgdb.h | 92 |
3 files changed, 156 insertions, 42 deletions
diff --git a/include/asm-arm/kgdb.h b/include/asm-arm/kgdb.h new file mode 100644 index 000000000000..67af4b841984 --- /dev/null +++ b/include/asm-arm/kgdb.h | |||
@@ -0,0 +1,104 @@ | |||
1 | /* | ||
2 | * ARM KGDB support | ||
3 | * | ||
4 | * Author: Deepak Saxena <dsaxena@mvista.com> | ||
5 | * | ||
6 | * Copyright (C) 2002 MontaVista Software Inc. | ||
7 | * | ||
8 | */ | ||
9 | |||
10 | #ifndef __ARM_KGDB_H__ | ||
11 | #define __ARM_KGDB_H__ | ||
12 | |||
13 | #include <linux/ptrace.h> | ||
14 | |||
15 | /* | ||
16 | * GDB assumes that we're a user process being debugged, so | ||
17 | * it will send us an SWI command to write into memory as the | ||
18 | * debug trap. When an SWI occurs, the next instruction addr is | ||
19 | * placed into R14_svc before jumping to the vector trap. | ||
20 | * This doesn't work for kernel debugging as we are already in SVC | ||
21 | * we would loose the kernel's LR, which is a bad thing. This | ||
22 | * is bad thing. | ||
23 | * | ||
24 | * By doing this as an undefined instruction trap, we force a mode | ||
25 | * switch from SVC to UND mode, allowing us to save full kernel state. | ||
26 | * | ||
27 | * We also define a KGDB_COMPILED_BREAK which can be used to compile | ||
28 | * in breakpoints. This is important for things like sysrq-G and for | ||
29 | * the initial breakpoint from trap_init(). | ||
30 | * | ||
31 | * Note to ARM HW designers: Add real trap support like SH && PPC to | ||
32 | * make our lives much much simpler. :) | ||
33 | */ | ||
34 | #define BREAK_INSTR_SIZE 4 | ||
35 | #define GDB_BREAKINST 0xef9f0001 | ||
36 | #define KGDB_BREAKINST 0xe7ffdefe | ||
37 | #define KGDB_COMPILED_BREAK 0xe7ffdeff | ||
38 | #define CACHE_FLUSH_IS_SAFE 1 | ||
39 | |||
40 | #ifndef __ASSEMBLY__ | ||
41 | |||
42 | static inline void arch_kgdb_breakpoint(void) | ||
43 | { | ||
44 | asm(".word 0xe7ffdeff"); | ||
45 | } | ||
46 | |||
47 | extern void kgdb_handle_bus_error(void); | ||
48 | extern int kgdb_fault_expected; | ||
49 | |||
50 | #endif /* !__ASSEMBLY__ */ | ||
51 | |||
52 | /* | ||
53 | * From Kevin Hilman: | ||
54 | * | ||
55 | * gdb is expecting the following registers layout. | ||
56 | * | ||
57 | * r0-r15: 1 long word each | ||
58 | * f0-f7: unused, 3 long words each !! | ||
59 | * fps: unused, 1 long word | ||
60 | * cpsr: 1 long word | ||
61 | * | ||
62 | * Even though f0-f7 and fps are not used, they need to be | ||
63 | * present in the registers sent for correct processing in | ||
64 | * the host-side gdb. | ||
65 | * | ||
66 | * In particular, it is crucial that CPSR is in the right place, | ||
67 | * otherwise gdb will not be able to correctly interpret stepping over | ||
68 | * conditional branches. | ||
69 | */ | ||
70 | #define _GP_REGS 16 | ||
71 | #define _FP_REGS 8 | ||
72 | #define _EXTRA_REGS 2 | ||
73 | #define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) | ||
74 | |||
75 | #define KGDB_MAX_NO_CPUS 1 | ||
76 | #define BUFMAX 400 | ||
77 | #define NUMREGBYTES (GDB_MAX_REGS << 2) | ||
78 | #define NUMCRITREGBYTES (32 << 2) | ||
79 | |||
80 | #define _R0 0 | ||
81 | #define _R1 1 | ||
82 | #define _R2 2 | ||
83 | #define _R3 3 | ||
84 | #define _R4 4 | ||
85 | #define _R5 5 | ||
86 | #define _R6 6 | ||
87 | #define _R7 7 | ||
88 | #define _R8 8 | ||
89 | #define _R9 9 | ||
90 | #define _R10 10 | ||
91 | #define _FP 11 | ||
92 | #define _IP 12 | ||
93 | #define _SPT 13 | ||
94 | #define _LR 14 | ||
95 | #define _PC 15 | ||
96 | #define _CPSR (GDB_MAX_REGS - 1) | ||
97 | |||
98 | /* | ||
99 | * So that we can denote the end of a frame for tracing, | ||
100 | * in the simple case: | ||
101 | */ | ||
102 | #define CFI_END_FRAME(func) __CFI_END_FRAME(_PC, _SPT, func) | ||
103 | |||
104 | #endif /* __ASM_KGDB_H__ */ | ||
diff --git a/include/asm-arm/traps.h b/include/asm-arm/traps.h index f1541afcf85c..aa399aec568e 100644 --- a/include/asm-arm/traps.h +++ b/include/asm-arm/traps.h | |||
@@ -24,4 +24,6 @@ static inline int in_exception_text(unsigned long ptr) | |||
24 | ptr < (unsigned long)&__exception_text_end; | 24 | ptr < (unsigned long)&__exception_text_end; |
25 | } | 25 | } |
26 | 26 | ||
27 | extern void __init early_trap_init(void); | ||
28 | |||
27 | #endif | 29 | #endif |
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__ */ |