From: Jacek Caban Subject: Re: [PATCH] winebuild: Clear RFLAGS before entering syscall. Message-Id: Date: Wed, 2 Jun 2021 17:35:31 +0200 In-Reply-To: <20210601084301.2074741-1-rbernon@codeweavers.com> References: <20210601084301.2074741-1-rbernon@codeweavers.com> Hi Rémi, On 6/1/21 10:43 AM, Rémi Bernon wrote: > We pushed the flags, but kept them set. Far Cry sets NT flags, which > causes later iretd instruction to raise a GP fault exception. > > This fixes a regression from e341d1f695311725752c287057f6c6ab60fdf2a3. iret is responsible for a fair chunk of syscall dispatcher overhead. I plan to submit patches optimizing syscall dispatcher to not do iret in the usual code path and use signal_restore_full_cpu_context if context was modified during the syscall. I don't have 32-bit version implemented yet, but the idea would be the same. I think those optimization should fix the regression without adjusting flags on each syscall. signal_restore_full_cpu_context would still have the same problem, but maybe then we could do flags adjustment only there? Or are there other reasons to do the adjustment (in which case I would need to take that into account in my patches as well)? Thanks, Jacek