[haiku-development] Re: ucontext_t?

  • From: "François Revol" <revol@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 02 Aug 2008 16:18:07 +0200 CEST

> >> 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.

>
> François: It seems difficult to support both BeOS and Posix semantics
> here, briefly looking at it. Would that be a post-R1 change?

No, it should be doable, as passing the ucontext is only enabled when
SA_SIGINFO is enabled:
http://opengroup.org/onlinepubs/007908775/xsh/sigaction.html

So we'd just use BeOS compatible args by default, and push a siginfo_t
and ucontext instead when the flag is set.

As for why it's in glibc/... well it's because it's an glibc internal
header, that doesn't mean we implement it in libroot.
Also note even BSD doesn't seem to implement part of that:
http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=ucontext

François.

Other related posts: