做一个简单的c入口函数
AREA INIT,CODE,READONLY CODE32
ARM_MODE_SVC EQU 0x13 I_BIT EQU 0x80 F_BIT EQU 0x40 USR_Stack EQU 0x00203000
ENTRY B InitReset ; 0x00 Reset handler undefvec B undefvec ; 0x04 Undefined Instruction swivec B swivec ; 0x08 Software Interrupt pabtvec B pabtvec ; 0x0C Prefetch Abort dabtvec B dabtvec ; 0x10 Data Abort rsvdvec B rsvdvec ; 0x14 reserved irqvec B irqvec ; 0x18 IRQ fiqvec B fiqvec ; 0x1c FIQ
InitReset MSR CPSR_c,#ARM_MODE_SVC| I_BIT | F_BIT ;改成用户模式且禁止IRQ和FIQ中断 LDR SP,=USR_Stack IMPORT main BL main stop B stop END
在ads中点调试,进入axd,一般情况下起始点是放在我的ENTRY B InitReset该条语句,但是我这个一进入axd就直接进入了反汇编界面,而且反汇编代码怪怪的,高手指点一下 反汇编代码: __main [0xe28f8090] add r8,pc,#0x90 ; #0x98 00000004 [0xe898000f] ldmia r8,{r0-r3} 00000008 [0xe0800008] add r0,r0,r8 0000000c [0xe0811008] add r1,r1,r8 00000010 [0xe0822008] add r2,r2,r8 00000014 [0xe0833008] add r3,r3,r8 00000018 [0xe240b001] sub r11,r0,#1 0000001c [0xe242c001] sub r12,r2,#1 _move_region [0xe1500001] cmp r0,r1 00000024 [0x0a00000e] beq _zero_region 00000028 [0xe8b00070] ldmia r0!,{r4-r6} 0000002c [0xe1540005] cmp r4,r5 00000030 [0x0afffffa] beq _move_region 00000034 [0xe3140001] tst r4,#1 00000038 [0x1084400b] addne r4,r4,r11 0000003c [0xe3150001] tst r5,#1 00000040 [0x1085500b] addne r5,r5,r11 00000044 [0xe3150002] tst r5,#2 00000048 [0x10855009] addne r5,r5,r9 0000004c [0xe3c55003] bic r5,r5,#3 _move_loop [0xe2566004] subs r6,r6,#4 00000054 [0x24947004] ldrcs r7,[r4],#4 00000058 [0x24857004] strcs r7,[r5],#4 0000005c [0x8afffffb] bhi _move_loop 00000060 [0xeaffffee] b _move_region _zero_region [0xe1520003] cmp r2,r3 00000068 [0x0b000028] bleq __rt_entry 0000006c [0xe3a07000] mov r7,#0 00000070 [0xe8b20030] ldmia r2!,{r4,r5} 00000074 [0xe3140001] tst r4,#1 00000078 [0x1084400c] addne r4,r4,r12 0000007c [0xe3140002] tst r4,#2 00000080 [0x10844009] addne r4,r4,r9 00000084 [0xe3c44003] bic r4,r4,#3 _zero_loop [0xe2555004] subs r5,r5,#4 0000008c [0x24847004] strcs r7,[r4],#4 00000090 [0x8afffffc] bhi _zero_loop 00000094 [0xeafffff2] b _zero_region _region_table [0x00000374] dcd 0x00000374 t... 0000009c [0x00000398] dcd 0x00000398 .... 000000a0 [0x00000398] dcd 0x00000398 .... 000000a4 [0x000003b0] dcd 0x000003b0 .... main [0xe59f2054] * ldr r2,0x00000104 ; = #0x00200000 000000ac [0xe3a00000] mov r0,#0 000000b0 [0xe5820000] str r0,[r2,#0] 000000b4 [0xe3a00000] mov r0,#0 000000b8 [0xe5921000] ldr r1,[r2,#0] 000000bc [0xe0811000] add r1,r1,r0 000000c0 [0xe5821000] str r1,[r2,#0] 000000c4 [0xe2800001] add r0,r0,#1 000000c8 [0xe3500002] cmp r0,#2 000000cc [0x9afffff9] bls 0xb8 ; (main + 0x10) 000000d0 [0xe3a00000] mov r0,#0 000000d4 [0xe1a0f00e] mov pc,r14 liu [0xe59f2024] ldr r2,0x00000104 ; = #0x00200000 000000dc [0xe3a00000] mov r0,#0 000000e0 [0xe5820000] str r0,[r2,#0] 000000e4 [0xe3a00000] mov r0,#0 000000e8 [0xe5921000] ldr r1,[r2,#0] 000000ec [0xe0811000] add r1,r1,r0 000000f0 [0xe5821000] str r1,[r2,#0] 000000f4 [0xe2800001] add r0,r0,#1 000000f8 [0xe3500002] cmp r0,#2 000000fc [0x9afffff9] bls 0xe8 ; (liu + 0x10) 00000100 [0xe1a0f00e] mov pc,r14 00000104 [0x00200000] dcd 0x00200000 .. . _main_redirection [0xe1a0f00e] mov pc,r14 _main [0xe1a0f00e] mov pc,r14 __rt_entry [0xeb00004d] bl __rt_stackheap_init 00000114 [0xeb00000d] bl __rt_lib_init 00000118 [0xebffffe2] bl main 0000011c [0xea000005] b exit __rt_exit [0xe92d4001] stmfd r13!,{r0,r14} 00000124 [0xeb000042] bl __rt_lib_shutdown 00000128 [0xe8bd4001] ldmfd r13!,{r0,r14} 0000012c [0xea000000] b __rt_abort1 __rt_abort [0xe3e00000] mvn r0,#0 __rt_abort1 [0xea000083] b _sys_exit exit [0xe92d4010] stmfd r13!,{r4,r14} 0000013c [0xe1a04000] mov r4,r0 00000140 [0xebffffff] bl 0x144 ; (exit + 0xc) 00000144 [0xe1a00004] mov r0,r4 00000148 [0xe8bd4010] ldmfd r13!,{r4,r14} 0000014c [0xeafffff3] b __32__rt_exit __rt_lib_init [0xe92d40f0] stmfd r13!,{r4-r7,r14} 00000154 [0xe24dd00c] sub r13,r13,#0xc 00000158 [0xe1a05001] mov r5,r1 0000015c [0xe1a04000] mov r4,r0 00000160 [0xeb0000a4] bl _fp_init 00000164 [0xe3a00000] mov r0,#0 00000168 [0xe58d4000] str r4,[r13,#0] 0000016c [0xe58d5004] str r5,[r13,#4] 00000170 [0xebffffff] bl 0x174 ; (__rt_lib_init + 0x24) 00000174 [0xe58d0008] str r0,[r13,#8] 00000178 [0xe59f00c8] ldr r0,0x00000248 ; = #0x000000c0 0000017c [0xe1a0100d] mov r1,r13 00000180 [0xe08f0000] add r0,pc,r0 00000184 [0xebffffff] bl 0x188 ; (__rt_lib_init + 0x38) 00000188 [0xe1a05000] mov r5,r0 0000018c [0xe1a06001] mov r6,r1 00000190 [0xe89d0003] ldmia r13,{r0,r1} 00000194 [0xebffffff] bl 0x198 ; (__rt_lib_init + 0x48) 00000198 [0xebffffff] bl 0x19c ; (__rt_lib_init + 0x4c) 0000019c [0xebffffff] bl 0x1a0 ; (__rt_lib_init + 0x50) 000001a0 [0xe3a01000] mov r1,#0 000001a4 [0xe3a00000] mov r0,#0 000001a8 [0xebffffff] bl 0x1ac ; (__rt_lib_init + 0x5c) 000001ac [0xe1a07000] mov r7,r0 000001b0 [0xeb00006a] bl __user_libspace 000001b4 [0xe1a04000] mov r4,r0 000001b8 [0xe5807020] str r7,[r0,#0x20] 000001bc [0xe3a00000] mov r0,#0 000001c0 [0xe3a01000] mov r1,#0 000001c4 [0xebffffff] bl 0x1c8 ; (__rt_lib_init + 0x78) 000001c8 [0xe2801001] add r1,r0,#1 000001cc [0xe5841024] str r1,[r4,#0x24] 000001d0 [0xe3a01000] mov r1,#0 000001d4 [0xe3a00000] mov r0,#0 000001d8 [0xebffffff] bl 0x1dc ; (__rt_lib_init + 0x8c) 000001dc [0xe5840028] str r0,[r4,#0x28] 000001e0 [0xe3a00000] mov r0,#0 000001e4 [0xe3a01000] mov r1,#0 000001e8 [0xebffffff] bl 0x1ec ; (__rt_lib_init + 0x9c) 000001ec [0xe584002c] str r0,[r4,#0x2c] 000001f0 [0xe3a00000] mov r0,#0 000001f4 [0xe3a01000] mov r1,#0 000001f8 [0xebffffff] bl 0x1fc ; (__rt_lib_init + 0xac) 000001fc [0xe5840030] str r0,[r4,#0x30] 00000200 [0xebffffff] bl 0x204 ; (__rt_lib_init + 0xb4) 00000204 [0xebffffff] bl 0x208 ; (__rt_lib_init + 0xb8) 00000208 [0xebffffff] bl 0x20c ; (__rt_lib_init + 0xbc) 0000020c [0xebffffff] bl 0x210 ; (__rt_lib_init + 0xc0) 00000210 [0xebffffff] bl 0x214 ; (__rt_lib_init + 0xc4) 00000214 [0xebffffff] bl 0x218 ; (__rt_lib_init + 0xc8) 00000218 [0xebffffff] bl 0x21c ; (__rt_lib_init + 0xcc) 0000021c [0xebffffff] bl 0x220 ; (__rt_lib_init + 0xd0) 00000220 [0xe1a00005] mov r0,r5 00000224 [0xe1a01006] mov r1,r6 00000228 [0xe28dd00c] add r13,r13,#0xc 0000022c [0xe8bd00f0] ldmfd r13!,{r4-r7} 00000230 [0xe49df004] ldr pc,[r13],#4 __rt_lib_shutdown [0xe92d4008] stmfd r13!,{r3,r14} 00000238 [0xebffffff] bl 0x23c ; (__rt_lib_shutdown + 0x8) 0000023c [0xebffffff] bl 0x240 ; (__rt_lib_shutdown + 0xc) 00000240 [0xebffffff] bl 0x244 ; (__rt_lib_shutdown + 0x10) 00000244 [0xe8bd8008] ldmfd r13!,{r3,pc} 00000248 [0x000000c0] dcd 0x000000c0 .... __rt_stackheap_init [0xe1a0500e] mov r5,r14 00000250 [0xeb000042] bl __user_libspace 00000254 [0xe1a0e005] mov r14,r5 00000258 [0xe1a04000] mov r4,r0 0000025c [0xe1a0100d] mov r1,r13 00000260 [0xe1a0300a] mov r3,r10 00000264 [0xe3c00007] bic r0,r0,#7 00000268 [0xe280d060] add r13,r0,#0x60 0000026c [0xe92d4010] stmfd r13!,{r4,r14} 00000270 [0xeb00003d] bl __user_initial_stackheap 00000274 [0xe8bd4010] ldmfd r13!,{r4,r14} 00000278 [0xe3c1d007] bic r13,r1,#7 0000027c [0xe3a06000] mov r6,#0 00000280 [0xe3a07000] mov r7,#0 00000284 [0xe3a08000] mov r8,#0 00000288 [0xe3a0b000] mov r11,#0 0000028c [0xe1a0c004] mov r12,r4 00000290 [0xe8ac09c0] stmia r12!,{r6-r8,r11} 00000294 [0xe8ac09c0] stmia r12!,{r6-r8,r11} 00000298 [0xe8ac09c0] stmia r12!,{r6-r8,r11} 0000029c [0xe8ac09c0] stmia r12!,{r6-r8,r11} 000002a0 [0xe92d4013] stmfd r13!,{r0,r1,r4,r14} 000002a4 [0xe3a00000] mov r0,#0 000002a8 [0xe3a01000] mov r1,#0 000002ac [0xebffffff] bl 0x2b0 ; (__rt_stackheap_init + 0x64) 000002b0 [0xe2811040] add r1,r1,#0x40 000002b4 [0xe0802001] add r2,r0,r1 000002b8 [0xe2822f44] add r2,r2,#0x110 000002bc [0xe584201c] str r2,[r4,#0x1c] 000002c0 [0xe5841018] str r1,[r4,#0x18] 000002c4 [0xe3a00001] mov r0,#1 000002c8 [0xe5840010] str r0,[r4,#0x10] 000002cc [0xe8bd4013] ldmfd r13!,{r0,r1,r4,r14} 000002d0 [0xe5840014] str r0,[r4,#0x14] 000002d4 [0xe1a01000] mov r1,r0 000002d8 [0xe1a0f00e] mov pc,r14 __rt_heap_extend [0xe92d4010] stmfd r13!,{r4,r14} 000002e0 [0xe92d0003] stmfd r13!,{r0,r1} 000002e4 [0xeb00001d] bl __user_libspace 000002e8 [0xe1a04000] mov r4,r0 000002ec [0xe8bd0003] ldmfd r13!,{r0,r1} 000002f0 [0xe594301c] ldr r3,[r4,#0x1c] 000002f4 [0xe04d3003] sub r3,r13,r3 000002f8 [0xe5942014] ldr r2,[r4,#0x14] 000002fc [0xe5812000] str r2,[r1,#0] 00000300 [0xe082e000] add r14,r2,r0 00000304 [0xe15e0003] cmp r14,r3 00000308 [0x8a00000a] bhi _heap_overflow 0000030c [0xe093300e] adds r3,r3,r14 00000310 [0xe1a03063] mov r3,r3,rrx 00000314 [0xe3c33007] bic r3,r3,#7 00000318 [0xe28e1d40] add r1,r14,#0x1000 0000031c [0xe2811007] add r1,r1,#7 00000320 [0xe3c11007] bic r1,r1,#7 00000324 [0xe1510003] cmp r1,r3 00000328 [0x81a01003] movhi r1,r3 0000032c [0xe0410002] sub r0,r1,r2 00000330 [0xe5841014] str r1,[r4,#0x14] 00000334 [0xe8bd8010] ldmfd r13!,{r4,pc} _heap_overflow [0xe1a02000] mov r2,r0 0000033c [0xe3a00000] mov r0,#0 00000340 [0xebffffff] bl 0x344 ; (_heap_overflow + 0xc) 00000344 [0xe8bd8010] ldmfd r13!,{r4,pc} _sys_exit [0xe3a00018] mov r0,#0x18 0000034c [0xe59f1008] ldr r1,0x0000035c ; = #0x00020026 00000350 [0xef123456] swi 0x123456 00000354 [0xe1a0f00e] mov pc,r14 00000358 [0x00000058] dcd 0x00000058 X... 0000035c [0x00020026] dcd 0x00020026 &... __user_libspace [0xe59f0000] ldr r0,0x00000368 ; = #0x00200004 00000364 [0xe1a0f00e] mov pc,r14 00000368 [0x00200004] dcd 0x00200004 .. . __user_initial_stackheap [0xe92d4000] stmfd r13!,{r14} 00000370 [0xe24dd014] sub r13,r13,#0x14 00000374 [0xe1a0100d] mov r1,r13 00000378 [0xe28d2004] add r2,r13,#4 0000037c [0xe5812000] str r2,[r1,#0] 00000380 [0xe3a00016] mov r0,#0x16 00000384 [0xef123456] swi 0x123456 00000388 [0xe59d0004] ldr r0,[r13,#4] 0000038c [0xe59d100c] ldr r1,[r13,#0xc] 00000390 [0xe59d2008] ldr r2,[r13,#8] 00000394 [0xe59d3010] ldr r3,[r13,#0x10] 00000398 [0xe3500000] cmp r0,#0 0000039c [0x059f0008] ldreq r0,_RW_Limit ; = #_RW_Limit 000003a0 [0xe28dd014] add r13,r13,#0x14 000003a4 [0xe8bd8000] ldmfd r13!,{pc} 000003a8 [0x00000008] dcd 0x00000008 .... _RW_Limit [0x00200064] dcd 0x00200064 d. . __semihosting_swi_guard [0xe1a0f00e] mov pc,r14 __rt_fp_status_addr [0xe92d4010] stmfd r13!,{r4,r14} 000003b8 [0xebffffe8] bl __user_libspace 000003bc [0xe2800004] add r0,r0,#4 000003c0 [0xe8bd8010] ldmfd r13!,{r4,pc} 000003c4 [0xea000006] b InitReset undefvec [0xeafffffe] b undefvec swivec [0xeafffffe] b swivec pabtvec [0xeafffffe] b pabtvec dabtvec [0xeafffffe] b dabtvec rsvdvec [0xeafffffe] b rsvdvec irqvec [0xeafffffe] b irqvec fiqvec [0xeafffffe] b fiqvec InitReset [0xe321f0d3] msr cpsr_c,#0xd3 000003e8 [0xe59fd004] ldr r13,0x000003f4 ; = #0x00203000 000003ec [0xebffff2d] bl main stop [0xeafffffe] b stop 000003f4 [0x00203000] dcd 0x00203000 .0 . _fp_init [0xe92d4010] stmfd r13!,{r4,r14} 000003fc [0xebffffec] bl __rt_fp_status_addr
|