#if defined(_TARGET_X86_)
MetaSig sig(pMD);
int numRegistersUsed = 0;
+ UINT16 cbRetPop = 0;
//
// m_cbStackArgSize represents the number of arg bytes for the MANAGED signature
m_cbStackArgSize = 0;
int offs = 0;
+
+#ifdef UNIX_X86_ABI
+ if (HasRetBuffArgUnmanagedFixup(&sig))
+ {
+ // callee should pop retbuf
+ numRegistersUsed += 1;
+ offs += STACK_ELEM_SIZE;
+ cbRetPop += STACK_ELEM_SIZE;
+ }
+#endif // UNIX_X86_ABI
+
for (UINT i = 0 ; i < sig.NumFixedArgs(); i++)
{
TypeHandle thValueType;
new (&sigInfo) PInvokeStaticSigInfo(pMD);
else
new (&sigInfo) PInvokeStaticSigInfo(GetSignature(), GetModule());
-
if (sigInfo.GetCallConv() == pmCallConvCdecl)
{
- // caller pop
- m_cbRetPop = 0;
+ m_cbRetPop = cbRetPop;
}
else
{
- // callee pop
- m_cbRetPop = static_cast<UINT16>(m_cbActualArgSize);
+ // For all the other calling convention except cdecl, callee pops the stack arguments
+ m_cbRetPop = cbRetPop + static_cast<UINT16>(m_cbActualArgSize);
}
#else // _TARGET_X86_
//
int numRegistersUsed = 0;
+#ifdef UNIX_X86_ABI
+ if (HasRetBuffArgUnmanagedFixup(&sig))
+ {
+ // Pass retbuf via Ecx
+ numRegistersUsed += 1;
+ pArgRegs->Ecx = *((UINT32 *)pCurSrc);
+ pCurSrc += STACK_ELEM_SIZE;
+ }
+#endif // UNIX_X86_ABI
+
for (UINT i = 0 ; i < sig.NumFixedArgs(); i++)
{
TypeHandle thValueType;