Exercise 2: What Shadow Space Is, and Why System V Has No Equivalent — Possible Solution ==================================================================== WHAT SHADOW SPACE IS ------------------------------ Per this chapter's own example, the Microsoft x64 convention requires the CALLER to reserve 32 bytes of space on the stack immediately before every function call — in the example, via SUB RSP, 32 — regardless of whether the function being called actually needs to use the stack for its arguments at all. This 32 bytes is set aside specifically so the called function has guaranteed scratch space available on the stack if it needs it, even when all of its arguments were already passed in registers (RCX, RDX, R8, R9 in the example) rather than on the stack. WHY IT'S REQUIRED EVEN WHEN ARGUMENTS FIT IN REGISTERS ------------------------------ Per this chapter's own wording, shadow space is reserved "even if all arguments fit in registers" — it isn't there to hold argument overflow (that's a separate, additional stack usage for a 5th or later argument). It's simply mandatory reserved space the Microsoft x64 convention guarantees will always be present for the callee to use, as part of the calling contract itself. WHY SYSTEM V HAS NO EQUIVALENT ------------------------------ Per this chapter's own comparison table, the System V AMD64 ABI simply doesn't include this requirement at all — its own contract between caller and callee never promises any guaranteed extra stack space beyond what's actually needed for genuine argument overflow. This is exactly the kind of divergence this chapter's own broader point is built around: the two conventions aren't just "the same idea with different register names" — they're two genuinely separate real contracts, and shadow space is a concrete requirement that exists in one and simply has no counterpart in the other at all. WHY THIS WORKS AS AN ANSWER ------------------------------ It explains shadow space using the chapter's own SUB RSP, 32 example, clarifies that it's unconditionally required rather than tied to argument count, and states plainly that System V has no matching requirement rather than assuming the two conventions must be structurally equivalent.