mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 17:34:57 +00:00
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:
parent
9b32d1a358
commit
b4bf27864c
1 changed files with 1 additions and 13 deletions
|
@ -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; \
|
||||
\
|
||||
|
|
Loading…
Reference in a new issue