Moved the DEFINE_REGS_ENTRYPOINT macros to include/wine/port.h.

Removed the C fallback code, do that in the callers instead.
This commit is contained in:
Alexandre Julliard 2003-12-04 05:48:03 +00:00
parent 86c905ab0c
commit e85491274d
3 changed files with 46 additions and 144 deletions

View file

@ -227,7 +227,6 @@ static void EXC_DefaultHandling( EXCEPTION_RECORD *rec, CONTEXT *context )
/***********************************************************************
* RtlRaiseException (NTDLL.@)
*/
DEFINE_REGS_ENTRYPOINT_1( RtlRaiseException, EXC_RtlRaiseException, EXCEPTION_RECORD * );
void WINAPI EXC_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
{
PEXCEPTION_REGISTRATION_RECORD frame, dispatch, nested_frame;
@ -295,12 +294,21 @@ void WINAPI EXC_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
EXC_DefaultHandling( rec, context );
}
#ifdef DEFINE_REGS_ENTRYPOINT
DEFINE_REGS_ENTRYPOINT( RtlRaiseException, EXC_RtlRaiseException, 4, 4 );
#else
void WINAPI RtlRaiseException( EXCEPTION_RECORD *rec )
{
CONTEXT context;
memset( &context, 0, sizeof(context) );
EXC_RtlRaiseException( rec, &context );
}
#endif
/*******************************************************************
* RtlUnwind (NTDLL.@)
*/
DEFINE_REGS_ENTRYPOINT_4( RtlUnwind, EXC_RtlUnwind,
PVOID, PVOID, PEXCEPTION_RECORD, PVOID );
void WINAPI EXC_RtlUnwind( PEXCEPTION_REGISTRATION_RECORD pEndFrame, LPVOID unusedEip,
PEXCEPTION_RECORD pRecord, DWORD returnEax,
CONTEXT *context )
@ -372,12 +380,22 @@ void WINAPI EXC_RtlUnwind( PEXCEPTION_REGISTRATION_RECORD pEndFrame, LPVOID unus
}
}
#ifdef DEFINE_REGS_ENTRYPOINT
DEFINE_REGS_ENTRYPOINT( RtlUnwind, EXC_RtlUnwind, 16, 16 );
#else
void WINAPI RtlUnwind( PEXCEPTION_REGISTRATION_RECORD pEndFrame, LPVOID unusedEip,
PEXCEPTION_RECORD pRecord, DWORD returnEax )
{
CONTEXT context;
memset( &context, 0, sizeof(context) );
EXC_RtlUnwind( pEndFrame, unusedEip, pRecord, returnEax, &context );
}
#endif
/*******************************************************************
* NtRaiseException (NTDLL.@)
*/
DEFINE_REGS_ENTRYPOINT_3( NtRaiseException, EXC_NtRaiseException,
EXCEPTION_RECORD *, CONTEXT *, BOOL );
void WINAPI EXC_NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx,
BOOL first, CONTEXT *context )
{
@ -385,6 +403,17 @@ void WINAPI EXC_NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx,
*context = *ctx;
}
#ifdef DEFINE_REGS_ENTRYPOINT
DEFINE_REGS_ENTRYPOINT( NtRaiseException, EXC_NtRaiseException, 12, 12 );
#else
void WINAPI NtRaiseException( EXCEPTION_RECORD *rec, CONTEXT *ctx, BOOL first )
{
CONTEXT context;
memset( &context, 0, sizeof(context) );
EXC_NtRaiseException( rec, ctx, first, &context );
}
#endif
/***********************************************************************
* RtlRaiseStatus (NTDLL.@)

View file

@ -181,6 +181,18 @@ struct statfs;
#endif
/* Register functions */
#ifdef __i386__
#define DEFINE_REGS_ENTRYPOINT( name, fn, args, pop_args ) \
__ASM_GLOBAL_FUNC( name, \
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
".long " __ASM_NAME(#fn) "\n\t" \
".byte " #args "," #pop_args )
/* FIXME: add support for other CPUs */
#endif /* __i386__ */
/****************************************************************
* Function definitions (only when using libwine_port)
*/

View file

@ -1155,145 +1155,6 @@ typedef struct _CONTEXT
typedef CONTEXT *PCONTEXT;
#ifdef __WINESRC__
/* Macros to retrieve the current context */
#ifdef __i386__
#define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
__ASM_GLOBAL_FUNC( name, \
"call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
".long " __ASM_NAME(#fn) "\n\t" \
".byte " #args ", " #args )
#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
extern void WINAPI name(void); \
_DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
extern void WINAPI name( t1 a1 ); \
_DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
extern void WINAPI name( t1 a1, t2 a2 ); \
_DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
extern void WINAPI name( t1 a1, t2 a2, t3 a3 ); \
_DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
extern void WINAPI name( t1 a1, t2 a2, t3 a3, t4 a4 ); \
_DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
#endif /* __i386__ */
#ifdef __sparc__
#ifdef __SUNPRO_C
static DWORD __builtin_return_address(int p_iDepth)
{
asm("ta 3");
asm("tst %i0");
asm("be End");
asm("mov %fp, %l0");
asm("Start:");
asm("sub %i0, 1, %i0");
asm("tst %i0");
asm("bne Start");
asm("ld [%l0+56], %l0");
asm("End:");
asm("ld [%l0+60], %i0");
}
#endif
/* FIXME: use getcontext() to retrieve full context */
#define _GET_CONTEXT \
CONTEXT context; \
do { memset(&context, 0, sizeof(CONTEXT)); \
context.ContextFlags = CONTEXT_CONTROL; \
context.pc = (DWORD)__builtin_return_address(0); \
} while (0)
#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
void WINAPI name ( void ) \
{ _GET_CONTEXT; fn( &context ); }
#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
void WINAPI name ( t1 a1 ) \
{ _GET_CONTEXT; fn( a1, &context ); }
#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
void WINAPI name ( t1 a1, t2 a2 ) \
{ _GET_CONTEXT; fn( a1, a2, &context ); }
#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, &context ); }
#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
#endif /* __sparc__ */
#ifdef __powerpc__
/* FIXME: use getcontext() to retrieve full context */
#define _GET_CONTEXT \
CONTEXT context; \
do { memset(&context, 0, sizeof(CONTEXT)); \
context.ContextFlags = CONTEXT_CONTROL; \
} while (0)
#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
void WINAPI name ( void ) \
{ _GET_CONTEXT; fn( &context ); }
#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
void WINAPI name ( t1 a1 ) \
{ _GET_CONTEXT; fn( a1, &context ); }
#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
void WINAPI name ( t1 a1, t2 a2 ) \
{ _GET_CONTEXT; fn( a1, a2, &context ); }
#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, &context ); }
#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
#endif /* __powerpc__ */
#ifdef __ALPHA__
/* FIXME:
* use getcontext() to retrieve full context
* I dont know if this is correct for alpha as was ripped from
* PPC support.
*/
#define _GET_CONTEXT \
CONTEXT context; \
do { memset(&context, 0, sizeof(CONTEXT)); \
context.ContextFlags = CONTEXT_CONTROL; \
} while (0)
#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
void WINAPI name ( void ) \
{ _GET_CONTEXT; fn( &context ); }
#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
void WINAPI name ( t1 a1 ) \
{ _GET_CONTEXT; fn( a1, &context ); }
#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
void WINAPI name ( t1 a1, t2 a2 ) \
{ _GET_CONTEXT; fn( a1, a2, &context ); }
#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, &context ); }
#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
{ _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
#endif /* __ALPHA__ */
#ifndef DEFINE_REGS_ENTRYPOINT_0
#error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
#endif
#endif /* __WINESRC__ */
/*
* Language IDs
*/