This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion
  • Note: This was originally posted on 24th July 2009 at http://forums.arm.com

    forumer,

    The simple piece of information you appear to be missing is that the double representation of 12.0 requires two ARM registers (in this case r2 and r3), and has the hexidecimal equivalent of 0x4028000000000000.

    Thus, the parameters for:

    [font="Courier New"]printf("Foo %d %f %d\n", 34, (12.0), 67);[/font]

    are passed as:

    [font="Courier New"]r0 = char * = "Foo %d %f %d\n"
    r1 = int = 0x22 = 34
    {r2,r3} = double = 0x40280...00 = 12.0
    sp[0] = int = 0x43 = 67[/font]

    hth
    s.
  • Note: This was originally posted on 25th July 2009 at http://forums.arm.com

    Why does LR holds 0x42 ?


    LR actually holds 0x43 and is used as a temporary register to store the 4th argument (3rd variadic one) on the stack - at offset 0x11020.  After registers R0 to R3 are used, generally, other arguments are passed on the stack...