- 论坛徽章:
- 0
|
本帖最后由 zhangxujun1981 于 2010-10-25 14:20 编辑
void TestSysCallSpeed(void)
{
int i;
for(i=0;i<9000000;i++){
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
}
}
Test.o: file format elf32-littlearm
Disassembly of section .text:
00000f40 <TestSysCallSpeed>:
f40: e59f3040 ldr r3, [pc, #64] ; f88 <TestSysCallSpeed+0x48>
f44: e59f2040 ldr r2, [pc, #64] ; f8c <TestSysCallSpeed+0x4c>
f48: e5933000 ldr r3, [r3]
f4c: e3a01000 mov r1, #0 ; 0x0
f50: e1c310b0 strh r1, [r3]
f54: e3a01001 mov r1, #1 ; 0x1
f58: e1c310b0 strh r1, [r3]
f5c: e3a01000 mov r1, #0 ; 0x0
f60: e1c310b0 strh r1, [r3]
f64: e3a01001 mov r1, #1 ; 0x1
f68: e1c310b0 strh r1, [r3]
f6c: e3a01000 mov r1, #0 ; 0x0
f70: e1c310b0 strh r1, [r3]
f74: e2522001 subs r2, r2, #1 ; 0x1
f78: e3a01001 mov r1, #1 ; 0x1
f7c: e1c310b0 strh r1, [r3]
f80: 1a0003d1 bne 1ecc <TestWinDr+0x16c>
f84: e1a0f00e mov pc, lr
f88: 00000000 andeq r0, r0, r0
f8c: 00895440 addeq r5, r9, r0, asr #8
-------------------------------------------------------------------------------
void TBank(void)
{
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
(*(volatile short *)(GBankAddr)=0);
(*(volatile short *)(GBankAddr)=1);
}
t.o: file format elf32-littlearm
Disassembly of section .text:
00000000 <Tbank>:
0: e59f1038 ldr r1, [pc, #56] ; 40 <.text+0x40>
4: e3a00001 mov r0, #1 ; 0x1
8: e3a0c000 mov ip, #0 ; 0x0
c: e5913000 ldr r3, [r1]
10: e1c300b0 strh r0, [r3]
14: e5912000 ldr r2, [r1]
18: e1c2c0b0 strh ip, [r2]
1c: e5913000 ldr r3, [r1]
20: e1c300b0 strh r0, [r3]
24: e5912000 ldr r2, [r1]
28: e1c2c0b0 strh ip, [r2]
2c: e5913000 ldr r3, [r1]
30: e1c300b0 strh r0, [r3]
34: e5912000 ldr r2, [r1]
38: e1c2c0b0 strh ip, [r2]
3c: e12fff1e bx lr
40: 00000000 .word 0x00000000
第一个是应用程序,第二个是驱动程序.好像没有什么区别.可能是你上面说的关于cache 使用的不一样吧.我马上试一试.
像for(i=0;i<50;i++)这样运行很快是意料之中的事情,cpu的主频是667M,而且是8级流水线的arm11 |
|