Index: uspace/lib/c/generic/context.c
===================================================================
--- uspace/lib/c/generic/context.c	(revision 84239b1cd7c5ed286263ce4edb649da00b34b249)
+++ uspace/lib/c/generic/context.c	(revision a35a3d819d4e2e4e35964eea617087b5c6431b02)
@@ -28,4 +28,5 @@
 
 #include <context.h>
+#include <setjmp.h>
 #include <libarch/tls.h>
 #include <libarch/fibril.h>
@@ -42,11 +43,11 @@
 void context_swap(context_t *self, context_t *other)
 {
-	if (context_save(self))
-		context_restore(other);
+	if (!__setjmp(self))
+		__longjmp(other, 1);
 }
 
 void context_create(context_t *context, const context_create_t *arg)
 {
-	context_save(context);
+	__setjmp(context);
 	context_set(context, FADDR(arg->fn), arg->stack_base,
 	    arg->stack_size, arg->tls);
Index: uspace/lib/c/generic/setjmp.c
===================================================================
--- uspace/lib/c/generic/setjmp.c	(revision 84239b1cd7c5ed286263ce4edb649da00b34b249)
+++ uspace/lib/c/generic/setjmp.c	(revision a35a3d819d4e2e4e35964eea617087b5c6431b02)
@@ -1,4 +1,5 @@
 /*
  * Copyright (c) 2013 Vojtech Horky
+ * Copyright (c) 2018 CZ.NIC, z.s.p.o.
  * All rights reserved.
  *
@@ -30,30 +31,13 @@
  * @{
  */
-/** @file Long jump implementation.
- *
- * Implementation inspired by Jiri Zarevucky's code from
- * http://bazaar.launchpad.net/~zarevucky-jiri/helenos/stdc/revision/1544/uspace/lib/posix/setjmp.h
- */
 
 #include <setjmp.h>
 #include <context.h>
 
-// TODO: setjmp/longjmp are basically a stronger version of
-// context_save/context_restore. It would be preferable to turn
-// those two into setjmp/longjmp (all it would need is preserving the
-// return value).
-
-/**
- * Restore environment previously stored by setjmp.
- *
- * This function never returns.
- *
- * @param env Variable with the environment previously stored by call
- * to setjmp.
- * @param val Value to fake when returning from setjmp (0 is transformed to 1).
- */
-void longjmp(jmp_buf env, int val) {
-	env[0].return_value = (val == 0) ? 1 : val;
-	context_restore(&env[0].context);
+/** Standard function implementation. */
+void longjmp(jmp_buf env, int val)
+{
+	/* __longjmp defined in assembly doesn't "correct" the value. */
+	__longjmp(env, val == 0 ? 1 : val);
 }
 
