I am looking at some x86 code, which I believe was built using a Microsoft tool chain, and am trying to figure out the calling convention used during this call:
push esi ; save ESI (it gets restored later) lea esi, [ebp-0xC] ; set param 1 for call to FOO call FOO test eax, eax ; test return value jz somelabel The function FOO starts like this:
FOO: mov edi, edi push ebx xor ebx, ebx push ebx ; null push esi ; pass ESI in as second param to upcoming call, which has been set by caller push ptr blah mov [esi+0x8], ebx mov [esi+0x4], ebx mov [esi], ebx call InterlockedCompareExchange ; known stdcall func which takes 3 params test eax, eax ... as ESI is not initialized in the body of FOO, I have assumed it is passed in as a param by the caller.
What is this calling convention? It looks to be a variant of fastcall. Is there a name for this convention?
structpassed through the arguments ? Theesiwill be the base address and access to each field is passed through several offsets. No ?