aboutsummaryrefslogtreecommitdiffstats
path: root/arch/m68k/mm/sun3mmu.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/m68k/mm/sun3mmu.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/m68k/mm/sun3mmu.c')
-rw-r--r--arch/m68k/mm/sun3mmu.c102
1 files changed, 102 insertions, 0 deletions
diff --git a/arch/m68k/mm/sun3mmu.c b/arch/m68k/mm/sun3mmu.c
new file mode 100644
index 000000000000..a47be196a47c
--- /dev/null
+++ b/arch/m68k/mm/sun3mmu.c
@@ -0,0 +1,102 @@
1/*
2 * linux/arch/m68k/mm/sun3mmu.c
3 *
4 * Implementations of mm routines specific to the sun3 MMU.
5 *
6 * Moved here 8/20/1999 Sam Creasey
7 *
8 */
9
10#include <linux/signal.h>
11#include <linux/sched.h>
12#include <linux/mm.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>
19
20#include <asm/setup.h>
21#include <asm/uaccess.h>
22#include <asm/page.h>
23#include <asm/pgtable.h>
24#include <asm/system.h>
25#include <asm/machdep.h>
26#include <asm/io.h>
27
28extern void mmu_emu_init (unsigned long bootmem_end);
29
30const char bad_pmd_string[] = "Bad pmd in pte_alloc: %08lx\n";
31
32extern unsigned long num_pages;
33
34void free_initmem(void)
35{
36}
37
38/* For the sun3 we try to follow the i386 paging_init() more closely */
39/* start_mem and end_mem have PAGE_OFFSET added already */
40/* now sets up tables using sun3 PTEs rather than i386 as before. --m */
41void __init paging_init(void)
42{
43 pgd_t * pg_dir;
44 pte_t * pg_table;
45 int i;
46 unsigned long address;
47 unsigned long next_pgtable;
48 unsigned long bootmem_end;
49 unsigned long zones_size[3] = {0, 0, 0};
50 unsigned long size;
51
52
53#ifdef TEST_VERIFY_AREA
54 wp_works_ok = 0;
55#endif
56 empty_zero_page = alloc_bootmem_pages(PAGE_SIZE);
57 memset(empty_zero_page, 0, PAGE_SIZE);
58
59 address = PAGE_OFFSET;
60 pg_dir = swapper_pg_dir;
61 memset (swapper_pg_dir, 0, sizeof (swapper_pg_dir));
62 memset (kernel_pg_dir, 0, sizeof (kernel_pg_dir));
63
64 size = num_pages * sizeof(pte_t);
65 size = (size + PAGE_SIZE) & ~(PAGE_SIZE-1);
66
67 next_pgtable = (unsigned long)alloc_bootmem_pages(size);
68 bootmem_end = (next_pgtable + size + PAGE_SIZE) & PAGE_MASK;
69
70 /* Map whole memory from PAGE_OFFSET (0x0E000000) */
71 pg_dir += PAGE_OFFSET >> PGDIR_SHIFT;
72
73 while (address < (unsigned long)high_memory) {
74 pg_table = (pte_t *) __pa (next_pgtable);
75 next_pgtable += PTRS_PER_PTE * sizeof (pte_t);
76 pgd_val(*pg_dir) = (unsigned long) pg_table;
77 pg_dir++;
78
79 /* now change pg_table to kernel virtual addresses */
80 pg_table = (pte_t *) __va ((unsigned long) pg_table);
81 for (i=0; i<PTRS_PER_PTE; ++i, ++pg_table) {
82 pte_t pte = pfn_pte(virt_to_pfn(address), PAGE_INIT);
83 if (address >= (unsigned long)high_memory)
84 pte_val (pte) = 0;
85 set_pte (pg_table, pte);
86 address += PAGE_SIZE;
87 }
88 }
89
90 mmu_emu_init(bootmem_end);
91
92 current->mm = NULL;
93
94 /* memory sizing is a hack stolen from motorola.c.. hope it works for us */
95 zones_size[0] = ((unsigned long)high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
96 zones_size[1] = 0;
97
98 free_area_init(zones_size);
99
100}
101
102