aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/head64.c
diff options
context:
space:
mode:
authorVivek Goyal <vgoyal@in.ibm.com>2007-05-02 13:27:07 -0400
committerAndi Kleen <andi@basil.nowhere.org>2007-05-02 13:27:07 -0400
commitcfd243d4af7c7f8f52f5cb99d3932d9074b039ff (patch)
treeae9b25a414117d0d39b535e5701d5a1b3f907558 /arch/x86_64/kernel/head64.c
parentbdb96a6614cfaba24e23dd9de4040c068c3af19b (diff)
[PATCH] x86-64: Remove the identity mapping as early as possible
With the rewrite of the SMP trampoline and the early page allocator there is nothing that needs identity mapped pages, once we start executing C code. So add zap_identity_mappings into head64.c and remove zap_low_mappings() from much later in the code. The functions are subtly different thus the name change. This also kills boot_level4_pgt which was from an earlier attempt to move the identity mappings as early as possible, and is now no longer needed. Essentially I have replaced boot_level4_pgt with trampoline_level4_pgt in trampoline.S Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Vivek Goyal <vgoyal@in.ibm.com> Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel/head64.c')
-rw-r--r--arch/x86_64/kernel/head64.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
index 5c529c1e3d6c..6c34bdd22e26 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86_64/kernel/head64.c
@@ -18,8 +18,16 @@
18#include <asm/setup.h> 18#include <asm/setup.h>
19#include <asm/desc.h> 19#include <asm/desc.h>
20#include <asm/pgtable.h> 20#include <asm/pgtable.h>
21#include <asm/tlbflush.h>
21#include <asm/sections.h> 22#include <asm/sections.h>
22 23
24static void __init zap_identity_mappings(void)
25{
26 pgd_t *pgd = pgd_offset_k(0UL);
27 pgd_clear(pgd);
28 __flush_tlb();
29}
30
23/* Don't add a printk in there. printk relies on the PDA which is not initialized 31/* Don't add a printk in there. printk relies on the PDA which is not initialized
24 yet. */ 32 yet. */
25static void __init clear_bss(void) 33static void __init clear_bss(void)
@@ -57,18 +65,15 @@ void __init x86_64_start_kernel(char * real_mode_data)
57 /* clear bss before set_intr_gate with early_idt_handler */ 65 /* clear bss before set_intr_gate with early_idt_handler */
58 clear_bss(); 66 clear_bss();
59 67
68 /* Make NULL pointers segfault */
69 zap_identity_mappings();
70
60 for (i = 0; i < IDT_ENTRIES; i++) 71 for (i = 0; i < IDT_ENTRIES; i++)
61 set_intr_gate(i, early_idt_handler); 72 set_intr_gate(i, early_idt_handler);
62 asm volatile("lidt %0" :: "m" (idt_descr)); 73 asm volatile("lidt %0" :: "m" (idt_descr));
63 74
64 early_printk("Kernel alive\n"); 75 early_printk("Kernel alive\n");
65 76
66 /*
67 * switch to init_level4_pgt from boot_level4_pgt
68 */
69 memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t));
70 asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
71
72 for (i = 0; i < NR_CPUS; i++) 77 for (i = 0; i < NR_CPUS; i++)
73 cpu_pda(i) = &boot_cpu_pda[i]; 78 cpu_pda(i) = &boot_cpu_pda[i];
74 79