thế nào là giá trị của 28h
(thập phân 40) được trừ vào rsp
tính như sau:alignment Stack trong lắp ráp x64
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
từ: http://www.japheth.de/JWasm/Win64_1.html
Bằng sự hiểu biết của tôi, tôi sẽ phải chỉ trừ 20h
vì mỗi giá trị tôi đang sử dụng mất 8 byte thành 4 là 20h
. vậy tại sao là 28h
bị trừ và cách đó dẫn đến căn chỉnh 16 byte?
xem thêm Is reserving stack space necessary for functions less than four arguments?
@mbratch thanks :). xin vui lòng gửi như câu trả lời. – vandale
Điều chắc chắn. Cảm ơn. :) – lurker