[haiku-development] Re: ucontext_t?

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 02 Aug 2008 17:29:40 +0200

On 2008-08-02 at 16:18:07 [+0200], François Revol <revol@xxxxxxx> wrote:
> > >> Is there any alternative mechanism for user-level context
> > > > switching,
> > >> or could I contribute to having it implemented for x86?
> > >
> > > Just like BeOS, we already provide extra args, including a vregs
> > > array,
> > > see
> > > headers/posix/signal.h
> > >
> > > But as this is totally non-standard we should probably also
> > > implement
> > > ucontext, and use it instead when it's enabled.
> >
> > Thanks to both of you for the quick answers.
> >
> > I am investigating struct vregs, and it's been a long time that I've
> > been in contact with x86 assembler, so... I'm wondering why there are
> > no members ebx, esi, edi? Are there different names for them or
> 
> Dunno, I never noticed those were lacking.
> Probably because they are not meant to be touched by signal code ?
> 
> > another way to get+set their value? Are they "safe" to ignore?
> 
> Just using asm("mov %%ebx,%0\n" : : ...); would do I think.

The C compiler might have generated code that already has changed them, 
though. With ebx usually being the GOT pointer that's even pretty likely to 
happen in the function prolog. So you'll probably have to write an assembly 
signal handler stub, if you need their value in your signal handler.

CU, Ingo

Other related posts: