From: Dale Farnsworth <[EMAIL PROTECTED]>

    When implemented in inline assembly, kgdb_fault_setjmp() and
    kgdb_fault_longjmp() fail when compiled with -fno-omit-frame-pointer.
    This patch avoids that problem by moving them to a separate assembly
    file, arch/ppc/kernel/kgdb_misc.S.

    Signed-off-by: Dale Farnsworth <[EMAIL PROTECTED]>

Index: linux-2.6.10/arch/ppc/kernel/Makefile
===================================================================
--- linux-2.6.10.orig/arch/ppc/kernel/Makefile
+++ linux-2.6.10/arch/ppc/kernel/Makefile
@@ -22,7 +22,7 @@ obj-$(CONFIG_POWER4)          += cpu_setup_power
 obj-$(CONFIG_MODULES)          += module.o ppc_ksyms.o
 obj-$(CONFIG_NOT_COHERENT_CACHE)       += dma-mapping.o
 obj-$(CONFIG_PCI)              += pci.o
-obj-$(CONFIG_KGDB)             += kgdb.o
+obj-$(CONFIG_KGDB)             += kgdb.o kgdb_misc.o
 obj-$(CONFIG_SMP)              += smp.o smp-tbsync.o
 obj-$(CONFIG_TAU)              += temp.o
 obj-$(CONFIG_ALTIVEC)          += vecemu.o vector.o
Index: linux-2.6.10/arch/ppc/kernel/kgdb.c
===================================================================
--- linux-2.6.10.orig/arch/ppc/kernel/kgdb.c
+++ linux-2.6.10/arch/ppc/kernel/kgdb.c
@@ -268,26 +268,6 @@ void gdb_regs_to_regs(unsigned long *gdb
 }
 
 /*
- * Save/restore state in case a memory access causes a fault.
- */
-int kgdb_fault_setjmp(unsigned long *curr_context)
-{
-       __asm__ __volatile__ ("mflr 0; stw 0,0(%0);"
-                             "stw 1,4(%0); stw 2,8(%0);"
-                             "mfcr 0; stw 0,12(%0);"
-                             "stmw 13,16(%0)" : : "r" (curr_context));
-       return 0;
-}
-
-void kgdb_fault_longjmp(unsigned long *curr_context)
-{
-       __asm__ __volatile__ ("lmw 13,16(%0);"
-                             "lwz 0,12(%0); mtcrf 0x38,0;"
-                             "lwz 0,0(%0); lwz 1,4(%0); lwz 2,8(%0);"
-                             "mtlr 0; mr 3,1" : : "r" (curr_context));
-}
-
-/*
  * This function does PoerPC specific procesing for interfacing to gdb.
  */
 int kgdb_arch_handle_exception (int vector, int signo, int err_code,
Index: linux-2.6.10/arch/ppc/kernel/kgdb_misc.S
===================================================================
--- /dev/null
+++ linux-2.6.10/arch/ppc/kernel/kgdb_misc.S
@@ -0,0 +1,57 @@
+/*
+ * arch/ppc/kernel/kgdb_setjmp.S
+ *
+ *
+ * Maintainer: Tom Rini <[EMAIL PROTECTED]>
+ *
+ * 1998 (c) Michael AK Tesch ([EMAIL PROTECTED])
+ * Copyright (C) 2003 Timesys Corporation.
+ * 2006 (c) MontaVista Software, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program as licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/config.h>
+#include <asm/processor.h>
+#include <asm/ppc_asm.h>
+
+       .text
+
+/*
+ * kgdb_fault_setjmp() and kgdb_fault_longjmp() were moved from inline
+ * assembly in arch/ppc/kernel/kgdb.c so they won't be mangled by
+ * -no-omit-frame-pointer
+ */
+
+/*
+ * Save state in case a memory access causes a fault.
+ *
+ * int kgdb_fault_setjmp(unsigned long *curr_context);
+ */
+_GLOBAL(kgdb_fault_setjmp)
+       mflr    r0
+       stw     r0,0(r3)
+       stw     r1,4(r3)
+       stw     r2,8(r3)
+       mfcr    r0
+       stw     r0,12(r3)
+       stmw    r13,16(r3)
+       li      r3,0
+       blr
+
+/*
+ * Restore state in case a memory access causes a fault.
+ * void kgdb_fault_longjmp(unsigned long *curr_context);
+ */
+_GLOBAL(kgdb_fault_longjmp)
+       lmw     r13,16(r3)
+       lwz     r0,12(r3)
+       mtcrf   56,r0
+       lwz     r0,0(r3)
+       lwz     r1,4(r3)
+       lwz     r2,8(r3)
+       mtlr    r0
+       mr      r3,r1
+       blr

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

Reply via email to