2 * linux/arch/m68k/mm/init.c
4 * Copyright (C) 1995 Hamish Macdonald
6 * Contains common initialization routines, specific init code moved
7 * to motorola.c and sun3mmu.c
10 #include <linux/signal.h>
11 #include <linux/sched.h>
13 #include <linux/swap.h>
14 #include <linux/kernel.h>
15 #include <linux/string.h>
16 #include <linux/types.h>
17 #include <linux/init.h>
18 #include <linux/bootmem.h>
20 #include <asm/setup.h>
21 #include <asm/uaccess.h>
23 #include <asm/pgalloc.h>
24 #include <asm/system.h>
25 #include <asm/machdep.h>
28 #include <asm/atari_stram.h>
32 DEFINE_PER_CPU(struct mmu_gather
, mmu_gathers
);
35 * ZERO_PAGE is a special page that is used for zero-initialized
39 void *empty_zero_page
;
44 int free
= 0, total
= 0, reserved
= 0, shared
= 0;
47 printk("\nMem-info:\n");
49 printk("Free swap: %6ldkB\n", nr_swap_pages
<<(PAGE_SHIFT
-10));
53 if (PageReserved(mem_map
+i
))
55 else if (PageSwapCache(mem_map
+i
))
57 else if (!page_count(mem_map
+i
))
60 shared
+= page_count(mem_map
+i
) - 1;
62 printk("%d pages of RAM\n",total
);
63 printk("%d free pages\n",free
);
64 printk("%d reserved pages\n",reserved
);
65 printk("%d pages shared\n",shared
);
66 printk("%d pages swap cached\n",cached
);
69 extern void init_pointer_table(unsigned long ptable
);
71 /* References to section boundaries */
73 extern char _text
, _etext
, _edata
, __bss_start
, _end
;
74 extern char __init_begin
, __init_end
;
76 extern pmd_t
*zero_pgtable
;
78 void __init
mem_init(void)
88 max_mapnr
= num_physpages
= (((unsigned long)high_memory
- PAGE_OFFSET
) >> PAGE_SHIFT
);
92 atari_stram_mem_init_hook();
95 /* this will put all memory onto the freelists */
96 totalram_pages
= free_all_bootmem();
98 for (tmp
= PAGE_OFFSET
; tmp
< (unsigned long)high_memory
; tmp
+= PAGE_SIZE
) {
99 if (PageReserved(virt_to_page(tmp
))) {
100 if (tmp
>= (unsigned long)&_text
101 && tmp
< (unsigned long)&_etext
)
103 else if (tmp
>= (unsigned long) &__init_begin
104 && tmp
< (unsigned long) &__init_end
)
113 /* insert pointer tables allocated so far into the tablelist */
114 init_pointer_table((unsigned long)kernel_pg_dir
);
115 for (i
= 0; i
< PTRS_PER_PGD
; i
++) {
116 if (pgd_present(kernel_pg_dir
[i
]))
117 init_pointer_table(__pgd_page(kernel_pg_dir
[i
]));
120 /* insert also pointer table that we used to unmap the zero page */
122 init_pointer_table((unsigned long)zero_pgtable
);
125 printk("Memory: %luk/%luk available (%dk kernel code, %dk data, %dk init)\n",
126 (unsigned long)nr_free_pages() << (PAGE_SHIFT
-10),
127 max_mapnr
<< (PAGE_SHIFT
-10),
128 codepages
<< (PAGE_SHIFT
-10),
129 datapages
<< (PAGE_SHIFT
-10),
130 initpages
<< (PAGE_SHIFT
-10));
133 #ifdef CONFIG_BLK_DEV_INITRD
134 void free_initrd_mem(unsigned long start
, unsigned long end
)
137 for (; start
< end
; start
+= PAGE_SIZE
) {
138 ClearPageReserved(virt_to_page(start
));
139 init_page_count(virt_to_page(start
));
144 printk ("Freeing initrd memory: %dk freed\n", pages
);