Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Michael Ellerman and committed by
Paul Mackerras
e0426047 af89fb80

+49 -10
+9
arch/powerpc/Kconfig.debug
··· 98 98 xmon is normally disabled unless booted with 'xmon=on'. 99 99 Use 'xmon=off' to disable xmon init during runtime. 100 100 101 + config 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 + 101 110 config IRQSTACKS 102 111 bool "Use separate kernel stacks when processing interrupts" 103 112 depends on PPC64
+6 -2
arch/powerpc/xmon/Makefile
··· 3 3 ifdef CONFIG_PPC64 4 4 EXTRA_CFLAGS += -mno-minimal-toc 5 5 endif 6 - obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \ 7 - nonstdio.o 6 + 7 + obj-y += xmon.o setjmp.o start.o nonstdio.o 8 + 9 + ifdef CONFIG_XMON_DISASSEMBLY 10 + obj-y += ppc-dis.o ppc-opc.o 8 11 obj-$(CONFIG_PPC_CELL) += spu-dis.o spu-opc.o 12 + endif
+31
arch/powerpc/xmon/dis-asm.h
··· 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 + 12 + extern void print_address (unsigned long memaddr); 13 + 14 + #ifdef CONFIG_XMON_DISASSEMBLY 15 + extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); 16 + extern int print_insn_spu(unsigned long insn, unsigned long memaddr); 17 + #else 18 + static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr) 19 + { 20 + printf("%.8x", insn); 21 + return 0; 22 + } 23 + 24 + static 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 */
+1 -2
arch/powerpc/xmon/ppc-dis.c
··· 21 21 #include "nonstdio.h" 22 22 #include "ansidecl.h" 23 23 #include "ppc.h" 24 - 25 - extern void print_address (unsigned long memaddr); 24 + #include "dis-asm.h" 26 25 27 26 /* Print a PowerPC or POWER instruction. */ 28 27
+1 -2
arch/powerpc/xmon/spu-dis.c
··· 22 22 #include "nonstdio.h" 23 23 #include "ansidecl.h" 24 24 #include "spu.h" 25 - 26 - extern void print_address (unsigned long memaddr); 25 + #include "dis-asm.h" 27 26 28 27 /* This file provides a disassembler function which uses 29 28 the disassembler interface defined in dis-asm.h. */
+1 -4
arch/powerpc/xmon/xmon.c
··· 47 47 #endif 48 48 49 49 #include "nonstdio.h" 50 + #include "dis-asm.h" 50 51 51 52 #define scanhex xmon_scanhex 52 53 #define skipbl xmon_skipbl ··· 111 110 static void dump(void); 112 111 static void prdump(unsigned long, long); 113 112 static int ppc_inst_dump(unsigned long, long, int); 114 - void print_address(unsigned long); 115 113 static void backtrace(struct pt_regs *); 116 114 static void excprint(struct pt_regs *); 117 115 static void prregs(struct pt_regs *); ··· 153 153 static int do_spu_cmd(void); 154 154 155 155 int xmon_no_auto_backtrace; 156 - 157 - extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr); 158 - extern int print_insn_spu(unsigned long insn, unsigned long memaddr); 159 156 160 157 extern void xmon_enter(void); 161 158 extern void xmon_leave(void);