This source file includes following definitions.
- paging_init
- mem_init
- mmu_init
- alloc_kuser_page
- arch_setup_additional_pages
- arch_vma_name
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 #include <linux/signal.h>
16 #include <linux/sched.h>
17 #include <linux/kernel.h>
18 #include <linux/errno.h>
19 #include <linux/string.h>
20 #include <linux/types.h>
21 #include <linux/ptrace.h>
22 #include <linux/mman.h>
23 #include <linux/mm.h>
24 #include <linux/init.h>
25 #include <linux/pagemap.h>
26 #include <linux/memblock.h>
27 #include <linux/slab.h>
28 #include <linux/binfmts.h>
29
30 #include <asm/setup.h>
31 #include <asm/page.h>
32 #include <asm/pgtable.h>
33 #include <asm/sections.h>
34 #include <asm/tlb.h>
35 #include <asm/mmu_context.h>
36 #include <asm/cpuinfo.h>
37 #include <asm/processor.h>
38
39 pgd_t *pgd_current;
40
41
42
43
44
45
46
47 void __init paging_init(void)
48 {
49 unsigned long zones_size[MAX_NR_ZONES];
50
51 memset(zones_size, 0, sizeof(zones_size));
52
53 pagetable_init();
54 pgd_current = swapper_pg_dir;
55
56 zones_size[ZONE_NORMAL] = max_mapnr;
57
58
59 free_area_init(zones_size);
60
61 flush_dcache_range((unsigned long)empty_zero_page,
62 (unsigned long)empty_zero_page + PAGE_SIZE);
63 }
64
65 void __init mem_init(void)
66 {
67 unsigned long end_mem = memory_end;
68
69
70 pr_debug("mem_init: start=%lx, end=%lx\n", memory_start, memory_end);
71
72 end_mem &= PAGE_MASK;
73 high_memory = __va(end_mem);
74
75
76 memblock_free_all();
77 mem_init_print_info(NULL);
78 }
79
80 void __init mmu_init(void)
81 {
82 flush_tlb_all();
83 }
84
85 #define __page_aligned(order) __aligned(PAGE_SIZE << (order))
86 pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned(PGD_ORDER);
87 pte_t invalid_pte_table[PTRS_PER_PTE] __page_aligned(PTE_ORDER);
88 static struct page *kuser_page[1];
89
90 static int alloc_kuser_page(void)
91 {
92 extern char __kuser_helper_start[], __kuser_helper_end[];
93 int kuser_sz = __kuser_helper_end - __kuser_helper_start;
94 unsigned long vpage;
95
96 vpage = get_zeroed_page(GFP_ATOMIC);
97 if (!vpage)
98 return -ENOMEM;
99
100
101 memcpy((void *)vpage, __kuser_helper_start, kuser_sz);
102
103 flush_icache_range(vpage, vpage + KUSER_SIZE);
104 kuser_page[0] = virt_to_page(vpage);
105
106 return 0;
107 }
108 arch_initcall(alloc_kuser_page);
109
110 int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
111 {
112 struct mm_struct *mm = current->mm;
113 int ret;
114
115 down_write(&mm->mmap_sem);
116
117
118 ret = install_special_mapping(mm, KUSER_BASE, KUSER_SIZE,
119 VM_READ | VM_EXEC | VM_MAYREAD |
120 VM_MAYEXEC, kuser_page);
121
122 up_write(&mm->mmap_sem);
123
124 return ret;
125 }
126
127 const char *arch_vma_name(struct vm_area_struct *vma)
128 {
129 return (vma->vm_start == KUSER_BASE) ? "[kuser]" : NULL;
130 }