employer cover photo
employer logo

VMware Interview Question

Explain x86 calling convention

Interview Answer

Anonymous

Feb 6, 2012

__cdecl: Caller: pushes params. on stack, pushes return PC. Callee: pushes current stack base pointer onto stack, sets SBP to current stack pointer, pushes/saves CPU registers (optionally), allocates local vars. on stack (optionally), does the work, release local vars (if allocated), restores CPU registers (if saved), restores SBP, jumps to return PC address, return value is in EAX register. Caller: pops off params. off of stack.