今天按照楼主说的方法用了一下log调试功能,只是那个logon=2的情况下,前两项是指令地址和指令,这个看的明白,可是后面记录的那些主要寄存器有哪些呢?顺序是什么样的呢?
我先贴一下部分代码和log文件:
这里是我的start.s文件:
[code:1]
begin:
@set up irq stack
mov r0, #0xd2 @ make irq mode with all irqs disabled
msr cpsr, r0
ldr sp, =irq_stack @ set sp_irq = irq_stack
bl hello
@b begin
.data
.align 4
irq_stack:
.space 4096
[/code:1]
可以看到这里我还是把那句调到begin的给注释掉了。
下面是编译后的那个hello.s的反汇编文件:
[code:1]
01000000 <begin>:
1000000: e3a000d2 mov r0, #210 ; 0xd2
1000004: e129f000 msr CPSR_all, r0
1000008: e59fd000 ldr sp, [pc, #0] ; 1000010 <begin+0x10>
100000c: eb000000 bl 1000014 <hello>
1000010: 01002000 tsteq r0, r0
[/code:1]
这一段是对应前面那个start.s的代码。下面部分是hello函数中return的部分:
[code:1]
return;
}
1000048: e91ba800 ldmdb r11, {r11, sp, pc}
100004c: 01000050 tsteq r0, r0, asr r0
1000050: 6c6c6568 stcvsl 5, cr6, [r12], -#416
1000054: 726f776f rsbvc r7, pc, #29097984 ; 0x1bc0000
1000058: Address 0x1000058 is out of bounds.
[/code:1]
下面是那个log文件的一部分:
[code:1]
N 3a :p 1000034,i e7d03002,R 1000050,fffd001c,9,6c,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,100003c,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 3b :p 1000038,i e2822001,R 1000050,fffd001c,9,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000040,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 3c :p 100003c,i e3520009,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000044,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 3d :p 1000040,i e5813000,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000048,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 3e :p 1000044,i dafffffa,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,100004c,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 3f :p 1000048,i e7ffdefe,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000050,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000030,T 0,L e2822001,D e7d03002,
N 40 :p 1000048,i e91ba800,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000050,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000048,T 0,L 6c6c6568,D 1000050,
N 41 :p 1000010,i 1002000,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1002000,1000010,1000018,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000048,T 0,L 6c6c6568,D 1000050,
N 41 :p 1000010,i 1002000,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1002000,1000010,1000018,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000010,T 0,L e92dd800,D e1a0c00d,
N 42 :p 1000014,i e1a0c00d,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1002000,1000010,100001c,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000010,T 0,L e92dd800,D e1a0c00d,
N 42 :p 1000014,i e1a0c00d,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1002000,1000010,100001c,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 43 :p 1000018,i e92dd800,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1002000,1000010,1000020,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 44 :p 100001c,i e24cb004,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,0,1002000,1001ff0,1000010,1000024,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 45 :p 1000020,i e3e01bbf,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000028,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 46 :p 1000024,i e2411e3e,R 1000050,fffd03ff,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,100002c,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 47 :p 1000028,i e2411003,R 1000050,fffd001f,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000030,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
N 48 :p 100002c,i e7ffdefe,R 1000050,fffd001c,a,64,0,0,0,0,0,0,0,1001ffc,1002000,1001ff0,1000010,1000034,C d2,S 0,0,0,0,0,0,0,M 12,B 2,E 0,I 0,P 1000014,T 0,L e24cb004,D e92dd800,
[/code:1]
下面是这段log里相关的一部分代码:
[code:1]
01000014 <hello>:
1000014: e1a0c00d mov r12, sp
1000018: e92dd800 stmdb sp!, {r11, r12, lr, pc}
100001c: e24cb004 sub r11, r12, #4 ; 0x4
void hello(void)
{
int i;
char * hellostr="helloworld";
long* paddr=(long*)0xfffd001c;
1000020: e3e01bbf mvn r1, #195584 ; 0x2fc00
1000024: e2411e3e sub r1, r1, #992 ; 0x3e0
1000028: e2411003 sub r1, r1, #3 ; 0x3
[/code:1]
根据log文件可以看到在1000048执行了2次,而且第一次的指令是e7ffdefe,不是反汇编对应的指令,而后面那条1000048才是。之后就跳到了1000010,同样执行了2次,然后就又顺序执行到了hello里面。
这个过程就是我上次的问题所在了。看了log之后,还是没想明白,呵呵
麻烦老大继续来解释解释吧。
另外我还有个问题,因为不了解GNU的汇编,所以想问问那下面终止语句是什么?
网上搜到了GNU AS的参考手册,可是没有找到该指令。
所以我想问问有什么可以学学GNU AS的,麻烦楼主继续指点~~~~ |