GCC fixes hookman_autogen
authorPavol Marko <pavolmarko@gmail.com>
Sat Nov 24 23:02:35 2007 +0000 (2007-11-24)
branchhookman_autogen
changeset 4745ae85f004e81
parent 473 79ed3766579b
child 475 20898390f369
GCC fixes
sourcehook/sourcehook_hookmangen.cpp
     1.1 --- a/sourcehook/sourcehook_hookmangen.cpp	Sat Nov 24 16:53:27 2007 +0000
     1.2 +++ b/sourcehook/sourcehook_hookmangen.cpp	Sat Nov 24 23:02:35 2007 +0000
     1.3 @@ -378,6 +378,8 @@
     1.4  				// :TODO: alignment here?
     1.5  				//  can't use normal alignment methods
     1.6  				//  because an unknown number of bytes has been pushed already (the other params)
     1.7 +
     1.8 +				// save eax
     1.9  				IA32_Push_Reg(&m_HookFunc, REG_EAX);
    1.10  
    1.11  				// compute dest addr to ECX
    1.12 @@ -398,6 +400,11 @@
    1.13  				IA32_Mov_Reg_Imm32(&m_HookFunc, REG_EDX, DownCastPtr(pi.pCopyCtor));
    1.14  				IA32_Call_Reg(&m_HookFunc, REG_EDX);
    1.15  
    1.16 +				// gcc: pop this ptr off the stack
    1.17 +				GCC_ONLY(IA32_Pop_Reg(&m_HookFunc, REG_ECX));
    1.18 +				// pop other params off the stack
    1.19 +				IA32_Pop_Reg(&m_HookFunc, REG_EAX);
    1.20 +
    1.21  				// restore eax
    1.22  				IA32_Pop_Reg(&m_HookFunc, REG_EAX);
    1.23  			}
    1.24 @@ -1883,7 +1890,7 @@
    1.25  			for (int i = 0; i < m_Proto.GetNumOfParams(); ++i)
    1.26  			{
    1.27  				IntPassInfo &pi = m_Proto.GetParam(i);
    1.28 -				if (pi.type == PassInfo::PassType_Object &&
    1.29 +				if (pi.type == PassInfo::PassType_Object && (pi.flags & PassInfo::PassFlag_ByVal) && 
    1.30  					(pi.flags & PassInfo::PassFlag_ODtor))
    1.31  				{
    1.32  					pi.flags |= PassFlag_ForcedByRef;