aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-02-27 16:27:38 -0500
committerH. Peter Anvin <hpa@zytor.com>2009-03-14 20:23:47 -0400
commitccf3fe02e35f4abca2589f99022cc25084bbd8ae (patch)
tree3bcf329116b8c689b4da1bb1a0d87bb587d3f3c7 /arch
parent5368a2be34b96fda9c05d79424fa63a73ead04ed (diff)
x86-32: use brk segment for allocating initial kernel pagetable
Impact: use new interface instead of previous ad hoc implementation Rather than having special purpose init_pg_table_start/end variables to delimit the kernel pagetable built by head_32.S, just use the brk mechanism to extend the bss for the new pagetable. This patch removes init_pg_table_start/end and pg0, defines __brk_base (which is page-aligned and immediately follows _end), initializes the brk region to start there, and uses it for the 32-bit pagetable. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/include/asm/pgtable_32.h3
-rw-r--r--arch/x86/include/asm/setup.h3
-rw-r--r--arch/x86/kernel/head32.c3
-rw-r--r--arch/x86/kernel/head_32.S14
-rw-r--r--arch/x86/kernel/setup.c6
-rw-r--r--arch/x86/kernel/vmlinux_32.lds.S4
-rw-r--r--arch/x86/lguest/boot.c8
7 files changed, 7 insertions, 34 deletions
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
index 97612fc7632f..31bd120cf2a2 100644
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -42,9 +42,6 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
42 */ 42 */
43#undef TEST_ACCESS_OK 43#undef TEST_ACCESS_OK
44 44
45/* The boot page tables (all created as a single array) */
46extern unsigned long pg0[];
47
48#ifdef CONFIG_X86_PAE 45#ifdef CONFIG_X86_PAE
49# include <asm/pgtable-3level.h> 46# include <asm/pgtable-3level.h>
50#else 47#else
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 45454f3fa121..366d36639940 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -109,9 +109,6 @@ void *extend_brk(size_t size, size_t align);
109void __init i386_start_kernel(void); 109void __init i386_start_kernel(void);
110extern void probe_roms(void); 110extern void probe_roms(void);
111 111
112extern unsigned long init_pg_tables_start;
113extern unsigned long init_pg_tables_end;
114
115#else 112#else
116void __init x86_64_start_kernel(char *real_mode); 113void __init x86_64_start_kernel(char *real_mode);
117void __init x86_64_start_reservations(char *real_mode_data); 114void __init x86_64_start_reservations(char *real_mode_data);
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 29f1095b0849..3f8579f8d42c 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -29,9 +29,6 @@ void __init i386_start_kernel(void)
29 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 29 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
30 } 30 }
31#endif 31#endif
32 reserve_early(init_pg_tables_start, init_pg_tables_end,
33 "INIT_PG_TABLE");
34
35 reserve_ebda_region(); 32 reserve_ebda_region();
36 33
37 /* 34 /*
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index c32ca19d591a..db6652710e98 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -167,7 +167,7 @@ num_subarch_entries = (. - subarch_entries) / 4
167/* 167/*
168 * Initialize page tables. This creates a PDE and a set of page 168 * Initialize page tables. This creates a PDE and a set of page
169 * tables, which are located immediately beyond _end. The variable 169 * tables, which are located immediately beyond _end. The variable
170 * init_pg_tables_end is set up to point to the first "safe" location. 170 * _brk_end is set up to point to the first "safe" location.
171 * Mappings are created both at virtual address 0 (identity mapping) 171 * Mappings are created both at virtual address 0 (identity mapping)
172 * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END. 172 * and PAGE_OFFSET for up to _end+sizeof(page tables)+INIT_MAP_BEYOND_END.
173 * 173 *
@@ -190,8 +190,7 @@ default_entry:
190 190
191 xorl %ebx,%ebx /* %ebx is kept at zero */ 191 xorl %ebx,%ebx /* %ebx is kept at zero */
192 192
193 movl $pa(pg0), %edi 193 movl $pa(__brk_base), %edi
194 movl %edi, pa(init_pg_tables_start)
195 movl $pa(swapper_pg_pmd), %edx 194 movl $pa(swapper_pg_pmd), %edx
196 movl $PTE_IDENT_ATTR, %eax 195 movl $PTE_IDENT_ATTR, %eax
19710: 19610:
@@ -216,7 +215,8 @@ default_entry:
216 cmpl %ebp,%eax 215 cmpl %ebp,%eax
217 jb 10b 216 jb 10b
2181: 2171:
219 movl %edi,pa(init_pg_tables_end) 218 addl $__PAGE_OFFSET, %edi
219 movl %edi, pa(_brk_end)
220 shrl $12, %eax 220 shrl $12, %eax
221 movl %eax, pa(max_pfn_mapped) 221 movl %eax, pa(max_pfn_mapped)
222 222
@@ -227,8 +227,7 @@ default_entry:
227 227
228page_pde_offset = (__PAGE_OFFSET >> 20); 228page_pde_offset = (__PAGE_OFFSET >> 20);
229 229
230 movl $pa(pg0), %edi 230 movl $pa(__brk_base), %edi
231 movl %edi, pa(init_pg_tables_start)
232 movl $pa(swapper_pg_dir), %edx 231 movl $pa(swapper_pg_dir), %edx
233 movl $PTE_IDENT_ATTR, %eax 232 movl $PTE_IDENT_ATTR, %eax
23410: 23310:
@@ -249,7 +248,8 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
249 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp 248 leal (INIT_MAP_BEYOND_END+PTE_IDENT_ATTR)(%edi),%ebp
250 cmpl %ebp,%eax 249 cmpl %ebp,%eax
251 jb 10b 250 jb 10b
252 movl %edi,pa(init_pg_tables_end) 251 addl $__PAGE_OFFSET, %edi
252 movl %edi, pa(_brk_end)
253 shrl $12, %eax 253 shrl $12, %eax
254 movl %eax, pa(max_pfn_mapped) 254 movl %eax, pa(max_pfn_mapped)
255 255
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index b8329029c150..3ac2aa7b9eaf 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -161,12 +161,6 @@ static struct resource bss_resource = {
161 161
162 162
163#ifdef CONFIG_X86_32 163#ifdef CONFIG_X86_32
164/* This value is set up by the early boot code to point to the value
165 immediately after the boot time page tables. It contains a *physical*
166 address, and must not be in the .bss segment! */
167unsigned long init_pg_tables_start __initdata = ~0UL;
168unsigned long init_pg_tables_end __initdata = ~0UL;
169
170static struct resource video_ram_resource = { 164static struct resource video_ram_resource = {
171 .name = "Video RAM area", 165 .name = "Video RAM area",
172 .start = 0xa0000, 166 .start = 0xa0000,
diff --git a/arch/x86/kernel/vmlinux_32.lds.S b/arch/x86/kernel/vmlinux_32.lds.S
index 27e44aa21585..1063fbe93c73 100644
--- a/arch/x86/kernel/vmlinux_32.lds.S
+++ b/arch/x86/kernel/vmlinux_32.lds.S
@@ -196,10 +196,6 @@ SECTIONS
196 __brk_limit = . ; 196 __brk_limit = . ;
197 197
198 _end = . ; 198 _end = . ;
199
200 /* This is where the kernel creates the early boot page tables */
201 . = ALIGN(PAGE_SIZE);
202 pg0 = . ;
203 } 199 }
204 200
205 /* Sections to be discarded */ 201 /* Sections to be discarded */
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 9fe4ddaa8f6f..90e44a10e68a 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -1058,14 +1058,6 @@ __init void lguest_init(void)
1058 * lguest_init() where the rest of the fairly chaotic boot setup 1058 * lguest_init() where the rest of the fairly chaotic boot setup
1059 * occurs. */ 1059 * occurs. */
1060 1060
1061 /* The native boot code sets up initial page tables immediately after
1062 * the kernel itself, and sets init_pg_tables_end so they're not
1063 * clobbered. The Launcher places our initial pagetables somewhere at
1064 * the top of our physical memory, so we don't need extra space: set
1065 * init_pg_tables_end to the end of the kernel. */
1066 init_pg_tables_start = __pa(pg0);
1067 init_pg_tables_end = __pa(pg0);
1068
1069 /* As described in head_32.S, we map the first 128M of memory. */ 1061 /* As described in head_32.S, we map the first 128M of memory. */
1070 max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT; 1062 max_pfn_mapped = (128*1024*1024) >> PAGE_SHIFT;
1071 1063