[PATCH] 2.5.40: lkcd (6/9): sysrq changes for dump

From: Matt D. Robinson (yakker@aparity.com)
Date: Fri Oct 04 2002 - 18:03:44 EST


Sysrq changes so that dumps can be generated on the fly.

diff -urN -X /home/bharata/dontdiff linux-2.5.40/drivers/char/sysrq.c linux-2.5.40+lkcd/drivers/char/sysrq.c
--- linux-2.5.40/drivers/char/sysrq.c Tue Oct 1 12:37:35 2002
+++ linux-2.5.40+lkcd/drivers/char/sysrq.c Thu Oct 3 07:18:35 2002
@@ -32,6 +32,7 @@
 #include <linux/buffer_head.h> /* for fsync_bdev() */
 
 #include <linux/spinlock.h>
+#include <linux/dump.h>
 
 #include <asm/ptrace.h>
 
@@ -307,6 +308,34 @@
         }
 }
 
+static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs,
+ struct tty_struct *tty) {
+ dump("sysrq", pt_regs);
+}
+static struct sysrq_key_op sysrq_crashdump_op = {
+ handler: sysrq_handle_crashdump,
+ help_msg: "Crash",
+ action_msg: "Start a Crash Dump (If Configured)",
+};
+
+static void sysrq_handle_dumpregs(int key, struct pt_regs *pt_regs,
+ struct tty_struct *tty) {
+#if defined(CONFIG_X86) && defined(CONFIG_SMP)
+ extern void (*dump_trace_ptr)(struct pt_regs *);
+ printk("Show state of all cpus\n");
+ if (dump_trace_ptr) {
+ dump_trace_ptr(pt_regs);
+ } else {
+ printk("Load dump module/configure first\n");
+ }
+#endif
+}
+static struct sysrq_key_op sysrq_dumpregs_op = {
+ handler: sysrq_handle_dumpregs,
+ help_msg: "Dumpregisters",
+ action_msg: "Dump CPU Registers (If Configured)"
+};
+
 static void sysrq_handle_term(int key, struct pt_regs *pt_regs,
                               struct tty_struct *tty)
 {
@@ -352,8 +381,8 @@
                  it is handled specially on the spark
                  and will never arive */
 /* b */ &sysrq_reboot_op,
-/* c */ NULL,
-/* d */ NULL,
+/* c */ &sysrq_crashdump_op,
+/* d */ &sysrq_dumpregs_op,
 /* e */ &sysrq_term_op,
 /* f */ NULL,
 /* g */ NULL,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 07 2002 - 22:00:48 EST