iPhone神秘组装

时间:2011-02-04 20:09:22

标签: iphone assembly reverse-engineering

我正在研究一个iPhone-assembly函数,其中包含对函数open和fcntl的调用。一般不熟悉汇编语言我无法理解程序执行。我想知道的是open和fcntl函数的参数。任何其他解释这个函数的功能也是最受欢迎的。

代码:

-[Utilities openFileAsset]:    
00000a94        b590    push    {r4, r7, lr}  
00000a96        af01    add r7, sp, #4  
00000a98        b088    sub sp, #32  
00000a9a        ab01    add r3, sp, #4  
00000a9c        6018    str r0, [r3, #0]  
00000a9e        466b    mov r3, sp  
00000aa0        6019    str r1, [r3, #0]  
00000aa2        ab01    add r3, sp, #4  
00000aa4        681a    ldr r2, [r3, #0]  
00000aa6        4b4a    ldr r3, [pc, #296]  (0xbd0)  
00000aa8        447b    add r3, pc  
00000aaa        681b    ldr r3, [r3, #0]  
00000aac        1c10    adds    r0, r2, #0  
00000aae        1c19    adds    r1, r3, #0  
00000ab0    f001ee46    blx 0x2740  ; symbol stub for: _objc_msgSend  
00000ab4        1c03    adds    r3, r0, #0  
00000ab6        b2db    uxtb    r3, r3  
00000ab8        2b00    cmp r3, #0  
00000aba        d100    bne.n   0xabe  
00000abc        e086    b.n 0xbcc  
00000abe        4b45    ldr r3, [pc, #276]  (0xbd4)  
00000ac0        447b    add r3, pc  
00000ac2        681b    ldr r3, [r3, #0]  
00000ac4        681b    ldr r3, [r3, #0]  
00000ac6        1c1a    adds    r2, r3, #0  
00000ac8        4b43    ldr r3, [pc, #268]  (0xbd8)  
00000aca        447b    add r3, pc  
00000acc        681b    ldr r3, [r3, #0]  
00000ace        1c10    adds    r0, r2, #0  
00000ad0        1c19    adds    r1, r3, #0  
00000ad2        2201    movs    r2, #1  
00000ad4    f001ee34    blx 0x2740  ; symbol stub for: _objc_msgSend  
00000ad8        1c02    adds    r2, r0, #0  
00000ada        23f0    movs    r3, #240  
00000adc        005b    lsls    r3, r3, #1  
00000ade        1c10    adds    r0, r2, #0  
00000ae0        2102    movs    r1, #2  
00000ae2        1c1a    adds    r2, r3, #0  
00000ae4    f001ee84    blx 0x27f0  ; symbol stub for: _open  
00000ae8        1c02    adds    r2, r0, #0  
00000aea        4b3c    ldr r3, [pc, #240]  (0xbdc)  
00000aec        447b    add r3, pc  
00000aee        681b    ldr r3, [r3, #0]  
00000af0        601a    str r2, [r3, #0]  
00000af2        4b3b    ldr r3, [pc, #236]  (0xbe0)  
00000af4        447b    add r3, pc  
00000af6        681b    ldr r3, [r3, #0]  
00000af8        681b    ldr r3, [r3, #0]  
00000afa        1c18    adds    r0, r3, #0  
00000afc        2104    movs    r1, #4  
00000afe        2204    movs    r2, #4  
00000b00    f001ee0e    blx 0x2720  ; symbol stub for: _fcntl  

1 个答案:

答案 0 :(得分:1)

您需要获取ARM ABI文档。

只要你只需要第一个或第一个参数,Greg的“so you crashed in objc_msgSend()”就是一个很好的参考(我一直都在使用它)。

(剧透:前三个参数是r0,r1和r2 ......或多或少)