当前位置: 技术问答>linux和unix
__lookup_processor_type 有一句不懂,请赐教~
来源: 互联网 发布时间:2016-12-10
本文导语: 本帖最后由 haohaokingXP 于 2011-06-22 21:19:17 编辑 在看ARM LINUX 2.6.31 启动的代码中head-common.S中 __lookup_processor_type: adr r3, 3f ldmda r3, {r5 - r7} sub r3, r3, r7 @ get offset between virt&phys add r5, r5, r3 @ convert...
__lookup_processor_type:
adr r3, 3f
ldmda r3, {r5 - r7}
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
and r4, r4, r9 @ mask wanted bits
teq r3, r4
beq 2f
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)
/*
* This provides a C-API version of the above function.
*/
ENTRY(lookup_processor_type)
stmfd sp!, {r4 - r7, r9, lr}
mov r9, r0
bl __lookup_processor_type
mov r0, r5
ldmfd sp!, {r4 - r7, r9, pc}
ENDPROC(lookup_processor_type)
/*
* Look in and arch/arm/kernel/arch.[ch] for
* more information about the __proc_info and __arch_info structures.
*/
.long __proc_info_begin
.long __proc_info_end
3: .long .
.long __arch_info_begin
.long __arch_info_end
sub r3, r3, r7不是很明白,这是怎么算出相对偏移量呢,我感觉应该是sub r3, r3, r5,请详细说说~
|
注意前面是ldmda r3, {r5 - r7},而不是ldmia ...,这两个指令的操作方向是相反的,贴一下ARM ARM中关于指令的伪代码,参考一下。另外注意,在新版本内核(如Linux 2.6.32)一般都使用ldmia处理,当然标号3的位置有改变,可以同时参考一下。
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] - 4*BitCount(registers) + 4;
for i = 0 to 14
if registers == ’1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers == ’1’ then
LoadWritePC(MemA[address,4]);
if wback && registers == ’0’ then R[n] = R[n] - 4*BitCount(registers);
if wback && registers == ’1’ then R[n] = bits(32) UNKNOWN;
if ConditionPassed() then
EncodingSpecificOperations();
address = R[n] - 4*BitCount(registers) + 4;
for i = 0 to 14
if registers == ’1’ then
R[i] = MemA[address,4]; address = address + 4;
if registers == ’1’ then
LoadWritePC(MemA[address,4]);
if wback && registers == ’0’ then R[n] = R[n] - 4*BitCount(registers);
if wback && registers == ’1’ then R[n] = bits(32) UNKNOWN;
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。