理解arm汇编代码结构的问题
代码列出如下,我想知道在结尾部分
0000e0b4 001d22d0 ldrsbeq r2, [sp], -r0
这是否对这行代码进行计算,因为它加载了结尾部分中定义的地址
0000e03c e59f4070 ldr r4, [pc, #112] ; 0xe0b4
以及为什么代码以这种方式组织?
-[Cube message1]:
0000e02c e92d40f0 push {r4, r5, r6, r7, lr}
0000e030 e28d700c add r7, sp, #12 ; 0xc
0000e034 e24dd008 sub sp, sp, #8 ; 0x8
0000e038 e59f1070 ldr r1, [pc, #112] ; 0xe0b0
0000e03c e59f4070 ldr r4, [pc, #112] ; 0xe0b4
0000e040 e1a06000 mov r6, r0
0000e044 e591e000 ldr lr, [r1]
0000e048 e5941000 ldr r1, [r4]
0000e04c e59e5000 ldr r5, [lr]
0000e050 e7900005 ldr r0, [r0, r5]
0000e054 eb05a78f bl 0x177e98
0000e058 e59f9058 ldr r9, [pc, #88] ; 0xe0b8
0000e05c e59f2058 ldr r2, [pc, #88] ; 0xe0bc
0000e060 e59fc058 ldr ip, [pc, #88] ; 0xe0c0
0000e064 e5921000 ldr r1, [r2]
0000e068 e59c4000 ldr r4, [ip]
0000e06c e1a05000 mov r5, r0
0000e070 e5990000 ldr r0, [r9]
0000e074 eb05a787 bl 0x177e98
0000e078 e1a01004 mov r1, r4
0000e07c e1a02000 mov r2, r0
0000e080 e1a00005 mov r0, r5
0000e084 eb05a783 bl 0x177e98
0000e088 e59f0034 ldr r0, [pc, #52] ; 0xe0c4
0000e08c e59f1034 ldr r1, [pc, #52] ; 0xe0c8
0000e090 e58d6000 str r6, [sp]
0000e094 e5903000 ldr r3, [r0]
0000e098 e5911000 ldr r1, [r1]
0000e09c e1a0000d mov r0, sp
0000e0a0 e58d3004 str r3, [sp, #4]
0000e0a4 eb05a77e bl 0x177ea4
0000e0a8 e247d00c sub sp, r7, #12 ; 0xc
0000e0ac e8bd80f0 pop {r4, r5, r6, r7, pc}
0000e0b0 001c2094 mulseq ip, r4, r0
0000e0b4 001d22d0 ldrsbeq r2, [sp], -r0
0000e0b8 001d65b4 ldrheq r6, [sp], -r4
0000e0bc 001d2204 andseq r2, sp, r4, lsl #4
0000e0c0 001d24c8 andseq r2, sp, r8, asr #9
0000e0c4 001d88c0 andseq r8, sp, r0, asr #17
0000e0c8 001d2494 mulseq sp, r4, r4
code is listed as follows, I want to know in the ending part
0000e0b4 001d22d0 ldrsbeq r2, [sp], -r0
does this do calculation for this line of code since it loads the address defined in the ending part
0000e03c e59f4070 ldr r4, [pc, #112] ; 0xe0b4
and why are code organized in this way?
-[Cube message1]:
0000e02c e92d40f0 push {r4, r5, r6, r7, lr}
0000e030 e28d700c add r7, sp, #12 ; 0xc
0000e034 e24dd008 sub sp, sp, #8 ; 0x8
0000e038 e59f1070 ldr r1, [pc, #112] ; 0xe0b0
0000e03c e59f4070 ldr r4, [pc, #112] ; 0xe0b4
0000e040 e1a06000 mov r6, r0
0000e044 e591e000 ldr lr, [r1]
0000e048 e5941000 ldr r1, [r4]
0000e04c e59e5000 ldr r5, [lr]
0000e050 e7900005 ldr r0, [r0, r5]
0000e054 eb05a78f bl 0x177e98
0000e058 e59f9058 ldr r9, [pc, #88] ; 0xe0b8
0000e05c e59f2058 ldr r2, [pc, #88] ; 0xe0bc
0000e060 e59fc058 ldr ip, [pc, #88] ; 0xe0c0
0000e064 e5921000 ldr r1, [r2]
0000e068 e59c4000 ldr r4, [ip]
0000e06c e1a05000 mov r5, r0
0000e070 e5990000 ldr r0, [r9]
0000e074 eb05a787 bl 0x177e98
0000e078 e1a01004 mov r1, r4
0000e07c e1a02000 mov r2, r0
0000e080 e1a00005 mov r0, r5
0000e084 eb05a783 bl 0x177e98
0000e088 e59f0034 ldr r0, [pc, #52] ; 0xe0c4
0000e08c e59f1034 ldr r1, [pc, #52] ; 0xe0c8
0000e090 e58d6000 str r6, [sp]
0000e094 e5903000 ldr r3, [r0]
0000e098 e5911000 ldr r1, [r1]
0000e09c e1a0000d mov r0, sp
0000e0a0 e58d3004 str r3, [sp, #4]
0000e0a4 eb05a77e bl 0x177ea4
0000e0a8 e247d00c sub sp, r7, #12 ; 0xc
0000e0ac e8bd80f0 pop {r4, r5, r6, r7, pc}
0000e0b0 001c2094 mulseq ip, r4, r0
0000e0b4 001d22d0 ldrsbeq r2, [sp], -r0
0000e0b8 001d65b4 ldrheq r6, [sp], -r4
0000e0bc 001d2204 andseq r2, sp, r4, lsl #4
0000e0c0 001d24c8 andseq r2, sp, r8, asr #9
0000e0c4 001d88c0 andseq r8, sp, r0, asr #17
0000e0c8 001d2494 mulseq sp, r4, r4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
e0b4
处的“指令”是数据而不是代码;它被放置在函数之后,位于从未执行过的地址处,因此可以使用 PC 相对寻址来加载它。因此,该指令将地址
0xe0b4
中的值0x001d22d0
加载到寄存器r4
中。The "instruction" at
e0b4
is data not code; it's placed after the function, at an address that's never executed, so it can be loaded using PC-relative addressing. So the instructionloads the value
0x001d22d0
from the address0xe0b4
into registerr4
.