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