diff options
Diffstat (limited to 'source/c-calling-conventions.rst')
-rw-r--r-- | source/c-calling-conventions.rst | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source/c-calling-conventions.rst b/source/c-calling-conventions.rst new file mode 100644 index 0000000..06ae61e --- /dev/null +++ b/source/c-calling-conventions.rst @@ -0,0 +1,22 @@ +C calling conventions +===================== + +cdecl (Windows X86) +------------------- + +Subroutine arguments are passed on the stack. + +Integer values and memory addresses are returned in the EAX register + +Registers EAX, ECX, and EDX are caller-saved, and the rest are callee-saved. [#wiki-call-conv]_ + +Other +----- + +GCC keeps stack aligned to 16 bytes because called function may be SSE2 instruction that requires alignment to 16 bytes. [#gcc-stack-alignment]_ + +Footnotes +--------- + +.. [#wiki-call-conv] https://en.wikipedia.org/wiki/X86_calling_conventions +.. [#gcc-stack-alignment] `StackOverflow: why does the compiler subtract value on ESP <https://stackoverflow.com/q/38128940>`_ |