what is the value of 28h (decimal 40), which is subtracted from rsp , calculated as follows:
option casemap:none includelib kernel32.lib includelib user32.lib externdef MessageBoxA : near externdef ExitProcess : near .data text db 'Hello world!', 0 caption db 'Hello x86-64', 0 .code main proc sub rsp, 28h ; space for 4 arguments + 16byte aligned stack xor r9d, r9d ; 4. argument: r9d = uType = 0 lea r8, [caption] ; 3. argument: r8 = caption lea rdx, [text] ; 2. argument: edx = window text xor rcx, rcx ; 1. argument: rcx = hWnd = NULL call MessageBoxA xor ecx, ecx ; ecx = exit code call ExitProcess main endp end
from: http://www.japheth.de/JWasm/Win64_1.html
In my opinion, I would only have to subtract 20h , since each value I use takes 8 bytes in 4, it's 20h . therefore, why is 28h subtracted and how does this result in 16-byte alignment?
see also Does the stack space save for functions with less than four arguments?
assembly
vandale Oct 02 '13 at 0:45 2013-10-02 00:45
source share