Search code examples
iphonecobjective-creverse-engineeringida

Can't decode a simple ARM function prototype from a dissasembly?


I can't figure out the prototype for this simple function:

In stack: stack screenshot

Function call:

function call screenshot

That's what I got so far, and it causes an error.

//No idea
void CameraDeviceCreate(int one,int two,int* three);

There are three registers used (R0,R1,R2) so there should be three arguments. Third one refers to a stack variable (I still don't get how that works). #0x28 (var_28) is only mentioned in the ADD call, not sure what it could be. Where did I make a mistake?

If I missed some info out tell me and I'll add it. This is from Camera.framework by the way.


Solution

  • Why do you think you have it wrong?

    Note, there is no guarantee that the third parameter is 'int*' - you need to look at what is in R4 at that point - I would guess its actually some sort of structure being pointed at, rather than an int.