diff options
| -rw-r--r-- | arch/powerpc/xmon/xmon.c | 36 |
1 files changed, 10 insertions, 26 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index eab3492a45c5..013f28668781 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <linux/reboot.h> | 17 | #include <linux/reboot.h> |
| 18 | #include <linux/delay.h> | 18 | #include <linux/delay.h> |
| 19 | #include <linux/kallsyms.h> | 19 | #include <linux/kallsyms.h> |
| 20 | #include <linux/kmsg_dump.h> | ||
| 20 | #include <linux/cpumask.h> | 21 | #include <linux/cpumask.h> |
| 21 | #include <linux/export.h> | 22 | #include <linux/export.h> |
| 22 | #include <linux/sysrq.h> | 23 | #include <linux/sysrq.h> |
| @@ -2148,40 +2149,23 @@ print_address(unsigned long addr) | |||
| 2148 | void | 2149 | void |
| 2149 | dump_log_buf(void) | 2150 | dump_log_buf(void) |
| 2150 | { | 2151 | { |
| 2151 | const unsigned long size = 128; | 2152 | struct kmsg_dumper dumper = { .active = 1 }; |
| 2152 | unsigned long end, addr; | 2153 | unsigned char buf[128]; |
| 2153 | unsigned char buf[size + 1]; | 2154 | size_t len; |
| 2154 | |||
| 2155 | addr = 0; | ||
| 2156 | buf[size] = '\0'; | ||
| 2157 | 2155 | ||
| 2158 | if (setjmp(bus_error_jmp) != 0) { | 2156 | if (setjmp(bus_error_jmp) != 0) { |
| 2159 | printf("Unable to lookup symbol __log_buf!\n"); | 2157 | printf("Error dumping printk buffer!\n"); |
| 2160 | return; | 2158 | return; |
| 2161 | } | 2159 | } |
| 2162 | 2160 | ||
| 2163 | catch_memory_errors = 1; | 2161 | catch_memory_errors = 1; |
| 2164 | sync(); | 2162 | sync(); |
| 2165 | addr = kallsyms_lookup_name("__log_buf"); | ||
| 2166 | |||
| 2167 | if (! addr) | ||
| 2168 | printf("Symbol __log_buf not found!\n"); | ||
| 2169 | else { | ||
| 2170 | end = addr + (1 << CONFIG_LOG_BUF_SHIFT); | ||
| 2171 | while (addr < end) { | ||
| 2172 | if (! mread(addr, buf, size)) { | ||
| 2173 | printf("Can't read memory at address 0x%lx\n", addr); | ||
| 2174 | break; | ||
| 2175 | } | ||
| 2176 | |||
| 2177 | printf("%s", buf); | ||
| 2178 | 2163 | ||
| 2179 | if (strlen(buf) < size) | 2164 | kmsg_dump_rewind_nolock(&dumper); |
| 2180 | break; | 2165 | while (kmsg_dump_get_line_nolock(&dumper, false, buf, sizeof(buf), &len)) { |
| 2181 | 2166 | buf[len] = '\0'; | |
| 2182 | addr += size; | 2167 | printf("%s", buf); |
| 2183 | } | 2168 | } |
| 2184 | } | ||
| 2185 | 2169 | ||
| 2186 | sync(); | 2170 | sync(); |
| 2187 | /* wait a little while to see if we get a machine check */ | 2171 | /* wait a little while to see if we get a machine check */ |
