ucontext: implement swapcontext

This function is supposed to atomically get the current context, and set a new one.
It should be just a matter of calling getcontext + setcontext in a row. If the thread
is descheduled, it will come back later with the same set of registers.

Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>