gdb跟踪剖发现free_area_init中一段优化错了,如下:
memset(mem_map, 0, start_mem - (unsigned long) mem_map);
do {
__asm__ __volatile__("":::"memory"); //gcc请不要优化
--p;
p->flags = (1 << PG_DMA) | (1 << PG_reserved);
p->map_nr = p - mem_map; //gcc优化后,p->map_nr值乱了,需要上面那行禁用gcc优化
} while (p > mem_map);
1.3.100