aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/xmon/xmon.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r--arch/powerpc/xmon/xmon.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 1124f1146202..b43a57425ea9 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Routines providing a simple monitor for use on the PowerMac. 2 * Routines providing a simple monitor for use on the PowerMac.
3 * 3 *
4 * Copyright (C) 1996 Paul Mackerras. 4 * Copyright (C) 1996-2005 Paul Mackerras.
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
@@ -18,6 +18,7 @@
18#include <linux/kallsyms.h> 18#include <linux/kallsyms.h>
19#include <linux/cpumask.h> 19#include <linux/cpumask.h>
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/sysrq.h>
21 22
22#include <asm/ptrace.h> 23#include <asm/ptrace.h>
23#include <asm/string.h> 24#include <asm/string.h>
@@ -144,15 +145,10 @@ static void xmon_print_symbol(unsigned long address, const char *mid,
144static const char *getvecname(unsigned long vec); 145static const char *getvecname(unsigned long vec);
145 146
146extern int print_insn_powerpc(unsigned long, unsigned long, int); 147extern int print_insn_powerpc(unsigned long, unsigned long, int);
147extern void printf(const char *fmt, ...);
148extern void xmon_vfprintf(void *f, const char *fmt, va_list ap);
149extern int xmon_putc(int c, void *f);
150extern int putchar(int ch);
151 148
152extern void xmon_enter(void); 149extern void xmon_enter(void);
153extern void xmon_leave(void); 150extern void xmon_leave(void);
154 151
155extern int xmon_read_poll(void);
156extern long setjmp(long *); 152extern long setjmp(long *);
157extern void longjmp(long *, long); 153extern void longjmp(long *, long);
158extern void xmon_save_regs(struct pt_regs *); 154extern void xmon_save_regs(struct pt_regs *);
@@ -748,7 +744,6 @@ cmds(struct pt_regs *excp)
748 printf("%x:", smp_processor_id()); 744 printf("%x:", smp_processor_id());
749#endif /* CONFIG_SMP */ 745#endif /* CONFIG_SMP */
750 printf("mon> "); 746 printf("mon> ");
751 fflush(stdout);
752 flush_input(); 747 flush_input();
753 termch = 0; 748 termch = 0;
754 cmd = skipbl(); 749 cmd = skipbl();
@@ -2151,7 +2146,6 @@ memzcan(void)
2151 ok = mread(a, &v, 1); 2146 ok = mread(a, &v, 1);
2152 if (ok && !ook) { 2147 if (ok && !ook) {
2153 printf("%.8x .. ", a); 2148 printf("%.8x .. ", a);
2154 fflush(stdout);
2155 } else if (!ok && ook) 2149 } else if (!ok && ook)
2156 printf("%.8x\n", a - mskip); 2150 printf("%.8x\n", a - mskip);
2157 ook = ok; 2151 ook = ok;
@@ -2372,7 +2366,7 @@ int
2372inchar(void) 2366inchar(void)
2373{ 2367{
2374 if (lineptr == NULL || *lineptr == 0) { 2368 if (lineptr == NULL || *lineptr == 0) {
2375 if (fgets(line, sizeof(line), stdin) == NULL) { 2369 if (xmon_gets(line, sizeof(line)) == NULL) {
2376 lineptr = NULL; 2370 lineptr = NULL;
2377 return EOF; 2371 return EOF;
2378 } 2372 }
@@ -2526,4 +2520,29 @@ void xmon_init(int enable)
2526 __debugger_dabr_match = NULL; 2520 __debugger_dabr_match = NULL;
2527 __debugger_fault_handler = NULL; 2521 __debugger_fault_handler = NULL;
2528 } 2522 }
2523 xmon_map_scc();
2529} 2524}
2525
2526#ifdef CONFIG_MAGIC_SYSRQ
2527static void sysrq_handle_xmon(int key, struct pt_regs *pt_regs,
2528 struct tty_struct *tty)
2529{
2530 /* ensure xmon is enabled */
2531 xmon_init(1);
2532 debugger(pt_regs);
2533}
2534
2535static struct sysrq_key_op sysrq_xmon_op =
2536{
2537 .handler = sysrq_handle_xmon,
2538 .help_msg = "Xmon",
2539 .action_msg = "Entering xmon",
2540};
2541
2542static int __init setup_xmon_sysrq(void)
2543{
2544 register_sysrq_key('x', &sysrq_xmon_op);
2545 return 0;
2546}
2547__initcall(setup_xmon_sysrq);
2548#endif /* CONFIG_MAGIC_SYSRQ */