|
@@ -52,11 +52,12 @@ int show_unhandled_signals = 1;
|
|
|
* Dump out the contents of some memory nicely...
|
|
|
*/
|
|
|
static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
|
|
|
- unsigned long top)
|
|
|
+ unsigned long top, bool compat)
|
|
|
{
|
|
|
unsigned long first;
|
|
|
mm_segment_t fs;
|
|
|
int i;
|
|
|
+ unsigned int width = compat ? 4 : 8;
|
|
|
|
|
|
/*
|
|
|
* We need to switch to kernel mode so that we can use __get_user
|
|
@@ -75,13 +76,22 @@ static void dump_mem(const char *lvl, const char *str, unsigned long bottom,
|
|
|
memset(str, ' ', sizeof(str));
|
|
|
str[sizeof(str) - 1] = '\0';
|
|
|
|
|
|
- for (p = first, i = 0; i < 8 && p < top; i++, p += 4) {
|
|
|
+ for (p = first, i = 0; i < (32 / width)
|
|
|
+ && p < top; i++, p += width) {
|
|
|
if (p >= bottom && p < top) {
|
|
|
- unsigned int val;
|
|
|
- if (__get_user(val, (unsigned int *)p) == 0)
|
|
|
- sprintf(str + i * 9, " %08x", val);
|
|
|
- else
|
|
|
- sprintf(str + i * 9, " ????????");
|
|
|
+ unsigned long val;
|
|
|
+
|
|
|
+ if (width == 8) {
|
|
|
+ if (__get_user(val, (unsigned long *)p) == 0)
|
|
|
+ sprintf(str + i * 17, " %016lx", val);
|
|
|
+ else
|
|
|
+ sprintf(str + i * 17, " ????????????????");
|
|
|
+ } else {
|
|
|
+ if (__get_user(val, (unsigned int *)p) == 0)
|
|
|
+ sprintf(str + i * 9, " %08lx", val);
|
|
|
+ else
|
|
|
+ sprintf(str + i * 9, " ????????");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
printk("%s%04lx:%s\n", lvl, first & 0xffff, str);
|
|
@@ -95,7 +105,7 @@ static void dump_backtrace_entry(unsigned long where, unsigned long stack)
|
|
|
print_ip_sym(where);
|
|
|
if (in_exception_text(where))
|
|
|
dump_mem("", "Exception stack", stack,
|
|
|
- stack + sizeof(struct pt_regs));
|
|
|
+ stack + sizeof(struct pt_regs), false);
|
|
|
}
|
|
|
|
|
|
static void dump_instr(const char *lvl, struct pt_regs *regs)
|
|
@@ -207,7 +217,8 @@ static int __die(const char *str, int err, struct thread_info *thread,
|
|
|
|
|
|
if (!user_mode(regs) || in_interrupt()) {
|
|
|
dump_mem(KERN_EMERG, "Stack: ", regs->sp,
|
|
|
- THREAD_SIZE + (unsigned long)task_stack_page(tsk));
|
|
|
+ THREAD_SIZE + (unsigned long)task_stack_page(tsk),
|
|
|
+ compat_user_mode(regs));
|
|
|
dump_backtrace(regs, tsk);
|
|
|
dump_instr(KERN_EMERG, regs);
|
|
|
}
|