mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
[KERNEL32]
- SwitchToFiber: instead of doing a ret to the return address on the stack (which wouldn't work for a newly created fiber) store the returnaddress in the Eip field old fiber context and do a jmp to the Eip of the new fiber. - BasepInitializeContext: set the Eip member of the Context to BaseFiberStartup for fibers CreateFiberEx: initialize the fiber context, instead of an unused context on the stack. - BaseFiberStartup: Use GetCurrentFiber, not GetFiberData to get the current fiber. Fixes kernel32_wintest fiber svn path=/trunk/; revision=47232
This commit is contained in:
@@ -364,7 +364,7 @@ BasepInitializeContext(IN PCONTEXT Context,
|
||||
}
|
||||
else if (ContextType == 2) /* For Fibers */
|
||||
{
|
||||
//Context->Eip = (ULONG)BaseFiberStartup;
|
||||
Context->Eip = (ULONG)BaseFiberStartup;
|
||||
}
|
||||
else /* For first thread in a Process */
|
||||
{
|
||||
|
||||
@@ -146,9 +146,8 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
||||
PFIBER pfCurFiber;
|
||||
NTSTATUS nErrCode;
|
||||
INITIAL_TEB usFiberInitialTeb;
|
||||
CONTEXT ctxFiberContext;
|
||||
PVOID ActivationContextStack = NULL;
|
||||
DPRINT1("Creating Fiber\n");
|
||||
DPRINT("Creating Fiber\n");
|
||||
|
||||
#ifdef SXS_SUPPORT_ENABLED
|
||||
/* Allocate the Activation Context Stack */
|
||||
@@ -203,7 +202,7 @@ CreateFiberEx(SIZE_T dwStackCommitSize,
|
||||
}
|
||||
|
||||
/* initialize the context for the fiber */
|
||||
BasepInitializeContext(&ctxFiberContext,
|
||||
BasepInitializeContext(&pfCurFiber->Context,
|
||||
lpParameter,
|
||||
lpStartAddress,
|
||||
usFiberInitialTeb.StackBase,
|
||||
@@ -253,10 +252,10 @@ WINAPI
|
||||
BaseFiberStartup(VOID)
|
||||
{
|
||||
#ifdef _M_IX86
|
||||
PFIBER Fiber = GetFiberData();
|
||||
PFIBER Fiber = GetCurrentFiber();
|
||||
|
||||
/* Call the Thread Startup Routine */
|
||||
DPRINT1("Starting Fiber\n");
|
||||
DPRINT("Starting Fiber\n");
|
||||
BaseThreadStartup((LPTHREAD_START_ROUTINE)Fiber->Context.Eax,
|
||||
(LPVOID)Fiber->Context.Ebx);
|
||||
#else
|
||||
|
||||
@@ -24,7 +24,11 @@ _SwitchToFiber@4:
|
||||
mov [eax+FIBER_CONTEXT_ESI], esi
|
||||
mov [eax+FIBER_CONTEXT_EDI], edi
|
||||
mov [eax+FIBER_CONTEXT_EBP], ebp
|
||||
|
||||
|
||||
/* Save the return address */
|
||||
mov ebx, [esp]
|
||||
mov [eax+FIBER_CONTEXT_EIP], ebx
|
||||
|
||||
/* Check if we're to save FPU State */
|
||||
cmp dword ptr [eax+FIBER_CONTEXT_FLAGS], CONTEXT_FULL | CONTEXT_FLOATING_POINT
|
||||
jnz NoFpuStateSave
|
||||
@@ -115,7 +119,7 @@ NoFpuStateRestore:
|
||||
mov eax, [ecx+FIBER_FLS_DATA]
|
||||
mov [edx+TEB_FLS_DATA], eax
|
||||
|
||||
/* Return */
|
||||
ret 4
|
||||
|
||||
/* Jump to new fiber */
|
||||
jmp [ecx+FIBER_CONTEXT_EIP]
|
||||
|
||||
/* EOF */
|
||||
|
||||
Reference in New Issue
Block a user