xref: /OK3568_Linux_fs/kernel/arch/powerpc/include/asm/kgdb.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * The PowerPC (32/64) specific defines / externs for KGDB.  Based on
3*4882a593Smuzhiyun  * the previous 32bit and 64bit specific files, which had the following
4*4882a593Smuzhiyun  * copyrights:
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * PPC64 Mods (C) 2005 Frank Rowand (frowand@mvista.com)
7*4882a593Smuzhiyun  * PPC Mods (C) 2004 Tom Rini (trini@mvista.com)
8*4882a593Smuzhiyun  * PPC Mods (C) 2003 John Whitney (john.whitney@timesys.com)
9*4882a593Smuzhiyun  * PPC Mods (C) 1998 Michael Tesch (tesch@cs.wisc.edu)
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
13*4882a593Smuzhiyun  * Author: Tom Rini <trini@kernel.crashing.org>
14*4882a593Smuzhiyun  *
15*4882a593Smuzhiyun  * 2006 (c) MontaVista Software, Inc. This file is licensed under
16*4882a593Smuzhiyun  * the terms of the GNU General Public License version 2. This program
17*4882a593Smuzhiyun  * is licensed "as is" without any warranty of any kind, whether express
18*4882a593Smuzhiyun  * or implied.
19*4882a593Smuzhiyun  */
20*4882a593Smuzhiyun #ifdef __KERNEL__
21*4882a593Smuzhiyun #ifndef __POWERPC_KGDB_H__
22*4882a593Smuzhiyun #define __POWERPC_KGDB_H__
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun #ifndef __ASSEMBLY__
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun #define BREAK_INSTR_SIZE	4
27*4882a593Smuzhiyun #define BUFMAX			((NUMREGBYTES * 2) + 512)
28*4882a593Smuzhiyun #define OUTBUFMAX		((NUMREGBYTES * 2) + 512)
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun #define BREAK_INSTR		0x7d821008	/* twge r2, r2 */
31*4882a593Smuzhiyun 
arch_kgdb_breakpoint(void)32*4882a593Smuzhiyun static inline void arch_kgdb_breakpoint(void)
33*4882a593Smuzhiyun {
34*4882a593Smuzhiyun 	asm(stringify_in_c(.long BREAK_INSTR));
35*4882a593Smuzhiyun }
36*4882a593Smuzhiyun #define CACHE_FLUSH_IS_SAFE	1
37*4882a593Smuzhiyun #define DBG_MAX_REG_NUM     70
38*4882a593Smuzhiyun 
39*4882a593Smuzhiyun /* The number bytes of registers we have to save depends on a few
40*4882a593Smuzhiyun  * things.  For 64bit we default to not including vector registers and
41*4882a593Smuzhiyun  * vector state registers. */
42*4882a593Smuzhiyun #ifdef CONFIG_PPC64
43*4882a593Smuzhiyun /*
44*4882a593Smuzhiyun  * 64 bit (8 byte) registers:
45*4882a593Smuzhiyun  *   32 gpr, 32 fpr, nip, msr, link, ctr
46*4882a593Smuzhiyun  * 32 bit (4 byte) registers:
47*4882a593Smuzhiyun  *   ccr, xer, fpscr
48*4882a593Smuzhiyun  */
49*4882a593Smuzhiyun #define NUMREGBYTES		((68 * 8) + (3 * 4))
50*4882a593Smuzhiyun #define NUMCRITREGBYTES		184
51*4882a593Smuzhiyun #else /* CONFIG_PPC32 */
52*4882a593Smuzhiyun /* On non-E500 family PPC32 we determine the size by picking the last
53*4882a593Smuzhiyun  * register we need, but on E500 we skip sections so we list what we
54*4882a593Smuzhiyun  * need to store, and add it up. */
55*4882a593Smuzhiyun #ifndef CONFIG_E500
56*4882a593Smuzhiyun #define MAXREG			(PT_FPSCR+1)
57*4882a593Smuzhiyun #else
58*4882a593Smuzhiyun /* 32 GPRs (8 bytes), nip, msr, ccr, link, ctr, xer, acc (8 bytes), spefscr*/
59*4882a593Smuzhiyun #define MAXREG                 ((32*2)+6+2+1)
60*4882a593Smuzhiyun #endif
61*4882a593Smuzhiyun #define NUMREGBYTES		(MAXREG * sizeof(int))
62*4882a593Smuzhiyun /* CR/LR, R1, R2, R13-R31 inclusive. */
63*4882a593Smuzhiyun #define NUMCRITREGBYTES		(23 * sizeof(int))
64*4882a593Smuzhiyun #endif /* 32/64 */
65*4882a593Smuzhiyun #endif /* !(__ASSEMBLY__) */
66*4882a593Smuzhiyun #endif /* !__POWERPC_KGDB_H__ */
67*4882a593Smuzhiyun #endif /* __KERNEL__ */
68