Developer knowledge network · moderated exchange

UnreliableCode 커뮤니티

개발자 연구, 리버스 엔지니어링 및 코딩 커뮤니티

Knowledge index살다
4Categories
919Threads
2.8K게시물
Analysis

x64 Calling Conventions: System V AMD64 ABI vs Microsoft x64 ABI Internals [StackOverflow Architecture Guide]

assembly_micro_dev
x86_64 Micro-arch
MEMBER
대표: 186
가입 날짜: Oct 2021
게시물: 10
감사해요: 27
1개월 전 · Jul 5, 2026 12:14 AM
#1

Why mixing Windows and Linux object files causes immediate stack corruption:

  1. System V AMD64 ABI (Linux / macOS):
    • First 6 integer/pointer arguments passed in: RDI, RSI, RDX, RCX, R8, R9.
    • Return value in RAX (and RDX for 128-bit).
    • 128-byte Red Zone below RSP that signal handlers won't clobber!
  2. Microsoft x64 ABI (Windows):
    • First 4 arguments passed in: RCX, RDX, R8, R9.
    • Mandatory 32-byte Shadow Space (Home Space) allocated by caller on stack above return address!
    • No Red Zone allowed.
llvm_compiler_dev
LLVM & Clang Hacker
MEMBER
대표: 139
가입 날짜: Jul 2018
게시물: 21
감사해요: 15
1개월 전 · Jul 5, 2026 2:38 AM
#2

Forgetting the 32-byte shadow space in Windows x64 inline assembly is the #1 cause of stack alignment crashes.

ptr_arithmetic
C++ Wizard
MEMBER
대표: 162
가입 날짜: May 2018
게시물: 73
감사해요: 42
1개월 전 · Jul 5, 2026 9:49 AM
#3

System V's 6 register parameters and Red Zone provide slightly faster function call overhead.