aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-04 00:01:02 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-04 00:01:02 +0000
commitc891b2df087e0219319785c29d3af6042e4ac94f (patch)
tree35f252e14d0024b991068214f533f738d23bdab7
parentf114375059d2f3ee90aaeea242120b3dda84787b (diff)
downloadglibc-c891b2df087e0219319785c29d3af6042e4ac94f.zip
glibc-c891b2df087e0219319785c29d3af6042e4ac94f.tar.gz
glibc-c891b2df087e0219319785c29d3af6042e4ac94f.tar.bz2
Update.
2001-04-03 Ulrich Drepper <drepper@redhat.com> * misc/dirname.c (dirname): Handle multiple slashes correctly. 2001-04-03 Martin Schwidefsky <schwidefsky@de.ibm.com> * sysdeps/s390/s390-64/initfini.c: Fix __gmon_start__ GOT access. 2001-04-03 Martin Schwidefsky <schwidefsky@de.ibm.com> * sysdeps/s390/s390-32/bcopy.S: Optimize for speed. * sysdeps/s390/s390-64/bcopy.S: Likewise. * sysdeps/s390/s390-32/mempcy.S: Likewise. * sysdeps/s390/s390-64/memcpy.S: Likewise. 2001-04-02 Bruno Haible <haible@clisp.cons.org> * manual/message.texi (Advanced gettext functions): More specific syntax in the plural formula examples. 2001-04-02 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> * sysdeps/powerpc/atomicity.h: Silence warnings. * sysdeps/powerpc/dl-machine.h: Likewise. * sysdeps/powerpc/register-dump.h: Likewise. * sysdeps/powerpc/fpu/s_lrint.c: Likewise. 2001-04-02 Andreas Jaeger <aj@suse.de> * misc/tst-dirname.c (main): Add more tests, derived from a bug report by Michael Kerrisk <mtk16@ext.canterbury.ac.nz>. 2001-04-01 Andreas Jaeger <aj@suse.de> * debug/xtrace.sh (pcprofileso): Use SLIBDIR since libpcprofile.so is installed there. * malloc/memusage.sh (memusageso): Likewise for libmemusage.so. 2001-04-01 H.J. Lu <hjl@gnu.org> * posix/annexc.c (macrofile): Renamed from TMPFILE and set to tmpnam (NULL). * stdlib/isomac.c (macrofile): Likewise. 2001-03-30 Thorsten Kukuk <kukuk@suse.de> * inet/rcmd.c: Allow AF_UNSPEC as parameter. * nis/ypclnt.c (yp_all): Print error message only at last try, check for protocoll error only if we don't have a network error.
-rw-r--r--ChangeLog50
-rw-r--r--FAQ12
-rw-r--r--FAQ.in12
-rwxr-xr-xdebug/xtrace.sh2
-rwxr-xr-xmalloc/memusage.sh2
-rw-r--r--manual/message.texi29
-rw-r--r--misc/dirname.c38
-rw-r--r--misc/tst-dirname.c9
-rw-r--r--nis/ypclnt.c8
-rw-r--r--posix/annexc.c27
-rw-r--r--stdlib/isomac.c27
-rw-r--r--sysdeps/powerpc/atomicity.h58
-rw-r--r--sysdeps/powerpc/dl-machine.h190
-rw-r--r--sysdeps/powerpc/fpu/s_lrint.c12
-rw-r--r--sysdeps/powerpc/register-dump.h34
-rw-r--r--sysdeps/s390/s390-32/bcopy.S54
-rw-r--r--sysdeps/s390/s390-32/memcpy.S37
-rw-r--r--sysdeps/s390/s390-64/bcopy.S47
-rw-r--r--sysdeps/s390/s390-64/initfini.c4
-rw-r--r--sysdeps/s390/s390-64/memcpy.S34
20 files changed, 410 insertions, 276 deletions
diff --git a/ChangeLog b/ChangeLog
index f43ec8b..ed9cba9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2001-04-03 Ulrich Drepper <drepper@redhat.com>
+
+ * misc/dirname.c (dirname): Handle multiple slashes correctly.
+
+2001-04-03 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * sysdeps/s390/s390-64/initfini.c: Fix __gmon_start__ GOT access.
+
+2001-04-03 Martin Schwidefsky <schwidefsky@de.ibm.com>
+
+ * sysdeps/s390/s390-32/bcopy.S: Optimize for speed.
+ * sysdeps/s390/s390-64/bcopy.S: Likewise.
+ * sysdeps/s390/s390-32/mempcy.S: Likewise.
+ * sysdeps/s390/s390-64/memcpy.S: Likewise.
+
+2001-04-02 Bruno Haible <haible@clisp.cons.org>
+
+ * manual/message.texi (Advanced gettext functions): More specific
+ syntax in the plural formula examples.
+
+2001-04-02 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
+
+ * sysdeps/powerpc/atomicity.h: Silence warnings.
+ * sysdeps/powerpc/dl-machine.h: Likewise.
+ * sysdeps/powerpc/register-dump.h: Likewise.
+ * sysdeps/powerpc/fpu/s_lrint.c: Likewise.
+
+2001-04-02 Andreas Jaeger <aj@suse.de>
+
+ * misc/tst-dirname.c (main): Add more tests, derived from a bug
+ report by Michael Kerrisk <mtk16@ext.canterbury.ac.nz>.
+
+2001-04-01 Andreas Jaeger <aj@suse.de>
+
+ * debug/xtrace.sh (pcprofileso): Use SLIBDIR since libpcprofile.so
+ is installed there.
+ * malloc/memusage.sh (memusageso): Likewise for libmemusage.so.
+
+2001-04-01 H.J. Lu <hjl@gnu.org>
+
+ * posix/annexc.c (macrofile): Renamed from TMPFILE and set to
+ tmpnam (NULL).
+ * stdlib/isomac.c (macrofile): Likewise.
+
+2001-03-30 Thorsten Kukuk <kukuk@suse.de>
+
+ * inet/rcmd.c: Allow AF_UNSPEC as parameter.
+ * nis/ypclnt.c (yp_all): Print error message only at last try,
+ check for protocoll error only if we don't have a network error.
+
2001-04-02 Andreas Schwab <schwab@suse.de>
* resolv/res_data.c (res_isourserver): Fix cast.
diff --git a/FAQ b/FAQ
index f9ae5af..955cc54 100644
--- a/FAQ
+++ b/FAQ
@@ -163,6 +163,7 @@ please let me know.
when I try to use it, it always returns -1 and sets errno to ENOSYS.
3.22. My program segfaults when I call fclose() on the FILE* returned
from setmntent(). Is this a glibc bug?
+3.23. I get "undefined reference to `atexit'"
4. Miscellaneous
@@ -1683,6 +1684,17 @@ In the case of setmntent(), it may appear to work in most cases, but it
won't always work. Unfortunately, for compatibility reasons, we can't
change the return type of setmntent() to something other than FILE *.
+
+3.23. I get "undefined reference to `atexit'"
+
+{UD} This means that your installation is somehow broken. The situation is
+the same as for 'stat', 'fstat', etc (see question 2.7). Investigate why the
+linker does not pick up libc_nonshared.a.
+
+If a similar message is issued at runtime this means that the application or
+DSO is not linked against libc. This can cause problems since 'atexit' is
+not exported anymore.
+
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
diff --git a/FAQ.in b/FAQ.in
index f06569a..397b62f 100644
--- a/FAQ.in
+++ b/FAQ.in
@@ -565,7 +565,7 @@ exactly what to use.
Version 2.7.2.3 does and future versions of GCC will automatically
provide the correct specs.
-?? Looking through the shared libc file I haven't found the
+??nonsh Looking through the shared libc file I haven't found the
functions `stat', `lstat', `fstat', and `mknod' and while
linking on my Linux system I get error messages. How is
this supposed to work?
@@ -1438,6 +1438,16 @@ In the case of setmntent(), it may appear to work in most cases, but it
won't always work. Unfortunately, for compatibility reasons, we can't
change the return type of setmntent() to something other than FILE *.
+?? I get "undefined reference to `atexit'"
+
+{UD} This means that your installation is somehow broken. The situation is
+the same as for 'stat', 'fstat', etc (see ?nonsh). Investigate why the
+linker does not pick up libc_nonshared.a.
+
+If a similar message is issued at runtime this means that the application or
+DSO is not linked against libc. This can cause problems since 'atexit' is
+not exported anymore.
+
? Miscellaneous
diff --git a/debug/xtrace.sh b/debug/xtrace.sh
index 3c7c7fe..d885650 100755
--- a/debug/xtrace.sh
+++ b/debug/xtrace.sh
@@ -18,7 +18,7 @@
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-pcprofileso=@LIBDIR@/libpcprofile.so
+pcprofileso=@SLIBDIR@/libpcprofile.so
pcprofiledump=@BINDIR@/pcprofiledump
# Print usage message.
diff --git a/malloc/memusage.sh b/malloc/memusage.sh
index 70595e8..1268f88 100755
--- a/malloc/memusage.sh
+++ b/malloc/memusage.sh
@@ -18,7 +18,7 @@
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
-memusageso=@LIBDIR@/libmemusage.so
+memusageso=@SLIBDIR@/libmemusage.so
memusagestat=@BINDIR@/memusagestat
# Print usage message.
diff --git a/manual/message.texi b/manual/message.texi
index ebf373d..ff410f0 100644
--- a/manual/message.texi
+++ b/manual/message.texi
@@ -1075,7 +1075,7 @@ code similar to the following:
@end smallexample
@noindent
-After the first complains from people internationalizing the code people
+After the first complaints from people internationalizing the code people
either completely avoided formulations like this or used strings like
@code{"file(s)"}. Both look unnatural and should be avoided. First
tries to solve the problem correctly looked like this:
@@ -1193,11 +1193,11 @@ details are explained in the GNU @code{gettext} manual. Here only a a
bit of information is provided.
The information about the plural form selection has to be stored in the
-header entry (the one with the empty (@code{msgid} string). There should
-be something like:
+header entry (the one with the empty (@code{msgid} string). It looks
+like this:
@smallexample
- nplurals=2; plural=n == 1 ? 0 : 1
+Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;
@end smallexample
The @code{nplurals} value must be a decimal number which specifies how
@@ -1222,11 +1222,11 @@ below).@footnote{Additions are welcome. Send appropriate information to
@table @asis
@item Only one form:
Some languages only require one single form. There is no distinction
-between the singular and plural form. And appropriate header entry
+between the singular and plural form. An appropriate header entry
would look like this:
@smallexample
-nplurals=1; plural=0
+Plural-Forms: nplurals=1; plural=0;
@end smallexample
@noindent
@@ -1246,7 +1246,7 @@ This is the form used in most existing programs since it is what English
is using. A header entry would look like this:
@smallexample
-nplurals=2; plural=n != 1
+Plural-Forms: nplurals=2; plural=n != 1;
@end smallexample
(Note: this uses the feature of C expressions that boolean expressions
@@ -1274,7 +1274,7 @@ Esperanto
Exceptional case in the language family. The header entry would be:
@smallexample
-nplurals=2; plural=n>1
+Plural-Forms: nplurals=2; plural=n>1;
@end smallexample
@noindent
@@ -1289,7 +1289,7 @@ French
The header entry would be:
@smallexample
-nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2
+Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;
@end smallexample
@noindent
@@ -1304,7 +1304,8 @@ Gaeilge
The header entry would look like this:
@smallexample
-nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1
+Plural-Forms: nplurals=3; \
+ plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1;
@end smallexample
@noindent
@@ -1319,8 +1320,9 @@ Czech, Russian, Slovak
The header entry would look like this:
@smallexample
-nplurals=3; plural=n==1 ? 0 : \
- n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2
+Plural-Forms: nplurals=3; \
+ plural=n==1 ? 0 : \
+ n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
@end smallexample
(Continuation in the next line is possible.)
@@ -1337,7 +1339,8 @@ Polish
The header entry would look like this:
@smallexample
-nplurals=4; plural=n==1 ? 0 : n%10==2 ? 1 : n%10==3 || n%10==4 ? 2 : 3
+Plural-Forms: nplurals=4; \
+ plural=n==1 ? 0 : n%10==2 ? 1 : n%10==3 || n%10==4 ? 2 : 3;
@end smallexample
@noindent
diff --git a/misc/dirname.c b/misc/dirname.c
index 8be25e5..b837404 100644
--- a/misc/dirname.c
+++ b/misc/dirname.c
@@ -1,5 +1,5 @@
/* dirname - return directory part of PATH.
- Copyright (C) 1996, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -32,16 +32,40 @@ dirname (char *path)
last_slash = path != NULL ? strrchr (path, '/') : NULL;
if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
- /* The '/' is the last character, we have to look further. */
- last_slash = __memrchr (path, '/', last_slash - path);
+ {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != '/')
+ break;
+
+ /* The '/' is the last character, we have to look further. */
+ if (runp != path)
+ last_slash = __memrchr (path, '/', runp - path);
+ }
if (last_slash != NULL)
{
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != '/')
+ break;
+
/* Terminate the path. */
- if (last_slash == path)
- /* The last slash is the first character in the string. We have to
- return "/". */
- ++last_slash;
+ if (runp == path)
+ {
+ /* The last slash is the first character in the string. We have to
+ return "/". As a special case we have to return "//" if there
+ are exactly two slashes at the beginning of the string. See
+ XBD 4.10 Path Name Resolution for more information. */
+ if (last_slash == path + 1)
+ ++last_slash;
+ else
+ last_slash = path + 1;
+ }
last_slash[0] = '\0';
}
diff --git a/misc/tst-dirname.c b/misc/tst-dirname.c
index e688bd3..aa0d782 100644
--- a/misc/tst-dirname.c
+++ b/misc/tst-dirname.c
@@ -1,5 +1,5 @@
/* Test program for dirname function a la XPG.
- Copyright (C) 1996, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1996, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@@ -54,6 +54,13 @@ main (void)
/* Some more tests. */
result |= test ("/usr/lib/", "/usr");
result |= test ("/usr", "/");
+ result |= test ("a//", ".");
+ result |= test ("a////", ".");
+ result |= test ("////usr", "/");
+ result |= test ("////usr//", "/");
+ result |= test ("//usr", "//");
+ result |= test ("//usr//", "//");
+ result |= test ("//", "//");
return result != 0;
}
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index a62e356..67ac425 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@suse.de>, 1996.
@@ -729,7 +729,9 @@ yp_all (const char *indomain, const char *inmap,
if (result != RPC_SUCCESS)
{
- clnt_perror (clnt, "yp_all: clnt_call");
+ /* Print the error message only on the last try */
+ if (try == MAXTRIES - 1)
+ clnt_perror (clnt, "yp_all: clnt_call");
res = YPERR_RPC;
}
else
@@ -738,7 +740,7 @@ yp_all (const char *indomain, const char *inmap,
__yp_unbind (ydb);
clnt_destroy (clnt);
- if (status != YP_NOMORE)
+ if (res == YPERR_SUCCESS && status != YP_NOMORE)
{
__set_errno (saved_errno);
return ypprot_err (status);
diff --git a/posix/annexc.c b/posix/annexc.c
index 1dbc3f6..78d70fa 100644
--- a/posix/annexc.c
+++ b/posix/annexc.c
@@ -25,9 +25,10 @@
#include <signal.h>
#include <sys/wait.h>
-#define TMPFILE "/tmp/macros"
#define HEADER_MAX 256
+static const char *macrofile;
+
/* <aio.h>. */
static const char *const aio_syms[] =
{
@@ -712,8 +713,10 @@ get_null_defines (void)
FILE *input;
int first = 1;
+ macrofile = tmpnam (NULL);
+
command = malloc (sizeof fmt + sizeof "/dev/null" + 2 * strlen (CC)
- + strlen (INC) + strlen (TMPFILE));
+ + strlen (INC) + strlen (macrofile));
if (command == NULL)
{
@@ -721,7 +724,7 @@ get_null_defines (void)
exit (1);
}
- sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE);
+ sprintf (command, fmt, "/dev/null", CC, INC, CC, macrofile);
if (xsystem (command))
{
@@ -729,11 +732,11 @@ get_null_defines (void)
return NULL;
}
free (command);
- input = fopen (TMPFILE, "r");
+ input = fopen (macrofile, "r");
if (input == NULL)
{
- printf ("Could not read %s: ", TMPFILE);
+ printf ("Could not read %s: ", macrofile);
perror (NULL);
return NULL;
}
@@ -782,7 +785,7 @@ get_null_defines (void)
}
result[result_len] = NULL;
fclose (input);
- remove (TMPFILE);
+ remove (macrofile);
return (const char **) result;
}
@@ -799,7 +802,7 @@ check_header (const struct header *header, const char **except)
memset (found, '\0', header->nsyms * sizeof (int));
command = alloca (sizeof fmt + strlen (header->name) + 2 * strlen (CC)
- + strlen (INC) + strlen (TMPFILE));
+ + strlen (INC) + strlen (macrofile));
if (command == NULL)
@@ -809,13 +812,13 @@ check_header (const struct header *header, const char **except)
}
printf ("=== %s ===\n", header->name);
- sprintf (command, fmt, header->name, CC, INC, CC, TMPFILE);
+ sprintf (command, fmt, header->name, CC, INC, CC, macrofile);
/* First see whether this subset is supported at all. */
if (header->subset != NULL)
{
sprintf (line, testfmt, header->subset, header->subset, CC, INC, CC,
- TMPFILE);
+ macrofile);
if (xsystem (line))
{
printf ("!! not available\n");
@@ -828,11 +831,11 @@ check_header (const struct header *header, const char **except)
puts ("system() returned nonzero");
result = 1;
}
- input = fopen (TMPFILE, "r");
+ input = fopen (macrofile, "r");
if (input == NULL)
{
- printf ("Could not read %s: ", TMPFILE);
+ printf ("Could not read %s: ", macrofile);
perror (NULL);
return 1;
}
@@ -884,7 +887,7 @@ check_header (const struct header *header, const char **except)
result |= 1;
}
fclose (input);
- remove (TMPFILE);
+ remove (macrofile);
for (i = 0; i < header->nsyms; ++i)
if (found[i] == 0)
diff --git a/stdlib/isomac.c b/stdlib/isomac.c
index ab63d1b..f18e8d9 100644
--- a/stdlib/isomac.c
+++ b/stdlib/isomac.c
@@ -52,7 +52,7 @@
preprocessor has something similar to gcc's -dM option. Tune
PRINT_MACROS in this case. This program assumes headers are found
under /usr/include and that there is a writable /tmp directory.
- Tune SYSTEM_INCLUDE and TMPFILE if your system differs.
+ Tune SYSTEM_INCLUDE if your system differs.
#define BROKEN_SYSTEM if system(NULL) bombs -- one more violation
of ISO C, by the way.
@@ -75,9 +75,10 @@
#include <stdlib.h>
#include <string.h>
-#define TMPFILE "/tmp/macros"
#define HEADER_MAX 256
+static const char *macrofile;
+
/* ISO C header names including Amendment 1 (without ".h" suffix). */
static char *header[] =
{
@@ -247,8 +248,10 @@ get_null_defines (void)
FILE *input;
int first = 1;
+ macrofile = tmpnam (NULL);
+
command = malloc (sizeof fmt + sizeof "/dev/null" + 2 * strlen (CC)
- + strlen (INC) + strlen (TMPFILE));
+ + strlen (INC) + strlen (macrofile));
if (command == NULL)
{
@@ -256,7 +259,7 @@ get_null_defines (void)
exit (1);
}
- sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE);
+ sprintf (command, fmt, "/dev/null", CC, INC, CC, macrofile);
if (system (command))
{
@@ -264,11 +267,11 @@ get_null_defines (void)
return NULL;
}
free (command);
- input = fopen (TMPFILE, "r");
+ input = fopen (macrofile, "r");
if (input == NULL)
{
- printf ("Could not read %s: ", TMPFILE);
+ printf ("Could not read %s: ", macrofile);
perror (NULL);
return NULL;
}
@@ -321,7 +324,7 @@ get_null_defines (void)
}
result[result_len] = NULL;
fclose (input);
- remove (TMPFILE);
+ remove (macrofile);
return (const char **) result;
}
@@ -335,7 +338,7 @@ check_header (const char *file_name, const char **except)
int result = 0;
command = malloc (sizeof fmt + strlen (file_name) + 2 * strlen (CC)
- + strlen (INC) + strlen (TMPFILE));
+ + strlen (INC) + strlen (macrofile));
if (command == NULL)
{
@@ -344,7 +347,7 @@ check_header (const char *file_name, const char **except)
}
puts (file_name);
- sprintf (command, fmt, file_name, CC, INC, CC, TMPFILE);
+ sprintf (command, fmt, file_name, CC, INC, CC, macrofile);
if (system (command))
{
@@ -352,11 +355,11 @@ check_header (const char *file_name, const char **except)
result = 1;
}
free (command);
- input = fopen (TMPFILE, "r");
+ input = fopen (macrofile, "r");
if (input == NULL)
{
- printf ("Could not read %s: ", TMPFILE);
+ printf ("Could not read %s: ", macrofile);
perror (NULL);
return 1;
}
@@ -430,7 +433,7 @@ check_header (const char *file_name, const char **except)
}
}
fclose (input);
- remove (TMPFILE);
+ remove (macrofile);
return result;
}
diff --git a/sysdeps/powerpc/atomicity.h b/sysdeps/powerpc/atomicity.h
index 2924b18..6942dfe 100644
--- a/sysdeps/powerpc/atomicity.h
+++ b/sysdeps/powerpc/atomicity.h
@@ -33,11 +33,11 @@ __attribute__ ((unused))
exchange_and_add (volatile uint32_t *mem, int val)
{
int tmp, result;
- __asm__ ("\
-0: lwarx %0,0,%2
- add%I3 %1,%0,%3
- stwcx. %1,0,%2
- bne- 0b
+ __asm__ ("\n\
+0: lwarx %0,0,%2 \n\
+ add%I3 %1,%0,%3 \n\
+ stwcx. %1,0,%2 \n\
+ bne- 0b \n\
" : "=&b"(result), "=&r"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
return result;
}
@@ -47,11 +47,11 @@ __attribute__ ((unused))
atomic_add (volatile uint32_t *mem, int val)
{
int tmp;
- __asm__ ("\
-0: lwarx %0,0,%1
- add%I2 %0,%0,%2
- stwcx. %0,0,%1
- bne- 0b
+ __asm__ ("\n\
+0: lwarx %0,0,%1 \n\
+ add%I2 %0,%0,%2 \n\
+ stwcx. %0,0,%1 \n\
+ bne- 0b \n\
" : "=&b"(tmp) : "r" (mem), "Ir"(val) : "cr0", "memory");
}
@@ -60,14 +60,14 @@ __attribute__ ((unused))
compare_and_swap (volatile long int *p, long int oldval, long int newval)
{
int result;
- __asm__ ("\
-0: lwarx %0,0,%1
- sub%I2c. %0,%0,%2
- cntlzw %0,%0
- bne- 1f
- stwcx. %3,0,%1
- bne- 0b
-1:
+ __asm__ ("\n\
+0: lwarx %0,0,%1 \n\
+ sub%I2c. %0,%0,%2 \n\
+ cntlzw %0,%0 \n\
+ bne- 1f \n\
+ stwcx. %3,0,%1 \n\
+ bne- 0b \n\
+1: \n\
" : "=&b"(result) : "r"(p), "Ir"(oldval), "r"(newval) : "cr0", "memory");
return result >> 5;
}
@@ -77,10 +77,10 @@ __attribute__ ((unused))
always_swap (volatile long int *p, long int newval)
{
long int result;
- __asm__ ("\
-0: lwarx %0,0,%1
- stwcx. %2,0,%1
- bne- 0b
+ __asm__ ("\n\
+0: lwarx %0,0,%1 \n\
+ stwcx. %2,0,%1 \n\
+ bne- 0b \n\
" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
return result;
}
@@ -90,13 +90,13 @@ __attribute__ ((unused))
test_and_set (volatile long int *p, long int newval)
{
int result;
- __asm__ ("\
-0: lwarx %0,0,%1
- cmpwi %0,0
- bne- 1f
- stwcx. %2,0,%1
- bne- 0b
-1:
+ __asm__ ("\n\
+0: lwarx %0,0,%1 \n\
+ cmpwi %0,0 \n\
+ bne- 1f \n\
+ stwcx. %2,0,%1 \n\
+ bne- 0b \n\
+1: \n\
" : "=&r"(result) : "r"(p), "r"(newval) : "cr0", "memory");
return result;
}
diff --git a/sysdeps/powerpc/dl-machine.h b/sysdeps/powerpc/dl-machine.h
index 961aafb..80db704 100644
--- a/sysdeps/powerpc/dl-machine.h
+++ b/sysdeps/powerpc/dl-machine.h
@@ -102,101 +102,101 @@ elf_machine_load_address (void)
/* This code is used in dl-runtime.c to call the `fixup' function
and then redirect to the address it returns. It is called
from code built in the PLT by elf_machine_runtime_setup. */
-#define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\
- .section \".text\"
- .align 2
- .globl _dl_runtime_resolve
- .type _dl_runtime_resolve,@function
-_dl_runtime_resolve:
- # We need to save the registers used to pass parameters, and register 0,
- # which is used by _mcount; the registers are saved in a stack frame.
- stwu 1,-64(1)
- stw 0,12(1)
- stw 3,16(1)
- stw 4,20(1)
- # The code that calls this has put parameters for `fixup' in r12 and r11.
- mr 3,12
- stw 5,24(1)
- mr 4,11
- stw 6,28(1)
- mflr 0
- # We also need to save some of the condition register fields.
- stw 7,32(1)
- stw 0,48(1)
- stw 8,36(1)
- mfcr 0
- stw 9,40(1)
- stw 10,44(1)
- stw 0,8(1)
- bl fixup@local
- # 'fixup' returns the address we want to branch to.
- mtctr 3
- # Put the registers back...
- lwz 0,48(1)
- lwz 10,44(1)
- lwz 9,40(1)
- mtlr 0
- lwz 8,36(1)
- lwz 0,8(1)
- lwz 7,32(1)
- lwz 6,28(1)
- mtcrf 0xFF,0
- lwz 5,24(1)
- lwz 4,20(1)
- lwz 3,16(1)
- lwz 0,12(1)
- # ...unwind the stack frame, and jump to the PLT entry we updated.
- addi 1,1,64
- bctr
- .size _dl_runtime_resolve,.-_dl_runtime_resolve
-
- .align 2
- .globl _dl_prof_resolve
- .type _dl_prof_resolve,@function
-_dl_prof_resolve:
- # We need to save the registers used to pass parameters, and register 0,
- # which is used by _mcount; the registers are saved in a stack frame.
- stwu 1,-64(1)
- stw 0,12(1)
- stw 3,16(1)
- stw 4,20(1)
- # The code that calls this has put parameters for `fixup' in r12 and r11.
- mr 3,12
- stw 5,24(1)
- mr 4,11
- stw 6,28(1)
- mflr 5
- # We also need to save some of the condition register fields.
- stw 7,32(1)
- stw 5,48(1)
- stw 8,36(1)
- mfcr 0
- stw 9,40(1)
- stw 10,44(1)
- stw 0,8(1)
- bl profile_fixup@local
- # 'fixup' returns the address we want to branch to.
- mtctr 3
- # Put the registers back...
- lwz 0,48(1)
- lwz 10,44(1)
- lwz 9,40(1)
- mtlr 0
- lwz 8,36(1)
- lwz 0,8(1)
- lwz 7,32(1)
- lwz 6,28(1)
- mtcrf 0xFF,0
- lwz 5,24(1)
- lwz 4,20(1)
- lwz 3,16(1)
- lwz 0,12(1)
- # ...unwind the stack frame, and jump to the PLT entry we updated.
- addi 1,1,64
- bctr
- .size _dl_prof_resolve,.-_dl_prof_resolve
- # Undo '.section text'.
- .previous
+#define ELF_MACHINE_RUNTIME_TRAMPOLINE asm ("\n\
+ .section \".text\" \n\
+ .align 2 \n\
+ .globl _dl_runtime_resolve \n\
+ .type _dl_runtime_resolve,@function \n\
+_dl_runtime_resolve: \n\
+ # We need to save the registers used to pass parameters, and register 0,\n\
+ # which is used by _mcount; the registers are saved in a stack frame.\n\
+ stwu 1,-64(1) \n\
+ stw 0,12(1) \n\
+ stw 3,16(1) \n\
+ stw 4,20(1) \n\
+ # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
+ mr 3,12 \n\
+ stw 5,24(1) \n\
+ mr 4,11 \n\
+ stw 6,28(1) \n\
+ mflr 0 \n\
+ # We also need to save some of the condition register fields.\n\
+ stw 7,32(1) \n\
+ stw 0,48(1) \n\
+ stw 8,36(1) \n\
+ mfcr 0 \n\
+ stw 9,40(1) \n\
+ stw 10,44(1) \n\
+ stw 0,8(1) \n\
+ bl fixup@local \n\
+ # 'fixup' returns the address we want to branch to.\n\
+ mtctr 3 \n\
+ # Put the registers back...\n\
+ lwz 0,48(1) \n\
+ lwz 10,44(1) \n\
+ lwz 9,40(1) \n\
+ mtlr 0 \n\
+ lwz 8,36(1) \n\
+ lwz 0,8(1) \n\
+ lwz 7,32(1) \n\
+ lwz 6,28(1) \n\
+ mtcrf 0xFF,0 \n\
+ lwz 5,24(1) \n\
+ lwz 4,20(1) \n\
+ lwz 3,16(1) \n\
+ lwz 0,12(1) \n\
+ # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
+ addi 1,1,64 \n\
+ bctr \n\
+ .size _dl_runtime_resolve,.-_dl_runtime_resolve \n\
+ \n\
+ .align 2 \n\
+ .globl _dl_prof_resolve \n\
+ .type _dl_prof_resolve,@function \n\
+_dl_prof_resolve: \n\
+ # We need to save the registers used to pass parameters, and register 0,\n\
+ # which is used by _mcount; the registers are saved in a stack frame.\n\
+ stwu 1,-64(1) \n\
+ stw 0,12(1) \n\
+ stw 3,16(1) \n\
+ stw 4,20(1) \n\
+ # The code that calls this has put parameters for `fixup' in r12 and r11.\n\
+ mr 3,12 \n\
+ stw 5,24(1) \n\
+ mr 4,11 \n\
+ stw 6,28(1) \n\
+ mflr 5 \n\
+ # We also need to save some of the condition register fields.\n\
+ stw 7,32(1) \n\
+ stw 5,48(1) \n\
+ stw 8,36(1) \n\
+ mfcr 0 \n\
+ stw 9,40(1) \n\
+ stw 10,44(1) \n\
+ stw 0,8(1) \n\
+ bl profile_fixup@local \n\
+ # 'fixup' returns the address we want to branch to.\n\
+ mtctr 3 \n\
+ # Put the registers back...\n\
+ lwz 0,48(1) \n\
+ lwz 10,44(1) \n\
+ lwz 9,40(1) \n\
+ mtlr 0 \n\
+ lwz 8,36(1) \n\
+ lwz 0,8(1) \n\
+ lwz 7,32(1) \n\
+ lwz 6,28(1) \n\
+ mtcrf 0xFF,0 \n\
+ lwz 5,24(1) \n\
+ lwz 4,20(1) \n\
+ lwz 3,16(1) \n\
+ lwz 0,12(1) \n\
+ # ...unwind the stack frame, and jump to the PLT entry we updated.\n\
+ addi 1,1,64 \n\
+ bctr \n\
+ .size _dl_prof_resolve,.-_dl_prof_resolve \n\
+ # Undo '.section text'.\n\
+ .previous \n\
");
/* The actual _start code is in dl-start.S. Use a really
diff --git a/sysdeps/powerpc/fpu/s_lrint.c b/sysdeps/powerpc/fpu/s_lrint.c
index a060598..ce8df31 100644
--- a/sysdeps/powerpc/fpu/s_lrint.c
+++ b/sysdeps/powerpc/fpu/s_lrint.c
@@ -32,12 +32,12 @@ __lrint (double x)
weak_alias (__lrint, lrint)
/* This code will also work for a 'float' argument. */
-asm ("\
- .globl __lrintf
- .globl lrintf
- .weak lrintf
- .set __lrintf,__lrint
- .set lrintf,__lrint
+asm ("\n\
+ .globl __lrintf \n\
+ .globl lrintf \n\
+ .weak lrintf \n\
+ .set __lrintf,__lrint \n\
+ .set lrintf,__lrint \n\
");
#ifdef NO_LONG_DOUBLE
diff --git a/sysdeps/powerpc/register-dump.h b/sysdeps/powerpc/register-dump.h
index f1d3985..5cea8f8 100644
--- a/sysdeps/powerpc/register-dump.h
+++ b/sysdeps/powerpc/register-dump.h
@@ -22,23 +22,23 @@
/* This prints out the information in the following form: */
static const char dumpform[] = "\
-Register dump:
-fp0-3: 0000030%0000031% 0000032%0000033% 0000034%0000035% 0000036%0000037%
-fp4-7: 0000038%0000039% 000003a%000003b% 000003c%000003d% 000003e%000003f%
-fp8-11: 0000040%0000041% 0000042%0000043% 0000044%0000045% 0000046%0000047%
-fp12-15: 0000048%0000049% 000004a%000004b% 000004c%000004d% 000004e%000004f%
-fp16-19: 0000050%0000051% 0000052%0000053% 0000054%0000055% 0000056%0000057%
-fp20-23: 0000058%0000059% 000005a%000005b% 000005c%000005d% 000005e%000005f%
-fp24-27: 0000060%0000061% 0000062%0000063% 0000064%0000065% 0000066%0000067%
-fp28-31: 0000068%0000069% 000006a%000006b% 000006c%000006d% 000006e%000006f%
-r0 =0000000% sp =0000001% r2 =0000002% r3 =0000003% trap=0000028%
-r4 =0000004% r5 =0000005% r6 =0000006% r7 =0000007% sr0=0000020% sr1=0000021%
-r8 =0000008% r9 =0000009% r10=000000a% r11=000000b% dar=0000029% dsi=000002a%
-r12=000000c% r13=000000d% r14=000000e% r15=000000f% r3*=0000022%
-r16=0000010% r17=0000011% r18=0000012% r19=0000013%
-r20=0000014% r21=0000015% r22=0000016% r23=0000017% lr=0000024% xer=0000025%
-r24=0000018% r25=0000019% r26=000001a% r27=000001b% mq=0000027% ctr=0000023%
-r28=000001c% r29=000001d% r30=000001e% r31=000001f% fscr=0000071% ccr=0000026%
+Register dump:\n\
+fp0-3: 0000030%0000031% 0000032%0000033% 0000034%0000035% 0000036%0000037%\n\
+fp4-7: 0000038%0000039% 000003a%000003b% 000003c%000003d% 000003e%000003f%\n\
+fp8-11: 0000040%0000041% 0000042%0000043% 0000044%0000045% 0000046%0000047%\n\
+fp12-15: 0000048%0000049% 000004a%000004b% 000004c%000004d% 000004e%000004f%\n\
+fp16-19: 0000050%0000051% 0000052%0000053% 0000054%0000055% 0000056%0000057%\n\
+fp20-23: 0000058%0000059% 000005a%000005b% 000005c%000005d% 000005e%000005f%\n\
+fp24-27: 0000060%0000061% 0000062%0000063% 0000064%0000065% 0000066%0000067%\n\
+fp28-31: 0000068%0000069% 000006a%000006b% 000006c%000006d% 000006e%000006f%\n\
+r0 =0000000% sp =0000001% r2 =0000002% r3 =0000003% trap=0000028%\n\
+r4 =0000004% r5 =0000005% r6 =0000006% r7 =0000007% sr0=0000020% sr1=0000021%\n\
+r8 =0000008% r9 =0000009% r10=000000a% r11=000000b% dar=0000029% dsi=000002a%\n\
+r12=000000c% r13=000000d% r14=000000e% r15=000000f% r3*=0000022%\n\
+r16=0000010% r17=0000011% r18=0000012% r19=0000013%\n\
+r20=0000014% r21=0000015% r22=0000016% r23=0000017% lr=0000024% xer=0000025%\n\
+r24=0000018% r25=0000019% r26=000001a% r27=000001b% mq=0000027% ctr=0000023%\n\
+r28=000001c% r29=000001d% r30=000001e% r31=000001f% fscr=0000071% ccr=0000026%\n\
";
/* Most of the fields are self-explanatory. 'sr0' is the next
diff --git a/sysdeps/s390/s390-32/bcopy.S b/sysdeps/s390/s390-32/bcopy.S
index 8bf5bbb..526e336 100644
--- a/sysdeps/s390/s390-32/bcopy.S
+++ b/sysdeps/s390/s390-32/bcopy.S
@@ -1,4 +1,4 @@
-/* bcopy -- copy a block from source to destination. For IBM S390
+/* bcopy -- copy a block from source to destination. S/390 version.
This file is part of the GNU C Library.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
@@ -18,48 +18,53 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/*
- * R2 = address of source
- * R3 = address of destination
- * R4 = number of bytes to copy
- */
+/* INPUT PARAMETERS
+ %r2 = address of source
+ %r3 = address of destination
+ %r4 = number of bytes to copy. */
#include "sysdep.h"
#include "asm-syntax.h"
.text
ENTRY(__bcopy)
+ ltr %r1,%r4 # zero bcopy ?
+ jz .L4
clr %r2,%r3 # check against destructive overlap
jnl .L0
- lr %r1,%r2
- alr %r1,%r4
+ alr %r1,%r2
clr %r1,%r3
- jh .L2
-.L0:
- lr %r5,%r4 # source length
- lr %r4,%r2 # source address
- sr %r1,%r1 # set pad byte to zero
- lr %r2,%r3 # set destination
- lr %r3,%r5 # destination length = source length
-.L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend
- jo .L1
- br %r14
-.L2: # destructive overlay, can not use mvcle
+ jh .L5
+.L0: ahi %r4,-1 # length - 1
+ lr %r1,%r4
+ srl %r1,8
+ ltr %r1,%r1
+ jz .L2
+.L1: mvc 0(256,%r3),0(%r2) # move in 256 byte chunks
+ la %r2,256(%r2)
+ la %r3,256(%r3)
+ brct %r1,.L1
+.L2: bras %r1,.L3 # setup base pointer for execute
+ mvc 0(1,%r3),0(%r2) # instruction for execute
+.L3: ex %r4,0(%r1) # execute mvc with length ((%r4)&255)+1
+.L4: br %r14
+
+.L5: # destructive overlay, can not use mvcle
lr %r1,%r2 # bcopy is called with source,dest
lr %r2,%r3 # memmove with dest,source! Oh, well...
lr %r3,%r1
basr %r1,0
-.L3:
+.L6:
#ifdef PIC
- al %r1,.L4-.L3(%r1) # get address of global offset table
+ al %r1,.L7-.L6(%r1) # get address of global offset table
# load address of memmove
l %r1,memmove@GOT12(%r1)
br %r1
-.L4: .long _GLOBAL_OFFSET_TABLE_-.L3
+.L7: .long _GLOBAL_OFFSET_TABLE_-.L6
#else
- al %r1,.L4-.L3(%r1) # load address of memmove
+ al %r1,.L7-.L6(%r1) # load address of memmove
br %r1 # jump to memmove
-.L4: .long memmove-.L3
+.L7: .long memmove-.L6
#endif
END(__bcopy)
@@ -67,3 +72,4 @@ END(__bcopy)
#ifndef NO_WEAK_ALIAS
weak_alias (__bcopy, bcopy)
#endif
+
diff --git a/sysdeps/s390/s390-32/memcpy.S b/sysdeps/s390/s390-32/memcpy.S
index 4bbec7c..9c4b840 100644
--- a/sysdeps/s390/s390-32/memcpy.S
+++ b/sysdeps/s390/s390-32/memcpy.S
@@ -1,4 +1,4 @@
-/* Set a block of memory to some byte value. For IBM S390
+/* memcpy - copy a block from source to destination. S/390 version.
Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
@@ -17,25 +17,30 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/*
- * R2 = address to destination memory area
- * R3 = address to source memory area
- * R4 = number of bytes to copy
- */
+/* INPUT PARAMETERS
+ %r2 = address of destination memory area
+ %r3 = address of source memory area
+ %r4 = number of bytes to copy. */
#include "sysdep.h"
#include "asm-syntax.h"
.text
ENTRY(memcpy)
- ltr %r5,%r4
+ ltr %r4,%r4
+ jz .L3
+ ahi %r4,-1 # length - 1
+ lr %r1,%r2 # copy destination address
+ lr %r5,%r4
+ sra %r5,8
jz .L1
- lr %r4,%r3 # %r4/%r5 = source ptr/len
- lr %r3,%r5 # %r2/%r3 = dest ptr/len
- lr %r0,%r2 # save source address
-.L0: mvcle %r2,%r4,0 # thats it, MVCLE is your friend
- jo .L0
- lr %r2,%r0 # return value is source address
-.L1:
- br %r14
-END(memset)
+.L0: mvc 0(256,%r1),0(%r3) # move in 256 byte chunks
+ la %r1,256(%r1)
+ la %r3,256(%r3)
+ brct %r5,.L0
+.L1: bras %r5,.L2 # setup base pointer for execute
+ mvc 0(1,%r1),0(%r3) # instruction for execute
+.L2: ex %r4,0(%r5) # execute mvc with length ((%r4)&255)+1
+.L3: br %r14
+END(memcpy)
+
diff --git a/sysdeps/s390/s390-64/bcopy.S b/sysdeps/s390/s390-64/bcopy.S
index 5cb02b3..0d75d3e 100644
--- a/sysdeps/s390/s390-64/bcopy.S
+++ b/sysdeps/s390/s390-64/bcopy.S
@@ -1,6 +1,6 @@
/* bcopy -- copy a block from source to destination. 64 bit S/390 version.
This file is part of the GNU C Library.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
The GNU C Library is free software ; you can redistribute it and/or
@@ -26,27 +26,32 @@
#include "sysdep.h"
#include "asm-syntax.h"
- .text
+ .text
ENTRY(__bcopy)
- clgr %r2,%r3 # check against destructive overlap
- jnl .L0
- lgr %r1,%r2
- algr %r1,%r4
- clgr %r1,%r3
- jh .L2
-.L0:
- lgr %r5,%r4 # source length
- lgr %r4,%r2 # source address
- sgr %r1,%r1 # set pad byte to zero
- lgr %r2,%r3 # set destination
- lgr %r3,%r5 # destination length = source length
-.L1: mvcle %r2,%r4,0(%r1) # thats it, MVCLE is your friend
- jo .L1
- br %r14
-.L2: # destructive overlay, can not use mvcle
- lgr %r1,%r2 # bcopy is called with source,dest
- lgr %r2,%r3 # memmove with dest,source! Oh, well...
- lgr %r3,%r1
+ ltgr %r1,%r4 # zero bcopy ?
+ jz .L4
+ clgr %r2,%r3 # check against destructive overlap
+ jnl .L0
+ algr %r1,%r2
+ clgr %r1,%r3
+ jh .L5
+.L0: aghi %r4,-1 # length - 1
+ srlg %r1,%r4,8
+ ltgr %r1,%r1
+ jz .L2
+.L1: mvc 0(256,%r3),0(%r2) # move in 256 byte chunks
+ la %r2,256(%r2)
+ la %r3,256(%r3)
+ brctg %r1,.L1
+.L2: bras %r1,.L3 # setup base pointer for execute
+ mvc 0(1,%r3),0(%r2) # instruction for execute
+.L3: ex %r4,0(%r1) # execute mvc with length ((%r4)&255)+1
+.L4: br %r14
+
+.L5: # destructive overlay, can not use mvcle
+ lgr %r1,%r2 # bcopy is called with source,dest
+ lgr %r2,%r3 # memmove with dest,source! Oh, well...
+ lgr %r3,%r1
#ifdef PIC
jg memmove@PLT
#else
diff --git a/sysdeps/s390/s390-64/initfini.c b/sysdeps/s390/s390-64/initfini.c
index 3d14b0b..be5614b 100644
--- a/sysdeps/s390/s390-64/initfini.c
+++ b/sysdeps/s390/s390-64/initfini.c
@@ -68,8 +68,8 @@ _init:
AGHI 15,-160
STG 1,0(15)
LARL 12,_GLOBAL_OFFSET_TABLE_
- LGHI 1,__gmon_start__@GOT
- LG 1,0(1,12)
+ LARL 1,__gmon_start__@GOTENT
+ LG 1,0(1)
LTGR 1,1
JE .L22
BASR 14,1
diff --git a/sysdeps/s390/s390-64/memcpy.S b/sysdeps/s390/s390-64/memcpy.S
index c59d3fb..008f026 100644
--- a/sysdeps/s390/s390-64/memcpy.S
+++ b/sysdeps/s390/s390-64/memcpy.S
@@ -1,7 +1,6 @@
-/* Set a block of memory to some byte value. 64 bit S/390 version.
- Copyright (C) 2001 Free Software Foundation, Inc.
+/* memcpy - copy a block from source to destination. 64 bit S/390 version.
+ Copyright (C) 2000, 2001 Free Software Foundation, Inc.
Contributed by Martin Schwidefsky (schwidefsky@de.ibm.com).
- 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 Library General Public License as
@@ -19,8 +18,8 @@
Boston, MA 02111-1307, USA. */
/* INPUT PARAMETERS
- %r2 = address to destination memory area
- %r3 = address to source memory area
+ %r2 = address of destination memory area
+ %r3 = address of source memory area
%r4 = number of bytes to copy. */
#include "sysdep.h"
@@ -28,14 +27,19 @@
.text
ENTRY(memcpy)
- ltgr %r5,%r4
+ ltgr %r4,%r4
+ jz .L3
+ aghi %r4,-1 # length - 1
+ lgr %r1,%r2 # copy destination address
+ srag %r5,%r4,8
jz .L1
- lgr %r4,%r3 # %r4/%r5 = source ptr/len
- lgr %r3,%r5 # %r2/%r3 = dest ptr/len
- lgr %r0,%r2 # save source address
-.L0: mvcle %r2,%r4,0 # thats it, MVCLE is your friend
- jo .L0
- lgr %r2,%r0 # return value is source address
-.L1:
- br %r14
-END(memset)
+.L0: mvc 0(256,%r1),0(%r3) # move in 256 byte chunks
+ la %r1,256(%r1)
+ la %r3,256(%r3)
+ brctg %r5,.L0
+.L1: bras %r5,.L2 # setup base pointer for execute
+ mvc 0(1,%r1),0(%r3) # instruction for execute
+.L2: ex %r4,0(%r5) # execute mvc with length ((%r4)&255)+1
+.L3: br %r14
+END(memcpy)
+