uclinux2.6(bf561)中的bootmem分析(1):猜测

 
   
  
在setup_arch(arch/blackfin/kernel/setup.c)函数中,与bootmem相关的代码有:
     int bootmap_size;
 
     /* setup memory defaults from the user config */
     physical_mem_end = 0;
     _ramend = CONFIG_MEM_SIZE * 1024 * 1024;
 
     if (physical_mem_end == 0)
         physical_mem_end = _ramend;
 
     /* by now the stack is part of the init task */
     memory_end = _ramend - DMA_UNCACHED_REGION;
 
     _ramstart = (unsigned long)__bss_stop;
     _rambase = (unsigned long)_stext;
#ifdef CONFIG_MPU
     /* Round up to multiple of 4MB. */
     memory_start = (_ramstart + 0x3fffff) & ~0x3fffff;
#else
     memory_start = PAGE_ALIGN(_ramstart);
#endif
 
     /*
      * give all the memory to the bootmap allocator, tell it to put the
      * boot mem_map at the start of memory
      */
     bootmap_size = init_bootmem_node(NODE_DATA(0), memory_start >> PAGE_SHIFT, /* map goes here */
                        PAGE_OFFSET >> PAGE_SHIFT,
                        memory_end >> PAGE_SHIFT);
     /*
      * free the usable memory, we have to make sure we do not free
      * the bootmem bitmap so we then reserve it after freeing it :-)
      */
     free_bootmem(memory_start, memory_end - memory_start);
 
     reserve_bootmem(memory_start, bootmap_size);
此时,内存管理的初始化函数paging_init尚未调用,因此猜测bootmem的作用似乎是在内核启动完成前提供一种简单的内存管理策略。看看mm/bootmem.c的注释:
/*
 * linux/mm/bootmem.c
 *
 * Copyright (C) 1999 Ingo Molnar
 * Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
 *
 * simple boot-time physical memory area allocator and
 * free memory collector. It's used to deal with reserved
 * system memory and memory holes as well.
 */
 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

嵌云阁主

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值