How C structures get passed to function in assembly?

后端 未结 3 1276
眼角桃花
眼角桃花 2021-01-22 09:10

1)How C structures get passed to function in assembly. I mean pass by value, not pass by reference. 2)By the way, how callees return structure to its callers? I\'m so sorry for

3条回答
  •  攒了一身酷
    2021-01-22 09:51

    It depends on the ABI for your system. On x86_64, most systems use SYSV ABI fo AMD64 -- the exception being Microsoft, who use their own non-standard ABI.

    On either of those ABIs, this structure will be passed on the stack, which is what is happening in the code -- first s is constructed in main's stack frame, then a copy of it is pushed on the stack (the 4 pushq instructions).

提交回复
热议问题