|
4 | 4 | #include <asm/asm-offsets.h>
|
5 | 5 | #include <asm/thread_info.h>
|
6 | 6 | #include <asm/processor-flags.h>
|
7 |
| -#include <asm/pgtable.h> |
8 | 7 |
|
9 | 8 | /*G:020
|
10 | 9 | * Our story starts with the kernel booting into startup_32 in
|
@@ -38,113 +37,9 @@ ENTRY(lguest_entry)
|
38 | 37 | /* Set up the initial stack so we can run C code. */
|
39 | 38 | movl $(init_thread_union+THREAD_SIZE),%esp
|
40 | 39 |
|
41 |
| - call init_pagetables |
42 |
| - |
43 | 40 | /* Jumps are relative: we're running __PAGE_OFFSET too low. */
|
44 | 41 | jmp lguest_init+__PAGE_OFFSET
|
45 | 42 |
|
46 |
| -/* |
47 |
| - * Initialize page tables. This creates a PDE and a set of page |
48 |
| - * tables, which are located immediately beyond __brk_base. The variable |
49 |
| - * _brk_end is set up to point to the first "safe" location. |
50 |
| - * Mappings are created both at virtual address 0 (identity mapping) |
51 |
| - * and PAGE_OFFSET for up to _end. |
52 |
| - * |
53 |
| - * FIXME: This code is taken verbatim from arch/x86/kernel/head_32.S: they |
54 |
| - * don't have a stack at this point, so we can't just use call and ret. |
55 |
| - */ |
56 |
| -init_pagetables: |
57 |
| -#if PTRS_PER_PMD > 1 |
58 |
| -#define PAGE_TABLE_SIZE(pages) (((pages) / PTRS_PER_PMD) + PTRS_PER_PGD) |
59 |
| -#else |
60 |
| -#define PAGE_TABLE_SIZE(pages) ((pages) / PTRS_PER_PGD) |
61 |
| -#endif |
62 |
| -#define pa(X) ((X) - __PAGE_OFFSET) |
63 |
| - |
64 |
| -/* Enough space to fit pagetables for the low memory linear map */ |
65 |
| -MAPPING_BEYOND_END = \ |
66 |
| - PAGE_TABLE_SIZE(((1<<32) - __PAGE_OFFSET) >> PAGE_SHIFT) << PAGE_SHIFT |
67 |
| -#ifdef CONFIG_X86_PAE |
68 |
| - |
69 |
| - /* |
70 |
| - * In PAE mode initial_page_table is statically defined to contain |
71 |
| - * enough entries to cover the VMSPLIT option (that is the top 1, 2 or 3 |
72 |
| - * entries). The identity mapping is handled by pointing two PGD entries |
73 |
| - * to the first kernel PMD. |
74 |
| - * |
75 |
| - * Note the upper half of each PMD or PTE are always zero at this stage. |
76 |
| - */ |
77 |
| - |
78 |
| -#define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */ |
79 |
| - |
80 |
| - xorl %ebx,%ebx /* %ebx is kept at zero */ |
81 |
| - |
82 |
| - movl $pa(__brk_base), %edi |
83 |
| - movl $pa(initial_pg_pmd), %edx |
84 |
| - movl $PTE_IDENT_ATTR, %eax |
85 |
| -10: |
86 |
| - leal PDE_IDENT_ATTR(%edi),%ecx /* Create PMD entry */ |
87 |
| - movl %ecx,(%edx) /* Store PMD entry */ |
88 |
| - /* Upper half already zero */ |
89 |
| - addl $8,%edx |
90 |
| - movl $512,%ecx |
91 |
| -11: |
92 |
| - stosl |
93 |
| - xchgl %eax,%ebx |
94 |
| - stosl |
95 |
| - xchgl %eax,%ebx |
96 |
| - addl $0x1000,%eax |
97 |
| - loop 11b |
98 |
| - |
99 |
| - /* |
100 |
| - * End condition: we must map up to the end + MAPPING_BEYOND_END. |
101 |
| - */ |
102 |
| - movl $pa(_end) + MAPPING_BEYOND_END + PTE_IDENT_ATTR, %ebp |
103 |
| - cmpl %ebp,%eax |
104 |
| - jb 10b |
105 |
| -1: |
106 |
| - addl $__PAGE_OFFSET, %edi |
107 |
| - movl %edi, pa(_brk_end) |
108 |
| - shrl $12, %eax |
109 |
| - movl %eax, pa(max_pfn_mapped) |
110 |
| - |
111 |
| - /* Do early initialization of the fixmap area */ |
112 |
| - movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax |
113 |
| - movl %eax,pa(initial_pg_pmd+0x1000*KPMDS-8) |
114 |
| -#else /* Not PAE */ |
115 |
| - |
116 |
| -page_pde_offset = (__PAGE_OFFSET >> 20); |
117 |
| - |
118 |
| - movl $pa(__brk_base), %edi |
119 |
| - movl $pa(initial_page_table), %edx |
120 |
| - movl $PTE_IDENT_ATTR, %eax |
121 |
| -10: |
122 |
| - leal PDE_IDENT_ATTR(%edi),%ecx /* Create PDE entry */ |
123 |
| - movl %ecx,(%edx) /* Store identity PDE entry */ |
124 |
| - movl %ecx,page_pde_offset(%edx) /* Store kernel PDE entry */ |
125 |
| - addl $4,%edx |
126 |
| - movl $1024, %ecx |
127 |
| -11: |
128 |
| - stosl |
129 |
| - addl $0x1000,%eax |
130 |
| - loop 11b |
131 |
| - /* |
132 |
| - * End condition: we must map up to the end + MAPPING_BEYOND_END. |
133 |
| - */ |
134 |
| - movl $pa(_end) + MAPPING_BEYOND_END + PTE_IDENT_ATTR, %ebp |
135 |
| - cmpl %ebp,%eax |
136 |
| - jb 10b |
137 |
| - addl $__PAGE_OFFSET, %edi |
138 |
| - movl %edi, pa(_brk_end) |
139 |
| - shrl $12, %eax |
140 |
| - movl %eax, pa(max_pfn_mapped) |
141 |
| - |
142 |
| - /* Do early initialization of the fixmap area */ |
143 |
| - movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax |
144 |
| - movl %eax,pa(initial_page_table+0xffc) |
145 |
| -#endif |
146 |
| - ret |
147 |
| - |
148 | 43 | /*G:055
|
149 | 44 | * We create a macro which puts the assembler code between lgstart_ and lgend_
|
150 | 45 | * markers. These templates are put in the .text section: they can't be
|
|
0 commit comments