Author: tkreuzer
Date: Tue Apr 28 21:27:35 2015
New Revision: 67473
URL:
http://svn.reactos.org/svn/reactos?rev=67473&view=rev
Log:
[NDK/KERNEL32]
Improve definition of FIBER. Based on ks386.inc, ksarm.h and ksamd64.inc
Modified:
trunk/reactos/dll/win32/kernel32/client/fiber.c
trunk/reactos/include/asm/ks386.template.h
trunk/reactos/include/ndk/ketypes.h
Modified: trunk/reactos/dll/win32/kernel32/client/fiber.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/fiber.c [iso-8859-1] Tue Apr 28 21:27:35 2015
@@ -17,10 +17,10 @@
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, FiberContext) == 0x14);
C_ASSERT(FIELD_OFFSET(FIBER, GuaranteedStackBytes) == 0x2E0);
C_ASSERT(FIELD_OFFSET(FIBER, FlsData) == 0x2E4);
-C_ASSERT(FIELD_OFFSET(FIBER, ActivationContextStack) == 0x2E8);
+C_ASSERT(FIELD_OFFSET(FIBER, ActivationContextStackPointer) == 0x2E8);
#endif // _M_IX86
/* PRIVATE FUNCTIONS **********************************************************/
@@ -30,7 +30,7 @@
BaseRundownFls(IN PVOID FlsData)
{
/* No FLS support yet */
-
+
}
/* PUBLIC FUNCTIONS ***********************************************************/
@@ -106,20 +106,20 @@
}
/* Copy some contextual data from the thread to the fiber */
- Fiber->Parameter = lpParameter;
+ Fiber->FiberData = lpParameter;
Fiber->ExceptionList = Teb->NtTib.ExceptionList;
Fiber->StackBase = Teb->NtTib.StackBase;
Fiber->StackLimit = Teb->NtTib.StackLimit;
Fiber->DeallocationStack = Teb->DeallocationStack;
Fiber->FlsData = Teb->FlsData;
Fiber->GuaranteedStackBytes = Teb->GuaranteedStackBytes;
- Fiber->ActivationContextStack = Teb->ActivationContextStackPointer;
- Fiber->Context.ContextFlags = CONTEXT_FULL;
+ Fiber->ActivationContextStackPointer = Teb->ActivationContextStackPointer;
+ Fiber->FiberContext.ContextFlags = CONTEXT_FULL;
/* Save FPU State if requested */
if (dwFlags & FIBER_FLAG_FLOAT_SWITCH)
{
- Fiber->Context.ContextFlags |= CONTEXT_FLOATING_POINT;
+ Fiber->FiberContext.ContextFlags |= CONTEXT_FLOATING_POINT;
}
/* Associate the fiber to the current thread */
@@ -168,7 +168,7 @@
PFIBER Fiber;
NTSTATUS Status;
INITIAL_TEB InitialTeb;
- PACTIVATION_CONTEXT_STACK ActivationContextStack = NULL;
+ PACTIVATION_CONTEXT_STACK ActivationContextStackPointer = NULL;
DPRINT("Creating Fiber\n");
/* Check for invalid flags */
@@ -180,7 +180,7 @@
}
/* Allocate the Activation Context Stack */
- Status = RtlAllocateActivationContextStack(&ActivationContextStack);
+ Status = RtlAllocateActivationContextStack(&ActivationContextStackPointer);
if (!NT_SUCCESS(Status))
{
/* Fail */
@@ -193,7 +193,7 @@
if (!Fiber)
{
/* Free the activation context stack */
- RtlFreeActivationContextStack(ActivationContextStack);
+ RtlFreeActivationContextStack(ActivationContextStackPointer);
/* Fail */
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
@@ -211,7 +211,7 @@
RtlFreeHeap(GetProcessHeap(), 0, Fiber);
/* Free the activation context stack */
- RtlFreeActivationContextStack(ActivationContextStack);
+ RtlFreeActivationContextStack(ActivationContextStackPointer);
/* Failure */
BaseSetLastNTError(Status);
@@ -219,24 +219,24 @@
}
/* Clear the context */
- RtlZeroMemory(&Fiber->Context, sizeof(CONTEXT));
+ RtlZeroMemory(&Fiber->FiberContext, sizeof(CONTEXT));
/* Copy the data into the fiber */
Fiber->StackBase = InitialTeb.StackBase;
Fiber->StackLimit = InitialTeb.StackLimit;
Fiber->DeallocationStack = InitialTeb.AllocatedStackBase;
- Fiber->Parameter = lpParameter;
+ Fiber->FiberData = lpParameter;
Fiber->ExceptionList = EXCEPTION_CHAIN_END;
Fiber->GuaranteedStackBytes = 0;
Fiber->FlsData = NULL;
- Fiber->ActivationContextStack = ActivationContextStack;
- Fiber->Context.ContextFlags = CONTEXT_FULL;
+ Fiber->ActivationContextStackPointer = ActivationContextStackPointer;
+ Fiber->FiberContext.ContextFlags = CONTEXT_FULL;
/* Save FPU State if requested */
- Fiber->Context.ContextFlags = (dwFlags & FIBER_FLAG_FLOAT_SWITCH) ?
CONTEXT_FLOATING_POINT : 0;
+ Fiber->FiberContext.ContextFlags = (dwFlags & FIBER_FLAG_FLOAT_SWITCH) ?
CONTEXT_FLOATING_POINT : 0;
/* initialize the context for the fiber */
- BaseInitializeContext(&Fiber->Context,
+ BaseInitializeContext(&Fiber->FiberContext,
lpParameter,
lpStartAddress,
InitialTeb.StackBase,
@@ -271,7 +271,7 @@
if (Fiber->FlsData) BaseRundownFls(Fiber->FlsData);
/* Get rid of the activation context stack */
- RtlFreeActivationContextStack(Fiber->ActivationContextStack);
+ RtlFreeActivationContextStack(Fiber->ActivationContextStackPointer);
/* Free the fiber data */
RtlFreeHeap(GetProcessHeap(), 0, lpFiber);
Modified: trunk/reactos/include/asm/ks386.template.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/asm/ks386.template…
==============================================================================
--- trunk/reactos/include/asm/ks386.template.h [iso-8859-1] (original)
+++ trunk/reactos/include/asm/ks386.template.h [iso-8859-1] Tue Apr 28 21:27:35 2015
@@ -350,29 +350,29 @@
SIZE(CONTEXT_FRAME_LENGTH, CONTEXT),
HEADER("FIBER"),
-OFFSET(FIBER_PARAMETER, FIBER, Parameter),
+OFFSET(FIBER_PARAMETER, FIBER, FiberData),
OFFSET(FIBER_EXCEPTION_LIST, FIBER, ExceptionList),
OFFSET(FIBER_STACK_BASE, FIBER, StackBase),
OFFSET(FIBER_STACK_LIMIT, FIBER, StackLimit),
OFFSET(FIBER_DEALLOCATION_STACK, FIBER, DeallocationStack),
-OFFSET(FIBER_CONTEXT, FIBER, Context),
-OFFSET(FIBER_CONTEXT_FLAGS, FIBER, Context.ContextFlags),
-OFFSET(FIBER_CONTEXT_EAX, FIBER, Context.Eax),
-OFFSET(FIBER_CONTEXT_EBX, FIBER, Context.Ebx),
-OFFSET(FIBER_CONTEXT_ECX, FIBER, Context.Ecx),
-OFFSET(FIBER_CONTEXT_EDX, FIBER, Context.Edx),
-OFFSET(FIBER_CONTEXT_ESI, FIBER, Context.Esi),
-OFFSET(FIBER_CONTEXT_EDI, FIBER, Context.Edi),
-OFFSET(FIBER_CONTEXT_EBP, FIBER, Context.Ebp),
-OFFSET(FIBER_CONTEXT_EIP, FIBER, Context.Eip),
-OFFSET(FIBER_CONTEXT_ESP, FIBER, Context.Esp),
-OFFSET(FIBER_CONTEXT_DR6, FIBER, Context.Dr6),
-OFFSET(FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD, FIBER, Context.FloatSave.ControlWord),
-OFFSET(FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD, FIBER, Context.FloatSave.StatusWord),
-OFFSET(FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD, FIBER, Context.FloatSave.TagWord),
+OFFSET(FIBER_CONTEXT, FIBER, FiberContext),
+OFFSET(FIBER_CONTEXT_FLAGS, FIBER, FiberContext.ContextFlags),
+OFFSET(FIBER_CONTEXT_EAX, FIBER, FiberContext.Eax),
+OFFSET(FIBER_CONTEXT_EBX, FIBER, FiberContext.Ebx),
+OFFSET(FIBER_CONTEXT_ECX, FIBER, FiberContext.Ecx),
+OFFSET(FIBER_CONTEXT_EDX, FIBER, FiberContext.Edx),
+OFFSET(FIBER_CONTEXT_ESI, FIBER, FiberContext.Esi),
+OFFSET(FIBER_CONTEXT_EDI, FIBER, FiberContext.Edi),
+OFFSET(FIBER_CONTEXT_EBP, FIBER, FiberContext.Ebp),
+OFFSET(FIBER_CONTEXT_EIP, FIBER, FiberContext.Eip),
+OFFSET(FIBER_CONTEXT_ESP, FIBER, FiberContext.Esp),
+OFFSET(FIBER_CONTEXT_DR6, FIBER, FiberContext.Dr6),
+OFFSET(FIBER_CONTEXT_FLOAT_SAVE_CONTROL_WORD, FIBER,
FiberContext.FloatSave.ControlWord),
+OFFSET(FIBER_CONTEXT_FLOAT_SAVE_STATUS_WORD, FIBER, FiberContext.FloatSave.StatusWord),
+OFFSET(FIBER_CONTEXT_FLOAT_SAVE_TAG_WORD, FIBER, FiberContext.FloatSave.TagWord),
OFFSET(FIBER_GUARANTEED_STACK_BYTES, FIBER, GuaranteedStackBytes),
OFFSET(FIBER_FLS_DATA, FIBER, FlsData),
-OFFSET(FIBER_ACTIVATION_CONTEXT_STACK, FIBER, ActivationContextStack),
+OFFSET(FIBER_ACTIVATION_CONTEXT_STACK, FIBER, ActivationContextStackPointer),
HEADER("KTSS"),
OFFSET(KTSS_IOMAPBASE, KTSS, IoMapBase),
Modified: trunk/reactos/include/ndk/ketypes.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/ketypes.h?rev=…
==============================================================================
--- trunk/reactos/include/ndk/ketypes.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/ketypes.h [iso-8859-1] Tue Apr 28 21:27:35 2015
@@ -168,18 +168,25 @@
#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 */
+typedef struct _FIBER /* Field offsets: */
+{ /* i386 arm x64 */
+ PVOID FiberData; /* 0x000 0x000 0x000 */
+ struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;/* 0x004 0x004 0x008 */
+ PVOID StackBase; /* 0x008 0x008 0x010 */
+ PVOID StackLimit; /* 0x00C 0x00C 0x018 */
+ PVOID DeallocationStack; /* 0x010 0x010 0x020 */
+ CONTEXT FiberContext; /* 0x014 0x018 0x030 */
+#if (NTDDI_VERSION >= NTDDI_LONGHORN)
+ PVOID Wx86Tib; /* 0x2E0 0x1b8 0x500 */
+ struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer; /* 0x2E4 0x1bc 0x508
*/
+ PVOID FlsData; /* 0x2E8 0x1c0 0x510 */
+ ULONG GuaranteedStackBytes; /* 0x2EC 0x1c4 0x518 */
+ ULONG TebFlags; /* 0x2F0 0x1c8 0x51C */
+#else
+ ULONG GuaranteedStackBytes; /* 0x2E0 */
+ PVOID FlsData; /* 0x2E4 */
+ struct _ACTIVATION_CONTEXT_STACK *ActivationContextStackPointer;
+#endif
} FIBER, *PFIBER;
#ifndef NTOS_MODE_USER