2010-06-19 3 views
0

코드가 다음과 같이 나열되어, 나는 끝 부분에 알고 싶은문제가

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 
+0

와우, 나는 'ldrsbeq'에 대한 Google 검색을 수행했으며이 질문은 두 번째 결과입니다. – ChaosPandion

답변

5

e0b4의 "instruction"은 데이터가 아닙니다. 그것은 결코 실행되지 않는 주소에 함수 뒤에 위치하므로 PC 상대 주소 지정을 사용하여로드 할 수 있습니다. 그래서 명령

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

부하 레지스터 r4에 주소 0xe0b4의 값 0x001d22d0.

+0

나는 그 귀환을 알아 차렸을 것이다. ;-) –

+0

수익은 정확히 어디입니까? 편집 : 방금 팝업 PC를 보았다 : –

+0

여기에 나열되지 않은 일부 지점에서 푸시 lr과 팝 PC 반환했다. 때로는 bx lr, mov pc, lr 또는 ldmia sp!, {... lr} –