Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1154467
  • 博文数量: 511
  • 博客积分: 967
  • 博客等级: 准尉
  • 技术积分: 2560
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-06 14:19
文章分类

全部博文(511)

文章存档

2016年(11)

2015年(61)

2014年(257)

2013年(63)

2012年(119)

分类: Android平台

2014-04-03 20:55:16

PAGE_OFFSET = 0x8000 0000  len = 1G

static inline void prepare_page_table(void)
{
unsigned long addr;
phys_addr_t end;
printk("pmd clear start addr : 0 ");
for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE){
pmd_clear(pmd_off_k(addr));
}
    //printk(" ~ 0x%x \n",addr);
#ifdef CONFIG_XIP_KERNEL
/* The XIP kernel is mapped in the module area -- skip over it */
addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK;
#endif
for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE)
pmd_clear(pmd_off_k(addr));
        printk(" ~ 0x%x \n",addr);
end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
    printk(" base start : 0x%x ~ 0x%x \n",memblock.memory.regions[0].base,end);
    printk(" base start : 0x%x ~ 0x%x \n",__phys_to_virt(memblock.memory.regions[0].base),__phys_to_virt(end));
if (end >= lowmem_limit)
end = lowmem_limit;
    printk(" pmd clear start addr : 0x%x ",__phys_to_virt(end));
for (addr = __phys_to_virt(end);              //0xc4000000
    addr < VMALLOC_END; addr += PGDIR_SIZE)  //VMALLOC_END 0xf0000000
pmd_clear(pmd_off_k(addr));

        printk(" ~ 0x%x \n",addr);
}

//[    0.000000@0] pmd clear start addr : 0  ~ 0xc0000000
//[    0.000000@0] base start : 0x80000000 ~ 0x84000000  // __phys_to_virt 得到下面的....
//[    0.000000@0] base start : 0xc0000000 ~ 0xc4000000
//[    0.000000@0] pmd clear start addr : 0xc4000000  ~ 0xf0000000
pmd clear : 清除页表时,内核空间在的部分没有清除(base start : 0xc0000000 ~ 0xc4000000
--------------------------------------------------------------------------------------------------------------------------
static void __init map_lowmem(void)
{
struct memblock_region *reg;
/* Map all the lowmem memory banks. */
for_each_memblock(memory, reg) {
phys_addr_t start = reg->base;
phys_addr_t end = start + reg->size;
struct map_desc map;
if (end > lowmem_limit)
end = lowmem_limit;
if (start >= end)
break;
map.pfn = __phys_to_pfn(start);//start = 0x80000000 0x0x95000000 0xa0000000
map.virtual = __phys_to_virt(start);
map.length = end - start;
map.type = MT_MEMORY;
     printk("map_lowmem map.pfn 0x%x map.virtual 0x%x len 0x%x \n",map.pfn,map.virtual,map.length);
        create_mapping(&map);
}}

//[    0.000000@0] map_lowmem map.pfn 0x80000 map.virtual 0xc0000000 len 0x4000000
    内核空间所在的内存的页表也被重建了,也就是说有两个表格了,何时switch成新建立的表格呢?
//[    0.000000@0] map_lowmem map.pfn 0x95000 map.virtual 0xd5000000 len 0xaf00000
//[    0.000000@0] map_lowmem map.pfn 0xa0000 map.virtual 0xe0000000 len 0x8000000


阅读(1111) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册