[start_kernel --> setup_arch --> paging_init]
paging_init is invoked on IA-32 systems during the boot process to split the virtual address space.
pagetable_init first initializes the page tables of the system using swapper_pg_dir as a basic.
The TLB entries must also be flushed because they still contain boot memory allocation data.
__flush_all_tlb does the necessary work.kmap_init initializes the global variable kmap_pte. The kernel uses this variable to store the page table
entry for the area later used to map pages from the highmem zone into kernel address space. Besides,
the address of the first fixmap area for highmem kernel mappings is stored in the global variable
kmem_vstart.
/*
* paging_init() sets up the page tables - note that the first 8MB are
* already mapped by head.S.
*
* This routines also unmaps the page at virtual kernel address 0, so
* that we can trap those pesky NULL-reference errors in the kernel.
*/
void __init paging_init(void)
{
pagetable_init();
__flush_tlb_all();
kmap_init();
/*
* NOTE: at this point the bootmem allocator is fully available.
*/
sparse_init();
zone_sizes_init();
}
|
static void __init pagetable_init(void)
{
pgd_t *pgd_base = swapper_pg_dir;
permanent_kmaps_init(pgd_base);
}
|
static void __init kmap_init(void)
{
unsigned long kmap_vstart;
/*
* Cache the first kmap pte:
*/
kmap_vstart = __fix_to_virt(FIX_KMAP_BEGIN);
kmap_pte = kmap_get_fixmap_pte(kmap_vstart);
kmap_prot = PAGE_KERNEL;
}
|
阅读(847) | 评论(1) | 转发(0) |