diff options
Diffstat (limited to 'arch/powerpc/xmon/xmon.c')
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 8dfad7d9a004..e1f33a81e5e1 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -110,6 +110,7 @@ static int bsesc(void); | |||
110 | static void dump(void); | 110 | static void dump(void); |
111 | static void prdump(unsigned long, long); | 111 | static void prdump(unsigned long, long); |
112 | static int ppc_inst_dump(unsigned long, long, int); | 112 | static int ppc_inst_dump(unsigned long, long, int); |
113 | static void dump_log_buf(void); | ||
113 | static void backtrace(struct pt_regs *); | 114 | static void backtrace(struct pt_regs *); |
114 | static void excprint(struct pt_regs *); | 115 | static void excprint(struct pt_regs *); |
115 | static void prregs(struct pt_regs *); | 116 | static void prregs(struct pt_regs *); |
@@ -197,6 +198,7 @@ Commands:\n\ | |||
197 | di dump instructions\n\ | 198 | di dump instructions\n\ |
198 | df dump float values\n\ | 199 | df dump float values\n\ |
199 | dd dump double values\n\ | 200 | dd dump double values\n\ |
201 | dl dump the kernel log buffer\n\ | ||
200 | dr dump stream of raw bytes\n\ | 202 | dr dump stream of raw bytes\n\ |
201 | e print exception information\n\ | 203 | e print exception information\n\ |
202 | f flush cache\n\ | 204 | f flush cache\n\ |
@@ -2009,6 +2011,8 @@ dump(void) | |||
2009 | nidump = MAX_DUMP; | 2011 | nidump = MAX_DUMP; |
2010 | adrs += ppc_inst_dump(adrs, nidump, 1); | 2012 | adrs += ppc_inst_dump(adrs, nidump, 1); |
2011 | last_cmd = "di\n"; | 2013 | last_cmd = "di\n"; |
2014 | } else if (c == 'l') { | ||
2015 | dump_log_buf(); | ||
2012 | } else if (c == 'r') { | 2016 | } else if (c == 'r') { |
2013 | scanhex(&ndump); | 2017 | scanhex(&ndump); |
2014 | if (ndump == 0) | 2018 | if (ndump == 0) |
@@ -2122,6 +2126,49 @@ print_address(unsigned long addr) | |||
2122 | xmon_print_symbol(addr, "\t# ", ""); | 2126 | xmon_print_symbol(addr, "\t# ", ""); |
2123 | } | 2127 | } |
2124 | 2128 | ||
2129 | void | ||
2130 | dump_log_buf(void) | ||
2131 | { | ||
2132 | const unsigned long size = 128; | ||
2133 | unsigned long end, addr; | ||
2134 | unsigned char buf[size + 1]; | ||
2135 | |||
2136 | addr = 0; | ||
2137 | buf[size] = '\0'; | ||
2138 | |||
2139 | if (setjmp(bus_error_jmp) != 0) { | ||
2140 | printf("Unable to lookup symbol __log_buf!\n"); | ||
2141 | return; | ||
2142 | } | ||
2143 | |||
2144 | catch_memory_errors = 1; | ||
2145 | sync(); | ||
2146 | addr = kallsyms_lookup_name("__log_buf"); | ||
2147 | |||
2148 | if (! addr) | ||
2149 | printf("Symbol __log_buf not found!\n"); | ||
2150 | else { | ||
2151 | end = addr + (1 << CONFIG_LOG_BUF_SHIFT); | ||
2152 | while (addr < end) { | ||
2153 | if (! mread(addr, buf, size)) { | ||
2154 | printf("Can't read memory at address 0x%lx\n", addr); | ||
2155 | break; | ||
2156 | } | ||
2157 | |||
2158 | printf("%s", buf); | ||
2159 | |||
2160 | if (strlen(buf) < size) | ||
2161 | break; | ||
2162 | |||
2163 | addr += size; | ||
2164 | } | ||
2165 | } | ||
2166 | |||
2167 | sync(); | ||
2168 | /* wait a little while to see if we get a machine check */ | ||
2169 | __delay(200); | ||
2170 | catch_memory_errors = 0; | ||
2171 | } | ||
2125 | 2172 | ||
2126 | /* | 2173 | /* |
2127 | * Memory operations - move, set, print differences | 2174 | * Memory operations - move, set, print differences |