[KERNEL32/NDK]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 28 Apr 2015 21:27:16 +0000 (21:27 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 28 Apr 2015 21:27:16 +0000 (21:27 +0000)
Move definition of FIBER to NDK

svn path=/trunk/; revision=67472

reactos/dll/win32/kernel32/client/fiber.c
reactos/include/asm/genincdata.c
reactos/include/ndk/ketypes.h

index 22ece1b..f3fb570 100644 (file)
@@ -3,7 +3,7 @@
  * PROJECT:     ReactOS System Libraries
  * FILE:        lib/kernel32/thread/fiber.c
  * PURPOSE:     Fiber Implementation
- * PROGRAMMERS: 
+ * PROGRAMMERS:
  *              Alex Ionescu (alex@relsoft.net)
  *              KJK::Hyperion <noog@libero.it>
  */
 #define NDEBUG
 #include <debug.h>
 
-typedef struct _FIBER                                      /* Field offsets:  */
-{                                                          /* 32 bit   64 bit */
-    /* this must be the first field */
-    PVOID Parameter;                                       /*   0x00     0x00 */
-    PEXCEPTION_REGISTRATION_RECORD ExceptionList;          /*   0x04     0x08 */
-    PVOID StackBase;                                       /*   0x08     0x10 */
-    PVOID StackLimit;                                      /*   0x0C     0x18 */
-    PVOID DeallocationStack;                               /*   0x10     0x20 */
-    CONTEXT Context;                                       /*   0x14     0x28 */
-    ULONG GuaranteedStackBytes;                            /*   0x2E0         */
-    PVOID FlsData;                                         /*   0x2E4         */
-    PACTIVATION_CONTEXT_STACK ActivationContextStack;      /*   0x2E8         */
-} FIBER, *PFIBER;
+#ifdef _M_IX86
+C_ASSERT(FIELD_OFFSET(FIBER, ExceptionList) == 0x04);
+C_ASSERT(FIELD_OFFSET(FIBER, StackBase) == 0x08);
+C_ASSERT(FIELD_OFFSET(FIBER, StackLimit) == 0x0C);
+C_ASSERT(FIELD_OFFSET(FIBER, DeallocationStack) == 0x10);
+C_ASSERT(FIELD_OFFSET(FIBER, Context) == 0x14);
+C_ASSERT(FIELD_OFFSET(FIBER, GuaranteedStackBytes) == 0x2E0);
+C_ASSERT(FIELD_OFFSET(FIBER, FlsData) == 0x2E4);
+C_ASSERT(FIELD_OFFSET(FIBER, ActivationContextStack) == 0x2E8);
+#endif // _M_IX86
 
 /* PRIVATE FUNCTIONS **********************************************************/
 
@@ -76,7 +73,7 @@ ConvertFiberToThread(VOID)
  */
 LPVOID
 WINAPI
-ConvertThreadToFiberEx(LPVOID lpParameter, 
+ConvertThreadToFiberEx(LPVOID lpParameter,
                        DWORD dwFlags)
 {
     PTEB Teb;
index fad0e01..12f48b8 100644 (file)
@@ -27,21 +27,6 @@ enum
 };
 #endif
 
-// FIXME: where to put this?
-typedef struct _FIBER                                      /* Field offsets:  */
-{                                                          /* 32 bit   64 bit */
-    /* this must be the first field */
-    PVOID Parameter;                                       /*   0x00     0x00 */
-    PEXCEPTION_REGISTRATION_RECORD ExceptionList;          /*   0x04     0x08 */
-    PVOID StackBase;                                       /*   0x08     0x10 */
-    PVOID StackLimit;                                      /*   0x0C     0x18 */
-    PVOID DeallocationStack;                               /*   0x10     0x20 */
-    CONTEXT Context;                                       /*   0x14     0x28 */
-    ULONG GuaranteedStackBytes;                            /*   0x2E0         */
-    PVOID FlsData;                                         /*   0x2E4         */
-    PVOID /* PACTIVATION_CONTEXT_STACK */ ActivationContextStack; /*   0x2E8         */
-} FIBER, *PFIBER;
-
 typedef struct
 {
     char Type;
@@ -75,10 +60,8 @@ __attribute__ ((section(".asmdef")))
 
 ASMGENDATA Table[] =
 {
-#if defined (_M_IX86) || defined (_M_AMD64)
 /* PORTABLE CONSTANTS ********************************************************/
 #include "ksx.template.h"
-#endif
 
 /* ARCHITECTURE SPECIFIC CONTSTANTS ******************************************/
 #ifdef _M_IX86
index 707bf51..78f5058 100644 (file)
@@ -168,6 +168,20 @@ Author:
 #define KI_EXCEPTION_INTERNAL           0x10000000
 #define KI_EXCEPTION_ACCESS_VIOLATION   (KI_EXCEPTION_INTERNAL | 0x04)
 
+typedef struct _FIBER                                      /* Field offsets:  */
+{                                                          /* 32 bit   64 bit */
+    /* this must be the first field */
+    PVOID Parameter;                                       /*   0x00     0x00 */
+    struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;  /*   0x04     0x08 */
+    PVOID StackBase;                                       /*   0x08     0x10 */
+    PVOID StackLimit;                                      /*   0x0C     0x18 */
+    PVOID DeallocationStack;                               /*   0x10     0x20 */
+    CONTEXT Context;                                       /*   0x14     0x28 */
+    ULONG GuaranteedStackBytes;                            /*   0x2E0         */
+    PVOID FlsData;                                         /*   0x2E4         */
+    struct _ACTIVATION_CONTEXT_STACK *ActivationContextStack;/*   0x2E8         */
+} FIBER, *PFIBER;
+
 #ifndef NTOS_MODE_USER
 //
 // Number of dispatch codes supported by KINTERRUPT