Commit 3d503753b40469b6a19dcc3511f6eb8c55f6d122

Authored by Daniel Jacobowitz
Committed by Ralf Baechle
1 parent e9feeb207e

[MIPS] Support /proc/kcore for MIPS

I'm pretty sure that the CKSEG0 bits are wrong, but I did need to
cover that region - because the SB-1 kernel links at 0xffffffff80100000
or so, disassembly and printing static variables don't work unless the
debugger can read that region.

Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

Showing 1 changed file with 16 additions and 0 deletions Side-by-side Diff

... ... @@ -24,6 +24,7 @@
24 24 #include <linux/bootmem.h>
25 25 #include <linux/highmem.h>
26 26 #include <linux/swap.h>
  27 +#include <linux/proc_fs.h>
27 28  
28 29 #include <asm/bootinfo.h>
29 30 #include <asm/cachectl.h>
... ... @@ -200,6 +201,11 @@
200 201 return 0;
201 202 }
202 203  
  204 +static struct kcore_list kcore_mem, kcore_vmalloc;
  205 +#ifdef CONFIG_64BIT
  206 +static struct kcore_list kcore_kseg0;
  207 +#endif
  208 +
203 209 void __init mem_init(void)
204 210 {
205 211 unsigned long codesize, reservedpages, datasize, initsize;
... ... @@ -248,6 +254,16 @@
248 254 codesize = (unsigned long) &_etext - (unsigned long) &_text;
249 255 datasize = (unsigned long) &_edata - (unsigned long) &_etext;
250 256 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
  257 +
  258 +#ifdef CONFIG_64BIT
  259 + if ((unsigned long) &_text > (unsigned long) CKSEG0)
  260 + /* The -4 is a hack so that user tools don't have to handle
  261 + the overflow. */
  262 + kclist_add(&kcore_kseg0, (void *) CKSEG0, 0x80000000 - 4);
  263 +#endif
  264 + kclist_add(&kcore_mem, __va(0), max_low_pfn << PAGE_SHIFT);
  265 + kclist_add(&kcore_vmalloc, (void *)VMALLOC_START,
  266 + VMALLOC_END-VMALLOC_START);
251 267  
252 268 printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
253 269 "%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",