]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[POWERPC] Add memory regions to the kcore list for 32-bit machines
authorEd Swarthout <Ed.Swarthout@freescale.com>
Fri, 21 Sep 2007 02:53:02 +0000 (12:53 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 2 Oct 2007 23:12:06 +0000 (09:12 +1000)
The entries are only 32-bit, so restrict the virtual address to stay
below 0xffff_ffff.  With KERNELBASE set to 0xc000_0000, this in effect
restricts access to the first 1GB of real memory.

Make setup_kcore conditional on CONFIG_PROC_KCORE for both 32/64.

Signed-off-by: Ed Swarthout <Ed.Swarthout@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/mm/init_32.c
arch/powerpc/mm/init_64.c

index d65995ae827320d71c839c4ffd521bcba4c5072d..27c234fb5118244c4a4ca31ef2d1723b0737bf34 100644 (file)
@@ -255,3 +255,40 @@ void free_initrd_mem(unsigned long start, unsigned long end)
        }
 }
 #endif
+
+#ifdef CONFIG_PROC_KCORE
+static struct kcore_list kcore_vmem;
+
+static int __init setup_kcore(void)
+{
+       int i;
+
+       for (i = 0; i < lmb.memory.cnt; i++) {
+               unsigned long base;
+               unsigned long size;
+               struct kcore_list *kcore_mem;
+
+               base = lmb.memory.region[i].base;
+               size = lmb.memory.region[i].size;
+
+               kcore_mem = kmalloc(sizeof(struct kcore_list), GFP_ATOMIC);
+               if (!kcore_mem)
+                       panic("%s: kmalloc failed\n", __FUNCTION__);
+
+               /* must stay under 32 bits */
+               if ( 0xfffffffful - (unsigned long)__va(base) < size) {
+                       size = 0xfffffffful - (unsigned long)(__va(base));
+                       printk(KERN_DEBUG "setup_kcore: restrict size=%lx\n",
+                                               size);
+               }
+
+               kclist_add(kcore_mem, __va(base), size);
+       }
+
+       kclist_add(&kcore_vmem, (void *)VMALLOC_START,
+               VMALLOC_END-VMALLOC_START);
+
+       return 0;
+}
+module_init(setup_kcore);
+#endif
index 9f27bb56a61dadfba5f0d644f6e4987dbb91b23b..fa90f6561b9f8fcce44f6f0377c66e02228810db 100644 (file)
@@ -113,6 +113,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
+#ifdef CONFIG_PROC_KCORE
 static struct kcore_list kcore_vmem;
 
 static int __init setup_kcore(void)
@@ -139,6 +140,7 @@ static int __init setup_kcore(void)
        return 0;
 }
 module_init(setup_kcore);
+#endif
 
 static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags)
 {