XSAVE-related segfaults observed under wine
Jeremy Drake
cygwin@jdrake.com
Fri Jun 27 17:45:16 GMT 2025
On Fri, 27 Jun 2025, Corinna Vinschen via Cygwin wrote:
> Hi Pip,
>
> On Jun 27 14:41, Pip Cet via Cygwin wrote:
> > My suggested fix is to align the value in %rbx to the next 64-byte
> > multiple after the "cpuid" instruction is executed, by performing the
> > assembler equivalent of $rbx += 63; $rbx &= -64; I tried this:
> >
> > diff --git a/winsup/cygwin/scripts/gendef b/winsup/cygwin/scripts/gendef
> > index 861a2405b..d681fde3f 100755
> > --- a/winsup/cygwin/scripts/gendef
> > +++ b/winsup/cygwin/scripts/gendef
> > @@ -232,6 +232,8 @@ sigdelayed:
> > movl \$0x0d,%eax
> > xorl %ecx,%ecx
> > cpuid # get necessary space for xsave
> > + addq \$63, %rbx
> > + andq \$-64, %rbx # align to next 64-byte multiple
>
> what about a oneliner instead by just aligning rsp? As in
>
> > movq %rbx,%rcx
> > addq \$0x48,%rbx # 0x18 for alignment, 0x30 for additional space
If aligning via andq, does the 0x18 "for alignment" still need to be
included?
> > subq %rbx,%rsp
>
> + andq \$-64, %rsp
>
More information about the Cygwin
mailing list