fastcall: What happens with the stack?
I'm currently learning x64 assembly by myself and have trouble understanding what happen with the stack when calling an assembly procedure from c++.
From what I currently understand from MSDN and Intel, the first 4 integer/floating point parameters are stored in the rcx/xmm0, rdx/xmm1, r8/xmm2 and r9/xmm3 registers and all others will be placed on the stack.
I just do not understand why i have to access the 5th parameter 40 bytes from rsp [rsp+28h] instead of just 8 since the first 32 bytes are accessed in registers.
Can someone explain me what actually happens?
Thank you.
The key is in this phrase from the linked MSDN:
The x64 Application Binary Interface (ABI) is a 4 register fast-call calling convention, with stack-backing for those registers .
That is, the registers are loaded with the first 4 arguments, but nevertheless they have its space reserved in the stack. As @HansPassant notes in the comments below, the caller does not write into this shadow space, but it is available for the callee, should it need to save the registers (for example for calling another function).
链接地址: http://www.djcxy.com/p/19144.html上一篇: 内容('php:// input')返回JSON消息的字符串
下一篇: fastcall:堆栈会发生什么?