帮忙arm 的汇编程序的汇编.
这是一段用objdump -d 出来的代码,一个设备上用的,各个作用看的不是很明白,希望有懂得给指点一下.
Disassembly of section .init:
00008320 <_init>:
8320: e52de004 str lr, [sp, #-4]!
8324: eb00001e bl 83a4 <call_gmon_start>
8328: eb000040 bl 8430 <frame_dummy>
832c: eb000123 bl 87c0 <__do_global_ctors_aux>
8330: e49df004 ldr pc, [sp], #4
Disassembly of section .plt:
00008334 <.plt>:
8334: e52de004 str lr, [sp, #-4]!
8338: e59fe004 ldr lr, [pc, #4] ; 8344 <.plt+0x10>
833c: e08fe00e add lr, pc, lr
8340: e5bef008 ldr pc, [lr, #8]!
8344: 000085ac andeq r8, r0, ip, lsr #11
8348: e28fc600 add ip, pc, #0 ; 0x0
834c: e28cca08 add ip, ip, #32768 ; 0x8000
8350: e5bcf5ac ldr pc, [ip, #1452]!
8354: e28fc600 add ip, pc, #0 ; 0x0
8358: e28cca08 add ip, ip, #32768 ; 0x8000
835c: e5bcf5a4 ldr pc, [ip, #1444]!
8360: e28fc600 add ip, pc, #0 ; 0x0
8364: e28cca08 add ip, ip, #32768 ; 0x8000
8368: e5bcf59c ldr pc, [ip, #1436]!
Disassembly of section .text:
0000836c <_start>:
836c: e59fc024 ldr ip, [pc, #36] ; 8398 <.text+0x2c>
8370: e3a0b000 mov fp, #0 ; 0x0
8374: e49d1004 ldr r1, [sp], #4
8378: e1a0200d mov r2, sp
837c: e52d2004 str r2, [sp, #-4]!
8380: e52d0004 str r0, [sp, #-4]!
8384: e59f0010 ldr r0, [pc, #16] ; 839c <.text+0x30>
8388: e59f3010 ldr r3, [pc, #16] ; 83a0 <.text+0x34>
838c: e52dc004 str ip, [sp, #-4]!
8390: ebffffef bl 8354 <.text-0x18>
8394: ebffffeb bl 8348 <.text-0x24>
8398: 00008760 andeq r8, r0, r0, ror #14
839c: 00008630 andeq r8, r0, r0, lsr r6
83a0: 000086fc streqd r8, [r0], -ip
000083a4 <call_gmon_start>:
83a4: e92d4400 stmdb sp!, {sl, lr}
83a8: e59fa01c ldr sl, [pc, #28] ; 83cc <.text+0x60>
83ac: e08fa00a add sl, pc, sl
83b0: e59f3018 ldr r3, [pc, #24] ; 83d0 <.text+0x64>
83b4: e79a3003 ldr r3, [sl, r3]
83b8: e3530000 cmp r3, #0 ; 0x0
83bc: 08bd8400 ldmeqia sp!, {sl, pc}
83c0: e1a0e00f mov lr, pc
83c4: e1a0f003 mov pc, r3
83c8: e8bd8400 ldmia sp!, {sl, pc}
83cc: 0000853c andeq r8, r0, ip, lsr r5
83d0: 00000028 andeq r0, r0, r8, lsr #32
000083d4 <__do_global_dtors_aux>:
83d4: e92d4030 stmdb sp!, {r4, r5, lr}
83d8: e59f5040 ldr r5, [pc, #64] ; 8420 <.text+0xb4>
83dc: e5d53000 ldrb r3, [r5]
83e0: e3530000 cmp r3, #0 ; 0x0
83e4: 18bd8030 ldmneia sp!, {r4, r5, pc}
83e8: e59f4034 ldr r4, [pc, #52] ; 8424 <.text+0xb8>
83ec: ea000004 b 8404 <__do_global_dtors_aux+0x30>
83f0: e5943000 ldr r3, [r4]
83f4: e2833004 add r3, r3, #4 ; 0x4
83f8: e5843000 str r3, [r4]
83fc: e1a0e00f mov lr, pc
8400: e1a0f002 mov pc, r2
8404: e5943000 ldr r3, [r4]
8408: e5932000 ldr r2, [r3]
840c: e3520000 cmp r2, #0 ; 0x0
8410: 1afffff6 bne 83f0 <__do_global_dtors_aux+0x1c>
8414: e3a03001 mov r3, #1 ; 0x1
8418: e5c53000 strb r3, [r5]
841c: e8bd8030 ldmia sp!, {r4, r5, pc}
8420: 00010928 andeq r0, r1, r8, lsr #18
8424: 00010924 andeq r0, r1, r4, lsr #18
00008428 <call___do_global_dtors_aux>:
8428: e52de004 str lr, [sp, #-4]!
842c: e49df004 ldr pc, [sp], #4
00008430 <frame_dummy>:
8430: e59f0018 ldr r0, [pc, #24] ; 8450 <.text+0xe4>
8434: e5903000 ldr r3, [r0]
8438: e3530000 cmp r3, #0 ; 0x0
843c: 01a0f00e moveq pc, lr
8440: e59f300c ldr r3, [pc, #12] ; 8454 <.text+0xe8>
8444: e3530000 cmp r3, #0 ; 0x0
8448: 01a0f00e moveq pc, lr
844c: eaffffc3 b 8360 <.text-0xc>
8450: 00010824 andeq r0, r1, r4, lsr #16
8454: 00000000 andeq r0, r0, r0
00008458 <call_frame_dummy>:
8458: e52de004 str lr, [sp, #-4]!
845c: e49df004 ldr pc, [sp], #4
00008510 <init_video>:
8510: e1a0c00d mov ip, sp
8514: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8518: e24cb004 sub fp, ip, #4 ; 0x4
851c: e3a0000a mov r0, #10 ; 0xa
8520: ebffffe2 bl 84b0 <init>
8524: e1a03000 mov r3, r0
8528: e1a00003 mov r0, r3
852c: e89da800 ldmia sp, {fp, sp, pc}
00008530 <init_usb>:
8530: e1a0c00d mov ip, sp
8534: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8538: e24cb004 sub fp, ip, #4 ; 0x4
853c: e3a0000c mov r0, #12 ; 0xc
8540: ebffffda bl 84b0 <init>
8544: e1a03000 mov r3, r0
8548: e1a00003 mov r0, r3
854c: e89da800 ldmia sp, {fp, sp, pc}
00008550 <entry>:
8550: e1a0c00d mov ip, sp
8554: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8558: e24cb004 sub fp, ip, #4 ; 0x4
855c: e3a00001 mov r0, #1 ; 0x1
8560: ebffffda bl 84d0 <switch_device>
8564: e1a03000 mov r3, r0
8568: e1a00003 mov r0, r3
856c: e89da800 ldmia sp, {fp, sp, pc}
00008570 <halt>:
8570: e1a0c00d mov ip, sp
8574: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8578: e24cb004 sub fp, ip, #4 ; 0x4
857c: e3a00000 mov r0, #0 ; 0x0
8580: ebffffd2 bl 84d0 <switch_device>
8584: e1a03000 mov r3, r0
8588: e1a00003 mov r0, r3
858c: e89da800 ldmia sp, {fp, sp, pc}
00008590 <error_video>:
8590: e1a0c00d mov ip, sp
8594: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8598: e24cb004 sub fp, ip, #4 ; 0x4
859c: e24dd004 sub sp, sp, #4 ; 0x4
85a0: e50b0010 str r0, [fp, #-16]
85a4: e51b0010 ldr r0, [fp, #-16]
85a8: ebffffd0 bl 84f0 <error_do>
85ac: e1a03000 mov r3, r0
85b0: e1a00003 mov r0, r3
85b4: e89da808 ldmia sp, {r3, fp, sp, pc}
000085b8 <error_usb>:
85b8: e1a0c00d mov ip, sp
85bc: e92dd800 stmdb sp!, {fp, ip, lr, pc}
85c0: e24cb004 sub fp, ip, #4 ; 0x4
85c4: e24dd004 sub sp, sp, #4 ; 0x4
85c8: e50b0010 str r0, [fp, #-16]
85cc: e51b0010 ldr r0, [fp, #-16]
85d0: ebffffc6 bl 84f0 <error_do>
85d4: e1a03000 mov r3, r0
85d8: e1a00003 mov r0, r3
85dc: e89da808 ldmia sp, {r3, fp, sp, pc}
000085e0 <error_entry>:
85e0: e1a0c00d mov ip, sp
85e4: e92dd800 stmdb sp!, {fp, ip, lr, pc}
85e8: e24cb004 sub fp, ip, #4 ; 0x4
85ec: e24dd004 sub sp, sp, #4 ; 0x4
85f0: e50b0010 str r0, [fp, #-16]
85f4: e51b0010 ldr r0, [fp, #-16]
85f8: ebffffbc bl 84f0 <error_do>
85fc: e1a03000 mov r3, r0
8600: e1a00003 mov r0, r3
8604: e89da808 ldmia sp, {r3, fp, sp, pc}
00008608 <error_halt>:
8608: e1a0c00d mov ip, sp
860c: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8610: e24cb004 sub fp, ip, #4 ; 0x4
8614: e24dd004 sub sp, sp, #4 ; 0x4
8618: e50b0010 str r0, [fp, #-16]
861c: e51b0010 ldr r0, [fp, #-16]
8620: ebffffb2 bl 84f0 <error_do>
8624: e1a03000 mov r3, r0
8628: e1a00003 mov r0, r3
862c: e89da808 ldmia sp, {r3, fp, sp, pc}
00008630 <main>:
8630: e1a0c00d mov ip, sp
8634: e92dd800 stmdb sp!, {fp, ip, lr, pc}
8638: e24cb004 sub fp, ip, #4 ; 0x4
863c: e24dd00c sub sp, sp, #12 ; 0xc
8640: ebffff86 bl 8460 <get_input>
8644: e1a03000 mov r3, r0
8648: e50b3010 str r3, [fp, #-16]
864c: e51b0010 ldr r0, [fp, #-16]
8650: ebffff88 bl 8478 <check_key>
8654: e1a03000 mov r3, r0
8658: e50b3014 str r3, [fp, #-20]
865c: e51b3014 ldr r3, [fp, #-20]
8660: e3530000 cmp r3, #0 ; 0x0
8664: 1a000000 bne 866c <main+0x3c>
8668: ebffff8a bl 8498 <to_poweroff>
866c: ebffffa7 bl 8510 <init_video>
8670: e1a03000 mov r3, r0
8674: e50b3018 str r3, [fp, #-24]
8678: e51b3018 ldr r3, [fp, #-24]
867c: e3530000 cmp r3, #0 ; 0x0
8680: 0a000001 beq 868c <main+0x5c>
8684: e51b0018 ldr r0, [fp, #-24]
8688: ebffffc0 bl 8590 <error_video>
868c: ebffffa7 bl 8530 <init_usb>
8690: e1a03000 mov r3, r0
8694: e50b3018 str r3, [fp, #-24]
8698: e51b3018 ldr r3, [fp, #-24]
869c: e3530000 cmp r3, #0 ; 0x0
86a0: 0a000001 beq 86ac <main+0x7c>
86a4: e51b0018 ldr r0, [fp, #-24]
86a8: ebffffc2 bl 85b8 <error_usb>
86ac: ebffffa7 bl 8550 <entry>
86b0: e1a03000 mov r3, r0
86b4: e50b3018 str r3, [fp, #-24]
86b8: e51b3018 ldr r3, [fp, #-24]
86bc: e3530000 cmp r3, #0 ; 0x0
86c0: 0a000001 beq 86cc <main+0x9c>
86c4: e51b0018 ldr r0, [fp, #-24]
86c8: ebffffc4 bl 85e0 <error_entry>
86cc: ebffffa7 bl 8570 <halt>
86d0: e1a03000 mov r3, r0
86d4: e50b3018 str r3, [fp, #-24]
86d8: e51b3018 ldr r3, [fp, #-24]
86dc: e3530000 cmp r3, #0 ; 0x0
86e0: 0a000001 beq 86ec <main+0xbc>
86e4: e51b0018 ldr r0, [fp, #-24]
86e8: ebffffc6 bl 8608 <error_halt>
86ec: e3a03000 mov r3, #0 ; 0x0
86f0: e1a00003 mov r0, r3
86f4: e24bd00c sub sp, fp, #12 ; 0xc
86f8: e89da800 ldmia sp, {fp, sp, pc}
000086fc <__libc_csu_init>:
86fc: e92d4470 stmdb sp!, {r4, r5, r6, sl, lr}
8700: e59fa04c ldr sl, [pc, #76] ; 8754 <.text+0x3e8>
8704: e08fa00a add sl, pc, sl
8708: ebffff04 bl 8320 <_init>
870c: e3a04000 mov r4, #0 ; 0x0
8710: e59f3040 ldr r3, [pc, #64] ; 8758 <.text+0x3ec>
8714: e79a3003 ldr r3, [sl, r3]
8718: e59f203c ldr r2, [pc, #60] ; 875c <.text+0x3f0>
871c: e79a2002 ldr r2, [sl, r2]
8720: e0623003 rsb r3, r2, r3
8724: e1540143 cmp r4, r3, asr #2
8728: 28bd8470 ldmcsia sp!, {r4, r5, r6, sl, pc}
872c: e1a06002 mov r6, r2
8730: e59f3020 ldr r3, [pc, #32] ; 8758 <.text+0x3ec>
8734: e79a3003 ldr r3, [sl, r3]
8738: e0625003 rsb r5, r2, r3
873c: e1a0e00f mov lr, pc
8740: e796f104 ldr pc, [r6, r4, lsl #2]
8744: e2844001 add r4, r4, #1 ; 0x1
8748: e1540145 cmp r4, r5, asr #2
874c: 3afffffa bcc 873c <__libc_csu_init+0x40>
8750: e8bd8470 ldmia sp!, {r4, r5, r6, sl, pc}
8754: 000081e4 andeq r8, r0, r4, ror #3
8758: 00000020 andeq r0, r0, r0, lsr #32
875c: 00000024 andeq r0, r0, r4, lsr #32
00008760 <__libc_csu_fini>:
8760: e92d4430 stmdb sp!, {r4, r5, sl, lr}
8764: e59fa048 ldr sl, [pc, #72] ; 87b4 <.text+0x448>
8768: e08fa00a add sl, pc, sl
876c: e59f3044 ldr r3, [pc, #68] ; 87b8 <.text+0x44c>
8770: e79a2003 ldr r2, [sl, r3]
8774: e59f3040 ldr r3, [pc, #64] ; 87bc <.text+0x450>
8778: e79a3003 ldr r3, [sl, r3]
877c: e0634002 rsb r4, r3, r2
8780: e1a04144 mov r4, r4, asr #2
8784: e2444001 sub r4, r4, #1 ; 0x1
8788: e3740001 cmn r4, #1 ; 0x1
878c: 0a000006 beq 87ac <__libc_csu_fini+0x4c>
8790: e59f3024 ldr r3, [pc, #36] ; 87bc <.text+0x450>
8794: e79a5003 ldr r5, [sl, r3]
8798: e1a0e00f mov lr, pc
879c: e795f104 ldr pc, [r5, r4, lsl #2]
87a0: e2444001 sub r4, r4, #1 ; 0x1
87a4: e3740001 cmn r4, #1 ; 0x1
87a8: 1afffffa bne 8798 <__libc_csu_fini+0x38>
87ac: eb000013 bl 8800 <_fini>
87b0: e8bd8430 ldmia sp!, {r4, r5, sl, pc}
87b4: 00008180 andeq r8, r0, r0, lsl #3
87b8: 00000018 andeq r0, r0, r8, lsl r0
87bc: 0000001c andeq r0, r0, ip, lsl r0
000087c0 <__do_global_ctors_aux>:
87c0: e92d4010 stmdb sp!, {r4, lr}
87c4: e59f3028 ldr r3, [pc, #40] ; 87f4 <.text+0x488>
87c8: e2434004 sub r4, r3, #4 ; 0x4
87cc: e5132004 ldr r2, [r3, #-4]
87d0: e3720001 cmn r2, #1 ; 0x1
87d4: 08bd8010 ldmeqia sp!, {r4, pc}
87d8: e1a03002 mov r3, r2
87dc: e1a0e00f mov lr, pc
87e0: e1a0f003 mov pc, r3
87e4: e5343004 ldr r3, [r4, #-4]!
87e8: e3730001 cmn r3, #1 ; 0x1
87ec: 1afffffa bne 87dc <__do_global_ctors_aux+0x1c>
87f0: e8bd8010 ldmia sp!, {r4, pc}
87f4: 00010818 andeq r0, r1, r8, lsl r8
000087f8 <call___do_global_ctors_aux>:
87f8: e52de004 str lr, [sp, #-4]!
87fc: e49df004 ldr pc, [sp], #4
Disassembly of section .fini:
00008800 <_fini>:
8800: e52de004 str lr, [sp, #-4]!
8804: ebfffef2 bl 83d4 <__do_global_dtors_aux>
8808: e49df004 ldr pc, [sp], #4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
这,是手动转的,还是自动转的?
可能的c 形式:
int init_video() //估计是有摄像头,具体看看你的设备里有没有
{
return(init(10));
}
int init_usb() //usb设备或控制器
{
return(init(12));
}
int entry()
{
return(switch_device(1));
}
int halt()
{
return(switch_device(0));
}
int error_video(int n)
{
return( error_do(n));
}
int error_usb(int n)
{
return(error_do(n));
}
int error_entry(int n)
{
return(error_do(n));
}
int error_halt(int n)
{
return(error_do(n));
}
int main()
{
int in;
int key;
int rtn;
in=get_input();
key=check_key(i);
if(key==0)
{
to_poweroff();
}
rtn=init_video();
if(rtn!=0)
{
error_video(rtn);
}
rtn=init_usb();
if(rtn!=0)
{
error_usb(rtn);
}
rtn=entry();
if(rtn!=0)
{
error_entry(rtn);
}
rtn=halt();
if(rtn!=0)
{
error_halt(rtn);
}
return(0);
}
//从代码里看,需要重点进一步分析一下error_do(...),init(...),switch_device(...)等.
_start是启动函数.
里面的init和编译器产生的_init不是一回事情.
至于main里做了什么? 把它转换为c的代码更容易看清楚些.
理论上可以
是,这样可行吗?
你的意思是,根据反汇编来看明白这段程序是做什么的?
比如<_start>: 和 <call_gmon_start>: 的作用,跟main和init是什么关系,main里又作了什么? 谢谢.
> 各个作用看的不是很明白
具体指什么?
先谢谢了.