mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-30 04:13:33 +00:00
modified include/reactos/libs/pseh/pseh2.h
Trampoline-related definitions are no longer necessary in the public header modified lib/pseh/i386/framebased-gcchack.c Don't use byte arrays when you mean unaligned field, Arch: use __attribute__((packed)) instead, and gcc will thank you for not violating strong aliasing svn path=/trunk/; revision=42737
This commit is contained in:
@@ -87,43 +87,6 @@ extern void __cdecl _SEH2Return(void);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
typedef struct __SEHTrampoline
|
||||
{
|
||||
unsigned char STR_MovEcx;
|
||||
unsigned char STR_Closure[4];
|
||||
unsigned char STR_Jmp;
|
||||
unsigned char STR_Function[4];
|
||||
}
|
||||
_SEHTrampoline_t;
|
||||
|
||||
static
|
||||
__inline__
|
||||
__attribute__((always_inline))
|
||||
int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;
|
||||
}
|
||||
|
||||
static
|
||||
__inline__
|
||||
__attribute__((always_inline))
|
||||
void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return (void *)(*(int *)(&trampoline_->STR_Function[0]) + (int)(trampoline_ + 1));
|
||||
}
|
||||
|
||||
static
|
||||
__inline__
|
||||
__attribute__((always_inline))
|
||||
void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return (void *)*(int *)(&trampoline_->STR_Closure[0]);
|
||||
}
|
||||
#else
|
||||
#error TODO
|
||||
#endif
|
||||
|
||||
/* A no-op side effect that scares GCC */
|
||||
#define __SEH_SIDE_EFFECT __asm__ __volatile__("#")
|
||||
|
||||
|
||||
@@ -42,6 +42,34 @@ extern DECLSPEC_NORETURN int __SEH2Handle(void *, void *, void *, void *, void *
|
||||
extern int __cdecl __SEH2FrameHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
||||
extern int __cdecl __SEH2UnwindHandler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
|
||||
|
||||
typedef struct __SEHTrampoline
|
||||
{
|
||||
unsigned char STR_MovEcx;
|
||||
unsigned char * STR_Closure;
|
||||
unsigned char STR_Jmp;
|
||||
unsigned char * STR_Function;
|
||||
}
|
||||
__attribute__((packed))
|
||||
_SEHTrampoline_t;
|
||||
|
||||
FORCEINLINE
|
||||
int _SEHIsTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return trampoline_->STR_MovEcx == 0xb9 && trampoline_->STR_Jmp == 0xe9;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
void * _SEHFunctionFromTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return (int)(trampoline_ + 1) + trampoline_->STR_Function;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
void * _SEHClosureFromTrampoline(_SEHTrampoline_t * trampoline_)
|
||||
{
|
||||
return trampoline_->STR_Closure;
|
||||
}
|
||||
|
||||
FORCEINLINE
|
||||
_SEH2Registration_t * __cdecl _SEH2CurrentRegistration(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user