Index: kernel/arch/ia32/src/context.S
===================================================================
--- kernel/arch/ia32/src/context.S	(revision 8844e7075a44097c359d1ef79350efa377c39ec5)
+++ kernel/arch/ia32/src/context.S	(revision 9a08e6bddeb3cffb3e0438813da2a3084dcd33c5)
@@ -29,4 +29,5 @@
 #include <abi/asmtool.h>
 #include <arch/context_struct.h>
+#include <arch/vreg.h>
 
 .text
@@ -48,4 +49,8 @@
 	movl %edi, CONTEXT_OFFSET_EDI(%edx)	# %edi -> ctx->edi
 	movl %ebp, CONTEXT_OFFSET_EBP(%edx)	# %ebp -> ctx->ebp
+
+	mov vreg_ptr, %ecx
+	movl %gs:VREG_TP(%ecx), %ecx
+	movl %ecx, CONTEXT_OFFSET_TP(%edx)
 
 	xorl %eax, %eax		# context_save returns 1
@@ -72,5 +77,9 @@
 
 	movl %edx, 0(%esp)	# put saved pc on stack
+
+	mov vreg_ptr, %ecx
+	movl CONTEXT_OFFSET_TP(%eax), %edx
+	movl %edx, %gs:VREG_TP(%ecx)
+
 	xorl %eax, %eax		# context_restore returns 0
 	ret
-FUNCTION_END(context_restore_arch)
