diff options
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/init_32.c | 37 | ||||
-rw-r--r-- | arch/powerpc/mm/init_64.c | 2 |
2 files changed, 39 insertions, 0 deletions
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index d65995ae8273..27c234fb5118 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -255,3 +255,40 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
255 | } | 255 | } |
256 | } | 256 | } |
257 | #endif | 257 | #endif |
258 | |||
259 | #ifdef CONFIG_PROC_KCORE | ||
260 | static struct kcore_list kcore_vmem; | ||
261 | |||
262 | static int __init setup_kcore(void) | ||
263 | { | ||
264 | int i; | ||
265 | |||
266 | for (i = 0; i < lmb.memory.cnt; i++) { | ||
267 | unsigned long base; | ||
268 | unsigned long size; | ||
269 | struct kcore_list *kcore_mem; | ||
270 | |||
271 | base = lmb.memory.region[i].base; | ||
272 | size = lmb.memory.region[i].size; | ||
273 | |||
274 | kcore_mem = kmalloc(sizeof(struct kcore_list), GFP_ATOMIC); | ||
275 | if (!kcore_mem) | ||
276 | panic("%s: kmalloc failed\n", __FUNCTION__); | ||
277 | |||
278 | /* must stay under 32 bits */ | ||
279 | if ( 0xfffffffful - (unsigned long)__va(base) < size) { | ||
280 | size = 0xfffffffful - (unsigned long)(__va(base)); | ||
281 | printk(KERN_DEBUG "setup_kcore: restrict size=%lx\n", | ||
282 | size); | ||
283 | } | ||
284 | |||
285 | kclist_add(kcore_mem, __va(base), size); | ||
286 | } | ||
287 | |||
288 | kclist_add(&kcore_vmem, (void *)VMALLOC_START, | ||
289 | VMALLOC_END-VMALLOC_START); | ||
290 | |||
291 | return 0; | ||
292 | } | ||
293 | module_init(setup_kcore); | ||
294 | #endif | ||
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index 9f27bb56a61d..fa90f6561b9f 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c | |||
@@ -113,6 +113,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) | |||
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | #ifdef CONFIG_PROC_KCORE | ||
116 | static struct kcore_list kcore_vmem; | 117 | static struct kcore_list kcore_vmem; |
117 | 118 | ||
118 | static int __init setup_kcore(void) | 119 | static int __init setup_kcore(void) |
@@ -139,6 +140,7 @@ static int __init setup_kcore(void) | |||
139 | return 0; | 140 | return 0; |
140 | } | 141 | } |
141 | module_init(setup_kcore); | 142 | module_init(setup_kcore); |
143 | #endif | ||
142 | 144 | ||
143 | static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) | 145 | static void zero_ctor(void *addr, struct kmem_cache *cache, unsigned long flags) |
144 | { | 146 | { |