|
@@ -416,6 +416,17 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
|
|
return pages;
|
|
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
|
|
static inline void
|
|
free_memmap(unsigned long start_pfn, unsigned long end_pfn)
|
|
free_memmap(unsigned long start_pfn, unsigned long end_pfn)
|
|
{
|
|
{
|
|
@@ -696,11 +707,13 @@ void free_initmem(void)
|
|
#ifdef CONFIG_HAVE_TCM
|
|
#ifdef CONFIG_HAVE_TCM
|
|
extern char __tcm_start, __tcm_end;
|
|
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)),
|
|
totalram_pages += free_area(__phys_to_pfn(__pa(&__tcm_start)),
|
|
__phys_to_pfn(__pa(&__tcm_end)),
|
|
__phys_to_pfn(__pa(&__tcm_end)),
|
|
"TCM link");
|
|
"TCM link");
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ poison_init_mem(__init_begin, __init_end - __init_begin);
|
|
if (!machine_is_integrator() && !machine_is_cintegrator())
|
|
if (!machine_is_integrator() && !machine_is_cintegrator())
|
|
totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
|
|
totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)),
|
|
__phys_to_pfn(__pa(__init_end)),
|
|
__phys_to_pfn(__pa(__init_end)),
|
|
@@ -713,10 +726,12 @@ static int keep_initrd;
|
|
|
|
|
|
void free_initrd_mem(unsigned long start, unsigned long end)
|
|
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)),
|
|
totalram_pages += free_area(__phys_to_pfn(__pa(start)),
|
|
__phys_to_pfn(__pa(end)),
|
|
__phys_to_pfn(__pa(end)),
|
|
"initrd");
|
|
"initrd");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
static int __init keepinitrd_setup(char *__unused)
|
|
static int __init keepinitrd_setup(char *__unused)
|