modified include/reactos/libs/pseh/pseh2.h

The return_twice and always_inline attributes don't mix: dump _SEH2PretendSetjmp, mark _SEH2EnterFrame as returns_twice (i.e. setjmp-like) instead, piggybacking the pretend-setjmp annotation on a function that's always called anyway. This ACTUALLY ensures GCC won't put variables in registers that might be clobbered by a SEH catch - at nearly no cost in binary code size and complexity

svn path=/trunk/; revision=38246
This commit is contained in:
KJK::Hyperion 2008-12-21 19:51:09 +00:00
parent 9b32d1a358
commit b4bf27864c

View file

@ -66,7 +66,7 @@ extern "C"
{
#endif
extern void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
extern __attribute__((returns_twice)) void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
extern void __cdecl _SEH2LeaveFrame(void);
extern void __cdecl _SEH2Return(void);
@ -131,23 +131,12 @@ void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
/* GCC doesn't know that this equals zero */
#define __SEH_VOLATILE_ZERO ({ int zero = 0; __asm__ __volatile__("#" : "+g" (zero)); zero; })
/* GCC believes this is setjmp */
#define __SEH_PRETEND_SETJMP() (_SEH2PretendSetjmp(), 0)
#define __SEH_VOLATILE_FALSE __builtin_expect(__SEH_VOLATILE_ZERO, 0)
#define __SEH_VOLATILE_TRUE __builtin_expect(!__SEH_VOLATILE_ZERO, 1)
#define ___SEH_STRINGIFY(X_) # X_
#define __SEH_STRINGIFY(X_) ___SEH_STRINGIFY(X_)
static
__inline__
__attribute__((returns_twice))
__attribute__((always_inline))
void _SEH2PretendSetjmp(void)
{
}
#define __SEH_FORCE_NEST \
__asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
@ -163,7 +152,6 @@ void _SEH2PretendSetjmp(void)
#define __SEH_RETURN_FINALLY() return
#define __SEH_BEGIN_TRY \
if(!__SEH_PRETEND_SETJMP()) \
{ \
__label__ _SEHEndTry; \
\