C to assembly call convention 32bit vs 64bit

后端 未结 1 1861
野性不改
野性不改 2021-02-13 23:10

I have been following the excellent book Programming Ground Up, wanting to learn assembly. Although not in the book at this point, I wanted to call my assembly function from C.

相关标签:
1条回答
  • 2021-02-13 23:31

    64-bit C calling convention is: %rdi, %rsi, %rdx, %rcx, %r8 and %r9

    See full description here: "System V Application Binary Interface: AMD64 Architecture Processor Supplement" http://www.x86-64.org/documentation/abi.pdf

    3.2 Function Calling Sequence

    When I learned the same topic, I made small C programs with required functions, compiled them in 64 bit compiler and read the Assembly code produced by C compiler. C/C++ compiler can be used like kind of Assembly reference.

    0 讨论(0)
提交回复
热议问题