Re: [PATCH] ntdll: Initialize StatusWord and TagWord in i386 init_thread_context.
This does not resolve the bug, but moves toward resolving it. I have not been able to get a consistent read on what to initialize the remaining members to. Thanks, Jefferson
I know this adds yet another copy/paste of XMM_SAVE_AREA32. I feel this patch is a separate concern from merging all of those into one though. On 7/3/2020 6:56 AM, Jefferson Carpenter wrote:
This does not resolve the bug, but moves toward resolving it.
I have not been able to get a consistent read on what to initialize the remaining members to.
Thanks, Jefferson
Jefferson Carpenter <jeffersoncarpenter2(a)gmail.com> writes:
@@ -2270,7 +2270,11 @@ static void init_thread_context( CONTEXT *context, LPTHREAD_START_ROUTINE entry, context->Esp = (DWORD)NtCurrentTeb()->Tib.StackBase - 16; context->Eip = (DWORD)relay; context->FloatSave.ControlWord = 0x27f; + context->FloatSave.StatusWord = 0; + context->FloatSave.TagWord = 0xffff; ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->ControlWord = 0x27f; + ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->StatusWord = 0; + ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->TagWord = 0; ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->MxCsr = 0x1f80;
The entire context is already initialized to 0, this shouldn't be necessary. -- Alexandre Julliard julliard(a)winehq.org
I will look into this. Zeroing the entire thing in this function clears up the valgrind warning (this could be a valgrind bug). However at least setting TagWord is a correction that sets the FPU to the correct state (all floats empty). On 7/3/2020 9:47 AM, Alexandre Julliard wrote:
Jefferson Carpenter <jeffersoncarpenter2(a)gmail.com> writes:
@@ -2270,7 +2270,11 @@ static void init_thread_context( CONTEXT *context, LPTHREAD_START_ROUTINE entry, context->Esp = (DWORD)NtCurrentTeb()->Tib.StackBase - 16; context->Eip = (DWORD)relay; context->FloatSave.ControlWord = 0x27f; + context->FloatSave.StatusWord = 0; + context->FloatSave.TagWord = 0xffff; ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->ControlWord = 0x27f; + ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->StatusWord = 0; + ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->TagWord = 0; ((XMM_SAVE_AREA32 *)context->ExtendedRegisters)->MxCsr = 0x1f80;
The entire context is already initialized to 0, this shouldn't be necessary.
participants (2)
-
Alexandre Julliard -
Jefferson Carpenter