[ros-diffs] [sserapion] 40114: Implement generic forms of __wine_push_frame and __wine_pop_frame (from wine). This code is duplicated but looks different, specifically the use of Frame->Next and Frame->Prev, this is just an effect of different definitions for EXCEPTION_REGISTRATION_RECORD both Next and Prev are actually the same. Maybe someone could look into tidying this up a bit.

sserapion at svn.reactos.org sserapion at svn.reactos.org
Fri Mar 20 05:42:57 CET 2009


Author: sserapion
Date: Fri Mar 20 07:42:55 2009
New Revision: 40114

URL: http://svn.reactos.org/svn/reactos?rev=40114&view=rev
Log:
Implement generic forms of __wine_push_frame and __wine_pop_frame (from wine). This code is duplicated but looks different, specifically the use of Frame->Next and Frame->Prev, this is just an effect of different definitions for EXCEPTION_REGISTRATION_RECORD both Next and Prev are actually the same. Maybe someone could look into tidying this up a bit.

Modified:
    branches/ros-amd64-bringup/reactos/include/reactos/wine/exception.h
    branches/ros-amd64-bringup/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h

Modified: branches/ros-amd64-bringup/reactos/include/reactos/wine/exception.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/include/reactos/wine/exception.h?rev=40114&r1=40113&r2=40114&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/reactos/wine/exception.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/reactos/wine/exception.h [iso-8859-1] Fri Mar 20 07:42:55 2009
@@ -54,22 +54,33 @@
 #define EXCEPTION_VM86_STI        0x80000111
 #define EXCEPTION_VM86_PICRETURN  0x80000112
 
-#ifdef _M_X86
 static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
 {
+#if defined(__i386__)
     frame->Prev = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
 	__writefsdword(0, (unsigned long)frame);
     return frame->Prev;
+#else
+	NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
+	frame->Prev = teb->ExceptionList;
+	teb->ExceptionList = frame;
+	return frame->Prev;
+#endif
 }
 
 static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
 {
+#if defined(__i386__)
 	__writefsdword(0, (unsigned long)frame->Prev);
     return frame->Prev;
+#else
+	NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
+	teb->ExceptionList = frame->Prev;
+	return frame->Prev;
+#endif
 }
 
 extern void __wine_enter_vm86( CONTEXT *context );
-#endif
 
 #ifdef __cplusplus
 }

Modified: branches/ros-amd64-bringup/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h?rev=40114&r1=40113&r2=40114&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/lib/sdk/crt/include/internal/wine/cppexcept.h [iso-8859-1] Fri Mar 20 07:42:55 2009
@@ -52,20 +52,31 @@
 #define EH_STACK_INVALID    0x08
 #define EH_NESTED_CALL      0x10
 
-#ifdef _M_X86
 static inline EXCEPTION_REGISTRATION_RECORD *__wine_push_frame( EXCEPTION_REGISTRATION_RECORD *frame )
 {
+#if defined(__i386__)
     frame->Next = (struct _EXCEPTION_REGISTRATION_RECORD *)__readfsdword(0);
 	__writefsdword(0, (unsigned long)frame);
     return frame->Next;
+#else
+	NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
+	frame->Next = teb->ExceptionList;
+	teb->ExceptionList = frame;
+	return frame->Next;
+#endif
 }
 
 static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTRATION_RECORD *frame )
 {
+#if defined(__i386__)
 	__writefsdword(0, (unsigned long)frame->Next);
     return frame->Next;
-}
+#else
+	NT_TIB *teb = (NT_TIB *)NtCurrentTeb();
+	teb->ExceptionList = frame->Next;
+	return frame->Next;
 #endif
+}
 
 #define __TRY _SEH2_TRY
 #define __EXCEPT(func) _SEH2_EXCEPT(func(_SEH2_GetExceptionInformation()))



More information about the Ros-diffs mailing list