[ros-diffs] [hyperion] 37601: Allow pseh.h and pseh2.h to be included in the same compilation unit. Mixing PSEH and PSEH 2.0 macros in the same function isn't safe yet, though

hyperion at svn.reactos.org hyperion at svn.reactos.org
Mon Nov 24 00:00:37 CET 2008


Author: hyperion
Date: Sun Nov 23 17:00:37 2008
New Revision: 37601

URL: http://svn.reactos.org/svn/reactos?rev=37601&view=rev
Log:
Allow pseh.h and pseh2.h to be included in the same compilation unit. Mixing PSEH and PSEH 2.0 macros in the same function isn't safe yet, though

Modified:
    trunk/reactos/include/reactos/libs/pseh/pseh2.h

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=37601&r1=37600&r2=37601&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 Nov 23 17:00:37 2008
@@ -31,7 +31,7 @@
 struct _EXCEPTION_POINTERS;
 struct _CONTEXT;
 
-typedef int (__cdecl * _SEHFrameHandler_t)
+typedef int (__cdecl * _SEH2FrameHandler_t)
 (
 	struct _EXCEPTION_RECORD *,
 	void *,
@@ -94,12 +94,12 @@
 /* Soft memory barrier */
 #define __SEH_BARRIER __asm__ __volatile__("#":::"memory")
 
-typedef struct __SEHRegistration
-{
-	struct __SEHRegistration * SER_Prev;
-	_SEHFrameHandler_t SER_Handler;
-}
-_SEHRegistration_t;
+typedef struct __SEH2Registration
+{
+	struct __SEH2Registration * SER_Prev;
+	_SEH2FrameHandler_t SER_Handler;
+}
+_SEH2Registration_t;
 
 #define __SEH_FORCE_NEST \
 	__asm__ __volatile__("#%0" : : "r" (&_SEHFrame))
@@ -118,24 +118,24 @@
 #define __SEH_RETURN_EXCEPT(R_) return (int)(R_)
 #define __SEH_RETURN_FINALLY() return
 
-typedef struct __SEHFrame
-{
-	_SEHRegistration_t SF_Registration;
-	volatile struct __SEHTryLevel * volatile SF_TopTryLevel;
+typedef struct __SEH2Frame
+{
+	_SEH2Registration_t SF_Registration;
+	volatile struct __SEH2TryLevel * volatile SF_TopTryLevel;
 	void * volatile SF_FramePointer;
 	void * volatile SF_StackPointer;
 	volatile unsigned long SF_Code;
 }
-_SEHFrame_t;
-
-typedef struct __SEHTryLevel
-{
-	volatile struct __SEHTryLevel * ST_Next;
+_SEH2Frame_t;
+
+typedef struct __SEH2TryLevel
+{
+	volatile struct __SEH2TryLevel * ST_Next;
 	void * ST_FramePointer;
 	void * ST_Filter;
 	void * ST_Body;
 }
-_SEHTryLevel_t;
+_SEH2TryLevel_t;
 
 #define __SEH_BEGIN_TRY \
 	{ \
@@ -157,16 +157,16 @@
 
 #define __SEH_SET_TRYLEVEL(TRYLEVEL_) \
 	{ \
-		__SEH_BARRIER; _SEHFrameP->SF_TopTryLevel = (TRYLEVEL_); __SEH_BARRIER; \
+		__SEH_BARRIER; _SEH2FrameP->SF_TopTryLevel = (TRYLEVEL_); __SEH_BARRIER; \
 	}
 
 #define __SEH_ENTER_TRYLEVEL() __SEH_SET_TRYLEVEL(&_SEHTryLevel)
 #define __SEH_LEAVE_TRYLEVEL() __SEH_SET_TRYLEVEL(_SEHPrevTryLevelP)
 
 #define __SEH_END_SCOPE_CHAIN \
-	static const int _SEHScopeKind = 1; \
-	static _SEHFrame_t * const _SEHFrameP = 0; \
-	static _SEHTryLevel_t * const _SEHTryLevelP = 0;
+	static const int _SEH2ScopeKind = 1; \
+	static _SEH2Frame_t * const _SEH2FrameP = 0; \
+	static _SEH2TryLevel_t * const _SEH2TryLevelP = 0;
 
 #define __SEH_BEGIN_SCOPE \
 	for(;;) \
@@ -176,9 +176,9 @@
  \
 		_SEHBeginScope: __SEH_SIDE_EFFECT; \
  \
-		const int _SEHTopTryLevel = (_SEHScopeKind != 0); \
-		_SEHFrame_t * const _SEHCurFrameP = _SEHFrameP; \
-		volatile _SEHTryLevel_t * const _SEHPrevTryLevelP = _SEHTryLevelP; \
+		const int _SEHTopTryLevel = (_SEH2ScopeKind != 0); \
+		_SEH2Frame_t * const _SEHCurFrameP = _SEH2FrameP; \
+		volatile _SEH2TryLevel_t * const _SEHPrevTryLevelP = _SEH2TryLevelP; \
  \
         (void)_SEHTopTryLevel; \
         (void)_SEHCurFrameP; \
@@ -191,17 +191,17 @@
 			__label__ _SEHBeforeTry; \
 			__label__ _SEHDoTry; \
 			__label__ _SEHAfterTry; \
-			static const int _SEHScopeKind = 0; \
-			_SEHFrame_t _SEHFrame; \
-			volatile _SEHTryLevel_t _SEHTryLevel; \
-			_SEHFrame_t * const _SEHFrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
-			volatile _SEHTryLevel_t * const _SEHTryLevelP = &_SEHTryLevel; \
- \
-			(void)_SEHScopeKind; \
+			static const int _SEH2ScopeKind = 0; \
+			_SEH2Frame_t _SEHFrame; \
+			volatile _SEH2TryLevel_t _SEHTryLevel; \
+			_SEH2Frame_t * const _SEH2FrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+			volatile _SEH2TryLevel_t * const _SEH2TryLevelP = &_SEHTryLevel; \
+ \
+			(void)_SEH2ScopeKind; \
 			(void)_SEHFrame; \
 			(void)_SEHTryLevel; \
-			(void)_SEHFrameP; \
-			(void)_SEHTryLevelP; \
+			(void)_SEH2FrameP; \
+			(void)_SEH2TryLevelP; \
  \
 			_SEHTryLevel.ST_Next = _SEHPrevTryLevelP; \
 			goto _SEHBeforeTry; \
@@ -274,9 +274,9 @@
 		{ \
 			__SEH_END_SCOPE_CHAIN; \
  \
-			(void)_SEHScopeKind; \
-			(void)_SEHFrameP; \
-			(void)_SEHTryLevelP; \
+			(void)_SEH2ScopeKind; \
+			(void)_SEH2FrameP; \
+			(void)_SEH2TryLevelP; \
  \
 			__SEH_NESTED_PROLOG; \
  \
@@ -299,7 +299,7 @@
 		_SEHTryLevel.ST_FramePointer = _SEHClosureFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
 		_SEHTryLevel.ST_Filter = _SEHFunctionFromTrampoline((_SEHTrampoline_t *)&_SEHExcept); \
 		_SEHTryLevel.ST_Body = &&_SEHBeginExcept; \
-		__SEH_BARRIER; __asm__ __volatile__("mov %%esp, %0" : "=m" (_SEHFrameP->SF_StackPointer)); __SEH_BARRIER; \
+		__SEH_BARRIER; __asm__ __volatile__("mov %%esp, %0" : "=m" (_SEH2FrameP->SF_StackPointer)); __SEH_BARRIER; \
 \
 		goto _SEHDoTry; \
 \
@@ -324,8 +324,8 @@
 		_SEHBeginExcept: __SEH_SIDE_EFFECT; \
 		{ \
 			{ \
-				_SEHFrame_t * const _SEHFrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
-				(void)_SEHFrameP; \
+				_SEH2Frame_t * const _SEH2FrameP = _SEHTopTryLevel ? &_SEHFrame : _SEHCurFrameP; \
+				(void)_SEH2FrameP; \
 				__SEH_BARRIER;
 
 #define _SEH2_END \
@@ -337,12 +337,12 @@
 	__SEH_END_SCOPE;
 
 #define _SEH2_GetExceptionInformation() ((struct _EXCEPTION_POINTERS *)_SEHExceptionPointers)
-#define _SEH2_GetExceptionCode() ((_SEHFrameP)->SF_Code)
+#define _SEH2_GetExceptionCode() ((_SEH2FrameP)->SF_Code)
 
 #define _SEH2_YIELD(STMT_) \
 	for(;;) \
 	{ \
-		if(!_SEHScopeKind) \
+		if(!_SEH2ScopeKind) \
 			_SEH2Return(); \
  \
 		STMT_; \
@@ -357,7 +357,7 @@
 {
 #endif
 
-extern void __cdecl _SEH2EnterFrame(_SEHFrame_t *);
+extern void __cdecl _SEH2EnterFrame(_SEH2Frame_t *);
 extern void __cdecl _SEH2LeaveFrame(void);
 extern void __cdecl _SEH2Return(void);
 



More information about the Ros-diffs mailing list