欢迎来到天天文库
浏览记录
ID:6053614
大小:75.50 KB
页数:10页
时间:2018-01-01
《arm linux内核启动过程(自解压后)的启动分析》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、内核启动过程分析/**linux/arch/arm/kernel/head.S**Copyright(C)1994-2002RussellKing*Copyright(c)2003ARMLimited*AllRightsReserved**Thisprogramisfreesoftware;youcanredistributeitand/ormodify*itunderthetermsoftheGNUGeneralPublicLicenseversion2as*publishedbytheFreeSoftwareFoundat
2、ion.**Kernelstartupcodeforall32-bitCPUs*/#include#include#include#include#include#include#include#include#include#if(PHYS_OF
3、FSET&0x001fffff)#error"PHYS_OFFSETmustbeataneven2MiBboundary!"//boundary(分界线)#endif#defineKERNEL_RAM_VADDR(PAGE_OFFSET+TEXT_OFFSET)#defineKERNEL_RAM_PADDR(PHYS_OFFSET+TEXT_OFFSET)/**swapper_pg_diristhevirtualaddressoftheinitialpage*Weplacethepagetables16KbelowKERNEL
4、_RAM_VADDR.Therefore,wemust*makesurethatKERNEL_RAM_VADDRiscorrectlyset.Currently,weexpect*theleastsignificant16bitstobe0x8000,butwecouldprobably*relaxthisrestrictiontoKERNEL_RAM_VADDR>=PAGE_OFFSET+0x4000.*/swapper_pg_dir是初始页表的虚拟地址.我们将页表放在KERNEL_RAM_VADDR以下16K的空间中.因此
5、我们必须保证KERNEL_RAM_VADDR已经被正常设置.当前,我们期望的是这个地址的最后16bits为0x8000,但我们或许可以放宽这项限制到KERNEL_RAM_VADDR>=PAGE_OFFSET+0x4000.#if(KERNEL_RAM_VADDR&0xffff)!=0x8000#errorKERNEL_RAM_VADDRmuststartat0xXXXX8000//内核的起始地址必须是32k对齐#endif.globlswapper_pg_dir//定义一个全局变量.equswapper_pg_dir,KERN
6、EL_RAM_VADDR-0x4000/*页表的起始地址,大小为16kb*/.macropgtbl,rd/*定义一个宏,在建页表时用到*/ldrrd,=(KERNEL_RAM_PADDR-0x4000).endm#ifdefCONFIG_XIP_KERNEL#defineKERNEL_STARTXIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR)#defineKERNEL_END_edata_loc#else#defineKERNEL_STARTKERNEL_RAM_VADDR#defineKERNEL_E
7、ND_end/*内核镜像的结束地址(虚拟地址,在vmlinux.lds.S中定义)*/#endif/**Kernelstartupentrypoint.*---------------------------*这些参数同通常是由解压代码传进来的*Thisisnormallycalledfromthedecompressorcode.Therequirements*are:MMU=off,D-cache=off,I-cache=dontcare,r0=0,*r1=machinenr,r2=atagspointer.**Thisc
8、odeismostlypositionindependent,soifyoulinkthekernelat*0xc0008000,youcallthisat__pa(0xc0008000).**Seelinux/arch/arm/tools/mach-typesforthec
此文档下载收益归作者所有