about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-24 06:48:43 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-24 06:48:43 +0000
commit188356b8cca3cadc66664b8da11d342d45f95ff5 (patch)
tree7149c280b59df5c4770a517f87c9ea84f920767d
parent760b7056239a51e7fa1cbbd99b293c4366f64a1a (diff)
downloadglibc-188356b8cca3cadc66664b8da11d342d45f95ff5.tar.gz
glibc-188356b8cca3cadc66664b8da11d342d45f95ff5.tar.xz
glibc-188356b8cca3cadc66664b8da11d342d45f95ff5.zip
Initialize %fs, %gs, and floating-point status as well.
-rw-r--r--sysdeps/unix/sysv/linux/i386/makecontext.S16
1 files changed, 16 insertions, 0 deletions
diff --git a/sysdeps/unix/sysv/linux/i386/makecontext.S b/sysdeps/unix/sysv/linux/i386/makecontext.S
index 56b5537ce3..1ca3233945 100644
--- a/sysdeps/unix/sysv/linux/i386/makecontext.S
+++ b/sysdeps/unix/sysv/linux/i386/makecontext.S
@@ -40,6 +40,22 @@ ENTRY(__makecontext)
 	movl	oLINK(%eax), %ecx
 	movl	%ecx, -4(%edx)
 
+	/* Copy the FS and GS segment register.  */
+	xorl	%ecx, %ecx
+	movw	%gs, %cx
+	movl	%ecx, oGS(%eax)
+	xorl	%ecx, %ecx
+	movw	%fs, %cx
+	movl	%ecx, oFS(%eax)
+
+	/* We have separate floating-point register content memory on the
+	   stack.  We use the __fpregs_mem block in the context.  Set the
+	   links up correctly.  */
+	leal	oFPREGSMEM(%eax), %ecx
+	movl	%ecx, oFPREGS(%eax)
+	/* Save the floating-point context.  */
+	fnstenv	(%ecx)
+
 	/* Remember the number of parameters for the exit handler since
 	   it has to remove them.  We store the number in the EBX register
 	   which the function we will call must preserve.  */