bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH glibc 16/34] hurd: Add sys/ucontext.h and sigcontext.h fo


From: Samuel Thibault
Subject: Re: [RFC PATCH glibc 16/34] hurd: Add sys/ucontext.h and sigcontext.h for x86_64
Date: Tue, 11 Apr 2023 00:23:00 +0200
User-agent: NeoMutt/20170609 (1.8.3)

Sergey Bugaev, le mar. 11 avril 2023 00:50:25 +0300, a ecrit:
> On Mon, Apr 10, 2023 at 10:22 PM Samuel Thibault
> <samuel.thibault@gnu.org> wrote:
> >
> > Sergey Bugaev, le lun. 10 avril 2023 22:13:06 +0300, a ecrit:
> > > On Mon, Apr 10, 2023 at 9:58 PM Samuel Thibault <samuel.thibault@gnu.org> 
> > > wrote:
> > > >
> > > > Sergey Bugaev, le dim. 19 mars 2023 18:09:59 +0300, a ecrit:
> > > > > +#ifdef __USE_GNU
> > > > > +/* Number of each register in the `gregset_t' array.  */
> > > > > +enum
> > > > > +{
> > > > > +  REG_GSFS = 0,              /* Actually int gs, fs.  */
> > > > > +# define REG_GSFS    REG_GSFS
> > > > > +  REG_ESDS,          /* Actually int es, ds.  */
> > > > > +# define REG_ESDS    REG_ESDS
> > > >
> > > > On second thought, why REG_ESDS? They are basically useless on amd64
> > > >
> > > > Linux packs all segment registers in REG_CSGSFS, probably better to
> > > > stuff them the same way? (all three really are 16bit only, even if the
> > > > thread_state is padding them to 32bits).
> > >
> > > Exactly because that's how they are laid out in struct
> > > i386_thread_state, if you count in 8-byte chunks.
> >
> > But we don't have to map to that.
> 
> Well yes, I was trying to make the x86_64 version do the same thing as
> i386 does, hence arranging registers in sigcontext, ucontext, and
> thread state in the same way, so they can be memcpied, like on i386.

Ah, but on i386 it's only coincidence that it's the same layout, just
because that's the pusha layourt :)

> But we could also lay this out differently and just write some more
> code to fill the ucontext.

I'd say better stick to some sane layout that makes it simpler for most
uses. We don't have to stick to the Linux layout either.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]