Chinaunix首页 | 论坛 | 博客
  • 博客访问: 427292
  • 博文数量: 123
  • 博客积分: 2686
  • 博客等级: 少校
  • 技术积分: 1349
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-23 22:11
文章分类
文章存档

2012年(3)

2011年(10)

2010年(100)

2009年(10)

我的朋友

分类: LINUX

2010-10-15 20:39:09

[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;
}


阅读(813) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-10-16 15:15:01

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com