0

I need to use context switching in linux on my x86 platform similar to ucontext.h does,

But unfortunately ucontext use kernel call to do it. In my Xenomai environment any call of kernel function turns system to secondary mode (linux scheduling)

So how to switch context on x86 platform with storing FPU registers without leaving user-space?

picoworm
  • 310
  • 3
  • 13
  • where did you get `ucotext.h`? what this `ucotext.h` does? Your questions needs to be clearer. – rakib_ Sep 30 '14 at 08:27
  • Sorry. I mean ucontext.h. This is standard glibc function – picoworm Oct 01 '14 at 07:07
  • 2
    `ucontext` does not use a kernel call to switch contexts. It's true that it makes a kernel call, but that is only to update signal masks (which should have predictable performance and certainly never blocks). If even that affects Xenomai and you still prefer `ucontext` to the alternatives, I think you could just copy the code out of glibc and remove the updating of signal masks. – Dolda2000 Oct 16 '14 at 16:27

1 Answers1

1

I found solution. Using longjmp instead of swapcontext do the same but do not executing kernel call, and do not switch system to secondary mode.

Solution was found here: http://www.1024cores.net/home/lock-free-algorithms/tricks/fibers

picoworm
  • 310
  • 3
  • 13