开发者

Problem with understanding arm assembly code structure

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
0000e03开发者_StackOverflow中文版c    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


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 instruction

0000e03c    e59f4070    ldr r4, [pc, #112]  ; 0xe0b4

loads the value 0x001d22d0 from the address 0xe0b4 into register r4.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜