diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2008-06-25 00:19:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:11:04 -0400 |
commit | a6523748bddd38bcec11431f57502090b6014a96 (patch) | |
tree | 1aa906ba270628323fcdfb26a0ae0f7cfba80ae6 | |
parent | 491eccb721c2ee67250273a96e4515fb5b423337 (diff) |
paravirt/x86, 64-bit: move __PAGE_OFFSET to leave a space for hypervisor
Set __PAGE_OFFSET to the most negative possible address +
16*PGDIR_SIZE. The gap is to allow a space for a hypervisor to fit.
The gap is more or less arbitrary, but it's what Xen needs.
When booting native, kernel/head_64.S has a set of compile-time
generated pagetables used at boot time. This patch removes their
absolutely hard-coded layout, and makes it parameterised on
__PAGE_OFFSET (and __START_KERNEL_map).
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Cc: xen-devel <xen-devel@lists.xensource.com>
Cc: Stephen Tweedie <sct@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/head_64.S | 17 | ||||
-rw-r--r-- | include/asm-x86/page_64.h | 8 |
2 files changed, 19 insertions, 6 deletions
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S index 32f5a114d1a2..38279fab093d 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S | |||
@@ -32,6 +32,13 @@ | |||
32 | * | 32 | * |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #define pud_index(x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD-1)) | ||
36 | |||
37 | L4_PAGE_OFFSET = pgd_index(__PAGE_OFFSET) | ||
38 | L3_PAGE_OFFSET = pud_index(__PAGE_OFFSET) | ||
39 | L4_START_KERNEL = pgd_index(__START_KERNEL_map) | ||
40 | L3_START_KERNEL = pud_index(__START_KERNEL_map) | ||
41 | |||
35 | .text | 42 | .text |
36 | .section .text.head | 43 | .section .text.head |
37 | .code64 | 44 | .code64 |
@@ -77,8 +84,8 @@ startup_64: | |||
77 | /* Fixup the physical addresses in the page table | 84 | /* Fixup the physical addresses in the page table |
78 | */ | 85 | */ |
79 | addq %rbp, init_level4_pgt + 0(%rip) | 86 | addq %rbp, init_level4_pgt + 0(%rip) |
80 | addq %rbp, init_level4_pgt + (258*8)(%rip) | 87 | addq %rbp, init_level4_pgt + (L4_PAGE_OFFSET*8)(%rip) |
81 | addq %rbp, init_level4_pgt + (511*8)(%rip) | 88 | addq %rbp, init_level4_pgt + (L4_START_KERNEL*8)(%rip) |
82 | 89 | ||
83 | addq %rbp, level3_ident_pgt + 0(%rip) | 90 | addq %rbp, level3_ident_pgt + 0(%rip) |
84 | 91 | ||
@@ -338,9 +345,9 @@ ENTRY(name) | |||
338 | */ | 345 | */ |
339 | NEXT_PAGE(init_level4_pgt) | 346 | NEXT_PAGE(init_level4_pgt) |
340 | .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE | 347 | .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE |
341 | .fill 257,8,0 | 348 | .org init_level4_pgt + L4_PAGE_OFFSET*8, 0 |
342 | .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE | 349 | .quad level3_ident_pgt - __START_KERNEL_map + _KERNPG_TABLE |
343 | .fill 252,8,0 | 350 | .org init_level4_pgt + L4_START_KERNEL*8, 0 |
344 | /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ | 351 | /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ |
345 | .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE | 352 | .quad level3_kernel_pgt - __START_KERNEL_map + _PAGE_TABLE |
346 | 353 | ||
@@ -349,7 +356,7 @@ NEXT_PAGE(level3_ident_pgt) | |||
349 | .fill 511,8,0 | 356 | .fill 511,8,0 |
350 | 357 | ||
351 | NEXT_PAGE(level3_kernel_pgt) | 358 | NEXT_PAGE(level3_kernel_pgt) |
352 | .fill 510,8,0 | 359 | .fill L3_START_KERNEL,8,0 |
353 | /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ | 360 | /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ |
354 | .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE | 361 | .quad level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE |
355 | .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE | 362 | .quad level2_fixmap_pgt - __START_KERNEL_map + _PAGE_TABLE |
diff --git a/include/asm-x86/page_64.h b/include/asm-x86/page_64.h index cac5b9e78265..010d12db80dc 100644 --- a/include/asm-x86/page_64.h +++ b/include/asm-x86/page_64.h | |||
@@ -26,7 +26,13 @@ | |||
26 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) | 26 | #define PUD_PAGE_SIZE (_AC(1, UL) << PUD_SHIFT) |
27 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) | 27 | #define PUD_PAGE_MASK (~(PUD_PAGE_SIZE-1)) |
28 | 28 | ||
29 | #define __PAGE_OFFSET _AC(0xffff810000000000, UL) | 29 | /* |
30 | * Set __PAGE_OFFSET to the most negative possible address + | ||
31 | * PGDIR_SIZE*16 (pgd slot 272). The gap is to allow a space for a | ||
32 | * hypervisor to fit. Choosing 16 slots here is arbitrary, but it's | ||
33 | * what Xen requires. | ||
34 | */ | ||
35 | #define __PAGE_OFFSET _AC(0xffff880000000000, UL) | ||
30 | 36 | ||
31 | #define __PHYSICAL_START CONFIG_PHYSICAL_START | 37 | #define __PHYSICAL_START CONFIG_PHYSICAL_START |
32 | #define __KERNEL_ALIGN 0x200000 | 38 | #define __KERNEL_ALIGN 0x200000 |