[ros-diffs] [hyperion] 42737: 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

hyperion at svn.reactos.org hyperion at svn.reactos.org
Sun Aug 16 18:40:52 CEST 2009


Author: hyperion
Date: Sun Aug 16 18:40:52 2009
New Revision: 42737

URL: http://svn.reactos.org/svn/reactos?rev=42737&view=rev
Log:
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

Modified:
    trunk/reactos/include/reactos/libs/pseh/pseh2.h
    trunk/reactos/lib/pseh/i386/framebased-gcchack.c

Modified: trunk/reactos/include/reactos/libs/pseh/pseh2.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/libs/pseh/pseh2.h?rev=42737&r1=42736&r2=42737&view=diff
==============================================================================
--- trunk/reactos/include/reactos/libs/pseh/pseh2.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/libs/pseh/pseh2.h [iso-8859-1] Sun Aug 16 18:40:52 2009
@@ -85,43 +85,6 @@
 
 #ifdef __cplusplus
 }
-#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 */

Modified: trunk/reactos/lib/pseh/i386/framebased-gcchack.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/pseh/i386/framebased-gcchack.c?rev=42737&r1=42736&r2=42737&view=diff
==============================================================================
--- trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] (original)
+++ trunk/reactos/lib/pseh/i386/framebased-gcchack.c [iso-8859-1] Sun Aug 16 18:40:52 2009
@@ -41,6 +41,34 @@
 extern DECLSPEC_NORETURN int __SEH2Handle(void *, 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)




More information about the Ros-diffs mailing list