From: Jefferson Carpenter Subject: Re: [PATCH] ntdll: Initialize StatusWord and TagWord in i386 init_thread_context. Message-Id: Date: Fri, 3 Jul 2020 09:50:27 +0000 In-Reply-To: <878sg153s2.fsf@wine> References: <8446bc80-d9b8-b913-32cd-40032f16a81d@gmail.com> <878sg153s2.fsf@wine> 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 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. >