Hello

I fixed these and pushed it, thanks so much!

Samuel

Samuel Thibault, le ven. 11 avril 2025 02:27:04 +0200, a ecrit:
> Hello,
> 
> Sorry it took me long to manage to fine time to look at this...
> 
> Luca Dariz, le mer. 19 mars 2025 18:11:18 +0100, a ecrit:
> > diff --git a/sysdeps/mach/hurd/i386/sigreturn.c 
> > b/sysdeps/mach/hurd/i386/sigreturn.c
> > index ce8df8d02b..618cb74196 100644
> > --- a/sysdeps/mach/hurd/i386/sigreturn.c
> > +++ b/sysdeps/mach/hurd/i386/sigreturn.c
> > @@ -21,6 +21,8 @@
> >  #include <stdlib.h>
> >  #include <string.h>
> >  
> > +#include <cpuid.h>
> > +
> >  /* This is run on the thread stack after restoring it, to be able to
> >     unlock SS off sigstack.  */
> >  static void
> > @@ -123,10 +125,27 @@ __sigreturn (struct sigcontext *scp)
> >    if (scp->sc_onstack)
> >      ss->sigaltstack.ss_flags &= ~SS_ONSTACK;
> >  
> > -  if (scp->sc_fpused)
> > -    /* Restore the FPU state.  Mach conveniently stores the state
> > -       in the format the i387 `frstor' instruction uses to restore it.  */
> > -    asm volatile ("frstor %0" : : "m" (scp->sc_fpsave));
> > +#ifdef i386_XFLOAT_STATE
> > +  if ((scp->xstate) && (scp->xstate->initialized))
> 
> else?
> 
> > +    {
> > +      unsigned eax, ebx, ecx, edx;
> > +      __cpuid_count(0xd, 0, eax, ebx, ecx, edx);
> > +      switch (scp->xstate->fp_save_kind)
> > +        {
> > +        case 0: // FNSAVE
> > +          asm volatile("frstor %0" : : "m" (scp->xstate->hw_state));
> > +          break;
> > +        case 1: // FXSAVE
> > +          asm volatile("fxrstor %0" : : "m" (scp->xstate->hw_state),    \
> > +                       "a" (eax), "d" (edx));
> > +          break;
> > +        default: // XSAVE
> > +          asm volatile("xrstor %0" : : "m" (scp->xstate->hw_state),     \
> > +                       "a" (eax), "d" (edx));
> > +          break;
> 
> There is also FP_XSAVES which should use xrstors. Better also explicit
> FP_XSAVEOPT FP_XSAVEC as using xrstor too.
> 
> (and similar in x86_64)
> 
> > +        }
> > +    }
> > +#endif
> >  
> >    {
> >      /* There are convenient instructions to pop state off the stack, so we
> > diff --git a/sysdeps/mach/hurd/x86/trampoline.c 
> > b/sysdeps/mach/hurd/x86/trampoline.c
> > index 8e2890f8c5..c333d56022 100644
> > --- a/sysdeps/mach/hurd/x86/trampoline.c
> > +++ b/sysdeps/mach/hurd/x86/trampoline.c
> > @@ -26,7 +26,11 @@
> >  #include "hurdfault.h"
> >  #include <intr-msg.h>
> >  #include <sys/ucontext.h>
> > -
> > +#ifdef __x86_64__
> > +#include <mach/x86_64/mach_i386.h>
> > +#else
> > +#include <mach/i386/mach_i386.h>
> > +#endif
> >  
> >  /* Fill in a siginfo_t structure for SA_SIGINFO-enabled handlers.  */
> >  static void fill_siginfo (siginfo_t *si, int signo,
> > @@ -93,7 +97,7 @@ static void fill_ucontext (ucontext_t *uc, const struct 
> > sigcontext *sc)
> >    /* XXX FPU state.  */
> >    memset (&uc->uc_mcontext.fpregs, 0, sizeof (fpregset_t));
> >  }
> > -
> > +#include <stdio.h>
> 
> Spurious change?
> 
> Samuel

-- 
Samuel
Hi ! I'm a .signature virus ! Copy me into your ~/.signature, please !

Reply via email to