Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
[pandora-kernel.git] / arch / arm / mm / init.c
index 4a8a01e..2fee782 100644 (file)
@@ -28,7 +28,6 @@
 #include <asm/sizes.h>
 #include <asm/tlb.h>
 #include <asm/fixmap.h>
-#include <asm/memory.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -214,11 +213,7 @@ static void __init arm_bootmem_init(unsigned long start_pfn,
 
 #ifdef CONFIG_ZONE_DMA
 
-#ifdef ARM_DMA_ZONE_SIZE
-unsigned long arm_dma_zone_size = ARM_DMA_ZONE_SIZE;
-#else
 unsigned long arm_dma_zone_size __read_mostly;
-#endif
 EXPORT_SYMBOL(arm_dma_zone_size);
 
 /*
@@ -439,6 +434,17 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
        return pages;
 }
 
+/*
+ * Poison init memory with an undefined instruction (ARM) or a branch to an
+ * undefined instruction (Thumb).
+ */
+static inline void poison_init_mem(void *s, size_t count)
+{
+       u32 *p = (u32 *)s;
+       while ((count = count - 4))
+               *p++ = 0xe7fddef0;
+}
+
 static inline void
 free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 {
@@ -656,8 +662,8 @@ void __init mem_init(void)
                        "    pkmap   : 0x%08lx - 0x%08lx   (%4ld MB)\n"
 #endif
                        "    modules : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-                       "      .init : 0x%p" " - 0x%p" "   (%4d kB)\n"
                        "      .text : 0x%p" " - 0x%p" "   (%4d kB)\n"
+                       "      .init : 0x%p" " - 0x%p" "   (%4d kB)\n"
                        "      .data : 0x%p" " - 0x%p" "   (%4d kB)\n"
                        "       .bss : 0x%p" " - 0x%p" "   (%4d kB)\n",
 
@@ -679,8 +685,8 @@ void __init mem_init(void)
 #endif
                        MLM(MODULES_VADDR, MODULES_END),
 
-                       MLK_ROUNDUP(__init_begin, __init_end),
                        MLK_ROUNDUP(_text, _etext),
+                       MLK_ROUNDUP(__init_begin, __init_end),
                        MLK_ROUNDUP(_sdata, _edata),
                        MLK_ROUNDUP(__bss_start, __bss_stop));
 
@@ -721,11 +727,13 @@ void free_initmem(void)
 #ifdef CONFIG_HAVE_TCM
        extern char __tcm_start, __tcm_end;
 
+       poison_init_mem(&__tcm_start, &__tcm_end - &__tcm_start);
        totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
                                    __phys_to_pfn(__pa(&__tcm_end)),
                                    "TCM link");
 #endif
 
+       poison_init_mem(__init_begin, __init_end - __init_begin);
        if (!machine_is_integrator() && !machine_is_cintegrator())
                totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
                                            __phys_to_pfn(__pa(__init_end)),
@@ -738,10 +746,12 @@ static int keep_initrd;
 
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       if (!keep_initrd)
+       if (!keep_initrd) {
+               poison_init_mem((void *)start, PAGE_ALIGN(end) - start);
                totalram_pages += free_area(__phys_to_pfn(__pa(start)),
                                            __phys_to_pfn(__pa(end)),
                                            "initrd");
+       }
 }
 
 static int __init keepinitrd_setup(char *__unused)