aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2006-11-22 18:46:45 -0500
committerPaul Mackerras <paulus@samba.org>2006-12-04 04:40:32 -0500
commite0426047cb684842700f0098f74842a38260dbae (patch)
treeeec4033ad96e019dbb4e00863c3e03ca6c3ae090 /arch/powerpc
parentaf89fb8041562508895c8f3ba04790d7c2f4338c (diff)
[POWERPC] Make xmon disassembly optional
While adding spu disassembly support it struck me that we're actually carrying quite a lot of code around, just to do disassembly in the case of a crash. While on large systems it's not an issue, on smaller ones it might be nice to have xmon - but without the weight of the disassembly support. For a Cell build this saves ~230KB (!), and for pSeries ~195KB. We still support the 'di' and 'sdi' commands, however they just dump the instruction in hex. Move the definitions into a header to clean xmon.c just a tiny bit. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/Kconfig.debug9
-rw-r--r--arch/powerpc/xmon/Makefile8
-rw-r--r--arch/powerpc/xmon/dis-asm.h31
-rw-r--r--arch/powerpc/xmon/ppc-dis.c3
-rw-r--r--arch/powerpc/xmon/spu-dis.c3
-rw-r--r--arch/powerpc/xmon/xmon.c5
6 files changed, 49 insertions, 10 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 5ad149b47e34..ff16063d67ff 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -98,6 +98,15 @@ config XMON_DEFAULT
98 xmon is normally disabled unless booted with 'xmon=on'. 98 xmon is normally disabled unless booted with 'xmon=on'.
99 Use 'xmon=off' to disable xmon init during runtime. 99 Use 'xmon=off' to disable xmon init during runtime.
100 100
101config XMON_DISASSEMBLY
102 bool "Include disassembly support in xmon"
103 depends on XMON
104 default y
105 help
106 Include support for disassembling in xmon. You probably want
107 to say Y here, unless you're building for a memory-constrained
108 system.
109
101config IRQSTACKS 110config IRQSTACKS
102 bool "Use separate kernel stacks when processing interrupts" 111 bool "Use separate kernel stacks when processing interrupts"
103 depends on PPC64 112 depends on PPC64
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index 4f274056e770..69303575d3d6 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -3,6 +3,10 @@
3ifdef CONFIG_PPC64 3ifdef CONFIG_PPC64
4EXTRA_CFLAGS += -mno-minimal-toc 4EXTRA_CFLAGS += -mno-minimal-toc
5endif 5endif
6obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \ 6
7 nonstdio.o 7obj-y += xmon.o setjmp.o start.o nonstdio.o
8
9ifdef CONFIG_XMON_DISASSEMBLY
10obj-y += ppc-dis.o ppc-opc.o
8obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o 11obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o
12endif
diff --git a/arch/powerpc/xmon/dis-asm.h b/arch/powerpc/xmon/dis-asm.h
new file mode 100644
index 000000000000..be3533b93f30
--- /dev/null
+++ b/arch/powerpc/xmon/dis-asm.h
@@ -0,0 +1,31 @@
1#ifndef _POWERPC_XMON_DIS_ASM_H
2#define _POWERPC_XMON_DIS_ASM_H
3/*
4 * Copyright (C) 2006 Michael Ellerman, IBM Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12extern void print_address (unsigned long memaddr);
13
14#ifdef CONFIG_XMON_DISASSEMBLY
15extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
16extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
17#else
18static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr)
19{
20 printf("%.8x", insn);
21 return 0;
22}
23
24static inline int print_insn_spu(unsigned long insn, unsigned long memaddr)
25{
26 printf("%.8x", insn);
27 return 0;
28}
29#endif
30
31#endif /* _POWERPC_XMON_DIS_ASM_H */
diff --git a/arch/powerpc/xmon/ppc-dis.c b/arch/powerpc/xmon/ppc-dis.c
index 3b67bee4830b..08652742fa77 100644
--- a/arch/powerpc/xmon/ppc-dis.c
+++ b/arch/powerpc/xmon/ppc-dis.c
@@ -21,8 +21,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21#include "nonstdio.h" 21#include "nonstdio.h"
22#include "ansidecl.h" 22#include "ansidecl.h"
23#include "ppc.h" 23#include "ppc.h"
24 24#include "dis-asm.h"
25extern void print_address (unsigned long memaddr);
26 25
27/* Print a PowerPC or POWER instruction. */ 26/* Print a PowerPC or POWER instruction. */
28 27
diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index 75ac0815f1a4..ee929c641bf3 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -22,8 +22,7 @@
22#include "nonstdio.h" 22#include "nonstdio.h"
23#include "ansidecl.h" 23#include "ansidecl.h"
24#include "spu.h" 24#include "spu.h"
25 25#include "dis-asm.h"
26extern void print_address (unsigned long memaddr);
27 26
28/* This file provides a disassembler function which uses 27/* This file provides a disassembler function which uses
29 the disassembler interface defined in dis-asm.h. */ 28 the disassembler interface defined in dis-asm.h. */
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 7a0eec23cb9c..c999638cc2de 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -47,6 +47,7 @@
47#endif 47#endif
48 48
49#include "nonstdio.h" 49#include "nonstdio.h"
50#include "dis-asm.h"
50 51
51#define scanhex xmon_scanhex 52#define scanhex xmon_scanhex
52#define skipbl xmon_skipbl 53#define skipbl xmon_skipbl
@@ -110,7 +111,6 @@ static int bsesc(void);
110static void dump(void); 111static void dump(void);
111static void prdump(unsigned long, long); 112static void prdump(unsigned long, long);
112static int ppc_inst_dump(unsigned long, long, int); 113static int ppc_inst_dump(unsigned long, long, int);
113void print_address(unsigned long);
114static void backtrace(struct pt_regs *); 114static void backtrace(struct pt_regs *);
115static void excprint(struct pt_regs *); 115static void excprint(struct pt_regs *);
116static void prregs(struct pt_regs *); 116static void prregs(struct pt_regs *);
@@ -154,9 +154,6 @@ static int do_spu_cmd(void);
154 154
155int xmon_no_auto_backtrace; 155int xmon_no_auto_backtrace;
156 156
157extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
158extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
159
160extern void xmon_enter(void); 157extern void xmon_enter(void);
161extern void xmon_leave(void); 158extern void xmon_leave(void);
162 159