arch/arm/kernel/vmlinux.lds
arch/arm/kernel/head.S
为入口位置
.section ".text.head", "ax"
ENTRY(stext)
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | SVC_MODE @ ensure svc mode
@ and irqs disabled
mrc p15, 0, r9, c0, c0 @ get processor id
bl __lookup_processor_type @ r5=procinfo r9=cpuid
movs r10, r5 @ invalid processor (r5=0)?
beq __error_p @ yes, error 'p'
bl __lookup_machine_type @ r5=machinfo
movs r8, r5 @ invalid machine (r5=0)?
beq __error_a @ yes, error 'a'
bl __vet_atags
bl __create_page_tables
arch/arm/kernel/head-common.S
__lookup_processor_type:
adr r3, 3f
ldmda r3, {r5 - r7} // r5 = __proc_info_begin虚拟地址值, r6 = __proc_info_end虚拟地址值, r7 = 3f对应的虚拟地址值[luther.gliethttp]
sub r3, r3, r7 @ get offset between virt&phys
add r5, r5, r3 @ convert virt addresses to
add r6, r6, r3 @ physical address space
1: ldmia r5, {r3, r4} @ value, mask // 将__arm920_proc_info的前8个字节数据取出来,r3 = 0x41009200,r4 = 0xff00fff0
and r4, r4, r9 @ mask wanted bits // r9在ENTRY(stext)刚刚进入时,使用mrc p15, 0, r9, c0, c0指令获得了processor id
teq r3, r4 // r9 = 0x41129200
beq 2f // 如果r4 & r9的结果为0x41009200,那么说明处理器id正确,跳转到2返回,内核一般不会在这里出问题[luther.gliethttp]
add r5, r5, #PROC_INFO_SZ @ sizeof(proc_info_list)
cmp r5, r6
blo 1b
mov r5, #0 @ unknown processor
2: mov pc, lr
ENDPROC(__lookup_processor_type)
.long __proc_info_begin
.long __proc_info_end
3: .long .
.long __arch_info_begin
.long __arch_info_end
反汇编之后.
c00082f4 <__lookup_processor_type>:
c00082f4: e28f304c add r3, pc, #76 ; 0x4c // pc向前跳76数值存入r3[luther.gliethttp]
c00082f8: e81300e0 ldmda r3, {r5, r6, r7} // r5 = c001b9e4
c00082fc: e0433007 sub r3, r3, r7 // r6 = c001ba18
c0008300: e0855003 add r5, r5, r3 // r7 = c0008348
c0008304: e0866003 add r6, r6, r3
c0008308: e8950018 ldmia r5, {r3, r4}
......
c0008340: c001b9e4 andgt fp, r1, r4, ror #19
c0008344: c001ba18 andgt fp, r1, r8, lsl sl
c0008348: c0008348 andgt r8, r0, r8, asr #6
c001b9e4 <__proc_info_begin>:
c001b9e4: 41009200 tstmi r0, r0, lsl #4 // arm920对应的id值
c001b9e8: ff00fff0 swinv 0x0000fff0 // mask掩码[luther.gliethttp]
c001b9ec: 00000c1e andeq r0, r0, lr, lsl ip
c001b9f0: 00000c12 andeq r0, r0, r2, lsl ip
arch/arm/mm/proc-arm920.S
.align
.section ".proc.info.init", #alloc, #execinstr
.type __arm920_proc_info,#object
__arm920_proc_info:
.long 0x41009200
.long 0xff00fff0
.long PMD_TYPE_SECT | \
PMD_SECT_BUFFERABLE | \
PMD_SECT_CACHEABLE | \
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
.long PMD_TYPE_SECT | \
PMD_BIT4 | \
PMD_SECT_AP_WRITE | \
PMD_SECT_AP_READ
b __arm920_setup
.long cpu_arch_name
.long cpu_elf_name
.long HWCAP_SWP | HWCAP_HALF | HWCAP_THUMB
.long cpu_arm920_name
.long arm920_processor_functions
.long v4wbi_tlb_fns
.long v4wb_user_fns
#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
.long arm920_cache_fns
#else
.long v4wt_cache_fns
#endif
.size __arm920_proc_info, . - __arm920_proc_info
阅读(1083) | 评论(0) | 转发(0) |