This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] S/390: Extend ucontext_t data structure
- From: Andreas Krebbel <krebbel at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 9 Dec 2013 16:56:55 +0100
- Subject: [PATCH] S/390: Extend ucontext_t data structure
- Authentication-results: sourceware.org; auth=none
Hi,
the attached patch reserves space in the ucontext_ data structure for
future extensions.
In ucontext_t we already have a flags field which can be used to
identify the version. Since all ucontext_t instances are supposed to
be initialized through getcontext only this function needs symbol
versioning. swapcontext inherits the ucontext_t version from the old
context structure.
Any comments?
Bye,
-Andreas-
2013-12-09 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* sysdeps/unix/sysv/linux/s390/Versions: Add getcontext as new
GLIBC_2.19 symbol.
* sysdeps/unix/sysv/linux/s390/getcontext.S: New file.
* sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S: Rename to ...
* sysdeps/unix/sysv/linux/s390/s390-32/getcontext-common.S:
... this.
* sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S: Rename to ...
* sysdeps/unix/sysv/linux/s390/s390-64/getcontext-common.S:
... this.
* sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist:
Regnerate.
* sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist:
Regenerate.
* sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S: Access the
signal mask with a runtime offset.
* sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S: Likewise.
* sysdeps/unix/sysv/linux/s390/sys/ucontext.h: Add new field to
uncontext_t structure.
* sysdeps/unix/sysv/linux/s390/ucontext_i.sym: Add
SC_RESERVED_BYTES for the assembler files.
commit 7f3dede683c6f8e7e92512770ab6536cd61c9f62
Author: Andreas Krebbel <krebbel@linux.vnet.ibm.com>
Date: Mon Dec 9 13:57:23 2013 +0000
S/390: Extend ucontext_t structure.
diff --git a/sysdeps/unix/sysv/linux/s390/Versions b/sysdeps/unix/sysv/linux/s390/Versions
index 9577823..f71a6bd 100644
--- a/sysdeps/unix/sysv/linux/s390/Versions
+++ b/sysdeps/unix/sysv/linux/s390/Versions
@@ -1,6 +1,7 @@
libc {
GLIBC_2.19 {
__longjmp_chk;
+ getcontext;
}
GLIBC_PRIVATE {
__vdso_clock_gettime;
diff --git a/sysdeps/unix/sysv/linux/s390/getcontext.S b/sysdeps/unix/sysv/linux/s390/getcontext.S
new file mode 100644
index 0000000..18455d0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/getcontext.S
@@ -0,0 +1,45 @@
+/* Extendible version of getcontext for System z
+ Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <libc-symbols.h>
+#include <shlib-compat.h>
+
+#if defined NOT_IN_libc
+/* Build a non-versioned object for rtld-*. */
+# include "getcontext-common.S"
+
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+versioned_symbol (libc, __v2getcontext, getcontext, GLIBC_2_19)
+# define __getcontext __v2getcontext
+
+# include "getcontext-common.S"
+
+# undef __getcontext
+
+libc_hidden_ver (__v2getcontext, getcontext)
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_1, GLIBC_2_19)
+# define __OLD_UCONTEXT
+compat_symbol (libc, __v1getcontext, getcontext, GLIBC_2_1)
+# define __getcontext __v1getcontext
+# include "getcontext-common.S"
+# undef __getcontext
+
+# endif
+#endif /* !NOT_IN_libc */
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext-common.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext-common.S
new file mode 100644
index 0000000..7b528cf
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext-common.S
@@ -0,0 +1,87 @@
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <features.h>
+
+#include "ucontext_i.h"
+
+/* __getcontext (const ucontext_t *ucp)
+
+ Saves the machine context in UCP such that when it is activated,
+ 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
+ other than the PRESERVED state. */
+
+ENTRY(__getcontext)
+ lr %r1,%r2
+
+ /* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
+ la %r2,SIG_BLOCK
+ slr %r3,%r3
+#ifdef __OLD_UCONTEXT
+ la %r4,SC_MASK-SC_RESERVED_BYTES(%r1)
+#else
+ la %r4,SC_MASK(%r1)
+#endif
+ lhi %r5,_NSIG8
+ svc SYS_ify(rt_sigprocmask)
+
+ /* Store fpu context. */
+ stfpc SC_FPC(%r1)
+ std %f0,SC_FPRS(%r1)
+ std %f1,SC_FPRS+8(%r1)
+ std %f2,SC_FPRS+16(%r1)
+ std %f3,SC_FPRS+24(%r1)
+ std %f4,SC_FPRS+32(%r1)
+ std %f5,SC_FPRS+40(%r1)
+ std %f6,SC_FPRS+48(%r1)
+ std %f7,SC_FPRS+56(%r1)
+ std %f8,SC_FPRS+64(%r1)
+ std %f9,SC_FPRS+72(%r1)
+ std %f10,SC_FPRS+80(%r1)
+ std %f11,SC_FPRS+88(%r1)
+ std %f12,SC_FPRS+96(%r1)
+ std %f13,SC_FPRS+104(%r1)
+ std %f14,SC_FPRS+112(%r1)
+ std %f15,SC_FPRS+120(%r1)
+
+ /* Store the version number into the uc_flags field. */
+#ifdef __OLD_UCONTEXT
+ lhi %r2,0
+#else
+ lhi %r2,1
+#endif
+ st %r2,SC_FLGS(%r1)
+
+ /* Set __getcontext return value to 0. */
+ slr %r2,%r2
+
+ /* Store access registers. */
+ stam %a0,%a15,SC_ACRS(%r1)
+
+ /* Store general purpose registers. */
+ stm %r0,%r15,SC_GPRS(%r1)
+
+ /* Return. */
+ br %r14
+END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
deleted file mode 100644
index 6923f0e..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-32/getcontext.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <features.h>
-
-#include "ucontext_i.h"
-
-/* __getcontext (const ucontext_t *ucp)
-
- Saves the machine context in UCP such that when it is activated,
- 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
- other than the PRESERVED state. */
-
-ENTRY(__getcontext)
- lr %r1,%r2
-
- /* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
- la %r2,SIG_BLOCK
- slr %r3,%r3
- la %r4,SC_MASK(%r1)
- lhi %r5,_NSIG8
- svc SYS_ify(rt_sigprocmask)
-
- /* Store fpu context. */
- stfpc SC_FPC(%r1)
- std %f0,SC_FPRS(%r1)
- std %f1,SC_FPRS+8(%r1)
- std %f2,SC_FPRS+16(%r1)
- std %f3,SC_FPRS+24(%r1)
- std %f4,SC_FPRS+32(%r1)
- std %f5,SC_FPRS+40(%r1)
- std %f6,SC_FPRS+48(%r1)
- std %f7,SC_FPRS+56(%r1)
- std %f8,SC_FPRS+64(%r1)
- std %f9,SC_FPRS+72(%r1)
- std %f10,SC_FPRS+80(%r1)
- std %f11,SC_FPRS+88(%r1)
- std %f12,SC_FPRS+96(%r1)
- std %f13,SC_FPRS+104(%r1)
- std %f14,SC_FPRS+112(%r1)
- std %f15,SC_FPRS+120(%r1)
-
- /* Set __getcontext return value to 0. */
- slr %r2,%r2
-
- /* Store access registers. */
- stam %a0,%a15,SC_ACRS(%r1)
-
- /* Store general purpose registers. */
- stm %r0,%r15,SC_GPRS(%r1)
-
- /* Return. */
- br %r14
-END(__getcontext)
-
-weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
index 18ec994..03f2e83 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libc.abilist
@@ -1781,6 +1781,7 @@ GLIBC_2.19
__sigsetjmp F
_longjmp F
_setjmp F
+ getcontext F
longjmp F
setjmp F
siglongjmp F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
index 03d2008..467613d 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/setcontext.S
@@ -34,8 +34,12 @@ ENTRY(__setcontext)
lr %r1,%r2
/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL). */
- la %r2,SIG_BLOCK
+ l %r2,SC_FLGS(%r1)
+ ltr %r2,%r2
la %r3,SC_MASK(%r1)
+ jnz 0f
+ la %r3,SC_MASK-SC_RESERVED_BYTES(%r1)
+0: la %r2,SIG_BLOCK
slr %r4,%r4
lhi %r5,_NSIG8
svc SYS_ify(rt_sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
index b022f2c..c3f905b 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/swapcontext.S
@@ -37,9 +37,13 @@ ENTRY(__swapcontext)
lr %r0,%r3
/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
- la %r2,SIG_BLOCK
- slr %r3,%r3
+ l %r2,SC_FLGS(%r3)
+ ltr %r2,%r2
la %r4,SC_MASK(%r1)
+ jnz 0f
+ la %r4,SC_MASK-SC_RESERVED_BYTES(%r1)
+0: la %r2,SIG_BLOCK
+ slr %r3,%r3
lhi %r5,_NSIG8
svc SYS_ify(rt_sigprocmask)
@@ -72,9 +76,15 @@ ENTRY(__swapcontext)
stm %r0,%r15,SC_GPRS(%r1)
/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL). */
- la %r2,SIG_BLOCK
lr %r5,%r0
+ l %r2,SC_FLGS(%r5)
+ ltr %r2,%r2
+ /* Copy uc_flags into the new ucontext_t. */
+ st %r2,SC_FLGS(%r1)
la %r3,SC_MASK(%r5)
+ jnz 0f
+ la %r3,SC_MASK-SC_RESERVED_BYTES(%r5)
+0: la %r2,SIG_BLOCK
slr %r4,%r4
lhi %r5,_NSIG8
svc SYS_ify(rt_sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext-common.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext-common.S
new file mode 100644
index 0000000..25fbc87
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext-common.S
@@ -0,0 +1,87 @@
+/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sysdep.h>
+#include <features.h>
+
+#include "ucontext_i.h"
+
+/* __getcontext (const ucontext_t *ucp)
+
+ Saves the machine context in UCP such that when it is activated,
+ 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
+ other than the PRESERVED state. */
+
+ENTRY(__getcontext)
+ lgr %r1,%r2
+
+ /* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
+ la %r2,SIG_BLOCK
+ slgr %r3,%r3
+#ifdef __OLD_UCONTEXT
+ la %r4,SC_MASK-SC_RESERVED_BYTES(%r1)
+#else
+ la %r4,SC_MASK(%r1)
+#endif
+ lghi %r5,_NSIG8
+ svc SYS_ify(rt_sigprocmask)
+
+ /* Store fpu context. */
+ stfpc SC_FPC(%r1)
+ std %f0,SC_FPRS(%r1)
+ std %f1,SC_FPRS+8(%r1)
+ std %f2,SC_FPRS+16(%r1)
+ std %f3,SC_FPRS+24(%r1)
+ std %f4,SC_FPRS+32(%r1)
+ std %f5,SC_FPRS+40(%r1)
+ std %f6,SC_FPRS+48(%r1)
+ std %f7,SC_FPRS+56(%r1)
+ std %f8,SC_FPRS+64(%r1)
+ std %f9,SC_FPRS+72(%r1)
+ std %f10,SC_FPRS+80(%r1)
+ std %f11,SC_FPRS+88(%r1)
+ std %f12,SC_FPRS+96(%r1)
+ std %f13,SC_FPRS+104(%r1)
+ std %f14,SC_FPRS+112(%r1)
+ std %f15,SC_FPRS+120(%r1)
+
+ /* Store the version number into the uc_flags field. */
+#ifdef __OLD_UCONTEXT
+ lghi %r2,0
+#else
+ lghi %r2,1
+#endif
+ stg %r2,SC_FLGS(%r1)
+
+ /* Set __getcontext return value to 0. */
+ slgr %r2,%r2
+
+ /* Store access registers. */
+ stam %a0,%a15,SC_ACRS(%r1)
+
+ /* Store general purpose registers. */
+ stmg %r0,%r15,SC_GPRS(%r1)
+
+ /* Return. */
+ br %r14
+END(__getcontext)
+
+weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
deleted file mode 100644
index 7c406cb..0000000
--- a/sysdeps/unix/sysv/linux/s390/s390-64/getcontext.S
+++ /dev/null
@@ -1,75 +0,0 @@
-/* Copyright (C) 2001-2013 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <features.h>
-
-#include "ucontext_i.h"
-
-/* __getcontext (const ucontext_t *ucp)
-
- Saves the machine context in UCP such that when it is activated,
- 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
- other than the PRESERVED state. */
-
-ENTRY(__getcontext)
- lgr %r1,%r2
-
- /* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
- la %r2,SIG_BLOCK
- slgr %r3,%r3
- la %r4,SC_MASK(%r1)
- lghi %r5,_NSIG8
- svc SYS_ify(rt_sigprocmask)
-
- /* Store fpu context. */
- stfpc SC_FPC(%r1)
- std %f0,SC_FPRS(%r1)
- std %f1,SC_FPRS+8(%r1)
- std %f2,SC_FPRS+16(%r1)
- std %f3,SC_FPRS+24(%r1)
- std %f4,SC_FPRS+32(%r1)
- std %f5,SC_FPRS+40(%r1)
- std %f6,SC_FPRS+48(%r1)
- std %f7,SC_FPRS+56(%r1)
- std %f8,SC_FPRS+64(%r1)
- std %f9,SC_FPRS+72(%r1)
- std %f10,SC_FPRS+80(%r1)
- std %f11,SC_FPRS+88(%r1)
- std %f12,SC_FPRS+96(%r1)
- std %f13,SC_FPRS+104(%r1)
- std %f14,SC_FPRS+112(%r1)
- std %f15,SC_FPRS+120(%r1)
-
- /* Set __getcontext return value to 0. */
- slgr %r2,%r2
-
- /* Store access registers. */
- stam %a0,%a15,SC_ACRS(%r1)
-
- /* Store general purpose registers. */
- stmg %r0,%r15,SC_GPRS(%r1)
-
- /* Return. */
- br %r14
-END(__getcontext)
-
-weak_alias (__getcontext, getcontext)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
index 05b5286..4576fc8 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libc.abilist
@@ -102,6 +102,7 @@ GLIBC_2.19
__sigsetjmp F
_longjmp F
_setjmp F
+ getcontext F
longjmp F
setjmp F
siglongjmp F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
index f9ce7b6..dfaff2a 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/setcontext.S
@@ -34,8 +34,12 @@ ENTRY(__setcontext)
lgr %r1,%r2
/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL). */
- la %r2,SIG_BLOCK
+ lg %r2,SC_FLGS(%r1)
+ ltgr %r2,%r2
la %r3,SC_MASK(%r1)
+ jnz 0f
+ la %r3,SC_MASK-SC_RESERVED_BYTES(%r1)
+0: la %r2,SIG_BLOCK
slgr %r4,%r4
lghi %r5,_NSIG8
svc SYS_ify(rt_sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
index a626660..3f49d76 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/swapcontext.S
@@ -37,9 +37,13 @@ ENTRY(__swapcontext)
lgr %r0,%r3
/* sigprocmask (SIG_BLOCK, NULL, &sc->sc_mask). */
- la %r2,SIG_BLOCK
- slgr %r3,%r3
+ lg %r2,SC_FLGS(%r3)
+ ltgr %r2,%r2
la %r4,SC_MASK(%r1)
+ jnz 0f
+ la %r4,SC_MASK-SC_RESERVED_BYTES(%r1)
+0: la %r2,SIG_BLOCK
+ slgr %r3,%r3
lghi %r5,_NSIG8
svc SYS_ify(rt_sigprocmask)
@@ -72,9 +76,15 @@ ENTRY(__swapcontext)
stmg %r0,%r15,SC_GPRS(%r1)
/* sigprocmask (SIG_SETMASK, &sc->sc_mask, NULL). */
- la %r2,SIG_BLOCK
lgr %r5,%r0
+ lg %r2,SC_FLGS(%r5)
+ ltgr %r2,%r2
+ /* Copy uc_flags into the new ucontext_t. */
+ stg %r2,SC_FLGS(%r1)
la %r3,SC_MASK(%r5)
+ jnz 0f
+ la %r3,SC_MASK-SC_RESERVED_BYTES(%r5)
+0: la %r2,SIG_BLOCK
lghi %r5,_NSIG8
slgr %r4,%r4
svc SYS_ify(rt_sigprocmask)
diff --git a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
index eca2625..954579e 100644
--- a/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
+++ b/sysdeps/unix/sysv/linux/s390/sys/ucontext.h
@@ -64,6 +64,8 @@ typedef struct
fpreg_t fprs[16];
} fpregset_t;
+#define __V2_MCONTEXT_NEW_BYTES 512
+
/* Context to describe whole processor state. */
typedef struct
{
@@ -71,6 +73,7 @@ typedef struct
unsigned long gregs[16];
unsigned int aregs[16];
fpregset_t fpregs;
+ char reserved[__V2_MCONTEXT_NEW_BYTES];
} mcontext_t;
/* Userlevel context. */
diff --git a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
index 6cc9f19..dfd8a33 100644
--- a/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
+++ b/sysdeps/unix/sysv/linux/s390/ucontext_i.sym
@@ -22,4 +22,6 @@ SC_GPRS mcontext (gregs)
SC_ACRS mcontext (aregs)
SC_FPC mcontext (fpregs.fpc)
SC_FPRS mcontext (fpregs.fprs)
-SC_MASK ucontext (uc_sigmask)
+SC_MASK ucontext (uc_sigmask)
+
+SC_RESERVED_BYTES __V2_MCONTEXT_NEW_BYTES