m68k: print memory layout info in boot log
authorGreg Ungerer <gerg@uclinux.org>
Thu, 13 Oct 2011 06:59:55 +0000 (16:59 +1000)
committerGreg Ungerer <gerg@uclinux.org>
Sat, 24 Dec 2011 11:47:57 +0000 (21:47 +1000)
Output a table of the kernel memory regions at boot time.
This is taken directly from the ARM architecture code that does this.
The table looks like this:

Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00000400   (   0 KiB)
    kmap    : 0xd0000000 - 0xe0000000   ( 256 MiB)
    vmalloc : 0xc0000000 - 0xcfffffff   ( 255 MiB)
    lowmem  : 0x00000000 - 0x02000000   (  32 MiB)
      .init : 0x00128000 - 0x00134000   (  48 KiB)
      .text : 0x00020000 - 0x00118d54   ( 996 KiB)
      .data : 0x00118d60 - 0x00126000   (  53 KiB)
      .bss  : 0x00134000 - 0x001413e0   (  53 KiB)

This has been very useful while debugging the ColdFire virtual memory
support code. But in general I think it is nice to know extacly where
the kernel has layed everything out on boot.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>
arch/m68k/include/asm/traps.h
arch/m68k/kernel/vmlinux-std.lds
arch/m68k/kernel/vmlinux-sun3.lds
arch/m68k/mm/init_mm.c

index 151068f64f44f088b03339d57d13f6bb394a04a3..4aff3358fbaff75eb80952b2ea05977845614421 100644 (file)
@@ -18,6 +18,7 @@
 
 typedef void (*e_vector)(void);
 extern e_vector vectors[];
+extern e_vector *_ramvec;
 
 asmlinkage void auto_inthandler(void);
 asmlinkage void user_inthandler(void);
index d0993594f558b3408317aede57c634c407ea580f..63407c836826842a9dc2648c84fb3c50ba5c4f79 100644 (file)
@@ -31,7 +31,9 @@ SECTIONS
 
   RW_DATA_SECTION(16, PAGE_SIZE, THREAD_SIZE)
 
+  _sbss = .;
   BSS_SECTION(0, 0, 0)
+  _ebss = .;
 
   _edata = .;                  /* End of data section */
 
index 8080469ee6c11c3e86ab59febaa4773790a2ffc7..ad0f46d64c0b66a8d6b6cf4f82ffeaeeabbda084 100644 (file)
@@ -44,7 +44,9 @@ __init_begin = .;
        . = ALIGN(PAGE_SIZE);
        __init_end = .;
 
+  _sbss = .;
   BSS_SECTION(0, 0, 0)
+  _ebss = .;
 
   _end = . ;
 
index bbe525434ccb677fe19af015a1b21b3d057095c4..85c5f0eee9ffabd182ea1d61fcb8d6d8da8fe4de 100644 (file)
@@ -24,6 +24,7 @@
 #include <asm/page.h>
 #include <asm/pgalloc.h>
 #include <asm/system.h>
+#include <asm/traps.h>
 #include <asm/machdep.h>
 #include <asm/io.h>
 #ifdef CONFIG_ATARI
@@ -75,6 +76,38 @@ extern void init_pointer_table(unsigned long ptable);
 
 extern pmd_t *zero_pgtable;
 
+#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
+#define VECTORS        &vectors[0]
+#else
+#define VECTORS        _ramvec
+#endif
+
+void __init print_memmap(void)
+{
+#define UL(x) ((unsigned long) (x))
+#define MLK(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 10
+#define MLM(b, t) UL(b), UL(t), (UL(t) - UL(b)) >> 20
+#define MLK_ROUNDUP(b, t) b, t, DIV_ROUND_UP(((t) - (b)), 1024)
+
+       pr_notice("Virtual kernel memory layout:\n"
+               "    vector  : 0x%08lx - 0x%08lx   (%4ld KiB)\n"
+               "    kmap    : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
+               "    vmalloc : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
+               "    lowmem  : 0x%08lx - 0x%08lx   (%4ld MiB)\n"
+               "      .init : 0x%p" " - 0x%p" "   (%4d KiB)\n"
+               "      .text : 0x%p" " - 0x%p" "   (%4d KiB)\n"
+               "      .data : 0x%p" " - 0x%p" "   (%4d KiB)\n"
+               "      .bss  : 0x%p" " - 0x%p" "   (%4d KiB)\n",
+               MLK(VECTORS, VECTORS + 256),
+               MLM(KMAP_START, KMAP_END),
+               MLM(VMALLOC_START, VMALLOC_END),
+               MLM(PAGE_OFFSET, (unsigned long)high_memory),
+               MLK_ROUNDUP(__init_begin, __init_end),
+               MLK_ROUNDUP(_stext, _etext),
+               MLK_ROUNDUP(_sdata, _edata),
+               MLK_ROUNDUP(_sbss, _ebss));
+}
+
 void __init mem_init(void)
 {
        pg_data_t *pgdat;
@@ -125,6 +158,7 @@ void __init mem_init(void)
               codepages << (PAGE_SHIFT-10),
               datapages << (PAGE_SHIFT-10),
               initpages << (PAGE_SHIFT-10));
+       print_memmap();
 }
 
 #ifdef CONFIG_BLK_DEV_INITRD
This page took 0.036394 seconds and 5 git commands to generate.