winnt.h resubmit

Josh DuBois duboisj at codeweavers.com
Mon Feb 12 13:32:06 CST 2001


Hi - 

   I #ifdef'd the gcc'ism (from my earlier patch) used to align
CRITICAL_SECTION structs to be ppc-gcc only.


       Josh.
       
   ChagneLog:
     include/winnt.h
         resubmit: changes for PowerPC compilation
-------------- next part --------------
Index: include/winnt.h
===================================================================
RCS file: /home/cvs/wine/wine/include/winnt.h,v
retrieving revision 1.82
diff -u -r1.82 winnt.h
--- include/winnt.h	2001/01/22 02:17:30	1.82
+++ include/winnt.h	2001/02/12 18:30:43
@@ -36,6 +36,10 @@
 # define WORDS_BIGENDIAN
 # define BITFIELDS_BIGENDIAN
 # undef  ALLOW_UNALIGNED_ACCESS
+#elif defined(__PPC__)
+# define WORDS_BIGENDIAN
+# define BITFIELDS_BIGENDIAN
+# undef  ALLOW_UNALIGNED_ACCESS
 #elif !defined(RC_INVOKED)
 # error Unknown CPU architecture!
 #endif
@@ -1118,6 +1122,34 @@
 
 #endif /* __sparc__ */
 
+#ifdef __PPC__
+
+/* FIXME: use getcontext() to retrieve full context */
+#define _GET_CONTEXT \
+    CONTEXT context;   \
+    do { memset(&context, 0, sizeof(CONTEXT));            \
+         context.ContextFlags = CONTEXT_CONTROL;          \
+       } while (0)
+
+#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
+  void WINAPI name ( void ) \
+  { _GET_CONTEXT; fn( &context ); }
+#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
+  void WINAPI name ( t1 a1 ) \
+  { _GET_CONTEXT; fn( a1, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
+  void WINAPI name ( t1 a1, t2 a2 ) \
+  { _GET_CONTEXT; fn( a1, a2, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
+  void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
+  { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
+#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
+  void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
+  { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
+
+#endif /* __PPC__ */
+
+
 #ifndef DEFINE_REGS_ENTRYPOINT_0
 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
 #endif
@@ -3396,7 +3428,22 @@
     HANDLE OwningThread;
     HANDLE LockSemaphore;
     ULONG_PTR SpinCount;
-} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+#ifdef __PPC__
+/* ---------------------------------------------------------------
+**   The LockCount member must be 4-byte aligned on the PPC
+**   for the Interlocked* functions to work.
+**   Unfortunatly, without an explicit alignment directive,
+**   instances of this type which are compile-time initialized
+**   are frequently placed on 2-byte boundaries for some reason.
+** --------------------------------------------------------------- */
+#ifdef __GNUC__
+} __attribute__ ((__aligned__(4))) RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+#else
+#error "Need alignment directive for your compiler."
+#endif /* __GNUC__ */
+#else
+}  RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
+#endif /* __PPC__ */
 
 
 #define EVENTLOG_SUCCESS                0x0000


More information about the wine-patches mailing list