about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-10 21:46:48 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-10 21:46:48 +0000
commit58f46c794a3dc049ae8c53dab76d83ea23408479 (patch)
tree5695211b81ee73dc571857728e377b59a6938d92 /sysdeps/unix
parentbf9d1166a06c7181e50d7d5c9a2cde665007ee1d (diff)
downloadglibc-58f46c794a3dc049ae8c53dab76d83ea23408479.tar.gz
glibc-58f46c794a3dc049ae8c53dab76d83ea23408479.tar.xz
glibc-58f46c794a3dc049ae8c53dab76d83ea23408479.zip
Update.
2001-04-10  Martin Schwidefsky  <schwidefsky@de.ibm.com>

	* sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S: Fix return
	value of getcontext.
	* sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S: Fix return
	value of setcontext.
	* sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S: Likewise.
	* sysdeps/unix/sysv/linux/s390/swapcontext.c: Skip setcontext
	call by changing the saved context.
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S10
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S3
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S10
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S3
-rw-r--r--sysdeps/unix/sysv/linux/s390/swapcontext.c10
5 files changed, 20 insertions, 16 deletions
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
index e64cc8588c..b3cae1c7fe 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
@@ -25,9 +25,7 @@
 /*  __getcontext (const ucontext_t *ucp)
 
   Saves the machine context in UCP such that when it is activated,
-  it appears as if __getcontext() returned again.  The only difference
-  is that on a first return, %r2 contains 1 and on a subsequent
-  return, it contains 0.
+  it appears as if __getcontext() returned again. 
 
   This implementation is intended to be used for *synchronous* context
   switches only.  Therefore, it does not have to save anything
@@ -61,11 +59,13 @@ ENTRY(__getcontext)
 	std     %f14,SC_FPRS+112(%r5)
 	std     %f15,SC_FPRS+120(%r5)
 
+	/* Set __getcontext return value to 0.  */
+	slr     %r2,%r2
+
 	/* Store general purpose registers.  */
 	stm     %r0,%r15,SC_GPRS(%r5)
 
-	/* Return 0.  */
-	slr	%r2,%r2
+	/* Return.  */
 	br	%r14
 END(__getcontext)
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 40adc8574a..2bed31847a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -62,8 +62,7 @@ ENTRY(__setcontext)
 	/* Load general purpose registers.  */
 	lm	%r0,%r15,SC_GPRS(%r5)
 
-        /* Return 1.  */
-	la      %r2,1
+	/* Return.  */
 	br	%r14
 END(__setcontext)
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
index 2fc21e2b60..9eba838edf 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
@@ -25,9 +25,7 @@
 /*  __getcontext (const ucontext_t *ucp)
 
   Saves the machine context in UCP such that when it is activated,
-  it appears as if __getcontext() returned again.  The only difference
-  is that on a first return, %r2 contains 1 and on a subsequent
-  return, it contains 0.
+  it appears as if __getcontext() returned again.
 
   This implementation is intended to be used for *synchronous* context
   switches only.  Therefore, it does not have to save anything
@@ -61,11 +59,13 @@ ENTRY(__getcontext)
 	std     %f14,SC_FPRS+112(%r5)
 	std     %f15,SC_FPRS+120(%r5)
 
+	/* Set __getcontext return value to 0.  */
+	slr     %r2,%r2
+
 	/* Store general purpose registers.  */
 	stmg    %r0,%r15,SC_GPRS(%r5)
 
-	/* Return 0.  */
-	slgr	%r2,%r2
+	/* Return.  */
 	br	%r14
 END(__getcontext)
 
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index b3a9fea405..a652ad3173 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -62,8 +62,7 @@ ENTRY(__setcontext)
 	/* Load general purpose registers.  */
 	lmg	%r0,%r15,SC_GPRS(%r5)
 
-        /* Return 1.  */
-	la      %r2,1
+	/* Return.  */
 	br	%r14
 END(__setcontext)
 
diff --git a/sysdeps/unix/sysv/linux/s390/swapcontext.c b/sysdeps/unix/sysv/linux/s390/swapcontext.c
index 9f1be058db..2b34b63ce4 100644
--- a/sysdeps/unix/sysv/linux/s390/swapcontext.c
+++ b/sysdeps/unix/sysv/linux/s390/swapcontext.c
@@ -25,8 +25,14 @@ extern int __setcontext (__const ucontext_t *__ucp) __THROW;
 int
 __swapcontext (ucontext_t *oucp, const ucontext_t *ucp)
 {
-  if (__getcontext (oucp) == 0)
-    __setcontext (ucp);
+  /* Save the current machine context to oucp.  */
+  __getcontext (oucp);
+  /* Modify oucp to skip the __setcontext call on reactivation.  */
+  oucp->uc_mcontext.gregs[14] = &&fake_return;
+  /* Restore the machine context in ucp.  */
+  __setcontext (ucp);
+
+fake_return:
   return 0;
 }