diff options
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 37 |
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, | |||
144 | static const char *getvecname(unsigned long vec); | 145 | static const char *getvecname(unsigned long vec); |
145 | 146 | ||
146 | extern int print_insn_powerpc(unsigned long, unsigned long, int); | 147 | extern int print_insn_powerpc(unsigned long, unsigned long, int); |
147 | extern void printf(const char *fmt, ...); | ||
148 | extern void xmon_vfprintf(void *f, const char *fmt, va_list ap); | ||
149 | extern int xmon_putc(int c, void *f); | ||
150 | extern int putchar(int ch); | ||
151 | 148 | ||
152 | extern void xmon_enter(void); | 149 | extern void xmon_enter(void); |
153 | extern void xmon_leave(void); | 150 | extern void xmon_leave(void); |
154 | 151 | ||
155 | extern int xmon_read_poll(void); | ||
156 | extern long setjmp(long *); | 152 | extern long setjmp(long *); |
157 | extern void longjmp(long *, long); | 153 | extern void longjmp(long *, long); |
158 | extern void xmon_save_regs(struct pt_regs *); | 154 | extern 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 | |||
2372 | inchar(void) | 2366 | inchar(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 | ||
2527 | static 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 | |||
2535 | static struct sysrq_key_op sysrq_xmon_op = | ||
2536 | { | ||
2537 | .handler = sysrq_handle_xmon, | ||
2538 | .help_msg = "Xmon", | ||
2539 | .action_msg = "Entering xmon", | ||
2540 | }; | ||
2541 | |||
2542 | static 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 */ | ||