Author: tkreuzer Date: Mon Jun 20 11:27:55 2011 New Revision: 52379
URL: http://svn.reactos.org/svn/reactos?rev=52379&view=rev Log: [CRT] Implement call_ebp_func for msvc
Modified: trunk/reactos/lib/sdk/crt/except/cppexcept.c
Modified: trunk/reactos/lib/sdk/crt/except/cppexcept.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/except/cppexcep... ============================================================================== --- trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/except/cppexcept.c [iso-8859-1] Mon Jun 20 11:27:55 2011 @@ -41,24 +41,39 @@ EXCEPTION_REGISTRATION_RECORD* nested_frame, int nested_trylevel );
/* call a function with a given ebp */ -static inline void *call_ebp_func( void *func, void *ebp ) -{ - void *ret; +#ifdef _MSC_VER +#pragma warning(disable:4731) // don't warn about modification of ebp +#endif +static inline void *call_ebp_func( void *func, void *_ebp ) +{ + void *result; +#ifdef _MSC_VER + __asm + { + push ebx + push ebp + mov ebp, _ebp + call func + pop ebp + pop ebx + mov result, eax + } +#else int dummy; -#ifdef _MSC_VER -#pragma message ("call_ebp_func is unimplemented for MSC") -#else __asm__ __volatile__ ("pushl %%ebx\n\t" "pushl %%ebp\n\t" "movl %4,%%ebp\n\t" "call *%%eax\n\t" "popl %%ebp\n\t" "popl %%ebx" - : "=a" (ret), "=S" (dummy), "=D" (dummy) - : "0" (func), "1" (ebp) : "ecx", "edx", "memory" ); -#endif - return ret; -} + : "=a" (result), "=S" (dummy), "=D" (dummy) + : "0" (func), "1" (_ebp) : "ecx", "edx", "memory" ); +#endif + return result; +} +#ifdef _MSC_VER +#pragma warning(default:4731) +#endif
/* call a copy constructor */ static inline void call_copy_ctor( void *func, void *this, void *src, int has_vbase )