ext_8103: (Default)
ext_8103 ([identity profile] ewx.livejournal.com) wrote in [personal profile] ewx 2008-03-14 02:23 pm (UTC)

It always passes 64 bits, even if it doesn't know anything about the called function. Source code:

#include <stdarg.h>
#include <stddef.h>

int f(int x, ...);

void g(void) {
  f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, NULL, 99);
}

(Lots of args because if you only have a few they end up in registers instead of on the stack.)

Assembler fragment:

        addi    r11,r0,15
        std     r11,160(SP)
        addi    r11,r0,0
        std     r11,168(SP)
        addi    r11,r0,99
        std     r11,176(SP)

If you turn on optimization then the assembler is harder to read as things are re-ordered rather, but it's still all std.


Post a comment in response:

(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org