[Verse 1] When your program needs a helper, time to make the call Arguments get pushed in order, stacking up the wall Caller saves its precious registers, EAX and ECX and EDX Before it jumps to foreign code, protecting what comes next [Chorus] Push the params, make the jump Stack grows down, frame builds up Save the state, pass control Return address, that's the goal EBP points to local space ESP tracks the growing chase Function calls, the sacred dance Parameters in neat advance [Verse 2] Callee grabs the stack pointer, builds a brand new frame Prologue sets the base pointer, playing by the game Arguments sit just above, locals down below Return address sandwiched tight where control will flow [Chorus] Push the params, make the jump Stack grows down, frame builds up Save the state, pass control Return address, that's the goal EBP points to local space ESP tracks the growing chase Function calls, the sacred dance Parameters in neat advance [Bridge] CDECL cleans from caller side STDCALL lets the callee decide Fastcall races through registers THISCALL knows its ministers Stack unwinding, frame by frame Epilogue restores the game [Verse 3] Return value rides in EAX, the designated throne Caller must restore the stack to claim what it now owns Registers get their old values, state comes flooding back Function call complete at last, no memory to lack [Chorus] Push the params, make the jump Stack grows down, frame builds up Save the state, pass control Return address, that's the goal EBP points to local space ESP tracks the growing chase Function calls, the sacred dance Parameters in neat advance [Outro] From caller to callee and back again The stack remembers where we've been Assembly's handshake, tried and true Function calls will carry you
← The Stack and Stack Operations | Bit Manipulation and Logical Operations →