Copy void __init init_mem_mapping(void)
{
load_cr3(swapper_pg_dir);
__flush_tlb_all();
}
Copy diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index 2ee7811..f6dc1ed 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -21,6 +21,7 @@ extern pmd_t level2_fixmap_pgt[512];
extern pmd_t level2_ident_pgt[512];
extern pte_t level1_fixmap_pgt[512];
extern pgd_t init_level4_pgt[];
+extern pgd_t early_level4_pgt[];
#define swapper_pg_dir init_level4_pgt
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 372aad2..ba19480 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -577,7 +577,7 @@ static void __init memory_map_bottom_up(unsigned long map_start,
void __init init_mem_mapping(void)
{
- unsigned long end;
+ unsigned long end, pgd;
probe_page_size_mask();
@@ -619,7 +619,13 @@ void __init init_mem_mapping(void)
early_ioremap_page_table_range_init();
#endif
+ printk(KERN_ERR "%s: early_level4_pgt is %lx\n", __func__, __pa_symbol(early_level4_pgt ));
+ printk(KERN_ERR "%s: init_level4_pgt is %lx\n", __func__, __pa_symbol(init_level4_pgt ));
+ pgd = read_cr3();
+ printk(KERN_ERR "%s: current cr3 is %lx\n", __func__, pgd);
load_cr3(swapper_pg_dir);
+ pgd = read_cr3();
+ printk(KERN_ERR "%s: cr3 is set to %lx\n", __func__, pgd);
__flush_tlb_all();
early_memtest(0, max_pfn_mapped << PAGE_SHIFT);
Copy [ 0.000000] init_mem_mapping: early_level4_pgt is 1fca000
[ 0.000000] init_mem_mapping: init_level4_pgt is 1e06000
[ 0.000000] init_mem_mapping: current cr3 is 1fca000
[ 0.000000] init_mem_mapping: cr3 is set to 1e06000
Copy asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data)
{
...
clear_page(init_level4_pgt);
...
/* set init_level4_pgt kernel high mapping*/
init_level4_pgt[511] = early_level4_pgt[511];
...
}