|
|
077c9d |
commit 07be392807ac78330da90f01408aa7e042a97a88
|
|
|
077c9d |
Author: Stefan Liebler <stli@linux.ibm.com>
|
|
|
077c9d |
Date: Tue Dec 18 13:57:05 2018 +0100
|
|
|
077c9d |
|
|
|
077c9d |
S390: Implement bzero with memset.
|
|
|
077c9d |
|
|
|
077c9d |
This patch removes the bzero s390 implementation with mvcle and
|
|
|
077c9d |
adds entry points for bzero in memset ifunc variants.
|
|
|
077c9d |
Therefore an ifunc resolver is implemented for bzero, too.
|
|
|
077c9d |
|
|
|
077c9d |
ChangeLog:
|
|
|
077c9d |
|
|
|
077c9d |
* sysdeps/s390/s390-32/bzero.S: Delete file.
|
|
|
077c9d |
* sysdeps/s390/s390-64/bzero.S: Likewise.
|
|
|
077c9d |
* sysdeps/s390/Makefile (sysdep_routines): Add bzero.
|
|
|
077c9d |
* sysdeps/s390/bzero.c: New file.
|
|
|
077c9d |
* sysdeps/s390/memset-z900.S: Add bzero entry points.
|
|
|
077c9d |
* sysdeps/s390/ifunc-memset.h: Add bzero function macros.
|
|
|
077c9d |
* sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
077c9d |
(__libc_ifunc_impl_list): Add bzero ifunc variants.
|
|
|
077c9d |
|
|
|
077c9d |
diff --git a/sysdeps/s390/Makefile b/sysdeps/s390/Makefile
|
|
|
077c9d |
index 360838e172f4ca37..e40e5bd982e54d89 100644
|
|
|
077c9d |
--- a/sysdeps/s390/Makefile
|
|
|
077c9d |
+++ b/sysdeps/s390/Makefile
|
|
|
077c9d |
@@ -31,5 +31,5 @@ sysdeps-gconv-modules = ../sysdeps/s390/gconv-modules
|
|
|
077c9d |
endif
|
|
|
077c9d |
|
|
|
077c9d |
ifeq ($(subdir),string)
|
|
|
077c9d |
-sysdep_routines += memset memset-z900
|
|
|
077c9d |
+sysdep_routines += bzero memset memset-z900
|
|
|
077c9d |
endif
|
|
|
077c9d |
diff --git a/sysdeps/s390/s390-32/bzero.S b/sysdeps/s390/bzero.c
|
|
|
077c9d |
similarity index 52%
|
|
|
077c9d |
rename from sysdeps/s390/s390-32/bzero.S
|
|
|
077c9d |
rename to sysdeps/s390/bzero.c
|
|
|
077c9d |
index 897aa2154a861b7f..9f8d95781bf2fb68 100644
|
|
|
077c9d |
--- a/sysdeps/s390/s390-32/bzero.S
|
|
|
077c9d |
+++ b/sysdeps/s390/bzero.c
|
|
|
077c9d |
@@ -1,7 +1,6 @@
|
|
|
077c9d |
-/* bzero -- set a block of memory to zero. IBM S390 version
|
|
|
077c9d |
+/* Multiple versions of bzero.
|
|
|
077c9d |
+ Copyright (C) 2018 Free Software Foundation, Inc.
|
|
|
077c9d |
This file is part of the GNU C Library.
|
|
|
077c9d |
- Copyright (C) 2000-2018 Free Software Foundation, Inc.
|
|
|
077c9d |
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
|
|
077c9d |
|
|
|
077c9d |
The GNU C Library is free software; you can redistribute it and/or
|
|
|
077c9d |
modify it under the terms of the GNU Lesser General Public
|
|
|
077c9d |
@@ -17,26 +16,32 @@
|
|
|
077c9d |
License along with the GNU C Library; if not, see
|
|
|
077c9d |
<http://www.gnu.org/licenses/>. */
|
|
|
077c9d |
|
|
|
077c9d |
-/*
|
|
|
077c9d |
- * R2 = address to memory area
|
|
|
077c9d |
- * R3 = number of bytes to fill
|
|
|
077c9d |
- */
|
|
|
077c9d |
-
|
|
|
077c9d |
-#include "sysdep.h"
|
|
|
077c9d |
-#include "asm-syntax.h"
|
|
|
077c9d |
-
|
|
|
077c9d |
- .text
|
|
|
077c9d |
-ENTRY(__bzero)
|
|
|
077c9d |
- ltr %r3,%r3
|
|
|
077c9d |
- jz .L1
|
|
|
077c9d |
- sr %r1,%r1 # set pad byte to zero
|
|
|
077c9d |
- sr %r4,%r4 # no source for MVCLE, only a pad byte
|
|
|
077c9d |
- sr %r5,%r5
|
|
|
077c9d |
-.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend
|
|
|
077c9d |
- jo .L0
|
|
|
077c9d |
-.L1: br %r14
|
|
|
077c9d |
-END(__bzero)
|
|
|
077c9d |
-
|
|
|
077c9d |
-#ifndef NO_WEAK_ALIAS
|
|
|
077c9d |
+#include <ifunc-memset.h>
|
|
|
077c9d |
+#if HAVE_MEMSET_IFUNC
|
|
|
077c9d |
+# include <string.h>
|
|
|
077c9d |
+# include <ifunc-resolve.h>
|
|
|
077c9d |
+
|
|
|
077c9d |
+# if HAVE_MEMSET_Z900_G5
|
|
|
077c9d |
+extern __typeof (__bzero) BZERO_Z900_G5 attribute_hidden;
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+
|
|
|
077c9d |
+# if HAVE_MEMSET_Z10
|
|
|
077c9d |
+extern __typeof (__bzero) BZERO_Z10 attribute_hidden;
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+
|
|
|
077c9d |
+# if HAVE_MEMSET_Z196
|
|
|
077c9d |
+extern __typeof (__bzero) BZERO_Z196 attribute_hidden;
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+
|
|
|
077c9d |
+s390_libc_ifunc_expr (__bzero, __bzero,
|
|
|
077c9d |
+ ({
|
|
|
077c9d |
+ s390_libc_ifunc_init ();
|
|
|
077c9d |
+ (HAVE_MEMSET_Z196 && S390_IS_Z196 (stfle_bits))
|
|
|
077c9d |
+ ? BZERO_Z196
|
|
|
077c9d |
+ : (HAVE_MEMSET_Z10 && S390_IS_Z10 (stfle_bits))
|
|
|
077c9d |
+ ? BZERO_Z10
|
|
|
077c9d |
+ : BZERO_DEFAULT;
|
|
|
077c9d |
+ })
|
|
|
077c9d |
+ )
|
|
|
077c9d |
weak_alias (__bzero, bzero)
|
|
|
077c9d |
#endif
|
|
|
077c9d |
diff --git a/sysdeps/s390/ifunc-memset.h b/sysdeps/s390/ifunc-memset.h
|
|
|
077c9d |
index 9a13b1001fed9979..32bc155f7e79fa26 100644
|
|
|
077c9d |
--- a/sysdeps/s390/ifunc-memset.h
|
|
|
077c9d |
+++ b/sysdeps/s390/ifunc-memset.h
|
|
|
077c9d |
@@ -25,16 +25,19 @@
|
|
|
077c9d |
|
|
|
077c9d |
#if defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
|
|
|
077c9d |
# define MEMSET_DEFAULT MEMSET_Z196
|
|
|
077c9d |
+# define BZERO_DEFAULT BZERO_Z196
|
|
|
077c9d |
# define HAVE_MEMSET_Z900_G5 0
|
|
|
077c9d |
# define HAVE_MEMSET_Z10 0
|
|
|
077c9d |
# define HAVE_MEMSET_Z196 1
|
|
|
077c9d |
#elif defined HAVE_S390_MIN_Z10_ZARCH_ASM_SUPPORT
|
|
|
077c9d |
# define MEMSET_DEFAULT MEMSET_Z10
|
|
|
077c9d |
+# define BZERO_DEFAULT BZERO_Z10
|
|
|
077c9d |
# define HAVE_MEMSET_Z900_G5 0
|
|
|
077c9d |
# define HAVE_MEMSET_Z10 1
|
|
|
077c9d |
# define HAVE_MEMSET_Z196 HAVE_MEMSET_IFUNC
|
|
|
077c9d |
#else
|
|
|
077c9d |
# define MEMSET_DEFAULT MEMSET_Z900_G5
|
|
|
077c9d |
+# define BZERO_DEFAULT BZERO_Z900_G5
|
|
|
077c9d |
# define HAVE_MEMSET_Z900_G5 1
|
|
|
077c9d |
# define HAVE_MEMSET_Z10 HAVE_MEMSET_IFUNC
|
|
|
077c9d |
# define HAVE_MEMSET_Z196 HAVE_MEMSET_IFUNC
|
|
|
077c9d |
@@ -48,18 +51,24 @@
|
|
|
077c9d |
|
|
|
077c9d |
#if HAVE_MEMSET_Z900_G5
|
|
|
077c9d |
# define MEMSET_Z900_G5 __memset_default
|
|
|
077c9d |
+# define BZERO_Z900_G5 __bzero_default
|
|
|
077c9d |
#else
|
|
|
077c9d |
# define MEMSET_Z900_G5 NULL
|
|
|
077c9d |
+# define BZERO_Z900_G5 NULL
|
|
|
077c9d |
#endif
|
|
|
077c9d |
|
|
|
077c9d |
#if HAVE_MEMSET_Z10
|
|
|
077c9d |
# define MEMSET_Z10 __memset_z10
|
|
|
077c9d |
+# define BZERO_Z10 __bzero_z10
|
|
|
077c9d |
#else
|
|
|
077c9d |
# define MEMSET_Z10 NULL
|
|
|
077c9d |
+# define BZERO_Z10 NULL
|
|
|
077c9d |
#endif
|
|
|
077c9d |
|
|
|
077c9d |
#if HAVE_MEMSET_Z196
|
|
|
077c9d |
# define MEMSET_Z196 __memset_z196
|
|
|
077c9d |
+# define BZERO_Z196 __bzero_z196
|
|
|
077c9d |
#else
|
|
|
077c9d |
# define MEMSET_Z196 NULL
|
|
|
077c9d |
+# define BZERO_Z196 NULL
|
|
|
077c9d |
#endif
|
|
|
077c9d |
diff --git a/sysdeps/s390/memset-z900.S b/sysdeps/s390/memset-z900.S
|
|
|
077c9d |
index eaf13402bd3e251d..bfc659ae0b029eb4 100644
|
|
|
077c9d |
--- a/sysdeps/s390/memset-z900.S
|
|
|
077c9d |
+++ b/sysdeps/s390/memset-z900.S
|
|
|
077c9d |
@@ -22,10 +22,14 @@
|
|
|
077c9d |
#include "asm-syntax.h"
|
|
|
077c9d |
#include <ifunc-memset.h>
|
|
|
077c9d |
|
|
|
077c9d |
-/* INPUT PARAMETERS
|
|
|
077c9d |
+/* INPUT PARAMETERS - MEMSET
|
|
|
077c9d |
%r2 = address of memory area
|
|
|
077c9d |
%r3 = byte to fill memory with
|
|
|
077c9d |
- %r4 = number of bytes to fill. */
|
|
|
077c9d |
+ %r4 = number of bytes to fill.
|
|
|
077c9d |
+
|
|
|
077c9d |
+ INPUT PARAMETERS - BZERO
|
|
|
077c9d |
+ %r2 = address of memory area
|
|
|
077c9d |
+ %r3 = number of bytes to fill. */
|
|
|
077c9d |
|
|
|
077c9d |
.text
|
|
|
077c9d |
|
|
|
077c9d |
@@ -44,7 +48,14 @@
|
|
|
077c9d |
# define BRCTG brct
|
|
|
077c9d |
# endif /* ! defined __s390x__ */
|
|
|
077c9d |
|
|
|
077c9d |
+ENTRY(BZERO_Z900_G5)
|
|
|
077c9d |
+ LGR %r4,%r3
|
|
|
077c9d |
+ xr %r3,%r3
|
|
|
077c9d |
+ j .L_Z900_G5_start
|
|
|
077c9d |
+END(BZERO_Z900_G5)
|
|
|
077c9d |
+
|
|
|
077c9d |
ENTRY(MEMSET_Z900_G5)
|
|
|
077c9d |
+.L_Z900_G5_start:
|
|
|
077c9d |
#if defined __s390x__
|
|
|
077c9d |
.machine "z900"
|
|
|
077c9d |
#else
|
|
|
077c9d |
@@ -90,7 +101,16 @@ END(MEMSET_Z900_G5)
|
|
|
077c9d |
#endif /* HAVE_MEMSET_Z900_G5 */
|
|
|
077c9d |
|
|
|
077c9d |
#if HAVE_MEMSET_Z10
|
|
|
077c9d |
+ENTRY(BZERO_Z10)
|
|
|
077c9d |
+ .machine "z10"
|
|
|
077c9d |
+ .machinemode "zarch_nohighgprs"
|
|
|
077c9d |
+ lgr %r4,%r3
|
|
|
077c9d |
+ xr %r3,%r3
|
|
|
077c9d |
+ j .L_Z10_start
|
|
|
077c9d |
+END(BZERO_Z10)
|
|
|
077c9d |
+
|
|
|
077c9d |
ENTRY(MEMSET_Z10)
|
|
|
077c9d |
+.L_Z10_start:
|
|
|
077c9d |
.machine "z10"
|
|
|
077c9d |
.machinemode "zarch_nohighgprs"
|
|
|
077c9d |
# if !defined __s390x__
|
|
|
077c9d |
@@ -122,7 +142,16 @@ END(MEMSET_Z10)
|
|
|
077c9d |
#endif /* HAVE_MEMSET_Z10 */
|
|
|
077c9d |
|
|
|
077c9d |
#if HAVE_MEMSET_Z196
|
|
|
077c9d |
+ENTRY(BZERO_Z196)
|
|
|
077c9d |
+ .machine "z196"
|
|
|
077c9d |
+ .machinemode "zarch_nohighgprs"
|
|
|
077c9d |
+ lgr %r4,%r3
|
|
|
077c9d |
+ xr %r3,%r3
|
|
|
077c9d |
+ j .L_Z196_start
|
|
|
077c9d |
+END(BZERO_Z196)
|
|
|
077c9d |
+
|
|
|
077c9d |
ENTRY(MEMSET_Z196)
|
|
|
077c9d |
+.L_Z196_start:
|
|
|
077c9d |
.machine "z196"
|
|
|
077c9d |
.machinemode "zarch_nohighgprs"
|
|
|
077c9d |
# if !defined __s390x__
|
|
|
077c9d |
@@ -177,6 +206,10 @@ END(__memset_mvcle)
|
|
|
077c9d |
/* If we don't use ifunc, define an alias for memset here.
|
|
|
077c9d |
Otherwise see sysdeps/s390/memset.c. */
|
|
|
077c9d |
strong_alias (MEMSET_DEFAULT, memset)
|
|
|
077c9d |
+/* Same for bzero. If ifunc is used, see
|
|
|
077c9d |
+ sysdeps/s390/bzero.c. */
|
|
|
077c9d |
+strong_alias (BZERO_DEFAULT, __bzero)
|
|
|
077c9d |
+weak_alias (__bzero, bzero)
|
|
|
077c9d |
#endif
|
|
|
077c9d |
|
|
|
077c9d |
#if defined SHARED && IS_IN (libc)
|
|
|
077c9d |
diff --git a/sysdeps/s390/multiarch/ifunc-impl-list.c b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
077c9d |
index 2f671eac1f4f1ffd..253f36045b57cc3c 100644
|
|
|
077c9d |
--- a/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
077c9d |
+++ b/sysdeps/s390/multiarch/ifunc-impl-list.c
|
|
|
077c9d |
@@ -59,6 +59,21 @@ __libc_ifunc_impl_list (const char *name, struct libc_ifunc_impl *array,
|
|
|
077c9d |
# endif
|
|
|
077c9d |
# if HAVE_MEMSET_Z900_G5
|
|
|
077c9d |
IFUNC_IMPL_ADD (array, i, memset, 1, MEMSET_Z900_G5)
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+ )
|
|
|
077c9d |
+
|
|
|
077c9d |
+ /* Note: bzero is implemented in memset. */
|
|
|
077c9d |
+ IFUNC_IMPL (i, name, bzero,
|
|
|
077c9d |
+# if HAVE_MEMSET_Z196
|
|
|
077c9d |
+ IFUNC_IMPL_ADD (array, i, bzero,
|
|
|
077c9d |
+ S390_IS_Z196 (stfle_bits), BZERO_Z196)
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+# if HAVE_MEMSET_Z10
|
|
|
077c9d |
+ IFUNC_IMPL_ADD (array, i, bzero,
|
|
|
077c9d |
+ S390_IS_Z10 (stfle_bits), BZERO_Z10)
|
|
|
077c9d |
+# endif
|
|
|
077c9d |
+# if HAVE_MEMSET_Z900_G5
|
|
|
077c9d |
+ IFUNC_IMPL_ADD (array, i, bzero, 1, BZERO_Z900_G5)
|
|
|
077c9d |
# endif
|
|
|
077c9d |
)
|
|
|
077c9d |
#endif /* HAVE_MEMSET_IFUNC */
|
|
|
077c9d |
diff --git a/sysdeps/s390/s390-64/bzero.S b/sysdeps/s390/s390-64/bzero.S
|
|
|
077c9d |
deleted file mode 100644
|
|
|
077c9d |
index b3216652985cc239..0000000000000000
|
|
|
077c9d |
--- a/sysdeps/s390/s390-64/bzero.S
|
|
|
077c9d |
+++ /dev/null
|
|
|
077c9d |
@@ -1,41 +0,0 @@
|
|
|
077c9d |
-/* bzero -- set a block of memory to zero. 64 bit S/390 version.
|
|
|
077c9d |
- This file is part of the GNU C Library.
|
|
|
077c9d |
- Copyright (C) 2001-2018 Free Software Foundation, Inc.
|
|
|
077c9d |
- Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
|
|
|
077c9d |
-
|
|
|
077c9d |
- The GNU C Library is free software; you can redistribute it and/or
|
|
|
077c9d |
- modify it under the terms of the GNU Lesser General Public
|
|
|
077c9d |
- License as published by the Free Software Foundation; either
|
|
|
077c9d |
- version 2.1 of the License, or (at your option) any later version.
|
|
|
077c9d |
-
|
|
|
077c9d |
- The GNU C Library is distributed in the hope that it will be useful,
|
|
|
077c9d |
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
077c9d |
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
077c9d |
- Lesser General Public License for more details.
|
|
|
077c9d |
-
|
|
|
077c9d |
- You should have received a copy of the GNU Lesser General Public
|
|
|
077c9d |
- License along with the GNU C Library; if not, see
|
|
|
077c9d |
- <http://www.gnu.org/licenses/>. */
|
|
|
077c9d |
-
|
|
|
077c9d |
-/* INPUT PARAMETERS
|
|
|
077c9d |
- %r2 = address of memory area
|
|
|
077c9d |
- %r3 = number of bytes to fill. */
|
|
|
077c9d |
-
|
|
|
077c9d |
-#include "sysdep.h"
|
|
|
077c9d |
-#include "asm-syntax.h"
|
|
|
077c9d |
-
|
|
|
077c9d |
- .text
|
|
|
077c9d |
-ENTRY(__bzero)
|
|
|
077c9d |
- ltgr %r3,%r3
|
|
|
077c9d |
- jz .L1
|
|
|
077c9d |
- sgr %r1,%r1 # set pad byte to zero
|
|
|
077c9d |
- sgr %r4,%r4 # no source for MVCLE, only a pad byte
|
|
|
077c9d |
- sgr %r5,%r5
|
|
|
077c9d |
-.L0: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend
|
|
|
077c9d |
- jo .L0
|
|
|
077c9d |
-.L1: br %r14
|
|
|
077c9d |
-END(__bzero)
|
|
|
077c9d |
-
|
|
|
077c9d |
-#ifndef NO_WEAK_ALIAS
|
|
|
077c9d |
-weak_alias (__bzero, bzero)
|
|
|
077c9d |
-#endif
|