Introduction To 64 Bit Windows Assembly Program... File

Each of these registers can be accessed in smaller chunks. For example, the lower 32 bits of RAX are referred to as EAX, the lower 16 bits as AX, and the lower 8 bits as AL. The Windows x64 Calling Convention

; External Windows functions extern GetStdHandle extern WriteFile extern ExitProcess section .data msg db "Hello, 64-bit World!", 0 msg_len equ $ - msg section .bss bytes_written resq 1 section .text global main main: sub rsp, 40 ; Reserve shadow space + align stack ; Get handle to standard output mov rcx, -11 ; STD_OUTPUT_HANDLE call GetStdHandle mov r12, rax ; Save handle in r12 ; Write to the console mov rcx, r12 ; Arg 1: Handle lea rdx, [rel msg] ; Arg 2: Buffer address mov r8, msg_len ; Arg 3: Length lea r9, [rel bytes_written] ; Arg 4: Pointer to written count mov qword [rsp + 32], 0 ; Arg 5: Overlapped (on stack) call WriteFile ; Exit the program xor rcx, rcx ; Return code 0 call ExitProcess Use code with caution. Copied to clipboard Introduction to 64 Bit Windows Assembly Program...

Shadow Space: Even if a function takes fewer than four arguments, the caller must reserve 32 bytes of "shadow space" on the stack before making the call. This space allows the called function to save those four register-based arguments if necessary. Each of these registers can be accessed in smaller chunks

RBP, RSP: Pointer registers. RSP is the stack pointer, while RBP is the base pointer. Copied to clipboard Shadow Space: Even if a