日期:2014-05-16  浏览次数:20702 次

linux-3.2.36内核启动4-setup_arch中的内存初始化3(arm平台 bootmem_init源码分析)

void__init bootmem_init(void)

{

        unsigned long min, max_low, max_high;

 

        max_low = max_high = 0;

 

        find_limits(&min, &max_low,&max_high);

static void __init find_limits(unsigned long *min,unsigned long *max_low,

        unsignedlong *max_high)

{

        structmeminfo *mi = &meminfo;

        int i;

 

        *min =-1UL;

        *max_low =*max_high = 0;

 

       for_each_bank (i, mi) {

               struct membank *bank = &mi->bank[i];

               unsigned long start, end;

 

               start = bank_pfn_start(bank);

                end= bank_pfn_end(bank);

 

                if(*min > start)

                       *min = start;

                if(*max_high < end)

                        *max_high = end;

                if(bank->highmem)

                       continue;

                if(*max_low < end)

                       *max_low = end;

        }

}