All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org, Arnd Bergmann <arnd.bergmann@de.ibm.com>
Subject: [RFC/PATCH 7/9] Make xmon disassembly optional
Date: Thu, 16 Nov 2006 18:23:26 +1100	[thread overview]
Message-ID: <20061116072328.651FC67BD3@ozlabs.org> (raw)
In-Reply-To: <1163661800.406227.631357998554.qpush@cradle>

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.

---

 arch/powerpc/Kconfig.debug  |    9 +++++++++
 arch/powerpc/xmon/Makefile  |    8 ++++++--
 arch/powerpc/xmon/dis-asm.h |   31 +++++++++++++++++++++++++++++++
 arch/powerpc/xmon/ppc-dis.c |    3 +--
 arch/powerpc/xmon/spu-dis.c |    3 +--
 arch/powerpc/xmon/xmon.c    |    5 +----
 6 files changed, 49 insertions(+), 10 deletions(-)

Index: cell/arch/powerpc/Kconfig.debug
===================================================================
--- cell.orig/arch/powerpc/Kconfig.debug
+++ cell/arch/powerpc/Kconfig.debug
@@ -98,6 +98,15 @@ config XMON_DEFAULT
 	  xmon is normally disabled unless booted with 'xmon=on'.
 	  Use 'xmon=off' to disable xmon init during runtime.
 
+config XMON_DISASSEMBLY
+	bool "Include disassembly support in xmon"
+	depends on XMON
+	default y
+	help
+	  Include support for disassembling in xmon. You probably want
+	  to say Y here, unless you're building for a memory-constrained
+	  system.
+
 config IRQSTACKS
 	bool "Use separate kernel stacks when processing interrupts"
 	depends on PPC64
Index: cell/arch/powerpc/xmon/Makefile
===================================================================
--- cell.orig/arch/powerpc/xmon/Makefile
+++ cell/arch/powerpc/xmon/Makefile
@@ -3,6 +3,10 @@
 ifdef CONFIG_PPC64
 EXTRA_CFLAGS += -mno-minimal-toc
 endif
-obj-y			+= xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \
-			   nonstdio.o
+
+obj-y			+= xmon.o setjmp.o start.o nonstdio.o
+
+ifdef CONFIG_XMON_DISASSEMBLY
+obj-y			+= ppc-dis.o ppc-opc.o
 obj-$(CONFIG_PPC_CELL)	+= spu-dis.o spu-opc.o
+endif
Index: cell/arch/powerpc/xmon/dis-asm.h
===================================================================
--- /dev/null
+++ cell/arch/powerpc/xmon/dis-asm.h
@@ -0,0 +1,31 @@
+#ifndef _POWERPC_XMON_DIS_ASM_H
+#define _POWERPC_XMON_DIS_ASM_H
+/*
+ * Copyright (C) 2006 Michael Ellerman, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+extern void print_address (unsigned long memaddr);
+
+#ifdef CONFIG_XMON_DISASSEMBLY
+extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
+extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
+#else
+static inline int print_insn_powerpc(unsigned long insn, unsigned long memaddr)
+{
+	printf("%.8x", insn);
+	return 0;
+}
+
+static inline int print_insn_spu(unsigned long insn, unsigned long memaddr)
+{
+	printf("%.8x", insn);
+	return 0;
+}
+#endif
+
+#endif /* _POWERPC_XMON_DIS_ASM_H */
Index: cell/arch/powerpc/xmon/ppc-dis.c
===================================================================
--- cell.orig/arch/powerpc/xmon/ppc-dis.c
+++ cell/arch/powerpc/xmon/ppc-dis.c
@@ -21,8 +21,7 @@ Software Foundation, 59 Temple Place - S
 #include "nonstdio.h"
 #include "ansidecl.h"
 #include "ppc.h"
-
-extern void print_address (unsigned long memaddr);
+#include "dis-asm.h"
 
 /* Print a PowerPC or POWER instruction.  */
 
Index: cell/arch/powerpc/xmon/spu-dis.c
===================================================================
--- cell.orig/arch/powerpc/xmon/spu-dis.c
+++ cell/arch/powerpc/xmon/spu-dis.c
@@ -22,8 +22,7 @@
 #include "nonstdio.h"
 #include "ansidecl.h"
 #include "spu.h"
-
-extern void print_address (unsigned long memaddr);
+#include "dis-asm.h"
 
 /* This file provides a disassembler function which uses
    the disassembler interface defined in dis-asm.h.   */
Index: cell/arch/powerpc/xmon/xmon.c
===================================================================
--- cell.orig/arch/powerpc/xmon/xmon.c
+++ cell/arch/powerpc/xmon/xmon.c
@@ -46,6 +46,7 @@
 #endif
 
 #include "nonstdio.h"
+#include "dis-asm.h"
 
 #define scanhex	xmon_scanhex
 #define skipbl	xmon_skipbl
@@ -109,7 +110,6 @@ static int bsesc(void);
 static void dump(void);
 static void prdump(unsigned long, long);
 static int ppc_inst_dump(unsigned long, long, int);
-void print_address(unsigned long);
 static void backtrace(struct pt_regs *);
 static void excprint(struct pt_regs *);
 static void prregs(struct pt_regs *);
@@ -153,9 +153,6 @@ static int do_spu_cmd(void);
 
 int xmon_no_auto_backtrace;
 
-extern int print_insn_powerpc(unsigned long insn, unsigned long memaddr);
-extern int print_insn_spu(unsigned long insn, unsigned long memaddr);
-
 extern void xmon_enter(void);
 extern void xmon_leave(void);
 

  parent reply	other threads:[~2006-11-16  7:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-16  7:23 [RFC/PATCH 0/9] More xmon cell patches Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 1/9] Fix sparse warning in xmon Cell code Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 3/9] Add a 'sd' command (spu dump) to xmon to dump spu local store Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 2/9] Show state of spus as they're stopped in Cell xmon helper Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 4/9] Prepare for spu disassembly in xmon Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 5/9] Import spu disassembly code into xmon Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 6/9] Add spu disassembly to xmon Michael Ellerman
2006-11-16  7:23 ` Michael Ellerman [this message]
2006-11-16  7:23 ` [RFC/PATCH 8/9] Make 64-bit cpu features defined on 32-bit Michael Ellerman
2006-11-16 10:17   ` Stephen Rothwell
2006-11-16 23:03     ` Michael Ellerman
2006-11-16  7:23 ` [RFC/PATCH 9/9] Import updated version of ppc disassembly code for xmon Michael Ellerman
2006-11-16 21:20 ` [RFC/PATCH 0/9] More xmon cell patches Arnd Bergmann
2006-11-20 22:06   ` Paul Mackerras
2006-11-21 10:24 ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061116072328.651FC67BD3@ozlabs.org \
    --to=michael@ellerman.id.au \
    --cc=arnd.bergmann@de.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.